From 78c4b5277f437435fafeebb79ca7d349a966177b Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 31 Oct 2018 09:39:01 +0800 Subject: power/mt8183: Obey ap-off reset flag if PMIC is already up On startup, we need to start from POWER_S5 if the PMIC is already up. However, if the ap-off reset flag is set, we need to make sure that we transition to G3 (and not to S3->S0). BRANCH=none BUG=b:118090373 TEST=reboot ap-off in S0/G3 works fine (AP does not boot). TEST=AP initiated reboot works fine (AP boots up) TEST=EC initiated reboot without ap-off works fine (AP boots up) Change-Id: I515f8f947bfb6b1ef45f1c2ceb7b9d9e0a324c78 Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/1309435 Reviewed-by: Yilun Lin --- power/mt8183.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/power/mt8183.c b/power/mt8183.c index ff842ba01c..7fce482e95 100644 --- a/power/mt8183.c +++ b/power/mt8183.c @@ -168,7 +168,13 @@ enum power_state power_chipset_init(void) CPRINTS("already in S0"); return POWER_S0; } - } else if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF)) { + } else if (system_get_reset_flags() & RESET_FLAG_AP_OFF) { + /* Force shutdown from S5 if the PMIC is already up. */ + if (power_get_signals() & IN_PGOOD_PMIC) { + forcing_shutdown = 1; + return POWER_S5; + } + } else { /* Auto-power on */ chipset_exit_hard_off(); } -- cgit v1.2.1