diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-07-27 16:48:17 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-02 08:09:28 +0000 |
commit | b81f638ba18b289d727e989e66d06a17aa625bc8 (patch) | |
tree | 969c6ecafc0e293233f158140a1fcaf1238460fc | |
parent | 1de22ccb3c82e265c7ac371fe9f7a0c052021292 (diff) | |
download | chrome-ec-b81f638ba18b289d727e989e66d06a17aa625bc8.tar.gz |
zephyr: test: isl923x: Fix finish i2c write
Side effects of I2C write messages should be applied only after actual
write message. Selecting register before an I2C read message isn't
considered as a write message.
BUG=None
TEST=zmake -D test test-drivers
BRANCH=None
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: I95871d1b518c7211ff1e56b74598e7ba35358d41
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3785335
Tested-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r-- | zephyr/emul/emul_isl923x.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/zephyr/emul/emul_isl923x.c b/zephyr/emul/emul_isl923x.c index 2787c08c5c..9853d57ab1 100644 --- a/zephyr/emul/emul_isl923x.c +++ b/zephyr/emul/emul_isl923x.c @@ -380,6 +380,11 @@ static int isl923x_emul_finish_write(const struct emul *emul, int reg, struct sbat_emul_bat_data *bat; int16_t current; + /* This write only selected register for I2C read message */ + if (bytes < 2) { + return 0; + } + switch (reg) { case ISL923X_REG_CHG_CURRENT: /* Write current to battery. */ |