diff options
author | Jett Rink <jettrink@chromium.org> | 2019-09-25 11:28:51 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-02 23:46:31 +0000 |
commit | bec03d91bc9f954682c02d122a0500d10cc102c2 (patch) | |
tree | 2b44756ee2847e039a38122d38ff0ddb70f98b70 /include | |
parent | ad64a080363380e7b34d4c395867a55b83e61c1c (diff) | |
download | chrome-ec-bec03d91bc9f954682c02d122a0500d10cc102c2.tar.gz |
usbc: remove unnecessary tcpc CC reads
We only need to read the CC pins when the CC evt is fired otherwise the
CC pins should have the same value. It is actually incorrect/undesirable
that our old PD stack queried the tpcp cc driver over i2c so frequently
for the CC pins status.
Also single source code that interprets the CC lines values into a UFP
or DFP state.
Lastly, remove extraneous timers for cc debouncing, we only need one.
BRANCH=none
BUG=none
TEST=builds
Change-Id: I65baa2e6fb92d7ab5ca12daa76225cd13b9ab974
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825504
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/usb_pd.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h index 70b37f19ef..cf18a325d1 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -9,6 +9,7 @@ #define __CROS_EC_USB_PD_H #include "common.h" +#include "usb_pd_tcpm.h" /* PD Host command timeout */ #define PD_HOST_COMMAND_TIMEOUT_US SECOND @@ -1106,9 +1107,6 @@ enum pd_states { #define PD_BBRMFLG_DATA_ROLE BIT(2) #define PD_BBRMFLG_VCONN_ROLE BIT(3) -/* Initial value for CC debounce variable */ -#define PD_CC_UNSET -1 - #ifdef CONFIG_USB_PD_DUAL_ROLE enum pd_dual_role_states { /* While disconnected, toggle between src and sink */ @@ -2261,6 +2259,13 @@ int pd_is_debug_acc(int port); */ void pd_notify_dp_alt_mode_entry(void); +/* + * Determines the PD state of the port partner according to Table 4-10 in USB PD + * specification. + */ +enum pd_cc_states pd_get_cc_state( + enum tcpc_cc_voltage_status cc1, enum tcpc_cc_voltage_status cc2); + /* ----- Logging ----- */ #ifdef CONFIG_USB_PD_LOGGING /** |