summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--power/rockchip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/power/rockchip.c b/power/rockchip.c
index 1a5c6c656a..25d1addb71 100644
--- a/power/rockchip.c
+++ b/power/rockchip.c
@@ -415,6 +415,8 @@ static int wait_for_power_button_release(unsigned int timeout_us)
*/
static void power_off(void)
{
+ unsigned int power_off_timeout = 100; /* ms */
+
/* Call hooks before we drop power rails */
hook_notify(HOOK_CHIPSET_SHUTDOWN);
/* switch off all rails */
@@ -423,6 +425,13 @@ static void power_off(void)
gpio_set_flags(GPIO_SUSPEND_L, GPIO_INPUT);
gpio_set_flags(GPIO_EC_INT, GPIO_INPUT);
+ /* Wait till we actually turn off to not mess up the state machine. */
+ while (power_get_signals() & IN_POWER_GOOD) {
+ msleep(1);
+ power_off_timeout--;
+ ASSERT(power_off_timeout);
+ }
+
lid_opened = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
powerled_set_state(POWERLED_STATE_OFF);