summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhuohao Lee <zhuohao@chromium.org>2021-04-28 13:48:45 +0800
committerCommit Bot <commit-bot@chromium.org>2021-04-28 19:13:47 +0000
commit9508d85efd91ec90c02e5b65e1bd507f994f8abe (patch)
treeadf98d7231b9708bd55ada496a3e16b2715c093b
parentb0e85f04fa46113163c059ccf86f85e5bfe152c4 (diff)
downloadchrome-ec-9508d85efd91ec90c02e5b65e1bd507f994f8abe.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/+/2856065 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--driver/charger/isl9241.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/driver/charger/isl9241.c b/driver/charger/isl9241.c
index e58c0663cd..4a633f71ef 100644
--- a/driver/charger/isl9241.c
+++ b/driver/charger/isl9241.c
@@ -506,11 +506,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);