summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Massey <aaronmassey@google.com>2022-04-11 12:19:34 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-11 19:47:22 +0000
commitde526c04271e4c421c3f8700022dfa62fbb7ab53 (patch)
treeacc061906cae365ae399b09e168d3d0efa524064
parent81933b47d4b3942f1a5fac14dcc50b8574991198 (diff)
downloadchrome-ec-de526c04271e4c421c3f8700022dfa62fbb7ab53.tar.gz
zephyr: test: USB 5v 3a PD sink alert race
The tcpci_tcpc_alert function is asynchronous meaning we must wait for its async routines to complete before depending on its functionality in USB power delivery tests. Add one second in virtual suspend time on test thread before relying on tcpci_tcpc_alert state changes. BRANCH=none BUG=b:228850425 TEST=zmake test --test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I20e3cb2ae4c899c6137bff7eb1047f4ee1abaae5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581653 Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r--zephyr/test/drivers/src/integration/usbc/usb_5v_3a_pd_sink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/zephyr/test/drivers/src/integration/usbc/usb_5v_3a_pd_sink.c b/zephyr/test/drivers/src/integration/usbc/usb_5v_3a_pd_sink.c
index 9541f20dd3..9a4df7d11e 100644
--- a/zephyr/test/drivers/src/integration/usbc/usb_5v_3a_pd_sink.c
+++ b/zephyr/test/drivers/src/integration/usbc/usb_5v_3a_pd_sink.c
@@ -34,7 +34,10 @@ connect_sink_to_port(struct usb_attach_5v_3a_pd_sink_fixture *fixture)
TCPC_REG_POWER_STATUS_VBUS_DET);
tcpci_emul_set_reg(fixture->tcpci_emul, TCPC_REG_EXT_STATUS,
TCPC_REG_EXT_STATUS_SAFE0V);
+
tcpci_tcpc_alert(0);
+ k_sleep(K_SECONDS(1));
+
zassume_ok(tcpci_snk_emul_connect_to_tcpci(
&fixture->sink_5v_3a.data,
&fixture->sink_5v_3a.common_data,