diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-01-31 19:46:39 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-01 11:49:50 +0000 |
commit | 3a8ae740a4ce0947c545ac86203b4e0ca28ae004 (patch) | |
tree | 2df93b3d2b08291df56aca56b7cb042e6abb3d07 | |
parent | bbfb707f04d3b4c7cd503afb936ecb05ae526731 (diff) | |
download | chrome-ec-3a8ae740a4ce0947c545ac86203b4e0ca28ae004.tar.gz |
zephyr: drivers: Ignore polarity on typec command test
Polarity in "typec" command is set to value reported by TC state
machine. TC SM presents polarity of last connected port partner even if
it disconnects.
Because of that test of "typec" command should expect that polarity is
set to value reported by TC SM.
BUG=none
BRANCH=none
TEST=zmake configure --test zephyr/test/drivers
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: Ieb85ce5b7648956ce9c8a78b0df7d6637087e665
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3427959
Tested-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Sam Hurst <shurst@google.com>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r-- | zephyr/test/drivers/src/usb_mux.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/zephyr/test/drivers/src/usb_mux.c b/zephyr/test/drivers/src/usb_mux.c index f63bc94b5d..c49091f37f 100644 --- a/zephyr/test/drivers/src/usb_mux.c +++ b/zephyr/test/drivers/src/usb_mux.c @@ -812,6 +812,7 @@ ZTEST(usb_init_mux, test_usb_mux_hc_mux_info) /** Test typec console command */ ZTEST(usb_init_mux, test_usb_mux_typec_command) { + mux_state_t polarity; mux_state_t exp_mode; /* TODO: investigate why call in usb_init_mux_before() is not enough */ set_test_runner_tid(); @@ -860,9 +861,13 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) /* Mux will enter low power mode */ CHECK_PROXY_FAKE_CALL_CNT(proxy_enter_low_power_mode, NUM_OF_PROXY); + /* Polarity is set based on PD */ + polarity = polarity_rm_dts(pd_get_polarity(USBC_PORT_C1)) ? + USB_PD_MUX_POLARITY_INVERTED : 0; + /* Test setting USB mode */ reset_proxy_fakes(); - exp_mode = USB_PD_MUX_USB_ENABLED; + exp_mode = USB_PD_MUX_USB_ENABLED | polarity; zassert_equal(EC_SUCCESS, shell_execute_cmd(shell_backend_uart_get_ptr(), "typec 1 usb"), NULL); @@ -872,7 +877,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) /* Test setting DP mode */ reset_proxy_fakes(); - exp_mode = USB_PD_MUX_DP_ENABLED; + exp_mode = USB_PD_MUX_DP_ENABLED | polarity; zassert_equal(EC_SUCCESS, shell_execute_cmd(shell_backend_uart_get_ptr(), "typec 1 dp"), NULL); @@ -880,7 +885,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) /* Test setting dock mode */ reset_proxy_fakes(); - exp_mode = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED; + exp_mode = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED | polarity; zassert_equal(EC_SUCCESS, shell_execute_cmd(shell_backend_uart_get_ptr(), "typec 1 dock"), NULL); |