diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-07-26 19:05:04 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-31 16:37:10 -0700 |
commit | 4c4d4d3d0fedfd9c68133d245ef5af66a7e455eb (patch) | |
tree | 575a4dcf8d1c51f1c9a15f124b959c2a033d9f3c /common/charge_state_v2.c | |
parent | 0be219558010b9d00b8d45048046f7340d4fd086 (diff) | |
download | chrome-ec-4c4d4d3d0fedfd9c68133d245ef5af66a7e455eb.tar.gz |
chgstv2: Always check batt disconnect state.
When the battery is responsive, the charge state machine only checks the
disconnect state if the battery requests 0 volts and 0 milliamps. Since
battery disconnect state essentially means "can the battery provide a
charge?" we should always check the battery disconnect state. It's
possible that the battery wants a charge to recover from a short term
failure, but cannot yet provide charge to the system.
This commit simply changes battery_seems_to_be_disconnected to always
query the disconnect state regardless of the request charge voltage and
current.
BUG=b:76121712
BRANCH=None
TEST=Flash nocturne; cutoff battery, verify that battery is able to
recover and system is able to boot.
Change-Id: I91f9bdf2a54d4e16fc90c67264888342d87f9fe0
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1152554
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r-- | common/charge_state_v2.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 3387ac6302..8102029c21 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -1717,12 +1717,18 @@ void charger_task(void *u) } else #endif #ifdef CONFIG_BATTERY_REVIVE_DISCONNECT - battery_seems_to_be_disconnected = 0; + /* + * Always check the disconnect state. This is because + * the battery disconnect state is one of the items used + * to decide whether or not to leave safe mode. + */ + battery_seems_to_be_disconnected = + battery_get_disconnect_state() == + BATTERY_DISCONNECTED; if (curr.requested_voltage == 0 && curr.requested_current == 0 && - battery_get_disconnect_state() == - BATTERY_DISCONNECTED) { + battery_seems_to_be_disconnected) { /* * Battery is in disconnect state. Apply a * current to kick it out of this state. @@ -1732,7 +1738,6 @@ void charger_task(void *u) batt_info->voltage_max; curr.requested_current = batt_info->precharge_current; - battery_seems_to_be_disconnected = 1; } else #endif if (curr.state == ST_PRECHARGE || |