From 898d76ff51aa84adace81b34b579dbdf4b7790c2 Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Fri, 4 Dec 2020 15:16:16 +0800 Subject: 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 Change-Id: I1f0544e16d818074378f58f1208bd586031a5ebb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2573895 Reviewed-by: Eric Yilun Lin Commit-Queue: Ting Shen Tested-by: Ting Shen --- power/mt8192.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- cgit v1.2.1