Skip to content

Commit 830087b

Browse files
Aidan MacDonaldsre
authored andcommitted
power: supply: axp20x_usb_power: Remove variant IDs from VBUS polling check
Use an explicit boolean flag instead of a check based on the variant ID. Since this is the last use of variant IDs in the driver, also remove the IDs. Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 305398b commit 830087b

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

drivers/power/supply/axp20x_usb_power.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ struct axp_data {
4848
const struct power_supply_desc *power_desc;
4949
const char * const *irq_names;
5050
unsigned int num_irq_names;
51-
enum axp20x_variants axp20x_id;
5251
const int *curr_lim_table;
5352
struct reg_field curr_lim_fld;
5453
struct reg_field vbus_valid_bit;
5554
struct reg_field vbus_mon_bit;
5655
struct reg_field usb_bc_en_bit;
5756
struct reg_field vbus_disable_bit;
57+
bool vbus_needs_polling: 1;
5858
};
5959

6060
struct axp20x_usb_power {
@@ -65,7 +65,6 @@ struct axp20x_usb_power {
6565
struct regmap_field *usb_bc_en_bit;
6666
struct regmap_field *vbus_disable_bit;
6767
struct power_supply *supply;
68-
enum axp20x_variants axp20x_id;
6968
const struct axp_data *axp_data;
7069
struct iio_channel *vbus_v;
7170
struct iio_channel *vbus_i;
@@ -83,7 +82,7 @@ static bool axp20x_usb_vbus_needs_polling(struct axp20x_usb_power *power)
8382
* present->absent transition implies an online->offline transition
8483
* and will trigger the VBUS_REMOVAL IRQ.
8584
*/
86-
if (power->axp20x_id >= AXP221_ID && !power->online)
85+
if (power->axp_data->vbus_needs_polling && !power->online)
8786
return true;
8887

8988
return false;
@@ -391,7 +390,6 @@ static const struct axp_data axp202_data = {
391390
.power_desc = &axp20x_usb_power_desc,
392391
.irq_names = axp20x_irq_names,
393392
.num_irq_names = ARRAY_SIZE(axp20x_irq_names),
394-
.axp20x_id = AXP202_ID,
395393
.curr_lim_table = axp20x_usb_curr_lim_table,
396394
.curr_lim_fld = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 0, 1),
397395
.vbus_valid_bit = REG_FIELD(AXP20X_USB_OTG_STATUS, 2, 2),
@@ -402,29 +400,29 @@ static const struct axp_data axp221_data = {
402400
.power_desc = &axp22x_usb_power_desc,
403401
.irq_names = axp22x_irq_names,
404402
.num_irq_names = ARRAY_SIZE(axp22x_irq_names),
405-
.axp20x_id = AXP221_ID,
406403
.curr_lim_table = axp221_usb_curr_lim_table,
407404
.curr_lim_fld = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 0, 1),
405+
.vbus_needs_polling = true,
408406
};
409407

410408
static const struct axp_data axp223_data = {
411409
.power_desc = &axp22x_usb_power_desc,
412410
.irq_names = axp22x_irq_names,
413411
.num_irq_names = ARRAY_SIZE(axp22x_irq_names),
414-
.axp20x_id = AXP223_ID,
415412
.curr_lim_table = axp20x_usb_curr_lim_table,
416413
.curr_lim_fld = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 0, 1),
414+
.vbus_needs_polling = true,
417415
};
418416

419417
static const struct axp_data axp813_data = {
420418
.power_desc = &axp22x_usb_power_desc,
421419
.irq_names = axp22x_irq_names,
422420
.num_irq_names = ARRAY_SIZE(axp22x_irq_names),
423-
.axp20x_id = AXP813_ID,
424421
.curr_lim_table = axp813_usb_curr_lim_table,
425422
.curr_lim_fld = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 0, 1),
426423
.usb_bc_en_bit = REG_FIELD(AXP288_BC_GLOBAL, 0, 0),
427424
.vbus_disable_bit = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 7, 7),
425+
.vbus_needs_polling = true,
428426
};
429427

430428
#ifdef CONFIG_PM_SLEEP
@@ -542,7 +540,6 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
542540

543541
platform_set_drvdata(pdev, power);
544542

545-
power->axp20x_id = axp_data->axp20x_id;
546543
power->axp_data = axp_data;
547544
power->regmap = axp20x->regmap;
548545
power->num_irqs = axp_data->num_irq_names;

0 commit comments

Comments
 (0)