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>
This commit is contained in:
Ting Shen 2020-12-04 15:16:16 +08:00 committed by Commit Bot
parent ce184a2ee3
commit 898d76ff51
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}