diff options
author | Zhuohao Lee <zhuohao@chromium.org> | 2021-04-28 13:48:45 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-28 17:28:32 +0000 |
commit | 46506b0d075084e5d8c22aaa7937f02159719403 (patch) | |
tree | 389cc58a1e78cf3fa30911c942aea98398f040b2 /driver/charger/isl9241.c | |
parent | 74a7b366366e3786ef10d39cdec230a4537ebb54 (diff) | |
download | chrome-ec-46506b0d075084e5d8c22aaa7937f02159719403.tar.gz |
isl9241: fix the system can't boot due to DCM mode
When the device recover from the battery cutoff,
the battery is not ready to output the power to the
system. If we toggle the DCM mode at that time, the
system power will be cutoff. To avoid this problem,
we check the battery battery_get_disconnect_state()
before setting the DCM.
BUG=b:186188004
BRANCH=firmware-volteer-13672.B
TEST=1. charge the battery to near full
2. battery cutoff
3. plug in AC
Change-Id: Ic2d959c89a9e37479b919133e10a69be8148a26e
Signed-off-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2853885
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/charger/isl9241.c')
-rw-r--r-- | driver/charger/isl9241.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/driver/charger/isl9241.c b/driver/charger/isl9241.c index 4a53c2440a..794ea0b342 100644 --- a/driver/charger/isl9241.c +++ b/driver/charger/isl9241.c @@ -503,11 +503,15 @@ static int isl9241_ramp_get_current_limit(int chgnum) * 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. + * Note: the charger_get_state() returns the last known charge value, + * so need to check the battery is not disconnected when the system + * comes from the battery cutoff. */ 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) { + && charge_get_state() == PWR_STATE_CHARGE_NEAR_FULL + && battery_get_disconnect_state() == BATTERY_NOT_DISCONNECTED) { charger_discharge_on_ac(1); msleep(50); charger_discharge_on_ac(0); |