summaryrefslogtreecommitdiff
path: root/power/common.c
diff options
context:
space:
mode:
authorArchana Patni <archana.patni@intel.com>2016-11-08 12:45:40 +0530
committerchrome-bot <chrome-bot@chromium.org>2016-11-17 16:09:44 -0800
commitb8406119c2c51acc46c551ef0930c51153657613 (patch)
tree7db348bfbc3affa88c6d452f70e7f349674ac642 /power/common.c
parent82aaccad4022737ba4c21cbeb119d73e51dff5f1 (diff)
downloadchrome-ec-b8406119c2c51acc46c551ef0930c51153657613.tar.gz
Apollolake: Enter/exit from S0ix based on host commands from kernel
This patch changes the entry/exit model for S0ix from a PCH SLP_S0 signal based model to a hybrid host event/direct interrupt model. The kernel will send host events on kernel freeze/thaw exit; EC will initiate the S0ix entry based on host command and exit via another host command from kernel. The assertion of SLP_S0 comes later than HC(suspend) and deasserion of SLP_S0 comes earlier than HC(resume). ________ ________ SLP_S0 |______________________| _____ ________ HC |___________________________| BRANCH=none BUG=chrome-os-partner:58740 TEST=Build/flash EC and check 'echo freeze > /sys/power/state' command in OS shell. Verify idle state transitions during display off and periodic wakes from S0ix do not lead to state transitions in EC. Change-Id: Ie18c6c2ac8998f59141641567d1d740cd72c2d2e Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com> Signed-off-by: Archana Patni <archana.patni@intel.com> Reviewed-on: https://chromium-review.googlesource.com/401072 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'power/common.c')
-rw-r--r--power/common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/power/common.c b/power/common.c
index 832e1cc251..c9f58e92db 100644
--- a/power/common.c
+++ b/power/common.c
@@ -735,6 +735,23 @@ static int host_command_host_sleep_event(struct host_cmd_handler_args *args)
const struct ec_params_host_sleep_event *p = args->params;
host_sleep_state = p->sleep_event;
+
+#ifdef CONFIG_POWER_S0IX
+ if (p->sleep_event == HOST_SLEEP_EVENT_S0IX_SUSPEND) {
+ CPRINTS("S0ix sus evt");
+ task_wake(TASK_ID_CHIPSET);
+ } else if (p->sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME) {
+ CPRINTS("S0ix res evt");
+ /*
+ * For all scenarios where lid is not open
+ * this will be trigerred when other wake
+ * sources like keyboard, trackpad are used.
+ */
+ if (!chipset_in_state(CHIPSET_STATE_ON))
+ task_wake(TASK_ID_CHIPSET);
+ }
+#endif /* CONFIG_POWER_S0IX */
+
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_HOST_SLEEP_EVENT,
@@ -745,4 +762,12 @@ enum host_sleep_event power_get_host_sleep_state(void)
{
return host_sleep_state;
}
+
+#ifdef CONFIG_POWER_S0IX
+void power_reset_host_sleep_state(enum host_sleep_event sleep_event)
+{
+ host_sleep_state = sleep_event;
+}
+#endif /* CONFIG_POWER_S0IX */
+
#endif /* CONFIG_POWER_TRACK_HOST_SLEEP_STATE */