diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2022-01-10 15:12:46 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-19 20:16:20 +0000 |
commit | 91a43998df92320610d7399433e221f493169410 (patch) | |
tree | cd0320e2ea4979a6bd65819ed549f766b62d74b7 | |
parent | ce92805dee3b8acea79163fccfd023231f2e13bc (diff) | |
download | chrome-ec-91a43998df92320610d7399433e221f493169410.tar.gz |
zephyr test: Check EC_CMD_TYPEC_STATUS results
After attaching emulated PD charger, using EC_CMD_TYPEC_STATUS to verify
USB default charging state.
BUG=b:209907297
TEST=zmake configure --test zephyr/test/drivers
BRANCH=none
Cq-Depend: chromium:3368262
Change-Id: Iaa414a8b459b453ffde64f303f584eeaba7e6871
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3379467
Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r-- | zephyr/test/drivers/src/integration_usb.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/zephyr/test/drivers/src/integration_usb.c b/zephyr/test/drivers/src/integration_usb.c index 2b512525f9..48d8c87726 100644 --- a/zephyr/test/drivers/src/integration_usb.c +++ b/zephyr/test/drivers/src/integration_usb.c @@ -113,6 +113,10 @@ static void test_attach_pd_charger(void) struct ec_response_charge_state charge_response; struct host_cmd_handler_args args = BUILD_HOST_COMMAND( EC_CMD_CHARGE_STATE, 0, charge_response, charge_params); + struct ec_params_typec_status typec_params; + struct ec_response_typec_status typec_response; + struct host_cmd_handler_args typec_args = BUILD_HOST_COMMAND( + EC_CMD_TYPEC_STATUS, 0, typec_response, typec_params); /* * TODO(b/209907297): Implement the steps of the test beyond USB default @@ -167,6 +171,22 @@ static void test_attach_pd_charger(void) "USB default current %dmA", charge_response.get_state.chg_current); + typec_params.port = 0; + zassert_ok(host_command_process(&typec_args), + "Failed to get Type-C state"); + zassert_true(typec_response.pd_enabled, + "Charger attached but PD disabled"); + zassert_true(typec_response.dev_connected, + "Charger attached but device disconnected"); + zassert_true(typec_response.sop_connected, + "Charger attached but not SOP capable"); + zassert_equal(typec_response.source_cap_count, 1, + "Charger has %d source PDOs", + typec_response.source_cap_count); + zassert_equal(typec_response.power_role, PD_ROLE_SINK, + "Charger attached, but TCPM power role is %d", + typec_response.power_role); + /* * 3. Wait for SenderResponseTimeout. Expect TCPM to send Request. * We could verify that the Request references the expected PDO, but |