Skip to content

Commit b3ded60

Browse files
jwrdegoedesre
authored andcommitted
power: supply: bq24190: Fix BQ24296 Vbus regulator support
There are 2 issues with bq24296_set_otg_vbus(): 1. When writing the OTG_CONFIG bit it uses POC_CHG_CONFIG_SHIFT which should be POC_OTG_CONFIG_SHIFT. 2. When turning the regulator off it never turns charging back on. Note this must be done through bq24190_charger_set_charge_type(), to ensure that the charge_type property value of none/trickle/fast is honored. Resolve both issues to fix BQ24296 Vbus regulator support not working. Fixes: b150a70 ("power: supply: bq24190_charger: Add support for BQ24296") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20241116203648.169100-2-hdegoede@redhat.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent c28dc9f commit b3ded60

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/power/supply/bq24190_charger.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ static int bq24190_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
567567

568568
static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
569569
{
570+
union power_supply_propval val = { .intval = bdi->charge_type };
570571
int ret;
571572

572573
ret = pm_runtime_resume_and_get(bdi->dev);
@@ -587,13 +588,18 @@ static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
587588

588589
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
589590
BQ24296_REG_POC_OTG_CONFIG_MASK,
590-
BQ24296_REG_POC_CHG_CONFIG_SHIFT,
591+
BQ24296_REG_POC_OTG_CONFIG_SHIFT,
591592
BQ24296_REG_POC_OTG_CONFIG_OTG);
592-
} else
593+
} else {
593594
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
594595
BQ24296_REG_POC_OTG_CONFIG_MASK,
595-
BQ24296_REG_POC_CHG_CONFIG_SHIFT,
596+
BQ24296_REG_POC_OTG_CONFIG_SHIFT,
596597
BQ24296_REG_POC_OTG_CONFIG_DISABLE);
598+
if (ret < 0)
599+
goto out;
600+
601+
ret = bq24190_charger_set_charge_type(bdi, &val);
602+
}
597603

598604
out:
599605
pm_runtime_mark_last_busy(bdi->dev);

0 commit comments

Comments
 (0)