summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2020-05-01 15:31:57 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-06 02:49:19 +0000
commit8db6eb89540a0ca72e29633ffbfd1eac10d6ad6a (patch)
tree3533ac265f0b338361ef4baf36dc94f45709f5f6
parentaa519e36857e1f19f8a4cd8806f4436cab7abd89 (diff)
downloadchrome-ec-8db6eb89540a0ca72e29633ffbfd1eac10d6ad6a.tar.gz
power: Don't boot after waking up from hibernation
When a device shuts down and is idle for 60 mins (configurable), EC enters hibernation. When an AC adapter is plugged, the system boots. This is not expected behavior and not consistent with the behavior that the system stays off on AC plug-in before hibernation. This patch fixes the above inconsistency by storing AP_OFF flag before entering hibernation after 60 mins idle in S5. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:1073960 BRANCH=none TEST=Verified Bloog stays off after waking up from hibernation on AC plug-in. Change-Id: I097bee97164284dd4c35f8bf9389c76319fd676a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2176555 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--include/config.h9
-rw-r--r--power/common.c7
2 files changed, 16 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index e9119374b4..b121148f88 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2112,6 +2112,15 @@
#undef CONFIG_HIBERNATE_WAKEUP_PINS
/*
+ * Boot after waking up from hibernation.
+ *
+ * Note enabling this will allow boards to be charged by PD power but create
+ * the inconsistent behavior between hibernation and S5 (chromium:1073960).
+ * Enable EFS2 to get both PD charging and the consistency.
+ */
+#undef CONFIG_BOOT_ON_HIBERNATE_WAKE
+
+/*
* If defined, chip hibernation is used. Your board needs to define wake-up
* signals. Undefine this to use board hibernation capability.
*/
diff --git a/power/common.c b/power/common.c
index 7c3ccc1475..94f2623487 100644
--- a/power/common.c
+++ b/power/common.c
@@ -343,6 +343,13 @@ static enum power_state power_common_state(enum power_state state)
&target, now)) {
case CRITICAL_SHUTDOWN_HIBERNATE:
CPRINTS("Hibernate due to G3 idle");
+ if (!IS_ENABLED(
+ CONFIG_BOOT_ON_HIBERNATE_WAKE)) {
+ uint32_t reset_flags;
+ reset_flags = chip_read_reset_flags() |
+ EC_RESET_FLAG_AP_OFF;
+ chip_save_reset_flags(reset_flags);
+ }
system_hibernate(0, 0);
break;
#ifdef CONFIG_BATTERY_CUT_OFF