summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-02-06 15:32:19 -0700
committerCommit Bot <commit-bot@chromium.org>2020-02-10 18:21:26 +0000
commit495146176d87c0f05a326571731e32dfd2602a4d (patch)
tree2fc3db6406c02a990aa4a3a1450c1e900b031803 /common/battery.c
parent579c08cd553353baeb8965a5e9b15278bca61afa (diff)
downloadchrome-ec-495146176d87c0f05a326571731e32dfd2602a4d.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>
Diffstat (limited to 'common/battery.c')
-rw-r--r--common/battery.c7
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);