summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/boten/gpio.inc1
-rw-r--r--board/drawcia/gpio.inc1
-rw-r--r--board/madoo/gpio.inc1
-rw-r--r--board/magolor/gpio.inc1
-rw-r--r--board/waddledee/gpio.inc1
-rw-r--r--board/waddledoo/gpio.inc1
-rw-r--r--board/wheelie/gpio.inc1
-rw-r--r--common/vboot/efs2.c12
-rw-r--r--power/common.c25
9 files changed, 20 insertions, 24 deletions
diff --git a/board/boten/gpio.inc b/board/boten/gpio.inc
index 8ce426b2ab..b73f53c091 100644
--- a/board/boten/gpio.inc
+++ b/board/boten/gpio.inc
@@ -62,6 +62,7 @@ GPIO(ALL_SYS_PWRGD, PIN(B, 7), GPIO_OUT_LOW)
GPIO(EN_SLP_Z, PIN(K, 3), GPIO_OUT_LOW)
/* Required for icelake chipset code, but implemented through other means for dedede */
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/drawcia/gpio.inc b/board/drawcia/gpio.inc
index 0f80d6443c..4c709c72c3 100644
--- a/board/drawcia/gpio.inc
+++ b/board/drawcia/gpio.inc
@@ -63,6 +63,7 @@ GPIO(ALL_SYS_PWRGD, PIN(B, 7), GPIO_OUT_LOW)
GPIO(EN_SLP_Z, PIN(K, 3), GPIO_OUT_LOW)
/* Required for icelake chipset code, but implemented through other means for dedede */
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/madoo/gpio.inc b/board/madoo/gpio.inc
index 0e0f5c216e..4f75cfe4a0 100644
--- a/board/madoo/gpio.inc
+++ b/board/madoo/gpio.inc
@@ -96,6 +96,7 @@ GPIO(EC_BATTERY_PRES_ODL, PIN(E, 1), GPIO_INPUT)
* Waddledoo doesn't have these physical pins coming to the EC but uses other
* logic.
*/
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/magolor/gpio.inc b/board/magolor/gpio.inc
index 1da5624b0a..2358addc21 100644
--- a/board/magolor/gpio.inc
+++ b/board/magolor/gpio.inc
@@ -96,6 +96,7 @@ GPIO(EC_BATTERY_PRES_ODL, PIN(E, 1), GPIO_INPUT)
* Waddledoo doesn't have these physical pins coming to the EC but uses other
* logic.
*/
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/waddledee/gpio.inc b/board/waddledee/gpio.inc
index 63e1843d00..612e3f0f5d 100644
--- a/board/waddledee/gpio.inc
+++ b/board/waddledee/gpio.inc
@@ -64,6 +64,7 @@ GPIO(ALL_SYS_PWRGD, PIN(B, 7), GPIO_OUT_LOW)
GPIO(EN_SLP_Z, PIN(K, 3), GPIO_OUT_LOW)
/* Required for icelake chipset code, but implemented through other means for dedede */
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/waddledoo/gpio.inc b/board/waddledoo/gpio.inc
index 0e0f5c216e..4f75cfe4a0 100644
--- a/board/waddledoo/gpio.inc
+++ b/board/waddledoo/gpio.inc
@@ -96,6 +96,7 @@ GPIO(EC_BATTERY_PRES_ODL, PIN(E, 1), GPIO_INPUT)
* Waddledoo doesn't have these physical pins coming to the EC but uses other
* logic.
*/
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/board/wheelie/gpio.inc b/board/wheelie/gpio.inc
index abd18ecbe3..80f6a63a64 100644
--- a/board/wheelie/gpio.inc
+++ b/board/wheelie/gpio.inc
@@ -64,6 +64,7 @@ GPIO(ALL_SYS_PWRGD, PIN(B, 7), GPIO_OUT_LOW)
GPIO(EN_SLP_Z, PIN(K, 3), GPIO_OUT_LOW)
/* Required for icelake chipset code, but implemented through other means for dedede */
+UNIMPLEMENTED(AC_PRESENT)
UNIMPLEMENTED(PG_EC_DSW_PWROK)
UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c
index e608fd5841..963d10a4b2 100644
--- a/common/vboot/efs2.c
+++ b/common/vboot/efs2.c
@@ -253,6 +253,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 (system_is_manual_recovery() ||
(system_get_reset_flags() & EC_RESET_FLAG_STAY_IN_RO)) {
if (system_is_manual_recovery())
diff --git a/power/common.c b/power/common.c
index 6dc0ebc666..0cdabca0fa 100644
--- a/power/common.c
+++ b/power/common.c
@@ -440,13 +440,7 @@ static enum power_state power_common_state(enum power_state state)
&target, now)) {
case CRITICAL_SHUTDOWN_HIBERNATE:
CPRINTS("Hibernate due to G3 idle");
- /*
- * Set AP_IDLE when hibernating so that AC plug
- * won't boot the system. If EFS2 isn't enabled,
- * we need to boot the AP to get PD power though
- * it's inconsistent with the S5 behavior.
- */
- if (IS_ENABLED(CONFIG_EXTPOWER) &&
+ if (IS_ENABLED(CONFIG_EXTPOWER_GPIO) &&
IS_ENABLED(CONFIG_VBOOT_EFS2)) {
uint32_t reset_flags;
reset_flags = chip_read_reset_flags() |
@@ -737,23 +731,6 @@ static void power_ac_change(void)
DECLARE_HOOK(HOOK_AC_CHANGE, power_ac_change, HOOK_PRIO_DEFAULT);
#endif
-#if defined(CONFIG_EXTPOWER) && defined(CONFIG_HIBERNATE) \
- && defined(CONFIG_VBOOT_EFS2)
-static void power_init_ap_idle(void)
-{
- if (extpower_is_present())
- return;
- /*
- * EC doesn't hibernate from G3 when AC is present. Thus if AC is not
- * present here, it implies we woke up by the power button or by the
- * lid. Clear AP_IDLE to avoid interfering with the boot.
- */
- CPRINTS("Clear AP_IDLE, assuming wake-up by PB or LID");
- system_clear_reset_flags(EC_RESET_FLAG_AP_IDLE);
-}
-DECLARE_HOOK(HOOK_INIT, power_init_ap_idle, HOOK_PRIO_INIT_EXTPOWER + 1);
-#endif
-
/*****************************************************************************/
/* Interrupts */