summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2019-06-14 11:56:53 +0800
committerCommit Bot <commit-bot@chromium.org>2019-06-17 12:20:45 +0000
commitfa0108b117dccff7102c86c2501bcafeba4b0e05 (patch)
tree0d1c9cbd0d94e96015600ccf0336a76007551e03 /power
parentddc1e52b75f5f6277af478630e5a0238394c31c4 (diff)
downloadchrome-ec-fa0108b117dccff7102c86c2501bcafeba4b0e05.tar.gz
power/mt8183: Stay in S5 for 10 seconds before forcing PMIC shutdown
On forced/emergency shutdown, the EC is only able to force the PMIC off by asserting GPIO_PMIC_FORCE_RESET_ODL, which also loses the RTC state. And it does so immediately after transitioning to S5. This causes issues with FAFT, as the RTC resets to original time. Instead, wait for 10 seconds in S5 before forcing the transition to G3, which is what other platforms do, and only force the reset at that time. BRANCH=none BUG=b:134912821 TEST=apshutdown => System stays in S5 for 10 seconds before force shutdown. TEST=apshutdown => powerb wakes the system in both S5 and G3 TEST=apshutdown; reboot ap-off in S5 still waits 10 seconds to force shutdown to G3. TEST=poweroff in AP console works, directly goes to G3, and powerb wakes the system TEST=Boot DUT: mosys eventlog clear; poweroff power on DUT, run dut-control power_state:off Within 10 seconds, power on DUT again mosys eventlog list shows events with correct time stamps: 0 | 2019-06-14 15:40:10 | Log area cleared | 55 1 | 2019-06-14 15:40:24 | System boot | 0 2 | 2019-06-14 15:40:24 | Chrome OS Developer Mode 3 | 2019-06-14 15:40:58 | System boot | 0 4 | 2019-06-14 15:40:58 | Chrome OS Developer Mode Change-Id: I7495950da58179fc066608d804e263c81b0993aa Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660070 Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/mt8183.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index 244cb5f8de..e005cb0288 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -241,14 +241,21 @@ enum power_state power_handle_state(enum power_state state)
break;
case POWER_S5:
- if (forcing_shutdown || ap_shutdown) {
+ /*
+ * If AP initiated shutdown, PMIC is off, and we can transition
+ * to G3 immediately.
+ */
+ if (ap_shutdown) {
ap_shutdown = 0;
return POWER_S5G3;
- } else {
+ } else if (!forcing_shutdown) {
+ /* Powering up. */
s5s3_retry = 1;
return POWER_S5S3;
}
- break;
+
+ /* Stay in S5, common code will drop to G3 after timeout. */
+ return POWER_S5;
case POWER_S3:
if (!power_has_signals(IN_PGOOD_S3) || forcing_shutdown)
@@ -409,9 +416,11 @@ enum power_state power_handle_state(enum power_state state)
static void power_button_changed(void)
{
if (power_button_is_pressed()) {
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
/* Power up from off */
+ forcing_shutdown = 0;
chipset_exit_hard_off();
+ }
/* Delayed power down from S0/S3, cancel on PB release */
hook_call_deferred(&chipset_force_shutdown_button_data,