summaryrefslogtreecommitdiff
path: root/common/power_button_x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/power_button_x86.c')
-rw-r--r--common/power_button_x86.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index 2d353b74ed..e37fb6f81f 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -397,3 +397,17 @@ static void powerbtn_x86_changed(void)
task_wake(TASK_ID_POWERBTN);
}
DECLARE_HOOK(HOOK_POWER_BUTTON_CHANGE, powerbtn_x86_changed, HOOK_PRIO_DEFAULT);
+
+/**
+ * Handle charge state changes
+ */
+static void powerbtn_x86_charge(void)
+{
+ /*
+ * If we were waiting for the charge state machine to init before we
+ * powered on the chipset, we can stop waiting.
+ */
+ if (pwrbtn_state == PWRBTN_STATE_INIT_ON)
+ task_wake(TASK_ID_POWERBTN);
+}
+DECLARE_HOOK(HOOK_CHARGE_STATE_CHANGE, powerbtn_x86_charge, HOOK_PRIO_DEFAULT);