diff options
-rw-r--r-- | common/usb_pd_protocol.c | 22 | ||||
-rw-r--r-- | common/usb_pd_tcpc.c | 6 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.c | 6 | ||||
-rw-r--r-- | driver/tcpm/fusb302.c | 6 | ||||
-rw-r--r-- | driver/tcpm/it83xx.c | 6 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 13 |
6 files changed, 31 insertions, 28 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index c5ab8ca9a2..d5937eaa29 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -767,8 +767,8 @@ static int pd_transmit(int port, enum tcpm_transmit_type type, int cc2; tcpm_get_cc(port, &cc1, &cc2); - if (cc1 == TYPEC_CC_VOLT_SNK_1_5 || - cc2 == TYPEC_CC_VOLT_SNK_1_5) { + if (cc1 == TYPEC_CC_VOLT_RP_1_5 || + cc2 == TYPEC_CC_VOLT_RP_1_5) { /* Sink can't transmit now. */ /* Check if message is already buffered. */ if (pd[port].ca_buffered) @@ -821,8 +821,8 @@ static void pd_ca_send_pending(int port) return; tcpm_get_cc(port, &cc1, &cc2); - if ((cc1 != TYPEC_CC_VOLT_SNK_1_5) && - (cc2 != TYPEC_CC_VOLT_SNK_1_5)) + if ((cc1 != TYPEC_CC_VOLT_RP_1_5) && + (cc2 != TYPEC_CC_VOLT_RP_1_5)) if (pd_transmit(port, pd[port].ca_type, pd[port].ca_header, pd[port].ca_buffer) < 0) @@ -2242,8 +2242,8 @@ static void pd_partner_port_reset(int port) */ static inline int cc_is_rp(int cc) { - return (cc == TYPEC_CC_VOLT_SNK_DEF) || (cc == TYPEC_CC_VOLT_SNK_1_5) || - (cc == TYPEC_CC_VOLT_SNK_3_0); + return (cc == TYPEC_CC_VOLT_RP_DEF) || (cc == TYPEC_CC_VOLT_RP_1_5) || + (cc == TYPEC_CC_VOLT_RP_3_0); } #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE @@ -2356,9 +2356,9 @@ void pd_ping_enable(int port, int enable) static inline int get_snk_polarity(int cc1, int cc2) { /* the following assumes: - * TYPEC_CC_VOLT_SNK_3_0 > TYPEC_CC_VOLT_SNK_1_5 - * TYPEC_CC_VOLT_SNK_1_5 > TYPEC_CC_VOLT_SNK_DEF - * TYPEC_CC_VOLT_SNK_DEF > TYPEC_CC_VOLT_OPEN + * TYPEC_CC_VOLT_RP_3_0 > TYPEC_CC_VOLT_RP_1_5 + * TYPEC_CC_VOLT_RP_1_5 > TYPEC_CC_VOLT_RP_DEF + * TYPEC_CC_VOLT_RP_DEF > TYPEC_CC_VOLT_OPEN */ return (cc2 > cc1); } @@ -2373,9 +2373,9 @@ static typec_current_t get_typec_current_limit(int polarity, int cc1, int cc2) int cc = polarity ? cc2 : cc1; int cc_alt = polarity ? cc1 : cc2; - if (cc == TYPEC_CC_VOLT_SNK_3_0 && cc_alt != TYPEC_CC_VOLT_SNK_1_5) + if (cc == TYPEC_CC_VOLT_RP_3_0 && cc_alt != TYPEC_CC_VOLT_RP_1_5) charge = 3000; - else if (cc == TYPEC_CC_VOLT_SNK_1_5) + else if (cc == TYPEC_CC_VOLT_RP_1_5) charge = 1500; else charge = 0; diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c index 11bc399b5e..3e79569e2e 100644 --- a/common/usb_pd_tcpc.c +++ b/common/usb_pd_tcpc.c @@ -746,11 +746,11 @@ static int cc_voltage_to_status(int port, int cc_volt, int cc_sel) #ifdef CONFIG_USB_PD_DUAL_ROLE else if (pd[port].cc_pull == TYPEC_CC_RD) { if (cc_volt >= TYPE_C_SRC_3000_THRESHOLD) - return TYPEC_CC_VOLT_SNK_3_0; + return TYPEC_CC_VOLT_RP_3_0; else if (cc_volt >= TYPE_C_SRC_1500_THRESHOLD) - return TYPEC_CC_VOLT_SNK_1_5; + return TYPEC_CC_VOLT_RP_1_5; else if (CC_RP(cc_volt)) - return TYPEC_CC_VOLT_SNK_DEF; + return TYPEC_CC_VOLT_RP_DEF; else return TYPEC_CC_VOLT_OPEN; } diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index e0c01f52dc..22f1f51e77 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -587,15 +587,15 @@ static int anx74xx_check_cc_type(int cc_reg) break; case BIT_VALUE_OF_SNK_CC_DEFAULT: - cc = TYPEC_CC_VOLT_SNK_DEF; + cc = TYPEC_CC_VOLT_RP_DEF; break; case BIT_VALUE_OF_SNK_CC_1_P_5: - cc = TYPEC_CC_VOLT_SNK_1_5; + cc = TYPEC_CC_VOLT_RP_1_5; break; case BIT_VALUE_OF_SNK_CC_3_P_0: - cc = TYPEC_CC_VOLT_SNK_3_0; + cc = TYPEC_CC_VOLT_RP_3_0; break; default: diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c index 68cf14774d..7b736e5b23 100644 --- a/driver/tcpm/fusb302.c +++ b/driver/tcpm/fusb302.c @@ -91,11 +91,11 @@ static int convert_bc_lvl(int port, int bc_lvl) ret = TYPEC_CC_VOLT_RD; } else { if (bc_lvl == 0x1) - ret = TYPEC_CC_VOLT_SNK_DEF; + ret = TYPEC_CC_VOLT_RP_DEF; else if (bc_lvl == 0x2) - ret = TYPEC_CC_VOLT_SNK_1_5; + ret = TYPEC_CC_VOLT_RP_1_5; else if (bc_lvl == 0x3) - ret = TYPEC_CC_VOLT_SNK_3_0; + ret = TYPEC_CC_VOLT_RP_3_0; } return ret; diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index 8fb6b985c0..f4783c1725 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -84,13 +84,13 @@ static enum tcpc_cc_voltage_status it83xx_get_cc( switch (ufp_volt) { case USBPD_UFP_STATE_SNK_DEF: - cc_state |= (TYPEC_CC_VOLT_SNK_DEF & 3); + cc_state |= (TYPEC_CC_VOLT_RP_DEF & 3); break; case USBPD_UFP_STATE_SNK_1_5: - cc_state |= (TYPEC_CC_VOLT_SNK_1_5 & 3); + cc_state |= (TYPEC_CC_VOLT_RP_1_5 & 3); break; case USBPD_UFP_STATE_SNK_3_0: - cc_state |= (TYPEC_CC_VOLT_SNK_3_0 & 3); + cc_state |= (TYPEC_CC_VOLT_RP_3_0 & 3); break; case USBPD_UFP_STATE_SNK_OPEN: cc_state = TYPEC_CC_VOLT_OPEN; diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 290261c081..d46aef454d 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -16,15 +16,17 @@ /* Time to wait for TCPC to complete transmit */ #define PD_T_TCPC_TX_TIMEOUT (100*MSEC) +/* Detected resistor values of port partner */ enum tcpc_cc_voltage_status { TYPEC_CC_VOLT_OPEN = 0, - TYPEC_CC_VOLT_RA = 1, /* Port partner is applying Ra */ - TYPEC_CC_VOLT_RD = 2, /* Port partner is applying Rd */ - TYPEC_CC_VOLT_SNK_DEF = 5, /* Port partner is applying Rp (0.5A) */ - TYPEC_CC_VOLT_SNK_1_5 = 6, /* Port partner is applying Rp (1.5A) */ - TYPEC_CC_VOLT_SNK_3_0 = 7, /* Port partner is applying Rp (3.0A) */ + TYPEC_CC_VOLT_RA = 1, /* Port partner is applying Ra */ + TYPEC_CC_VOLT_RD = 2, /* Port partner is applying Rd */ + TYPEC_CC_VOLT_RP_DEF = 5, /* Port partner is applying Rp (0.5A) */ + TYPEC_CC_VOLT_RP_1_5 = 6, /* Port partner is applying Rp (1.5A) */ + TYPEC_CC_VOLT_RP_3_0 = 7, /* Port partner is applying Rp (3.0A) */ }; +/* Resistor types we apply on our side of the CC lines */ enum tcpc_cc_pull { TYPEC_CC_RA = 0, TYPEC_CC_RP = 1, @@ -32,6 +34,7 @@ enum tcpc_cc_pull { TYPEC_CC_OPEN = 3, }; +/* Pull-up values we apply as a SRC to advertise different current limits */ enum tcpc_rp_value { TYPEC_RP_USB = 0, TYPEC_RP_1A5 = 1, |