summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2023-03-31 10:21:50 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-06 09:30:27 +0000
commit5056315df012ebfcd2531ec4b804918fbc768213 (patch)
tree3313d28af881321dccf372abf53bd159a745c0db
parent83e5835dd464cac67a8e15ebfaf12a384941358f (diff)
downloadchrome-ec-5056315df012ebfcd2531ec4b804918fbc768213.tar.gz
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 <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387196 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
-rw-r--r--power/mt8186.c10
1 files changed, 9 insertions, 1 deletions
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)" : "");