diff options
author | Caveh Jalali <caveh@chromium.org> | 2018-12-04 23:31:24 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-12-06 22:06:25 -0800 |
commit | 74a598dd11bdfb03001e8ab8e62757beb8622583 (patch) | |
tree | 2748e695def7601e7594b6da31c730e713438703 /common | |
parent | a0d936bda4fd38d45bda171cb442de1a582b65e4 (diff) | |
download | chrome-ec-74a598dd11bdfb03001e8ab8e62757beb8622583.tar.gz |
chgstv2: fix LED glitch on reboot
this fixes a glitch where the LEDs are momentarily set to the battery
fail color when the EC initializes. it takes a bit of time to confirm
battery presense - we were treating this window of uncertainty as a
battery failure. there's another case where we try to wake up a
depleted battery (ST_PRECHARGE). this should also not be treated as a
battery failure until the state machine moves to ST_IDLE after
PRECHARGE_TIMEOUT.
BUG=b:120200655
BRANCH=none
TEST=EC reboot no longer flashes the LEDs red
Change-Id: Ib85fc7282c3edb68d2e22b5d1f3071a89bbcb21d
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1362626
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state_v2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 45f8ece5b5..bd4bb81558 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -2077,7 +2077,7 @@ enum charge_state charge_get_state(void) { switch (curr.state) { case ST_IDLE: - if (battery_seems_to_be_dead || curr.batt.is_present != BP_YES) + if (battery_seems_to_be_dead || curr.batt.is_present == BP_NO) return PWR_STATE_ERROR; return PWR_STATE_IDLE; case ST_DISCHARGE: @@ -2093,6 +2093,9 @@ enum charge_state charge_get_state(void) return PWR_STATE_CHARGE_NEAR_FULL; else return PWR_STATE_CHARGE; + case ST_PRECHARGE: + /* we're in battery discovery mode */ + return PWR_STATE_IDLE; default: /* Anything else can be considered an error for LED purposes */ return PWR_STATE_ERROR; |