summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-08-02 09:48:41 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-24 03:59:47 -0700
commit118ab1fdba370bad2b476be906836657b87734f6 (patch)
tree968a925b7a3e0ba61deb1dc3bd301f9b4ce816d6
parent17d8d87c9b5881f4ad3f8f4077f271698e741135 (diff)
downloadchrome-ec-118ab1fdba370bad2b476be906836657b87734f6.tar.gz
power/mt8183: Power sequence from S5, not G3
The previous code was switching on the AP on G3 to S5 transition, this causes problems as there is a 10s timeout in the S5 to G3 transition, so we would not be able to boot the AP from S5. The only difference now between S5 and G3, is the case where the PMIC fails to shut down properly: we only enter G3 if the PMIC shuts down as expected. BRANCH=none BUG=b:109850749 TEST=make BOARD=kukui -j Change-Id: I260146e6d4622a76ad3a53d67fdde43a8669697c Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1181008 Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--power/mt8183.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index 13a76532a2..2a4cef45b1 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -133,10 +133,6 @@ enum power_state power_chipset_init(void)
} else if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF)) {
/* Auto-power on */
chipset_exit_hard_off();
- /*
- * TODO(b:109850749): If we see that PMIC power good is up,
- * we could probably jump straight to S5 and power on the AP.
- */
}
return POWER_G3;
@@ -170,17 +166,6 @@ enum power_state power_handle_state(enum power_state state)
case POWER_S5:
if (forcing_shutdown) {
- /*
- * While PMIC is still not off, press power+home button.
- * This should not happen if PMIC is configured
- * properly, and shuts down upon receiving WATCHDOG.
- */
- if (power_has_signals(IN_PGOOD_PMIC)) {
- gpio_set_level(GPIO_PMIC_EN_ODL, 0);
- return POWER_S5;
- }
-
- gpio_set_level(GPIO_PMIC_EN_ODL, 1);
return POWER_S5G3;
} else {
return POWER_S5S3;
@@ -205,6 +190,12 @@ enum power_state power_handle_state(enum power_state state)
case POWER_G3S5:
forcing_shutdown = 0;
+ gpio_set_level(GPIO_PMIC_FORCE_RESET, 0);
+
+ /* Power up to next state */
+ return POWER_S5;
+
+ case POWER_S5S3:
/* If PMIC is off, switch it on by pulsing PMIC enable. */
if (!power_has_signals(IN_PGOOD_PMIC)) {
gpio_set_level(GPIO_PMIC_EN_ODL, 0);
@@ -228,10 +219,6 @@ enum power_state power_handle_state(enum power_state state)
if (power_wait_signals(IN_PGOOD_PMIC))
return POWER_G3;
- /* Power up to next state */
- return POWER_S5;
-
- case POWER_S5S3:
/* Enable S3 power supplies, release AP reset. */
power_seq_run(s5s3_power_seq, ARRAY_SIZE(s5s3_power_seq));
@@ -300,6 +287,22 @@ enum power_state power_handle_state(enum power_state state)
return POWER_S5;
case POWER_S5G3:
+ /*
+ * If PMIC is still not off, assert PMIC_FORCE_RESET.
+ * This should not happen if PMIC is configured properly, and
+ * shuts down upon receiving WATCHDOG.
+ */
+ if (power_has_signals(IN_PGOOD_PMIC)) {
+#if defined(BOARD_KUKUI) && BOARD_REV == 0
+ CPRINTS("Cannot force PMIC off (rev0)");
+#else
+ CPRINTS("Forcing PMIC off");
+ gpio_set_level(GPIO_PMIC_FORCE_RESET, 1);
+ msleep(50);
+ return POWER_S5G3;
+#endif
+ }
+
return POWER_G3;
}