diff options
Diffstat (limited to 'include/usb_pd_tcpm.h')
-rw-r--r-- | include/usb_pd_tcpm.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 9a4140afb4..97b0ec0864 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -50,11 +50,46 @@ enum tcpc_rp_value { }; enum tcpc_cc_polarity { + /* + * _NONE: either disconnected or connected to a SNK Debug + * Accessory + */ POLARITY_NONE = -1, + + /* + * _CCx: is used to indicate the polarity while not connected to + * a Debug Accessory. Only one CC line will assert a resistor and + * the other will be open. + */ POLARITY_CC1 = 0, POLARITY_CC2 = 1, + + /* + * CCx_DTS is used to indicate the polarity while connected to a + * SRC Debug Accessory. Assert resistors on both lines. + */ + POLARITY_CC1_DTS = 2, + POLARITY_CC2_DTS = 3, + + /* + * The current TCPC code relies on these specific POLARITY values. + * Adding in a check to verify if the list grows for any reason + * that this will give a hint that other places need to be + * adjusted. + */ + POLARITY_COUNT }; +/** + * Returns whether the polarity without the DTS extension + */ +static inline enum tcpc_cc_polarity polarity_rm_dts( + enum tcpc_cc_polarity polarity) +{ + BUILD_ASSERT(POLARITY_COUNT == 4); + return (polarity == POLARITY_NONE) ? polarity : polarity & BIT(0); +} + enum tcpm_transmit_type { TCPC_TX_SOP = 0, TCPC_TX_SOP_PRIME = 1, @@ -104,6 +139,15 @@ static inline int cc_is_snk_dbg_acc(enum tcpc_cc_voltage_status cc1, } /** + * Returns true if we detect the port partner is a src debug accessory. + */ +static inline int cc_is_src_dbg_acc(enum tcpc_cc_voltage_status cc1, + enum tcpc_cc_voltage_status cc2) +{ + return cc_is_rp(cc1) && cc_is_rp(cc2); +} + +/** * Returns true if the port partner is an audio accessory. */ static inline int cc_is_audio_acc(enum tcpc_cc_voltage_status cc1, |