diff options
-rw-r--r-- | common/power_button_x86.c | 14 | ||||
-rw-r--r-- | include/chipset.h | 7 | ||||
-rw-r--r-- | power/qcom.c | 8 |
3 files changed, 26 insertions, 3 deletions
diff --git a/common/power_button_x86.c b/common/power_button_x86.c index ba972ca876..fd24f7a75b 100644 --- a/common/power_button_x86.c +++ b/common/power_button_x86.c @@ -459,6 +459,14 @@ static void powerbtn_x86_init(void) } DECLARE_HOOK(HOOK_INIT, powerbtn_x86_init, HOOK_PRIO_DEFAULT); +void chipset_power_on(void) +{ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF) && + pwrbtn_state != PWRBTN_STATE_INIT_ON) { + power_button_pch_pulse(); + } +} + #ifdef CONFIG_LID_SWITCH /** * Handle switch changes based on lid event. @@ -466,9 +474,9 @@ DECLARE_HOOK(HOOK_INIT, powerbtn_x86_init, HOOK_PRIO_DEFAULT); static void powerbtn_x86_lid_change(void) { /* If chipset is off, pulse the power button on lid open to wake it. */ - if (lid_is_open() && chipset_in_state(CHIPSET_STATE_ANY_OFF) - && pwrbtn_state != PWRBTN_STATE_INIT_ON) - power_button_pch_pulse(); + if (lid_is_open()) { + chipset_power_on(); + } } DECLARE_HOOK(HOOK_LID_CHANGE, powerbtn_x86_lid_change, HOOK_PRIO_DEFAULT); #endif diff --git a/include/chipset.h b/include/chipset.h index 48c65374a2..51a9018dfb 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -94,6 +94,13 @@ void chipset_throttle_cpu(int throttle); void chipset_force_shutdown(enum chipset_shutdown_reason reason); /** + * Attempt to power on the chipset if it's in S4/S5/G3. + * + * This does nothing if in S3/S0ix/S0. + */ +void chipset_power_on(void); + +/** * Reset the CPU and/or chipset. */ void chipset_reset(enum chipset_shutdown_reason reason); diff --git a/power/qcom.c b/power/qcom.c index d931e6bb29..107bdcb04d 100644 --- a/power/qcom.c +++ b/power/qcom.c @@ -824,6 +824,14 @@ void chipset_force_shutdown(enum chipset_shutdown_reason reason) task_wake(TASK_ID_CHIPSET); } +void chipset_power_on(void) +{ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) { + power_request = POWER_REQ_ON; + task_wake(TASK_ID_CHIPSET); + } +} + /** * Warm reset the AP * |