From 5056315df012ebfcd2531ec4b804918fbc768213 Mon Sep 17 00:00:00 2001 From: Eric Yilun Lin Date: Fri, 31 Mar 2023 10:21:50 +0800 Subject: mt8186,mt8188: fix chipset_force_shutdown before power_chipset_init The power state is not reflect the actual power state before the power_chipset_init. When a chipset_force_shutdown is called before the task inited, the power state API will not reflect the actual state. This CL fix that by querying the signal state instead. BUG=b:276229973 TEST=pass firmware_CorruptMinios.minios_b BRANCH=none Change-Id: I0e48d9745039c6de460fd5579486fe5f3e74cda8 Signed-off-by: Eric Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387196 Reviewed-by: Ting Shen Tested-by: Eric Yilun Lin Commit-Queue: Eric Yilun Lin --- power/mt8186.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/power/mt8186.c b/power/mt8186.c index ad0f189510..297d86c317 100644 --- a/power/mt8186.c +++ b/power/mt8186.c @@ -90,6 +90,9 @@ static bool is_s5g3_passed; */ static bool is_exiting_off; +/* forward declaration */ +static enum power_state power_get_signal_state(void); + /* Turn on the PMIC power source to AP, this also boots AP. */ static void set_pmic_pwron(void) { @@ -159,7 +162,12 @@ void chipset_watchdog_interrupt(enum gpio_signal signal) void chipset_force_shutdown(enum chipset_shutdown_reason reason) { - bool chipset_off = chipset_in_state(CHIPSET_STATE_ANY_OFF); + int state = power_get_signal_state(); + /* use the signal state instead of the chipset_in_state because the + * power_state is not initaialized when chipset_force_shutdown is called + * from power_chipset_init. + */ + bool chipset_off = (state != POWER_S0 && state != POWER_S3); CPRINTS("%s: 0x%x%s", __func__, reason, chipset_off ? "(skipped)" : ""); -- cgit v1.2.1