summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--power/mt8183.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index 1bbd06a05f..313116e5b3 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -273,6 +273,7 @@ enum power_state power_handle_state(enum power_state state)
* transition to S5, G3.
*/
static int ap_shutdown;
+ uint16_t tries = 0;
switch (state) {
case POWER_G3:
@@ -359,6 +360,24 @@ enum power_state power_handle_state(enum power_state state)
}
#endif
+ /*
+ * Allow time for charger to be initialized, in case we're
+ * trying to boot the AP with no battery.
+ */
+ while (charge_prevent_power_on(0) &&
+ tries++ < CHARGER_INITIALIZED_TRIES) {
+ msleep(CHARGER_INITIALIZED_DELAY_MS);
+ }
+
+ /* Return to G3 if battery level is too low. */
+ if (charge_want_shutdown() ||
+ tries > CHARGER_INITIALIZED_TRIES) {
+ CPRINTS("power-up inhibited");
+ chipset_force_shutdown(
+ CHIPSET_SHUTDOWN_BATTERY_INHIBIT);
+ return POWER_G3;
+ }
+
#if CONFIG_CHIPSET_POWER_SEQ_VERSION == 1
hook_call_deferred(&deassert_en_pp1800_s5_l_data, -1);
#endif