summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/vboot/efs2.c12
-rw-r--r--power/common.c5
2 files changed, 15 insertions, 2 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())
diff --git a/power/common.c b/power/common.c
index ea5bad51f8..cc06d0891a 100644
--- a/power/common.c
+++ b/power/common.c
@@ -348,10 +348,11 @@ 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_VBOOT_EFS2)) {
+ if (IS_ENABLED(CONFIG_EXTPOWER_GPIO) &&
+ IS_ENABLED(CONFIG_VBOOT_EFS2)) {
uint32_t reset_flags;
reset_flags = chip_read_reset_flags() |
- EC_RESET_FLAG_AP_OFF;
+ EC_RESET_FLAG_AP_IDLE;
chip_save_reset_flags(reset_flags);
}
system_hibernate(0, 0);