diff options
author | Robert Zieba <robertzieba@google.com> | 2023-03-20 19:46:47 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-14 17:53:11 +0000 |
commit | a1aae4231ab006eee3105ecd0167c0b85996ebb5 (patch) | |
tree | b646616dcb8c2c53e41ad4bffe29e390470c8971 /zephyr/emul | |
parent | ffde16edd3b2de6671ae5317e96470988deeb966 (diff) | |
download | chrome-ec-a1aae4231ab006eee3105ecd0167c0b85996ebb5.tar.gz |
zephyr/emul/retimer/anx7483: Add function to validate tuning settings
Board tests may want to have a basic check to ensure that tunings are
getting set, while the actual full testing remains in the ANX7483
emulator tests. Add `anx7483_emul_validate_tuning` function to
facilitate this.
BRANCH=none
BUG=b:247151116
TEST=Ran tests
Change-Id: I88ce43b079db98d16aedf561a463df0046c4460b
Signed-off-by: Robert Zieba <robertzieba@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4354875
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/emul')
-rw-r--r-- | zephyr/emul/retimer/emul_anx7483.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/zephyr/emul/retimer/emul_anx7483.c b/zephyr/emul/retimer/emul_anx7483.c index 507eaff2ce..13c6e39d43 100644 --- a/zephyr/emul/retimer/emul_anx7483.c +++ b/zephyr/emul/retimer/emul_anx7483.c @@ -337,6 +337,25 @@ void anx7483_emul_reset(const struct emul *emul) anx7483->regs[i].def); } +int anx7483_emul_validate_tuning(const struct emul *emul, + const struct anx7483_tuning_set *tuning, + size_t tuning_count) +{ + uint8_t val; + int rv; + + for (size_t i = 0; i < tuning_count; i++) { + rv = anx7483_emul_get_reg(emul, tuning[i].addr, &val); + if (rv) + return rv; + + if (val != tuning[i].value) + return 1; + } + + return 0; +} + static int anx7483_emul_init(const struct emul *emul, const struct device *parent) { |