summaryrefslogtreecommitdiff
path: root/include/power.h
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2020-05-04 11:31:11 +0800
committerCommit Bot <commit-bot@chromium.org>2020-05-08 12:09:15 +0000
commitbf7f4a3e51d50d42375dda84c7e444f967adb055 (patch)
treeae4e4f8e1a978c85b2dd03c84f0eca669f66a358 /include/power.h
parentad5374cd4fa2e377ebe64b296102bc8499bb0b03 (diff)
downloadchrome-ec-bf7f4a3e51d50d42375dda84c7e444f967adb055.tar.gz
power: add power_wait_mask_signals_timeout()
Currently, we can only wait for a signal is presented via power_wait_signals*(). However, we might want to wait a power signal disappeared. power_wait_mask_signals_timeout() does the thing, which can wait until a power signal is disappeared. BRANCH=master BUG=b:150341779 TEST=test with CL:2120114 Change-Id: I0bbc04fcf76e67d7cfe86096a42e3b767a136ef9 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2176820 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'include/power.h')
-rw-r--r--include/power.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/power.h b/include/power.h
index 410f412502..41d7a5585d 100644
--- a/include/power.h
+++ b/include/power.h
@@ -116,7 +116,7 @@ int power_has_signals(uint32_t want);
/**
* Wait for power input signals to be present using default timeout
*
- * @param want Mask of signals which must be present (one or more
+ * @param want Wanted signals which must be present (one or more
* POWER_SIGNAL_MASK()s). If want=0, stops waiting for
* signals.
* @return EC_SUCCESS when all inputs are present, or ERROR_TIMEOUT if timeout
@@ -127,7 +127,7 @@ int power_wait_signals(uint32_t want);
/**
* Wait for power input signals to be present
*
- * @param want Mask of signals which must be present (one or more
+ * @param want Wanted signals which must be present (one or more
* POWER_SIGNAL_MASK()s). If want=0, stops waiting for
* signals.
* @param timeout Timeout in usec to wait for signals to be present.
@@ -137,6 +137,21 @@ int power_wait_signals(uint32_t want);
int power_wait_signals_timeout(uint32_t want, int timeout);
/**
+ * Wait for power input signals to be the desired state.
+ *
+ * @param want Desired signals states. (one or more
+ * POWER_SIGNAL_MASK()s). Signals can be presented or be
+ * disappeared.
+ * @param mask Masked signals that param 'want' cares.
+ * @param timeout Timeout in usec to wait for signals be in the deisred
+ * state.
+ * @return EC_SUCCESS when masked signals = wanted signals, or ERROR_TIMEOUT
+ * if timeout before reaching the desired state.
+ */
+int power_wait_mask_signals_timeout(uint32_t want, uint32_t mask, int timeout);
+
+
+/**
* Set the low-level power chipset state.
*
* @param new_state New chipset state.