summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2014-12-16 10:17:06 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-02 10:24:09 +0000
commit0a2807572ef406610cb90c3de422dea8b9a6955c (patch)
tree3154625148cf86b2ce031745d7ff5941e2d5bd6f
parent783b46afb9f005cd7350d08f02691004f759a884 (diff)
downloadchrome-ec-0a2807572ef406610cb90c3de422dea8b9a6955c.tar.gz
samus: Don't power-on AP if battery level < 1%
This will also inhibit power-on if no battery is attached. BUG=chrome-os-partner:31127 TEST=Manual on Samus. Verify that AP continues to boot normally when charge level exceeds CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. Verify that power button presses are ignored when the charge level is below the threshold, and we return to G3. Also, verify that Samus can boot successfully to the OS with 1% battery and a 5V @ 500mA charger attached. BRANCH=Samus Change-Id: I47cd3903c8cc13282fd5038f9d5fd1e310283ea7 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236022 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/samus/board.h1
-rw-r--r--board/samus/power_sequence.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/board/samus/board.h b/board/samus/board.h
index fad50ec80d..fbc1327a23 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -48,6 +48,7 @@
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_INPUT_CURRENT 448
#define CONFIG_CHARGER_DISCHARGE_ON_AC
+#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
#define CONFIG_FANS 2
#define CONFIG_GESTURE_DETECTION
#define CONFIG_GESTURE_SAMPLING_INTERVAL_MS 5
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index e034c69f71..c999c98180 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -6,6 +6,7 @@
/* X86 chipset power control module for Chrome EC */
#include "battery.h"
+#include "charge_state.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -196,6 +197,13 @@ enum power_state power_handle_state(enum power_state state)
case POWER_S5:
while ((power_get_signals() & IN_PCH_SLP_S5_DEASSERTED) == 0) {
+ /* Return to G3 if battery level is too low */
+ if (charge_want_shutdown() ||
+ charge_prevent_power_on()) {
+ CPRINTS("power-up inhibited");
+ return POWER_S5G3;
+ }
+
if (task_wait_event(SECOND*4) == TASK_EVENT_TIMER) {
CPRINTS("timeout waiting for S5 exit");
/* Put system in G3 and assert RTCRST# */