summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-12-16 12:45:16 +0100
committerCommit Bot <commit-bot@chromium.org>2022-01-05 17:45:36 +0000
commit95e3440614554b4a1d47a152c63647f76681854c (patch)
tree48be4ee5d7b8407a7faeab13f928150939d0f653
parent26890e8bfd823ffc7a4e5e2316e0383d630b9da3 (diff)
downloadchrome-ec-95e3440614554b4a1d47a152c63647f76681854c.tar.gz
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 <tm@semihalf.com> Change-Id: I58301073322cef503aa455fc0ed5799f32ba1e8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3347661 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r--zephyr/test/drivers/src/tcpci.c5
-rw-r--r--zephyr/test/drivers/src/tcpci_test_common.c9
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);