From 8fd62bab5711a126e50559e3133e053c0130e764 Mon Sep 17 00:00:00 2001 From: Eric Yilun Lin Date: Wed, 15 Mar 2023 15:32:15 +0800 Subject: mt8186,mt8188: skip forcing shutdown if AP is off If the AP is off, we should stop calling chipset_force_shutdown() from re-doing shutdown. BUG=b:273657181 TEST=In S0, dut-control power_key:8.2, the chipset_force_shutdown is not called BRANCH=none Change-Id: I4413f984465f10d0f4b588cd6d80ead8464778bc Signed-off-by: Eric Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338759 Reviewed-by: Ting Shen Tested-by: Eric Yilun Lin Commit-Queue: Eric Yilun Lin Auto-Submit: Eric Yilun Lin --- power/mt8186.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'power') diff --git a/power/mt8186.c b/power/mt8186.c index 0653c70ba0..9acb27dfa2 100644 --- a/power/mt8186.c +++ b/power/mt8186.c @@ -159,7 +159,13 @@ void chipset_watchdog_interrupt(enum gpio_signal signal) void chipset_force_shutdown(enum chipset_shutdown_reason reason) { - CPRINTS("%s: 0x%x", __func__, reason); + bool chipset_off = chipset_in_state(CHIPSET_STATE_ANY_OFF); + + CPRINTS("%s: 0x%x%s", __func__, reason, chipset_off ? "(skipped)" : ""); + + if (chipset_off) + return; + report_ap_reset(reason); is_shutdown = true; @@ -424,6 +430,11 @@ enum power_state power_handle_state(enum power_state state) return POWER_S3; case POWER_S3S5: + /* Stop the power key shutdown deferred in case the power key + * is still pressed. + */ + hook_call_deferred(&chipset_force_shutdown_button_data, -1); + power_signal_disable_interrupt(GPIO_AP_IN_SLEEP_L); power_signal_disable_interrupt(GPIO_AP_EC_WDTRST_L); power_signal_disable_interrupt(GPIO_AP_EC_WARM_RST_REQ); -- cgit v1.2.1