From 4bbbf044373605938050f7dc0e680eea38278cd9 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Tue, 4 Nov 2014 16:11:30 -0800 Subject: [PATCH] Do not try to wake the battery after battery cut-off When the battery cut-off command is issued with external power present, the battery can end up in one of the following two states: 1. The battery stays responsive but is waiting for the external power to go away. 2. The battery decides to cut itself off right away. In case 1, we are already avoiding charging the battery again, so we're good. However, in case 2, the charge state machine mistakenly thinks the battery is dead and tries to revive it. Fix this by checking if the battery is cut off before starting to revive it. BRANCH=None BUG=chrome-os-partner:33372 TEST=Cut off the battery with external power connected. Wait for a while and then disconnect external power. Check the battery is sure cut off. Repeat for several times. Change-Id: Icf343b168a556a490bc1786802a8a6e230863a28 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/227521 Reviewed-by: Bill Richardson --- common/charge_state_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index e0ab8e5929..2346ddd131 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -592,7 +592,7 @@ void charger_task(void) /* If the battery is not responsive, try to wake it up. */ if (!(curr.batt.flags & BATT_FLAG_RESPONSIVE)) { - if (battery_seems_to_be_dead) { + if (battery_seems_to_be_dead || battery_is_cut_off()) { /* It's dead, do nothing */ curr.state = ST_IDLE; curr.requested_voltage = 0;