summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorSue Chen <sue.chen@quanta.corp-partner.google.com>2020-10-26 09:07:39 +0800
committerCommit Bot <commit-bot@chromium.org>2020-11-02 02:30:12 +0000
commit5e58c9687bfe09c0e98ce5ece32944f9a9bf0a3d (patch)
tree4ac2923618d781a4da034b748808a496613aa8c4 /common/system.c
parent4170ffcb8ba7ba7bcefdcd7c4c8f21b8366576df (diff)
downloadchrome-ec-5e58c9687bfe09c0e98ce5ece32944f9a9bf0a3d.tar.gz
System: shutdown chipset before enter hibernate
Pressing Alt + h + Volume Up cannot enter hibernate on lazor. The DUT would boot up immediately. To ensure the KB hibernate successfully, the AP needs fully shutdown before hibernating. BUG=b:171731177 BRANCH=none TEST=Pressing Alt+h+VolumeUp can enter hibernate in S0, and can wake up by plugging AC, pressing power button. make buildall -j2 Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I3c09c0d339ebbaab33635a283fd57bac61ebf08f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2497371 Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/common/system.c b/common/system.c
index 1f353d49a6..6e79a6686c 100644
--- a/common/system.c
+++ b/common/system.c
@@ -945,6 +945,27 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
}
}
+void system_enter_hibernate(uint32_t seconds, uint32_t microseconds)
+{
+ if (!IS_ENABLED(CONFIG_HIBERNATE))
+ return;
+
+ /*
+ * If chipset is already off, then call system_hibernate directly. Else,
+ * let chipset_task bring down the power rails and transition to proper
+ * state before system_hibernate is called.
+ */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ system_hibernate(seconds, microseconds);
+ else {
+ reboot_at_shutdown = EC_REBOOT_HIBERNATE;
+ hibernate_seconds = seconds;
+ hibernate_microseconds = microseconds;
+
+ chipset_force_shutdown(CHIPSET_SHUTDOWN_CONSOLE_CMD);
+ }
+}
+
/*****************************************************************************/
/* Hooks */
@@ -1081,20 +1102,7 @@ __maybe_unused static int command_hibernate(int argc, char **argv)
} else
ccprintf("Hibernating until wake pin asserted.\n");
- /*
- * If chipset is already off, then call system_hibernate directly. Else,
- * let chipset_task bring down the power rails and transition to proper
- * state before system_hibernate is called.
- */
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- system_hibernate(seconds, microseconds);
- else {
- reboot_at_shutdown = EC_REBOOT_HIBERNATE;
- hibernate_seconds = seconds;
- hibernate_microseconds = microseconds;
-
- chipset_force_shutdown(CHIPSET_SHUTDOWN_CONSOLE_CMD);
- }
+ system_enter_hibernate(seconds, microseconds);
return EC_SUCCESS;
}