summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-01-07 17:27:58 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-08 04:02:46 +0000
commit4ab20ee15f0b18432004b606d6bec1768076a0b9 (patch)
tree13264b17607ae38c888315e8ea135bca12d50df8
parent55c3456b52e7ed6a8f35c1dec3b5b0036239e8eb (diff)
downloadchrome-ec-4ab20ee15f0b18432004b606d6bec1768076a0b9.tar.gz
samus: Fix flaw in power up inhibit
Power up inhibit is intended to stop the AP from booting when the battery is in certain states. It works most of the time, but sometimes IN_PCH_SLP_S5_DEASSERTED is already set by the time we get to S5 and we incorrectly boot the AP. Thinking about this more, it's better to check the battery state in G3, before we transition to S5, to prevent the needless transition back to G3 if power up is indeed inhibited. BUG=chrome-os-partner:35182 TEST=Manual on Samus. Drain battery to 1% and attach charger. Press power button multiple times and verify that AP doesn't boot. Charge better to 2% and press power button. Verify that AP boots. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ib03c3f707f9d90d0a9cb07ada3738d00e2728c32 Reviewed-on: https://chromium-review.googlesource.com/239352 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/samus/power_sequence.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index c999c98180..ea3be48c90 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -196,14 +196,8 @@ enum power_state power_handle_state(enum power_state state)
break;
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;
- }
+ while ((power_get_signals() & IN_PCH_SLP_S5_DEASSERTED) == 0) {
if (task_wait_event(SECOND*4) == TASK_EVENT_TIMER) {
CPRINTS("timeout waiting for S5 exit");
/* Put system in G3 and assert RTCRST# */
@@ -243,6 +237,14 @@ enum power_state power_handle_state(enum power_state state)
break;
case POWER_G3S5:
+ /* Return to G3 if battery level is too low */
+ if (charge_want_shutdown() ||
+ charge_prevent_power_on()) {
+ CPRINTS("power-up inhibited");
+ chipset_force_g3();
+ return POWER_G3;
+ }
+
/* Enable 3.3V DSW */
gpio_set_level(GPIO_PP3300_DSW_EN, 1);