summaryrefslogtreecommitdiff
path: root/include/power.h
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2019-03-01 13:09:08 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-28 19:04:16 -0700
commit49b8070623ee1cecac387488ce668a4a11403653 (patch)
treebf4cc3078a496e7a9c8aa14c902be79cd3897c69 /include/power.h
parenta029c7a27f3bd1a1066db9c167c6166688fe4ef3 (diff)
downloadchrome-ec-49b8070623ee1cecac387488ce668a4a11403653.tar.gz
power/intel_x86: Introduce s0ix failure detection
This change introduces logic in the EC that can detect if the host attempted to go into S0ix, but never made it. The host already sends commands indicating its intent to enter S0ix, and the EC has a SLP_S0 line that gets asserted by the AP when it actually enters S0ix. All that's needed to monitor failures is to arm a timer when receiving the S0ix suspend message. If the SLP_S0 pin goes low, then the suspend occurred and the timer is canceled. If the timer expires before SLP_S0 goes low, then the EC wakes the AP up, since it has entered a shallower idle state than intended, and should be alerted to avoid short battery life. The timer is also started when SLP_S0 is deasserted on resume. The SoC comes out of S0ix to perform housekeeping activities unbeknownst to Linux. In cases where housekeeping fails to suspend all the way back down, this timer will wake the AP. Additionally, the number of S0ix transitions is reported on resume. This enabled the AP to analyze the amount of "sleepwalking" that is done, and can complain if it seems to be waking up too often. Design doc at: https://docs.google.com/document/d/1mY-v02KAuOyET3td9s5GnxeUgMiAcD058oLEo57DZpY/edit BUG=b:123716513 BRANCH=None TEST=Test S0ix on hatch with modified code that forces a timeout, use ectool to send messages manually before and after timeout, Hack Linux to fail suspend very late to verify no regressions. Signed-off-by: Evan Green <evgreen@chromium.org> Change-Id: Ia64b496675a13dbed4ef74637f51e39eee68aa1a Reviewed-on: https://chromium-review.googlesource.com/1501512 Commit-Ready: Evan Green <evgreen@chromium.org> Tested-by: Evan Green <evgreen@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Diffstat (limited to 'include/power.h')
-rw-r--r--include/power.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/power.h b/include/power.h
index 3bf598b182..2c57209e84 100644
--- a/include/power.h
+++ b/include/power.h
@@ -192,12 +192,28 @@ void power_set_pause_in_s5(int pause);
enum host_sleep_event power_get_host_sleep_state(void);
/**
+ * Set sleep state of host.
+ *
+ * @param state The new state to set.
+ */
+void power_set_host_sleep_state(enum host_sleep_event state);
+
+/* Context to pass to a host sleep command handler. */
+struct host_sleep_event_context {
+ uint32_t sleep_transitions; /* Number of sleep transitions observed */
+ uint16_t sleep_timeout_ms; /* Timeout in milliseconds */
+};
+
+/**
* Provide callback to allow chipset to take any action on host sleep event
* command.
*
* @param state Current host sleep state updated by the host.
+ * @param ctx Possible sleep parameters and return values, depending on state.
*/
-void power_chipset_handle_host_sleep_event(enum host_sleep_event state);
+void
+power_chipset_handle_host_sleep_event(enum host_sleep_event state,
+ struct host_sleep_event_context *ctx);
/**
* Provide callback to allow board to take any action on host sleep event