diff options
author | Yuval Peress <peress@chromium.org> | 2021-04-15 10:55:25 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-16 22:32:27 +0000 |
commit | a2b75b36ebfeaf5f344e03e1c0ee0b77c11e82de (patch) | |
tree | faa28631546a204f7f718b63173c36046830b269 /include | |
parent | 7ffc631e080dde6741580ecf217e9565ad791a71 (diff) | |
download | chrome-ec-a2b75b36ebfeaf5f344e03e1c0ee0b77c11e82de.tar.gz |
driver: bmi: fix use of I2C_PORT_ACCEL
The BMI 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: I6196cc595dc61877ab2b8ed5416bebee51276927
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829010
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index be61317550..71a5724cf7 100644 --- a/include/config.h +++ b/include/config.h @@ -132,6 +132,14 @@ #undef CONFIG_ACCELGYRO_ICM_COMM_SPI #undef CONFIG_ACCELGYRO_ICM_COMM_I2C +/* Select the communication mode for the accelgyro BMI. Only one of these should + * be set. To set the value manually, simply define one or the other. If neither + * is defined, but I2C_PORT_ACCEL is defined, then CONFIG_ACCELGYRO_BMI_I2C will + * automatically be set. + */ +#undef CONFIG_ACCELGYRO_BMI_COMM_SPI +#undef CONFIG_ACCELGYRO_BMI_COMM_I2C + /* * Some chips have a portion of memory which will remain powered even * during a reset. This is called Always-On, or AON memory, and @@ -6296,4 +6304,15 @@ * !CONFIG_ACCELGYRO_ICM_COMM_I2C */ +#if !defined(CONFIG_ZEPHYR) && !defined(CONFIG_ACCELGYRO_BMI_COMM_SPI) && \ + !defined(CONFIG_ACCELGYRO_BMI_COMM_I2C) +#ifdef I2C_PORT_ACCEL +#define CONFIG_ACCELGYRO_BMI_COMM_I2C +#else +#define CONFIG_ACCELGYRO_BMI_COMM_SPI +#endif +#endif /* !CONFIG_ZEPHYR && !CONFIG_ACCELGYRO_BMI_SPI && \ + * !CONFIG_ACCELGYRO_BMI_I2C + */ + #endif /* __CROS_EC_CONFIG_H */ |