diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2021-10-27 16:13:17 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-28 19:01:18 +0000 |
commit | 3deccd4a73122a5da91a9d47b4983ec426eca73c (patch) | |
tree | b765b993ea8a8f5551f633a13d3a82bd1b0e6538 /zephyr/emul/emul_syv682x.c | |
parent | a645d15ee4a2341ebdae05481c3fad0139c8d7fd (diff) | |
download | chrome-ec-3deccd4a73122a5da91a9d47b4983ec426eca73c.tar.gz |
zephyr test: SYV682x VBAT_OVP interrupt
Emulate VCONN over-voltage conditions. Check that the driver handles
them by reinitializing the PPC. Increase syv682x.c line coverage from
68.8% to 70.3%.
BUG=b:190519131
TEST=zmake configure --test zephyr/test/drivers
BRANCH=none
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: I172aade75df8b52202c3a214a44423d899cca7ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3249159
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'zephyr/emul/emul_syv682x.c')
-rw-r--r-- | zephyr/emul/emul_syv682x.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/zephyr/emul/emul_syv682x.c b/zephyr/emul/emul_syv682x.c index 2bc18b7089..3a4aba8189 100644 --- a/zephyr/emul/emul_syv682x.c +++ b/zephyr/emul/emul_syv682x.c @@ -100,6 +100,14 @@ void syv682x_emul_set_control_4(struct i2c_emul *emul, uint8_t val) * current. The latter behavior is observed in practice, and this * emulator does not currently model it. */ + + /* VBAT_OVP disconnects CC and VCONN. */ + if (val_interrupt & SYV682X_CONTROL_4_VBAT_OVP) { + data->reg[SYV682X_CONTROL_4_REG] &= ~(SYV682X_CONTROL_4_CC1_BPS + | SYV682X_CONTROL_4_CC2_BPS + | SYV682X_CONTROL_4_VCONN1 + | SYV682X_CONTROL_4_VCONN2); + } } int syv682x_emul_get_reg(struct i2c_emul *emul, int reg, uint8_t *val) |