summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorxiong.huang <xiong.huang@bitland.corp-partner.google.com>2020-02-11 19:12:43 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-12 18:02:05 +0000
commitde22373b50ee01a77de5921564bb5bdc0d8c1e17 (patch)
tree714e6dc70e7e0a5fb9ba1c129a7f9bfdedfc56a7 /power
parent65bf4e879f39229ddd69c7a993f95909dbf3f1d0 (diff)
downloadchrome-ec-de22373b50ee01a77de5921564bb5bdc0d8c1e17.tar.gz
Kodama: delay to boot system until the smart battery is ready
With the adapter to activate the smart battery which is shutdown mode, will enable PMIC during activation and have heavy loading, which will prevent the system from powering on. Delay to boot system until the smart battry is ready. BUG=b:148045048 TEST=1) When battery is cutoff mode or shutdown mode, DUT will 4 second to boot, which activated with the adapter. And the return value of system_get_reset_flags() is 0x02. 2) Power off the DUT with click the UI icon 'Shut down' or long press the power button. And the return value of system_get_reset_flags() is 0x802. Both test 1 and 2 can boot DUT. BRANCH=kukui Change-Id: Icb4ed75dbca13fef4c44e5386b7b957a12970557 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2049929 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/mt8183.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index b7ef591932..08789f09f2 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -108,6 +108,7 @@ static const struct power_seq_op s3s5_power_seq[] = {
};
static int forcing_shutdown;
+static int boot_from_cutoff;
void chipset_reset_request_interrupt(enum gpio_signal signal)
{
@@ -201,6 +202,9 @@ enum power_state power_chipset_init(void)
} else {
/* Auto-power on */
chipset_exit_hard_off();
+
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN)
+ boot_from_cutoff = 1;
}
/* Start from S5 if the PMIC is already up. */
@@ -280,6 +284,8 @@ enum power_state power_handle_state(enum power_state state)
break;
case POWER_S5:
+ boot_from_cutoff = 0;
+
/*
* If AP initiated shutdown, PMIC is off, and we can transition
* to G3 immediately.
@@ -330,6 +336,25 @@ enum power_state power_handle_state(enum power_state state)
case POWER_G3S5:
forcing_shutdown = 0;
+#ifdef CONFIG_BATTERY_SMART
+ /*
+ * b:148045048: With the adapter to activate the smart battery
+ * which is shutdown mode, will enable PMIC during activation
+ * and have heavy loading, which will prevent the system from
+ * powering on. Delay to boot system until the smart battry
+ * is ready.
+ */
+ if (battery_hw_present() && boot_from_cutoff) {
+ static int total_sleep_ms;
+
+ if (total_sleep_ms < 4000) {
+ msleep(10);
+ total_sleep_ms += 10;
+ return POWER_G3S5;
+ }
+ }
+#endif
+
#if CONFIG_CHIPSET_POWER_SEQ_VERSION == 1
hook_call_deferred(&deassert_en_pp1800_s5_l_data, -1);
#endif