diff options
author | Keith Short <keithshort@chromium.org> | 2020-02-06 15:32:19 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-27 10:42:16 +0000 |
commit | d76c5fc90e4b820bc1cbbc86c87377fac32c3c56 (patch) | |
tree | 1fcce553731810c8a0c1faf27f93225c9ed56c72 | |
parent | e0bcfa438df88688b38b33c2a511d5a698c47885 (diff) | |
download | chrome-ec-d76c5fc90e4b820bc1cbbc86c87377fac32c3c56.tar.gz |
battery: set correct battery cutoff state
The battery cutoff state was not updated when using the "at-shutdown"
option. This caused the EC to continue charging the battery following
cutoff.
BUG=none
BRANCH=none
TEST=make buildall -j
TEST=Run "ectool batterycutoff at-shutdown" and then "shutdown -h now".
Verify the EC stops charging the battery and the battery voltage is
reported as 0.
Change-Id: I7aef46a4a4840ea1b17234f4d90ebf7e074a873b
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2042902
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
(cherry picked from commit 495146176d87c0f05a326571731e32dfd2602a4d)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2501803
Tested-by: David Huang <david.huang@quanta.corp-partner.google.com>
Auto-Submit: David Huang <david.huang@quanta.corp-partner.google.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | common/battery.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/common/battery.c b/common/battery.c index 850d703954..3fecc44c00 100644 --- a/common/battery.c +++ b/common/battery.c @@ -305,10 +305,13 @@ static void pending_cutoff_deferred(void) rv = board_cut_off_battery(); - if (rv == EC_RES_SUCCESS) + if (rv == EC_RES_SUCCESS) { CUTOFFPRINTS("succeeded."); - else + battery_cutoff_state = BATTERY_CUTOFF_STATE_CUT_OFF; + } else { CUTOFFPRINTS("failed!"); + battery_cutoff_state = BATTERY_CUTOFF_STATE_NORMAL; + } } DECLARE_DEFERRED(pending_cutoff_deferred); |