summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-09-08 12:50:16 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-09 21:37:08 +0000
commit0cd34573caa2b786bfe3528231c3206a00f3c9cf (patch)
treee4a27072a303f6cc71df804a38a97514a9331ee9
parentab9d98de46cd75c1742f999c30ecf8671bf21639 (diff)
downloadchrome-ec-0cd34573caa2b786bfe3528231c3206a00f3c9cf.tar.gz
tcpmv2: Increase SOP' Discovery Identity timeout
Increase the tDiscoveryIdentity timer outside of an explicit contract so that SOP' Discover Identity commands are only sent at the same rate as Source Cap messages. This allows operation with captive cable devices that power the SOP' responder from VBUS instead of VCONN. BUG=b:166650426 BRANCH=none TEST=make buildall TEST=Verify TBT entry with the TBT loopback device. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I862a0284f36fe8aa2fb78eeaa3ac9db2764da32f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2399036 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 83660bcc0a..e527f8bea8 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -178,6 +178,15 @@
#define N_DISCOVER_IDENTITY_COUNT 6
/*
+ * tDiscoverIdentity is only defined while an explicit contract is in place.
+ * To support captive cable devices that power the SOP' responder from VBUS
+ * instead of VCONN stretch out the SOP' Discover Identity messages when
+ * no contract is present. 200 ms provides about 1 second for the cable
+ * to power up (200 * 5 retries).
+ */
+#define PE_T_DISCOVER_IDENTITY_NO_CONTRACT (200*MSEC)
+
+/*
* Only VCONN source can communicate with the cable plug. Hence, try VCONN swap
* 3 times before giving up.
*
@@ -4759,16 +4768,27 @@ static void pe_vdm_identity_request_cbl_exit(int port)
prl_set_rev(port, TCPC_TX_SOP_PRIME, PD_REV20);
/*
- * Set discover identity timer unless BUSY case already did so
- *
- * Note: DiscoverIdentityTimer only applies within an explicit
- * contract, so we could re-try faster from src_discovery if
- * desired here
+ * Set discover identity timer unless BUSY case already did so.
*/
if (pd_get_identity_discovery(port, pe[port].tx_type) == PD_DISC_NEEDED
- && pe[port].discover_identity_timer < get_time().val)
- pe[port].discover_identity_timer = get_time().val +
- PD_T_DISCOVER_IDENTITY;
+ && pe[port].discover_identity_timer < get_time().val) {
+ uint64_t timer;
+
+ /*
+ * The tDiscoverIdentity timer is used during an explicit
+ * contract when discovering whether a cable is PD capable.
+ *
+ * Pre-contract, slow the rate Discover Identity commands are
+ * sent. This permits operation with captive cable devices that
+ * power the SOP' responder from VBUS instead of VCONN.
+ */
+ if (pe_is_explicit_contract(port))
+ timer = PD_T_DISCOVER_IDENTITY;
+ else
+ timer = PE_T_DISCOVER_IDENTITY_NO_CONTRACT;
+
+ pe[port].discover_identity_timer = get_time().val + timer;
+ }
/* Do not attempt further discovery if identity discovery failed. */
if (pd_get_identity_discovery(port, pe[port].tx_type) == PD_DISC_FAIL)