summaryrefslogtreecommitdiff
path: root/include/power.h
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-23 15:04:17 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-07 19:04:25 +0000
commit099a6bc377ac53fe389d35d3a6296a81229df3d8 (patch)
treecf75f35aa70de271600b900b5d2532cd9d487265 /include/power.h
parent530c9c71275ca9f08f1a8c470da380f3aa38bebc (diff)
downloadchrome-ec-099a6bc377ac53fe389d35d3a6296a81229df3d8.tar.gz
power: Move the sleep failure detection to a common library
Move the sleep failure detection logic from intel_x86 power sequence to a common library, i.e. host_sleep. This CL simply moves the code, without any logic change. BRANCH=None BUG=b:162083524 TEST=Build the hatch board. Change-Id: Ia3f70804ded8d80c4a079a36fbf1819c05a2090b Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321874 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'include/power.h')
-rw-r--r--include/power.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/power.h b/include/power.h
index 8801250951..4a267ed8ad 100644
--- a/include/power.h
+++ b/include/power.h
@@ -278,6 +278,67 @@ __override_proto void power_board_handle_host_sleep_event(
*/
#define HOST_SLEEP_EVENT_DEFAULT_RESET 0
+enum sleep_notify_type {
+ SLEEP_NOTIFY_NONE,
+ SLEEP_NOTIFY_SUSPEND,
+ SLEEP_NOTIFY_RESUME,
+};
+
+/**
+ * Set the sleep notify
+ *
+ * It is called in power_chipset_handle_host_sleep_event(), to set the sleep
+ * notify. The sleep notify is assigned based on the host sleep state.
+ *
+ * @param notify The sleep notify to set.
+ */
+void sleep_set_notify(enum sleep_notify_type notify);
+
+/**
+ * Notify the given hook is the sleep notify is matched.
+ *
+ * @param check_state: The sleep notify to check.
+ * @param hook_id: The hook to notify.
+ */
+void sleep_notify_transition(int check_state, int hook_id);
+
+/**
+ * Called during the suspend transition, to increase the transition counter.
+ */
+void sleep_suspend_transition(void);
+
+/**
+ * Called during the resume transition, to increase the transition counter.
+ */
+void sleep_resume_transition(void);
+
+/**
+ * Start the suspend process.
+ *
+ * It is called in power_chipset_handle_host_sleep_event(), after it receives
+ * a host sleep event to hint that the suspend process starts.
+ *
+ * @param ctx Possible sleep parameters and return values, depending on state.
+ * @param callback Will be called if timed out, i.e. suspend hang.
+ */
+void sleep_start_suspend(struct host_sleep_event_context *ctx,
+ void (*callback)(void));
+
+/**
+ * Complete the resume process.
+ *
+ * It is called in power_chipset_handle_host_sleep_event(), after it receives
+ * a host sleep event to hint that the resume process completes.
+ *
+ * @param ctx Possible sleep parameters and return values, depending on state.
+ */
+void sleep_complete_resume(struct host_sleep_event_context *ctx);
+
+/**
+ * Reset the transition counter and timer.
+ */
+void sleep_reset_tracking(void);
+
#ifdef CONFIG_POWER_S0IX
/**
* Reset the sleep state reported by the host.