diff options
Diffstat (limited to 'driver/charger/isl9241.c')
-rw-r--r-- | driver/charger/isl9241.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/driver/charger/isl9241.c b/driver/charger/isl9241.c index ab92ef70ad..4a53c2440a 100644 --- a/driver/charger/isl9241.c +++ b/driver/charger/isl9241.c @@ -12,6 +12,7 @@ #include "battery.h" #include "battery_smart.h" #include "charger.h" +#include "charge_state.h" #include "console.h" #include "common.h" #include "hooks.h" @@ -498,6 +499,30 @@ static int isl9241_ramp_get_current_limit(int chgnum) } #endif /* CONFIG_CHARGE_RAMP_HW */ +/* + * When fully charged in a low-power state, the ISL9241 may get stuck + * in CCM. Toggle learning mode for 50 ms to enter DCM and save power. + * This is a workaround provided by Renesas. See b/183771327. + */ +static void isl9241_restart_charge_voltage_when_full(void) +{ + if (!chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) + && charge_get_state() == PWR_STATE_CHARGE_NEAR_FULL) { + charger_discharge_on_ac(1); + msleep(50); + charger_discharge_on_ac(0); + } +} +DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, + isl9241_restart_charge_voltage_when_full, + HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, + isl9241_restart_charge_voltage_when_full, + HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, + isl9241_restart_charge_voltage_when_full, + HOOK_PRIO_DEFAULT); + /*****************************************************************************/ #ifdef CONFIG_CMD_CHARGER_DUMP static void dump_reg_range(int chgnum, int low, int high) |