summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2020-12-04 15:16:16 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-04 09:04:04 +0000
commit898d76ff51aa84adace81b34b579dbdf4b7790c2 (patch)
treed386c2a64e0fdcc61dcdbb0f15b7aad55652f104 /power
parentce184a2ee3cd280cca840929b13af994e478fd61 (diff)
downloadchrome-ec-898d76ff51aa84adace81b34b579dbdf4b7790c2.tar.gz
power/mt8192: back to S5 when PMIC failed to shutdown
`apshutdown` sometimes fails to shutdown PMIC, when this happens, powerstate will bounce between G3 and S5G3 until watchdog kicks in. To fix this, we should detect PMIC status in S5G3, go back to S5 to retry shutdown if PMIC is still alive. BUG=b:174546890 TEST=Run the reproduce steps in b/174546890#comment13, verify EC enters G3. BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I1f0544e16d818074378f58f1208bd586031a5ebb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2573895 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/mt8192.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/power/mt8192.c b/power/mt8192.c
index c1d545fc86..b1ff717100 100644
--- a/power/mt8192.c
+++ b/power/mt8192.c
@@ -425,6 +425,10 @@ enum power_state power_handle_state(enum power_state state)
if (forcing_shutdown)
GPIO_SET_LEVEL(GPIO_EC_PMIC_EN_ODL, 1);
+ /* If PMIC is not off, go back to S5 and try again. */
+ if (power_get_signals() & IN_PGOOD_PMIC)
+ return POWER_S5;
+
return POWER_G3;
}