summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2019-02-27 07:48:33 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-27 04:59:03 -0800
commit5a7600276d9f2a5eafb87a348f305e875f7e4382 (patch)
tree931a40fa15e1ec21d5b40a76b18474b5e8153f76
parent56cd91fda92d1dc8147c487737444933a665852a (diff)
downloadchrome-ec-5a7600276d9f2a5eafb87a348f305e875f7e4382.tar.gz
power/mt8183: Detect AP-initiated PMIC shutdown and stay S5/G3
Without this change, EC would go to POWER_S5 state, and immediately go back to S3, which resets the system. BRANCH=none BUG=b:126295807 TEST=poweroff in AP console, systems goes to G3 (without requiring forced PMIC shutdown) and stays there Change-Id: Icbff7eb3962e26a6e2e9cb061f53665b9d94423b Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490791 Reviewed-by: Yilun Lin <yllin@chromium.org>
-rw-r--r--power/mt8183.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index fa9b31271c..9b823a0a8a 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -240,6 +240,12 @@ enum power_state power_handle_state(enum power_state state)
/* Retry S5->S3 transition, if not zero. */
static int s5s3_retry;
+ /*
+ * PMIC power went away (AP most likely decided to shut down):
+ * transition to S5, G3.
+ */
+ static int ap_shutdown;
+
switch (state) {
case POWER_G3:
/* Go back to S5->G3 if the PMIC unexpectedly starts again. */
@@ -248,7 +254,8 @@ enum power_state power_handle_state(enum power_state state)
break;
case POWER_S5:
- if (forcing_shutdown) {
+ if (forcing_shutdown || ap_shutdown) {
+ ap_shutdown = 0;
return POWER_S5G3;
} else {
s5s3_retry = 1;
@@ -376,6 +383,10 @@ enum power_state power_handle_state(enum power_state state)
return POWER_S3;
case POWER_S3S5:
+ /* PMIC has shutdown, transition to G3. */
+ if (!(power_get_signals() & IN_PGOOD_PMIC))
+ ap_shutdown = 1;
+
/* Call hooks before we remove power rails */
hook_notify(HOOK_CHIPSET_SHUTDOWN);