summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-04-15 12:04:38 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-15 22:14:54 +0000
commit569554001e85e44196d8ad50ea2d8ab248b6dc58 (patch)
tree7a0d48315edb147f01b0542511e63db40a6eaf8e /common/system.c
parent49996a08da85606ee86176d3dbf6d45bf3ff8321 (diff)
downloadchrome-ec-569554001e85e44196d8ad50ea2d8ab248b6dc58.tar.gz
system: Wait 1s for EC to quiesce before hibernate
The EC can enter hibernate via a keyboard shortcut alt+vol_up+H when in S0. However, the EC will never actually hibernate from S0; instead, it waits until the system is in S5/Pseudo G3 for 1hr (default setting). If the system is in S0 when hibernate is requested, it performs an unclean shutdown and then enters hibernate immediately. However, this can allow spurious interrupts to wake up the EC again. This commit simply adds a 1s delay after the unordely shutdown and before entering hibernate. BUG=b:185302895,b:185206379 BRANCH=dedede TEST=Build and flash DUT, boot to S0, press alt+vol_up+H, verify DUT turns off and stays off. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I98e094a64ae716811e44fe1858ad981403da7b39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829116 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/system.c b/common/system.c
index 65c0d7c6ca..6a96db415f 100644
--- a/common/system.c
+++ b/common/system.c
@@ -950,6 +950,13 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
if (!IS_ENABLED(CONFIG_HIBERNATE))
return EC_ERROR_INVAL;
+ /*
+ * Allow some time for the system to quiesce before entering EC
+ * hibernate. Otherwise, some stray signals may cause an
+ * immediate wake up.
+ */
+ CPRINTS("Waiting 1s before hibernating...");
+ msleep(1000);
CPRINTS("system hibernating");
system_hibernate(hibernate_seconds, hibernate_microseconds);
/* That shouldn't return... */