mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
power: supply: axp288_charger: Fix constant_charge_voltage writes
commit b34ce4a59cfe9cd0d6f870e6408e8ec88a964585 upstream.
info->max_cv is in millivolts, divide the microvolt value being written
to constant_charge_voltage by 1000 *before* clamping it to info->max_cv.
Before this fix the code always tried to set constant_charge_voltage
to max_cv / 1000 = 4 millivolt, which ends up in setting it to 4.1V
which is the lowest supported value.
Fixes: 843735b788 ("power: axp288_charger: axp288 charger driver")
Cc: [email protected]
Signed-off-by: Hans de Goede <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sebastian Reichel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
da18145e7d
commit
1031a0e7c2
1 changed files with 2 additions and 2 deletions
|
|
@ -371,8 +371,8 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
|
|||
dev_warn(&info->pdev->dev, "set charge current failed\n");
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
|
||||
scaled_val = min(val->intval, info->max_cv);
|
||||
scaled_val = DIV_ROUND_CLOSEST(scaled_val, 1000);
|
||||
scaled_val = DIV_ROUND_CLOSEST(val->intval, 1000);
|
||||
scaled_val = min(scaled_val, info->max_cv);
|
||||
ret = axp288_charger_set_cv(info, scaled_val);
|
||||
if (ret < 0)
|
||||
dev_warn(&info->pdev->dev, "set charge voltage failed\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue