summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-11-16 10:25:27 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-16 19:53:22 +0000
commit435c14e5d7821751d14b2955ee7b076c892860fd (patch)
treef6e7f5ee32f2acb2ad948bc054b740055ec7fe91
parent859432dfa6d6ed36f22a12e7a6206f0eb10540b9 (diff)
downloadchrome-ec-435c14e5d7821751d14b2955ee7b076c892860fd.tar.gz
zephyr: config: check for multiple instances of maxim,max695x
Use DT_COMPAT_GET_ANY_STATUS_OKAY to find the address of maxim,max695x devices and add a build check to ensure there's only on instance active. BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I9e7008759d68b7e03a38067b95abe1caaf950e09 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4030437 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com>
-rw-r--r--zephyr/shim/include/config_chip.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 51f06a2bcb..1d88f1832e 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -2108,7 +2108,10 @@ extern char mock_jump_data[sizeof(struct jump_data) + 256];
#undef CONFIG_MAX695X_SEVEN_SEGMENT_DISPLAY
#ifdef CONFIG_PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY
#define CONFIG_MAX695X_SEVEN_SEGMENT_DISPLAY
-#define PORT80_I2C_ADDR DT_REG_ADDR(DT_INST(0, maxim_max695x))
+#define PORT80_I2C_ADDR \
+ DT_REG_ADDR(DT_COMPAT_GET_ANY_STATUS_OKAY(maxim_max695x))
+BUILD_ASSERT((DT_NUM_INST_STATUS_OKAY(maxim_max695x)) == 1,
+ "Only one instance of maxim,max695x should be defined");
#endif
#undef CONFIG_CMD_SEVEN_SEG_DISPLAY