summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-10-01 15:51:58 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-02 17:49:16 -0700
commit939d07fc4e5e7eee8e493c5edbae6053ee05668e (patch)
treec1eae3ad8c6c039cbbf9893e10ca6647f998bf55
parent229094b2455e093c95d07251a0021f3b637e813c (diff)
downloadchrome-ec-939d07fc4e5e7eee8e493c5edbae6053ee05668e.tar.gz
charge_state_v2: add option to cut-off battery when level is critical
Add a build option CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF to perform a battery cut-off when we reach the battery critical low level. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=none TEST=Discharge a Ryu device down to the critical level, see the message and verify we cannot restart with the power button. Also check that plugging the charger revives the device and starts charging. Change-Id: Ic132a658de5c5131a6a1dd1ce343196b68d480f6 Reviewed-on: https://chromium-review.googlesource.com/303549 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 80b3c99319771312d5733b126b6b3eb839addde9) Reviewed-on: https://chromium-review.googlesource.com/303812 Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/charge_state_v2.c4
-rw-r--r--include/config.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 0ca0974739..630ee06d74 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -499,6 +499,10 @@ static void shutdown_on_critical_battery(void)
CPRINTS(
"charge force EC hibernate due to critical battery");
system_hibernate(0, 0);
+#elif defined(CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF)
+ CPRINTS(
+ "charge force battery cut-off due to critical level");
+ board_cut_off_battery();
#endif
} else {
/* Timeout waiting for AP to shut down, so kill it */
diff --git a/include/config.h b/include/config.h
index f87afc8f6b..9f0a10faf1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -191,6 +191,9 @@
*/
#define CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT 30
+/* Perform a battery cut-off when we reach the battery critical level */
+#undef CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
+
/*
* Support battery cut-off as host command and console command.
*