summaryrefslogtreecommitdiff
path: root/driver/accelgyro_icm_common.h
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-04-15 00:32:57 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-16 22:32:26 +0000
commit7ffc631e080dde6741580ecf217e9565ad791a71 (patch)
treec59ed3c07ed80d8af65b3d2740f5dc95e309d9ce /driver/accelgyro_icm_common.h
parent1bfa6a7da4017b0c86d21cda2de70fb31d87ffc7 (diff)
downloadchrome-ec-7ffc631e080dde6741580ecf217e9565ad791a71.tar.gz
driver: icm: fix use of I2C_PORT_ACCEL
The ICM driver is currently using I2C_PORT_ACCEL incorrectly as a CONFIG_ value. Update the use cases to a new config option that selects between SPI and I2C communication specifically for the chip. To avoid a lot of device.h changes, the value of the config value is automatically inferred if not explicitly set. BRANCH=none BUG=b:185392974, b:146065507 TEST=zmake testall TEST=make buildall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8b1a507a76031c2bb1aaf4ca7b14b92252a941f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2826920 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/accelgyro_icm_common.h')
-rw-r--r--driver/accelgyro_icm_common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/driver/accelgyro_icm_common.h b/driver/accelgyro_icm_common.h
index 33a94274fd..8cf3b1e41d 100644
--- a/driver/accelgyro_icm_common.h
+++ b/driver/accelgyro_icm_common.h
@@ -12,6 +12,11 @@
#include "hwtimer.h"
#include "timer.h"
+#if !defined(CONFIG_ACCELGYRO_ICM_COMM_SPI) && \
+ !defined(CONFIG_ACCELGYRO_ICM_COMM_I2C)
+#error "ICM must use either SPI or I2C communication"
+#endif
+
#ifdef CONFIG_ACCEL_FIFO
/* reserve maximum 4 samples of 16 bytes */
#define ICM_FIFO_BUFFER 64