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 <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/227521
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Vic Yang
2014-11-04 16:11:30 -08:00
committed by chrome-internal-fetch
parent 4792db413f
commit 4bbbf04437

View File

@@ -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;