diff options
author | Keith Short <keithshort@chromium.org> | 2020-11-19 09:35:00 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-20 23:30:30 +0000 |
commit | 86cd11143962af1a6e9b695599c0af605df9256b (patch) | |
tree | 7b9c883d5375b4dc232076803cf56e30f6ef6485 | |
parent | 5ff8db10799fb15dff6ef9d39880faeddc7c234f (diff) | |
download | chrome-ec-86cd11143962af1a6e9b695599c0af605df9256b.tar.gz |
tcpmv2: reduce time to enter alternate modes
The USB Type-C specification defines tAMETimeout (1000 ms) as the time
between sink attach until a USB Billboard device class is exposed. For
some SNK devices, the billboard class can interfere with processing of
PD messages, causing PD discovery and altnernate modes to fail.
Reduce the time to enter alternate modes for PD2.0 devices by only
performing a hold-off delay after the first contract is established.
This change also reduces the minimum hold off delay fro 400ms to 200ms.
BUG=b:169741906
BRANCH=firmware-volteer-13521.B-master
TEST=connect StarTech dongle to Delbin. Observe that altnerate mode
entry occurs between 700 and 950ms. Prior to this change, altnernate
mode entry took 900 to 1200ms.
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Id65ad061a0019f07bbfba72dcab82c51472c6273
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550306
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 86563efc59..8f85c2694d 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -219,12 +219,13 @@ /* * The time that we allow the port partner to send any messages after an - * explicit contract is established. 400ms was chosen somewhat arbitrarily as + * explicit contract is established. 200ms was chosen somewhat arbitrarily as * it should be long enough for sources to decide to send a message if they were * going to, but not so long that a "low power charger connected" notification - * would be shown in the chrome OS UI. + * would be shown in the chrome OS UI. Setting t0o large a delay can cause + * problems if the PD discovery time exceeds 1s (tAMETimeout) */ -#define SRC_SNK_READY_HOLD_OFF_US (400 * MSEC) +#define SRC_SNK_READY_HOLD_OFF_US (200 * MSEC) /* * Function pointer to a Structured Vendor Defined Message (SVDM) response @@ -2174,14 +2175,17 @@ static void pe_src_transition_supply_run(int port) if (PE_CHK_FLAG(port, PE_FLAGS_PS_READY)) { PE_CLR_FLAG(port, PE_FLAGS_PS_READY); /* NOTE: Second pass through this code block */ - /* Explicit Contract is now in place */ - pe_set_explicit_contract(port); /* * Set first message flag to trigger a wait and add - * jitter delay when operating in PD2.0 mode. + * jitter delay when operating in PD2.0 mode. Skip + * if we already have a contract. */ - PE_SET_FLAG(port, PE_FLAGS_FIRST_MSG); + if (!pe_is_explicit_contract(port)) + PE_SET_FLAG(port, PE_FLAGS_FIRST_MSG); + + /* Explicit Contract is now in place */ + pe_set_explicit_contract(port); /* * Setup to get Device Policy Manager to request |