power: supply: ab8500: Respect charge_restart_voltage_uv
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 15 Apr 2022 20:36:37 +0000 (22:36 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 9 Jun 2022 20:09:58 +0000 (22:09 +0200)
commit6aa35ab9db2c9ca141ba9d64a2ad95b73dbf90e3
treef2ddd7d5a5d568e625845061496dafeb5baf3e00
parent23c46bab922b856b585a5f49413f74a9a7b2400d
power: supply: ab8500: Respect charge_restart_voltage_uv

The battery info contains a voltage indicating when the voltage
is so low that it is time to restart the CC/CV charging.
Make the AB8500 respect and prioritize this setting over the
hardcoded 95% threshold.

Break out the check into its own function and add some safeguards
so we do not run into unpredictable side effects.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/ab8500_chargalg.c