diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2020-07-31 14:03:44 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-05 07:50:52 +0000 |
commit | ae40b0d68c1dd02dafdb0ed4777747878655beff (patch) | |
tree | e10327c9647f2b74f38fee17674b40e44d597644 | |
parent | 980cf5248b8f5479f4f54f183a55611fbafc9478 (diff) | |
download | chrome-ec-ae40b0d68c1dd02dafdb0ed4777747878655beff.tar.gz |
usb_pd: disable Vconn of PPC first then TCPC
Disabling PPC's Vconn first in case the PPC's Vconn
feed back to TCPC.
On ITE EC, its CC pins have multi-function (analog module), and
it needs to disable PPC's Vconn then can safely disable the 5V
tolerance on the CC pin.
Switching the PPC disable order should have no effect to the other
TCPCs.
BUG=b:162294637
TEST=On asurada(ITE EC) and lazor(NPCX EC), Vconn is enabled and
disabled on hub plug/unplug
BRANCH=none
Change-Id: If2af04931d00c5c8a52908a3391a482a7571b5fc
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2331987
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-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 */ |