summaryrefslogtreecommitdiff
path: root/test/usb_tcpmv2_tcpci.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-11-11 16:53:12 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-20 17:43:24 +0000
commit30a9f90a098be3514beea0ed4238252c63d93c51 (patch)
tree4b195823ca1893f25c4f753d25366bfa443df349 /test/usb_tcpmv2_tcpci.c
parentd0530ca42969435e91627977267c517e26349c97 (diff)
downloadchrome-ec-30a9f90a098be3514beea0ed4238252c63d93c51.tar.gz
TCPMv2: Always probe sink caps
This commit adds the ability to always probe the partner for sink capabilities, and re-names the state to reflect that sources may use it now too. This also fixes some issues in the state to get sink capabilities, including correcting the message detection and soft resetting with the SOP* of the unexpected message. This also updates the unit tests to expect a Get_Sink_Caps message as a part of typical startup. BRANCH=None BUG=b:168862110,b:160009733 TEST=on drawcia, observe sink caps are requested from source and sink partners Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I5da3adc17ccec71f6cad9e8f152b9570ec99691d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540389 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'test/usb_tcpmv2_tcpci.c')
-rw-r--r--test/usb_tcpmv2_tcpci.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/usb_tcpmv2_tcpci.c b/test/usb_tcpmv2_tcpci.c
index 960cb9ff0f..c032c472a2 100644
--- a/test/usb_tcpmv2_tcpci.c
+++ b/test/usb_tcpmv2_tcpci.c
@@ -244,6 +244,18 @@ __maybe_unused static int test_connect_as_pd3_source(void)
rx_id++;
mock_set_alert(TCPC_REG_ALERT_RX_STATUS);
+ TEST_EQ(verify_tcpci_transmit(TCPC_TX_SOP, PD_CTRL_GET_SINK_CAP, 0),
+ EC_SUCCESS, "%d");
+ mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS);
+ task_wait_event(10 * MSEC);
+ mock_tcpci_receive(PD_MSG_SOP,
+ PD_HEADER(PD_DATA_SINK_CAP, PD_ROLE_SINK,
+ PD_ROLE_UFP, rx_id,
+ 1, PD_REV30, 0),
+ &pdo);
+ rx_id++;
+ mock_set_alert(TCPC_REG_ALERT_RX_STATUS);
+
task_wait_event(1 * SECOND);
TEST_EQ(tc_is_attached_src(PORT0), true, "%d");
TEST_EQ(TCPC_REG_ROLE_CTRL_RP(mock_tcpci_get_reg(TCPC_REG_ROLE_CTRL)),