summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2022-01-17 21:43:04 +0100
committerCommit Bot <commit-bot@chromium.org>2022-01-21 11:07:26 +0000
commitd27c82d2c3a8b9b12c56dae0a424749e486792f7 (patch)
treeddf436c6dedb81cb6627f55ce90c53cd586bc004
parentcb89f6e8c25100787992db89c479cebc5f8d71ab (diff)
downloadchrome-ec-d27c82d2c3a8b9b12c56dae0a424749e486792f7.tar.gz
zephyr: drivers: Fix timinig issues of ppc syv682x test
test_ppc_syv682x_interrupt() should wait for repeated interrupt after setting high-voltage overcurrent state. test_ppc_syv682x_write_busy() should wait for at least 400 busy reads to trigger timeout in syv682x_wait_for_ready(). This function timeouts after 400 ms repeatedly calling i2c read with 1 ms delay after each call. BUG=b:203858808 BRANCH=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I096928bc1bb889036283ab2d715c13b1771dfd85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3398503 Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r--zephyr/test/drivers/src/ppc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/zephyr/test/drivers/src/ppc.c b/zephyr/test/drivers/src/ppc.c
index 5a729de3d6..dd31e98fba 100644
--- a/zephyr/test/drivers/src/ppc.c
+++ b/zephyr/test/drivers/src/ppc.c
@@ -216,14 +216,16 @@ static void test_ppc_syv682x_interrupt(void)
"Power path disabled after HV_OC handled");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
SYV682X_CONTROL_4_NONE);
- msleep(1);
+ /* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
+ msleep(15);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
"Power path disabled after HV_OC handled");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
SYV682X_CONTROL_4_NONE);
- msleep(1);
+ /* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
+ msleep(15);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB,
@@ -391,12 +393,12 @@ static void test_ppc_syv682x_write_busy(void)
/*
* Writes should fail while the BUSY bit is set, except that writes to
- * CONTROL_4 should succeed on the SYV682C. 100 reads is intentionally
+ * CONTROL_4 should succeed on the SYV682C. 1000 reads is intentionally
* many more than the driver is expected to make before reaching its
* timeout. It is not a goal of this test to verify the frequency of
* polling or the exact value of the timeout.
*/
- syv682x_emul_set_busy_reads(emul, 100);
+ syv682x_emul_set_busy_reads(emul, 1000);
zassert_equal(ppc_set_vbus_source_current_limit(syv682x_port,
TYPEC_RP_USB),
EC_ERROR_TIMEOUT, "SYV682 busy, but write completed");