From 9b03aa4e66c18f9e37460a9cbe0eb16a3c20a9f7 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Thu, 13 Dec 2018 07:12:00 -0700 Subject: tcpc: wait for TCPC wake up upon first access Previously we tried to perform i2c communication with the TCPC when it was in low power mode and only if the i2c transaction failed did we wait for the device to wake up. Now that the PS8751 will respond to i2c transaction (ACK them) when it is in LPM, ensure the init happers before we start talking to the device to handle an interrupt. BRANCH=none BUG=b:118063849,b:121109893 TEST=verify that plug and unplug for PS8751, ANX3429, and ANX3447 LPM still works. Change-Id: I8c18195e55ee6d04af7d4ff24230a3bd2d147d53 Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1375102 Commit-Ready: ChromeOS CL Exonerator Bot Reviewed-by: Daisuke Nojiri Reviewed-by: Edward Hill Reviewed-on: https://chromium-review.googlesource.com/c/1383318 --- include/usb_pd.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'include/usb_pd.h') diff --git a/include/usb_pd.h b/include/usb_pd.h index 1927add067..7865f15d44 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -1038,6 +1038,15 @@ int pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, */ int pd_is_max_request_allowed(void); +/** + * Waits for the TCPC to exit low power mode (including re-initializing) if it + * is currently in low power mode. If not, then the function immediately + * returns. + * + * @param port USB-C port number + */ +void pd_wait_exit_low_power(int port); + /** * Informs the TCPM state machine that code within the EC has accessed the TCPC * via its communication bus (e.g. i2c). This is important to keep track of as @@ -1061,24 +1070,6 @@ void pd_device_accessed(int port); */ 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 - * pd_wait_for_wakeup() - * - * @param port USB-C port number - * @return True if device is in LPM and i2c transaction should be retried - */ -int pd_device_in_low_power(int port); - -/** - * Requests that the PD task wakeup the TCPC out of low power mode properly, and - * waits for the wakeup operation to complete. - * - * @param port USB-C port number - */ -void pd_wait_for_wakeup(int port); - /** * Process source capabilities packet * -- cgit v1.2.1