diff options
-rw-r--r-- | driver/tcpm/ps8xxx.c | 2 | ||||
-rw-r--r-- | zephyr/test/drivers/src/ps8xxx.c | 10 | ||||
-rw-r--r-- | zephyr/test/drivers/src/usb_mux.c | 15 |
3 files changed, 27 insertions, 0 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 572616efb4..ea76b64d6f 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -340,6 +340,7 @@ static int dp_set_irq(const struct usb_mux *me, int enable) return mux_write(me, MUX_IN_HPD_ASSERTION_REG, reg); } +/* LCOV_EXCL_START */ __overridable uint16_t board_get_ps8xxx_product_id(int port) { @@ -366,6 +367,7 @@ uint16_t board_get_ps8xxx_product_id(int port) CPRINTS("%s: Any new product id is not defined here?", __func__); return 0; } +/* LCOV_EXCL_STOP */ bool check_ps8755_chip(int port) { diff --git a/zephyr/test/drivers/src/ps8xxx.c b/zephyr/test/drivers/src/ps8xxx.c index a2052b43fc..b6c3b5198b 100644 --- a/zephyr/test/drivers/src/ps8xxx.c +++ b/zephyr/test/drivers/src/ps8xxx.c @@ -497,6 +497,8 @@ static void test_ps8xxx_get_chip_info(uint16_t current_product_id) info.product_id, NULL); zassert_equal(device_id, info.device_id, NULL); zassert_equal(fw_rev, info.fw_version_number, NULL); + + zassert_equal(false, check_ps8755_chip(USBC_PORT_C1), NULL); } static void test_ps8805_get_chip_info(void) @@ -747,6 +749,14 @@ static void test_ps8805_gpio(void) }, }; + /* Test fail on invalid signal for gpio control reg */ + zassert_equal(EC_ERROR_INVAL, + ps8805_gpio_set_level(USBC_PORT_C1, PS8805_GPIO_NUM, 1), + NULL); + zassert_equal(EC_ERROR_INVAL, + ps8805_gpio_get_level(USBC_PORT_C1, PS8805_GPIO_NUM, + &level), NULL); + /* Setup fail on gpio control reg read */ i2c_common_emul_set_read_fail_reg(gpio_i2c_emul, PS8805_REG_GPIO_CONTROL); diff --git a/zephyr/test/drivers/src/usb_mux.c b/zephyr/test/drivers/src/usb_mux.c index 517bb59107..4c5cf6d281 100644 --- a/zephyr/test/drivers/src/usb_mux.c +++ b/zephyr/test/drivers/src/usb_mux.c @@ -20,6 +20,8 @@ #include "i2c.h" #include "stubs.h" #include "task.h" +#include "tcpm/ps8xxx_public.h" +#include "tcpm/tcpci.h" #include "usb_prl_sm.h" #include "usb_tc_sm.h" @@ -698,6 +700,19 @@ void test_usb_mux_hpd_update(void) CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0); CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY, exp_mode); + + /* Test ps8xxx hpd update */ + usb_muxes[USBC_PORT_C1].usb_port = 1; + usb_muxes[USBC_PORT_C1].driver = &tcpci_tcpm_usb_mux_driver; + usb_muxes[USBC_PORT_C1].hpd_update = &ps8xxx_tcpc_update_hpd_status; + + reset_proxy_fakes(); + exp_mode = virt_mode | USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ; + usb_mux_hpd_update(USBC_PORT_C1, exp_mode); + /* Check if PS8xxx mux mode is updated correctly */ + tcpci_tcpm_usb_mux_driver.get(&usb_muxes[USBC_PORT_C1], &mode); + zassert_equal(0, mode, "mux mode is 0x%x (!= 0x%x)", + mode, 0); } void test_usb_mux_fw_update_port_info(void) |