From 13c8b5688f6cb501ce04bcf10e3f4ddca66b2b63 Mon Sep 17 00:00:00 2001 From: li feng Date: Mon, 30 Aug 2021 20:19:38 -0700 Subject: TCPMV2: check if vconn swap is allowed Connect TBT/USB4 device to PD port in G3 state, port discovery requests to be vconn source even the PP5000_A rail is turned off in G3, as a result system won't be able to source vconn and cable discovery fails. Port discovery should check if sourcing vconn is possible at board level before it requests swap vconn so to prevent this failure. BUG=b:198226223 BRANCH=none TEST=Boot up ADL RVP, put system in G3 by "shutdown -h now", plug in Gatkex board to port 0, confirmed EC does not request vconn swap in G3 if 5V is not available. Wake up system by "powerbtn" on EC console, cable discovery is successful. Signed-off-by: li feng Change-Id: Ic94c21dbfe0c910b6c9826302b8658eeeff44b72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131408 Reviewed-by: Vijay Hiremath Reviewed-by: Abe Levkoy Commit-Queue: Abe Levkoy --- common/usbc/usbc_pd_policy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/usbc/usbc_pd_policy.c b/common/usbc/usbc_pd_policy.c index 2170734d6a..6a06d4014f 100644 --- a/common/usbc/usbc_pd_policy.c +++ b/common/usbc/usbc_pd_policy.c @@ -32,14 +32,15 @@ __overridable bool port_discovery_dr_swap_policy(int port, /* * Default Port Discovery VCONN Swap Policy. * - * 1) If vconn_swap_to_on_flag == true and vconn is currently off, - * transition to pe_vcs_send_swap + * 1) If vconn_swap_to_on_flag == true, and vconn is currently off, + * 2) Sourcing VCONN is possible + * then transition to pe_vcs_send_swap */ __overridable bool port_discovery_vconn_swap_policy(int port, bool vconn_swap_flag) { if (IS_ENABLED(CONFIG_USBC_VCONN) && vconn_swap_flag && - !tc_is_vconn_src(port)) + !tc_is_vconn_src(port) && tc_check_vconn_swap(port)) return true; /* Do not perform a VCONN swap */ -- cgit v1.2.1