mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
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: b150a703b5
("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>
This commit is contained in:
parent
c28dc9fc24
commit
b3ded6072c
@ -567,6 +567,7 @@ static int bq24190_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
|
|||||||
|
|
||||||
static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
|
static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
|
||||||
{
|
{
|
||||||
|
union power_supply_propval val = { .intval = bdi->charge_type };
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pm_runtime_resume_and_get(bdi->dev);
|
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)
|
|||||||
|
|
||||||
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
|
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
|
||||||
BQ24296_REG_POC_OTG_CONFIG_MASK,
|
BQ24296_REG_POC_OTG_CONFIG_MASK,
|
||||||
BQ24296_REG_POC_CHG_CONFIG_SHIFT,
|
BQ24296_REG_POC_OTG_CONFIG_SHIFT,
|
||||||
BQ24296_REG_POC_OTG_CONFIG_OTG);
|
BQ24296_REG_POC_OTG_CONFIG_OTG);
|
||||||
} else
|
} else {
|
||||||
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
|
ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
|
||||||
BQ24296_REG_POC_OTG_CONFIG_MASK,
|
BQ24296_REG_POC_OTG_CONFIG_MASK,
|
||||||
BQ24296_REG_POC_CHG_CONFIG_SHIFT,
|
BQ24296_REG_POC_OTG_CONFIG_SHIFT,
|
||||||
BQ24296_REG_POC_OTG_CONFIG_DISABLE);
|
BQ24296_REG_POC_OTG_CONFIG_DISABLE);
|
||||||
|
if (ret < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ret = bq24190_charger_set_charge_type(bdi, &val);
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
pm_runtime_mark_last_busy(bdi->dev);
|
pm_runtime_mark_last_busy(bdi->dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user