diff options
author | Wai-Hong Tam <waihong@google.com> | 2022-02-15 11:47:18 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-16 01:55:59 +0000 |
commit | 43a3de42c65c469b4f1bf1bca93274943ed4d0c8 (patch) | |
tree | 4edd5cd3ef8932142b5b885930e6fe0ea6e4cc25 | |
parent | 0f02290de91879b7cd9f50abcdf8e6357c21e45b (diff) | |
download | chrome-ec-43a3de42c65c469b4f1bf1bca93274943ed4d0c8.tar.gz |
qcom: Catch the unexpected case that POWER_GOOD up again after lost
When the POWER_GOOD was lost, it sets the shutdown_from_on flag. We
don't expect the POWER_GOOD up again. However, a hardware bug makes
this happen. Catch this unexpected case and go straight to turn off
the switchcap.
BRANCH=None
BUG=b:218878427
TEST=Typed "shutdown -P now" in userspace. Saw the EC warning message:
[41.599700 Warning: POWER_GOOD up again after lost]
Change-Id: Ieadffd5347f46070336cc608af2ed3cbc20c612c
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3466417
Reviewed-by: Alexandru Stan <amstan@chromium.org>
Commit-Queue: Alexandru Stan <amstan@chromium.org>
-rw-r--r-- | power/qcom.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/power/qcom.c b/power/qcom.c index edb3230490..127dbbf6cc 100644 --- a/power/qcom.c +++ b/power/qcom.c @@ -612,15 +612,27 @@ enum power_state power_chipset_init(void) /** * Power off the AP + * + * @param shutdown_event reason of shutdown, which is a return value of + * check_for_power_off_event() */ -static void power_off_seq(void) +static void power_off_seq(uint8_t shutdown_event) { /* Check PMIC POWER_GOOD */ if (is_pmic_pwron()) { - /* Do a graceful way to shutdown PMIC/AP first */ - set_pmic_pwron(0); - usleep(PMIC_POWER_OFF_DELAY); - + if (shutdown_event == POWER_OFF_BY_POWER_GOOD_LOST) { + /* + * The POWER_GOOD was lost previously, which sets the + * shutdown_event flag. But now it is up again. This + * is unexpected. Show the warning message. Then go + * straight to turn off the switchcap. + */ + CPRINTS("Warning: POWER_GOOD up again after lost"); + } else { + /* Do a graceful way to shutdown PMIC/AP first */ + set_pmic_pwron(0); + usleep(PMIC_POWER_OFF_DELAY); + } } /* @@ -1023,7 +1035,7 @@ enum power_state power_handle_state(enum power_state state) hook_notify(HOOK_CHIPSET_PRE_INIT); if (power_on_seq() != EC_SUCCESS) { - power_off_seq(); + power_off_seq(shutdown_from_on); boot_from_off = 0; return POWER_S5; } @@ -1134,7 +1146,7 @@ enum power_state power_handle_state(enum power_state state) /* Call hooks before we drop power rails */ hook_notify(HOOK_CHIPSET_SHUTDOWN); - power_off_seq(); + power_off_seq(shutdown_from_on); CPRINTS("power shutdown complete"); /* Call hooks after we drop power rails */ |