Skip to content

Commit 30cc7b0

Browse files
refractionwaresre
authored andcommitted
power: supply: max77693: Fix wrong conversion of charge input threshold value
The charge input threshold voltage register on the MAX77693 PMIC accepts four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v. Due to an oversight, the driver calculated the values for 4.7v and above starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000] gives 0). Add 1 to the calculation to ensure that 4.7v is converted to a register value of 0x1 and that the other two voltages are converted correctly as well. Fixes: 87c2d90 ("power: max77693: Add charger driver for Maxim 77693") Signed-off-by: Artur Weber <aweber.kernel@gmail.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250316-max77693-charger-input-threshold-fix-v1-1-2b037d0ac722@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent aae075a commit 30cc7b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/power/supply/max77693_charger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chg
608608
case 4700000:
609609
case 4800000:
610610
case 4900000:
611-
data = (uvolt - 4700000) / 100000;
611+
data = ((uvolt - 4700000) / 100000) + 1;
612612
break;
613613
default:
614614
dev_err(chg->dev, "Wrong value for charge input voltage regulation threshold\n");

0 commit comments

Comments
 (0)