summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2022-10-12 11:39:11 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-12 23:50:19 +0000
commitffa5765555b6d684cd465db15081545cf41e2265 (patch)
tree5e37643e0c24c95ba20ca2aacbce56d78b0455c9
parent297c648ebcf2e62b1da7e2ad13eee4bad83c9545 (diff)
downloadchrome-ec-ffa5765555b6d684cd465db15081545cf41e2265.tar.gz
zephyr test: VCONN Swap off via host command
With the TCPM as VCONN Source, use EC_CMD_USB_PD_CONTROL to initiate a VCONN Swap. Verify that the TCPM is not VCONN Source afterward. BUG=b:251485312 TEST=twister -s zephyr/test/drivers/drivers.usbc_vconn_swap BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ifa5bc067270f0744d74b0f7004b8820ba4f8b778 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3949613 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
index 70d13bdada..c7f20e5387 100644
--- a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
+++ b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
@@ -134,5 +134,21 @@ ZTEST_F(usbc_vconn_swap, vconn_swap_before_discovery)
"TCPM did not initiate VCONN Swap after attach");
}
+ZTEST_F(usbc_vconn_swap, vconn_swap_via_host_command)
+{
+ struct ec_response_typec_status status =
+ host_cmd_typec_status(TEST_PORT);
+
+ zassume_equal(status.vconn_role, PD_ROLE_VCONN_SRC,
+ "TCPM did not initiate VCONN Swap after attach");
+
+ host_cmd_usb_pd_control(TEST_PORT, USB_PD_CTRL_SWAP_VCONN);
+ k_sleep(K_SECONDS(1));
+
+ status = host_cmd_typec_status(TEST_PORT);
+ zassert_equal(status.vconn_role, PD_ROLE_VCONN_OFF,
+ "TCPM did not initiate VCONN Swap after host command");
+}
+
ZTEST_SUITE(usbc_vconn_swap, drivers_predicate_post_main, usbc_vconn_swap_setup,
usbc_vconn_swap_before, usbc_vconn_swap_after, NULL);