summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-03-31 15:08:34 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-17 17:20:42 +0000
commit8d2f8964ffc7ef794166b81cd475e208b5c4328b (patch)
treeb77fb10cec5b143beee97adf494d294ac4baed44 /test
parent380e33b10fed03f41ba17de764ca80facf40e42c (diff)
downloadchrome-ec-8d2f8964ffc7ef794166b81cd475e208b5c4328b.tar.gz
TCPMv2: Revamp pe_attempt_port_discovery
Revamps pe_attempt_port_discovery to be called from the ready run states, try once to be DFP and Vconn source, and moves timer check and discovery calls into this function. Note that nDiscoverIdentityCount and DiscoverIdentityTimer are only applicable to cable plugs, though here the discover identity timer is also repurposed to space out requests to a BUSY partner. Long term, the policy decisions regarding our data and vconn role will be moved out into their own file in order to support allowing the AP to override EC default policies. BRANCH=None BUG=b:152417977 TEST=on kindred running TCPMv2, ensured we could complete discovery and enter mode DP mode (when applicable) with: - PD 2.0 Apple dongle, with and without external power - PD 2.0 Acer hub - PD 2.0 charger which would DR swap - PD 3.0 Cable Matters hub, with and without external power - PD 3.0 Hoo Too hub, with and without external power Ensured we did not attempt discovery with: - PD 2.0 charger which won't DR swap Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I9c049690a87f3fc0eca3b9d2c85128470cbb2a91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130478 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/usb_pe_drp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/usb_pe_drp.c b/test/usb_pe_drp.c
index 9c5771851b..8fe474ce8f 100644
--- a/test/usb_pe_drp.c
+++ b/test/usb_pe_drp.c
@@ -64,9 +64,11 @@ static int test_pe_frs(void)
/*
* FRS will only trigger when we are SNK, with an Explicit
- * contract. So set this state up manually
+ * contract. So set this state up manually. Also ensure any
+ * background tasks (ex. discovery) aren't running.
*/
tc_prs_src_snk_assert_rd(PORT0);
+ pe_set_flag(PORT0, PE_FLAGS_DISCOVER_PORT_IDENTITY_DONE);
pe_set_flag(PORT0, PE_FLAGS_EXPLICIT_CONTRACT);
set_state_pe(PORT0, PE_SNK_READY);
pe_run(PORT0, EVT_IGNORED, ENABLED);