summaryrefslogtreecommitdiff
path: root/common/vboot
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2020-06-08 22:12:13 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-11 03:19:46 +0000
commit4aacf83506fd959d1341e29b664f6e4fe97824cb (patch)
tree46003fbfc642ca56ef8582fdae5868760c2111e0 /common/vboot
parent0ca41341b9bb80b3e640aaa516a16e2096327515 (diff)
downloadchrome-ec-4aacf83506fd959d1341e29b664f6e4fe97824cb.tar.gz
system: Clear AP_IDLE when waking up from hibernation by AC
Currently, AP_IDLE is set when EC is left idle in G3. This makes the AP stay off after EC wakes up from hibernation (for any wake-up source). This makes a board require another power button press to boot the system from hibernation. This change makes RO clear AP_IDLE unless AC is present. When AC is present, EC doesn't hibernate. So, AC presence infers the EC woke up from hibernation by AC. That is, if the system wakes up by a power button press, AP_IDLE is cleared and AP will be turned on (unless it's overwritten by AP_OFF). Tested as follows on Trembyle: 1. Put DUT in hibernation. 2. Wake up DUT and observe: a. When waking up by power button, AP is turned on. b. When waking up by lid open, AP is turned on. c. When waking up by AC, AP is left idle. BUG=b:157077589, chromium:1073960 BRANCH=none TEST=See above. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ie5020bbe50ad489f4e3010820681cc57ff51b941 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2236589
Diffstat (limited to 'common/vboot')
-rw-r--r--common/vboot/efs2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c
index ae21d21f81..f1976d8e8e 100644
--- a/common/vboot/efs2.c
+++ b/common/vboot/efs2.c
@@ -252,6 +252,18 @@ void vboot_main(void)
return;
}
+ if (IS_ENABLED(CONFIG_HIBERNATE)
+ && IS_ENABLED(CONFIG_EXTPOWER_GPIO)
+ && !gpio_get_level(GPIO_AC_PRESENT)) {
+ /*
+ * EC doesn't hibernate from G3 when AC is present. Thus if AC
+ * is not present here, it implies we woke up by power button or
+ * by lid. Clear AP_IDLE to avoid interfering with the AP boot.
+ */
+ CPRINTS("Clear AP_IDLE, assuming wake-up by PB or LID");
+ system_clear_reset_flags(EC_RESET_FLAG_AP_IDLE);
+ }
+
if (is_manual_recovery() ||
(system_get_reset_flags() & EC_RESET_FLAG_STAY_IN_RO)) {
if (is_manual_recovery())