summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-12-15 09:06:41 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-12-19 16:56:35 +0000
commit6e24375bc0f65a336b430920c8fe593a465b4469 (patch)
treec25a245131fa3f77f1f942b113729819ab9a39f3
parent4c3eb939c06a477b9180e18b315e06692c694efa (diff)
downloadchrome-ec-6e24375bc0f65a336b430920c8fe593a465b4469.tar.gz
Snappy: Cutoff battery when system shuts down due to critical battery
Currently, Snappy EC hibernates when system shuts down due to critical battery level. This causes devices with deeply drained battery to fail to exit from hibernation. This patch makes Snappy EC cut-off battery when the system is shutting down due to critical battery level. This patch also disables hibernation. It'll make chipset_task sleep instead of hibernate in G3. So, charger_task should eventually cut off the battery when the battery reaches critical level. BUG=b:70183568 BRANCH=none TEST= [Setup] A battery is connected but deeply discharged. EC sees it 0% charged. Battery cells are connected to 5.8V power supply. [Test] 1. Boot the device by AC. If it doesn't boot, press reset button on servo. 2. Wait till EC jumps to RW (or firmware screen shows up). 3. Unplug AC. 4. Wait for EC to hibernate (~30 sec). 5. Make sure VBAT is 5.8V (indicating battery's CFET is closed). 6. Plug AC adapter to wake up the system. Snappy successfully boots 10 out of 10 attempts. Change-Id: I9e1a8b2b3175c2e914d745e5522b8b9bedda3a78 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/829985 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/snappy/board.h2
-rw-r--r--common/charge_state_v2.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/board/snappy/board.h b/board/snappy/board.h
index d0aad15de7..3bdc6dd086 100644
--- a/board/snappy/board.h
+++ b/board/snappy/board.h
@@ -60,6 +60,7 @@
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#define CONFIG_USB_CHARGER
#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
+#define CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
/* USB-A config */
#define CONFIG_USB_PORT_POWER_SMART
@@ -154,6 +155,7 @@
#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
#define CONFIG_PWR_STATE_DISCHARGE_FULL
#define CONFIG_EC_FEATURE_BOARD_OVERRIDE
+#undef CONFIG_HIBERNATE
/*
*During shutdown sequence TPS65094x PMIC turns off the sensor rails
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 12549d1b93..41a5a5ff7f 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -521,9 +521,12 @@ static void shutdown_on_critical_battery(void)
"charge force EC hibernate due to critical battery");
system_hibernate(0, 0);
#elif defined(CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF)
+ int rv;
CPRINTS(
"charge force battery cut-off due to critical level");
- board_cut_off_battery();
+ rv = board_cut_off_battery();
+ /* Theoretically, we should not reach here */
+ CPRINTS("Battery cutoff may have failed: %d", rv);
#endif
} else {
/* Timeout waiting for AP to shut down, so kill it */