diff options
-rw-r--r-- | common/usb_pd_protocol.c | 13 | ||||
-rw-r--r-- | common/usbc/usb_tc_drp_acc_trysrc_sm.c | 11 |
2 files changed, 19 insertions, 5 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index b3be338d64..ececdde8ed 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -424,6 +424,13 @@ void pd_vbus_low(int port) static void set_vconn(int port, int enable) { /* + * Disable PPC Vconn first then TCPC in case the voltage feeds back + * to TCPC and damages. + */ + if (IS_ENABLED(CONFIG_USBC_PPC_VCONN) && !enable) + ppc_set_vconn(port, 0); + + /* * We always need to tell the TCPC to enable Vconn first, otherwise some * TCPCs get confused when a PPC sets secondary CC line to 5V and TCPC * immediately disconnect. If there is a PPC, both devices will @@ -431,9 +438,9 @@ static void set_vconn(int port, int enable) * "make before break" electrical requirements when swapping anyway. */ tcpm_set_vconn(port, enable); -#ifdef CONFIG_USBC_PPC_VCONN - ppc_set_vconn(port, enable); -#endif + + if (IS_ENABLED(CONFIG_USBC_PPC_VCONN) && enable) + ppc_set_vconn(port, 1); } #endif /* defined(CONFIG_USBC_VCONN) */ diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 7491250088..a72b99a155 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -1508,6 +1508,13 @@ static void set_vconn(int port, int enable) TC_CLR_FLAG(port, TC_FLAGS_VCONN_ON); /* + * Disable PPC Vconn first then TCPC in case the voltage feeds back + * to TCPC and damages. + */ + if (IS_ENABLED(CONFIG_USBC_PPC_VCONN) && !enable) + ppc_set_vconn(port, 0); + + /* * We always need to tell the TCPC to enable Vconn first, otherwise some * TCPCs get confused and think the CC line is in over voltage mode and * immediately disconnects. If there is a PPC, both devices will @@ -1516,8 +1523,8 @@ static void set_vconn(int port, int enable) */ tcpm_set_vconn(port, enable); - if (IS_ENABLED(CONFIG_USBC_PPC_VCONN)) - ppc_set_vconn(port, enable); + if (IS_ENABLED(CONFIG_USBC_PPC_VCONN) && enable) + ppc_set_vconn(port, 1); } /* This must only be called from the PD task */ |