diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2022-04-15 22:36:38 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2022-06-09 22:10:05 +0200 |
commit | e08f8a118514c94c8cf78aa1dcf5f26f7b6918ba (patch) | |
tree | 531042babd79fad3369c52bcf3a5aad04c222888 /drivers/power | |
parent | 6aa35ab9db2c9ca141ba9d64a2ad95b73dbf90e3 (diff) | |
download | linux-e08f8a118514c94c8cf78aa1dcf5f26f7b6918ba.tar.gz linux-e08f8a118514c94c8cf78aa1dcf5f26f7b6918ba.tar.bz2 linux-e08f8a118514c94c8cf78aa1dcf5f26f7b6918ba.zip |
power: supply: ab8500: Exit maintenance if too low voltage
The maintenance charging is supposedly designed such that the
maintenance current compensates for the battery discharge curve,
and as the charging progress from CC/CV -> maintenance A ->
maintenance B states, we end up on a reasonable voltage to
restart ordinary CC/CV charging after the safety timer at the
maintenance B state exits.
However: old batteries discharge quicker, and in an old
battery we might not get to the expiration of the maintenance B
timer before the battery is completely depleted and the system
powers off with an empty battery.
This is hardly the desire of anyone leaving their phone in the
charger for a few days!
Introduce a second clause in both maintenance states such that
we exit the state and return to ordinary CC/CV charging if
the voltage drops below charge_restart_voltage_uv or 95%
if this is not defined for the battery.
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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/ab8500_chargalg.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c index 037ae9b4a7d0..f4c017527de4 100644 --- a/drivers/power/supply/ab8500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -1514,6 +1514,14 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) ab8500_chargalg_stop_maintenance_timer(di); ab8500_chargalg_state_to(di, STATE_MAINTENANCE_B_INIT); } + /* + * This happens if the voltage drops too quickly during + * maintenance charging, especially in older batteries. + */ + if (ab8500_chargalg_time_to_restart(di)) { + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); + dev_info(di->dev, "restarted charging from maintenance state A - battery getting old?\n"); + } break; case STATE_MAINTENANCE_B_INIT: @@ -1538,6 +1546,14 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) ab8500_chargalg_stop_maintenance_timer(di); ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); } + /* + * This happens if the voltage drops too quickly during + * maintenance charging, especially in older batteries. + */ + if (ab8500_chargalg_time_to_restart(di)) { + ab8500_chargalg_state_to(di, STATE_NORMAL_INIT); + dev_info(di->dev, "restarted charging from maintenance state B - battery getting old?\n"); + } break; case STATE_TEMP_LOWHIGH_INIT: |