From b7288876ac2500d50a49d925833382be6f1eb5fc Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Thu, 4 Oct 2018 12:37:33 -0600 Subject: usb-pd: allow a task to prevent TCPC LPM If a particularly low priority task (like hooks) wants to access the TCPC, then we do not want the LPM debounce to trigger in the middle of the communication sequence. This is especially a concern if the TCPC access is on debug registers that do not push out the LPM debounce deadline. BRANCH=none BUG=b:111406013 TEST=TCPC communication on meep is much more reliable with this change. TCPC will still go into low power mode after all tasks stop preventing LPM. Change-Id: I58cee8e202ced4085f131ff86dbda9d366e1dcca Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1262107 Reviewed-by: Jonathan Brandmeyer --- include/usb_pd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/usb_pd.h b/include/usb_pd.h index c5f6799a26..929b6d43ab 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -1045,6 +1045,18 @@ int pd_is_max_request_allowed(void); */ void pd_device_accessed(int port); +/** + * Prevents the TCPC from going back into low power mode. Invocations must be + * called in a pair from the same task, otherwise the TCPC will never re-enter + * low power mode. + * + * Note: This will not wake the device up if it is in LPM. + * + * @param port USB-C port number + * @param prevent 1 to prevent this port from entering LPM + */ +void pd_prevent_low_power_mode(int port, int prevent); + /** * Returns true if this TCPC is in low power mode and a failed i2c transaction * should be retried after waiting for the device to wake up via -- cgit v1.2.1