mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 21:02:19 +00:00
regulator: max8997/8966: fix charger cv voltage set bug
When min charger-CV is <= 4.0V and max charger-CV is >= 4.0V, we can use 4.00V as CV (register value = 0x1).` The original code had a typo that wrote ">=" (max_uV >= 4000000), which should've been "<", which is not necessary anyway as mentioned by Dan Carpenter. Reported-By: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2ea659a9ef
commit
f74521ca57
@ -428,12 +428,9 @@ static int max8997_set_voltage_charger_cv(struct regulator_dev *rdev,
|
||||
if (max_uV < 4000000 || min_uV > 4350000)
|
||||
return -EINVAL;
|
||||
|
||||
if (min_uV <= 4000000) {
|
||||
if (max_uV >= 4000000)
|
||||
return -EINVAL;
|
||||
else
|
||||
val = 0x1;
|
||||
} else if (min_uV <= 4200000 && max_uV >= 4200000)
|
||||
if (min_uV <= 4000000)
|
||||
val = 0x1;
|
||||
else if (min_uV <= 4200000 && max_uV >= 4200000)
|
||||
val = 0x0;
|
||||
else {
|
||||
lb = (min_uV - 4000001) / 20000 + 2;
|
||||
|
Loading…
Reference in New Issue
Block a user