From 95e3440614554b4a1d47a152c63647f76681854c Mon Sep 17 00:00:00 2001 From: Tomasz Michalec Date: Thu, 16 Dec 2021 12:45:16 +0100 Subject: zephyr: drivers: Use default value for power status in TCPCI tests Use default value for power status register in TCPCI tests BUG=b:209907609 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec Change-Id: I58301073322cef503aa455fc0ed5799f32ba1e8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3347661 Reviewed-by: Denis Brockus Tested-by: Tomasz Michalec Commit-Queue: Tomasz Michalec --- zephyr/test/drivers/src/tcpci.c | 5 +++-- zephyr/test/drivers/src/tcpci_test_common.c | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/zephyr/test/drivers/src/tcpci.c b/zephyr/test/drivers/src/tcpci.c index be38711307..cdc13861ab 100644 --- a/zephyr/test/drivers/src/tcpci.c +++ b/zephyr/test/drivers/src/tcpci.c @@ -295,8 +295,9 @@ static void test_generic_tcpci_mux_init(void) zassert_equal(EC_ERROR_TIMEOUT, tcpci_tcpm_mux_init(tcpci_usb_mux), NULL); - /* Set correct power status for rest of the test */ - tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, 0); + /* Set default power status for rest of the test */ + tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, + TCPC_REG_POWER_STATUS_VBUS_DET); /* Test fail on alert mask write fail */ i2c_common_emul_set_write_fail_reg(i2c_emul, TCPC_REG_ALERT_MASK); diff --git a/zephyr/test/drivers/src/tcpci_test_common.c b/zephyr/test/drivers/src/tcpci_test_common.c index 525c64085e..a2925bf3be 100644 --- a/zephyr/test/drivers/src/tcpci_test_common.c +++ b/zephyr/test/drivers/src/tcpci_test_common.c @@ -57,7 +57,8 @@ void test_tcpci_init(const struct emul *emul, enum usbc_port port) TCPC_REG_ALERT_FAULT | TCPC_REG_ALERT_POWER_STATUS; /* Set TCPCI emulator VBUS to safe0v (disconnected) */ - tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, 0); + tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, + TCPC_REG_POWER_STATUS_VBUS_DET); /* Test init with VBUS safe0v without vSafe0V tcpc config flag */ zassert_equal(EC_SUCCESS, drv->init(port), NULL); @@ -69,7 +70,8 @@ void test_tcpci_init(const struct emul *emul, enum usbc_port port) /* Set TCPCI emulator VBUS to present (connected, above 4V) */ tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, - TCPC_REG_POWER_STATUS_VBUS_PRES); + TCPC_REG_POWER_STATUS_VBUS_PRES | + TCPC_REG_POWER_STATUS_VBUS_DET); /* Test init with VBUS present without vSafe0V tcpc config flag */ zassert_equal(EC_SUCCESS, drv->init(port), NULL); @@ -92,7 +94,8 @@ void test_tcpci_init(const struct emul *emul, enum usbc_port port) check_tcpci_reg(emul, TCPC_REG_ALERT_MASK, exp_mask); /* Set TCPCI emulator VBUS to safe0v (disconnected) */ - tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, 0); + tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS, + TCPC_REG_POWER_STATUS_VBUS_DET); tcpci_emul_set_reg(emul, TCPC_REG_EXT_STATUS, TCPC_REG_EXT_STATUS_SAFE0V); -- cgit v1.2.1