summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2020-09-29 14:08:36 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-05 08:43:29 +0000
commitcc39b716fbfc35ef51fb558885b58bde42b312c4 (patch)
tree8533d72a55f41794fe8f89a82aece45d84058245
parent0d0c0cbf530f41bc61d8781bc51168b7ee47ddbb (diff)
downloadchrome-ec-cc39b716fbfc35ef51fb558885b58bde42b312c4.tar.gz
power/mt8192: don't boot AP when wake from AC insert
Implement the wakeup behavior defined in our spec: AC insert -> wake EC Lid open / Power button -> wake EC + AP BUG=b:163963220 TEST=Verify boot behavior matches the spec BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ifc225c07d9a9faf25cf99578d535e63f63fc9bff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437238 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--power/mt8192.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/power/mt8192.c b/power/mt8192.c
index 4c0ca97aa7..c1d545fc86 100644
--- a/power/mt8192.c
+++ b/power/mt8192.c
@@ -172,6 +172,8 @@ void chipset_reset(enum chipset_reset_reason reason)
enum power_state power_chipset_init(void)
{
+ int exit_hard_off = 1;
+
/* Enable reboot / sleep control inputs from AP */
gpio_enable_interrupt(GPIO_AP_EC_WARM_RST_REQ);
gpio_enable_interrupt(GPIO_AP_IN_SLEEP_L);
@@ -184,11 +186,17 @@ enum power_state power_chipset_init(void)
return POWER_S0;
}
} else if (system_get_reset_flags() & EC_RESET_FLAG_AP_OFF) {
- /* Force shutdown from S5 if the PMIC is already up. */
- if (power_get_signals() & IN_PGOOD_PMIC) {
- forcing_shutdown = 1;
- return POWER_S5;
- }
+ exit_hard_off = 0;
+ } else if ((system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE) &&
+ gpio_get_level(GPIO_AC_PRESENT)) {
+ /*
+ * If AC present, assume this is a wake-up by AC insert.
+ * Boot EC only.
+ *
+ * Note that extpower module is not initialized at this point,
+ * the only way is to ask GPIO_AC_PRESENT directly.
+ */
+ exit_hard_off = 0;
}
if (battery_is_present() == BP_YES)
@@ -199,13 +207,17 @@ enum power_state power_chipset_init(void)
*/
battery_wait_for_stable();
- if (!(system_get_reset_flags() & EC_RESET_FLAG_AP_OFF))
+ if (exit_hard_off)
/* Auto-power on */
chipset_exit_hard_off();
/* Start from S5 if the PMIC is already up. */
- if (power_get_signals() & IN_PGOOD_PMIC)
+ if (power_get_signals() & IN_PGOOD_PMIC) {
+ /* Force shutdown from S5 if the PMIC is already up. */
+ if (!exit_hard_off)
+ forcing_shutdown = 1;
return POWER_S5;
+ }
return POWER_G3;
}