From d75d74f27e526d2b6ac4f3ef972cc744d89c14ab Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Tue, 18 Aug 2020 16:42:28 +0000 Subject: Revert "system: Clear AP_IDLE when waking up from hibernation by AC" This reverts commit 4aacf83506fd959d1341e29b664f6e4fe97824cb. Reason for revert: See chromium:1073960 Original change's description: > 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 > Change-Id: Ie5020bbe50ad489f4e3010820681cc57ff51b941 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2236589 Bug: b:157077589 Bug: chromium:1073960 Change-Id: Id92d0d3657a622338581cb111d3925cbc11bf168 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2363080 Tested-by: Daisuke Nojiri Reviewed-by: Denis Brockus Reviewed-by: Daisuke Nojiri Commit-Queue: Daisuke Nojiri Auto-Submit: Daisuke Nojiri --- common/vboot/efs2.c | 12 ------------ power/common.c | 5 ++--- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c index 963d10a4b2..e608fd5841 100644 --- a/common/vboot/efs2.c +++ b/common/vboot/efs2.c @@ -253,18 +253,6 @@ 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 0cdabca0fa..2dab633ef1 100644 --- a/power/common.c +++ b/power/common.c @@ -440,11 +440,10 @@ 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_EXTPOWER_GPIO) && - IS_ENABLED(CONFIG_VBOOT_EFS2)) { + if (IS_ENABLED(CONFIG_VBOOT_EFS2)) { uint32_t reset_flags; reset_flags = chip_read_reset_flags() | - EC_RESET_FLAG_AP_IDLE; + EC_RESET_FLAG_AP_OFF; chip_save_reset_flags(reset_flags); } system_hibernate(0, 0); -- cgit v1.2.1