diff options
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/CMakeLists.txt | 5 | ||||
-rw-r--r-- | zephyr/Kconfig.accelgyro_bmi | 33 | ||||
-rw-r--r-- | zephyr/Kconfig.sensor_devices | 9 | ||||
-rw-r--r-- | zephyr/projects/volteer/volteer/prj.conf | 1 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 10 |
5 files changed, 56 insertions, 2 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index ce47548d3b..883031ef7e 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -201,10 +201,11 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC "${PLATFORM_EC}/common/base32.c" zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCEL_BMA255 "${PLATFORM_EC}/driver/accel_bma2x2.c" "${PLATFORM_EC}/common/math_util.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI260 +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI "${PLATFORM_EC}/driver/accelgyro_bmi_common.c" - "${PLATFORM_EC}/driver/accelgyro_bmi260.c" "${PLATFORM_EC}/common/math_util.c") +zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI260 + "${PLATFORM_EC}/driver/accelgyro_bmi260.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_ICM "${PLATFORM_EC}/driver/accelgyro_icm_common.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_ICM426XX diff --git a/zephyr/Kconfig.accelgyro_bmi b/zephyr/Kconfig.accelgyro_bmi new file mode 100644 index 0000000000..bb8239f6d8 --- /dev/null +++ b/zephyr/Kconfig.accelgyro_bmi @@ -0,0 +1,33 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +if PLATFORM_EC_ACCELGYRO_BMI +menu "BMI Sensor Common" + +choice PLATFORM_EC_ACCELGYRO_BMI_COMM + prompt "Accelgyro BMI's communication mode" + help + When using the BMI drivers, there's the option to communicate with the + chip via several methods. This choice helps improve code size by only + compiling the needed communication channels. + +config PLATFORM_EC_ACCELGYRO_BMI_COMM_SPI + bool "Use SPI communication" + help + The BMI chip is using SPI communication. This config value is used to + save on code size as only the SPI communication code will be included + for the BMI chip. + +config PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C + bool "Use I2C communication" + help + The BMI chip is using I2C communication. This config value is used to + save on code size as only the I2C communication code will be included + for the BMI chip. + +endchoice + +endmenu # BMI Sensor +endif # PLATFORM_EC_ACCELGYRO_BMI
\ No newline at end of file diff --git a/zephyr/Kconfig.sensor_devices b/zephyr/Kconfig.sensor_devices index a62a43d6c2..3cfa41220d 100644 --- a/zephyr/Kconfig.sensor_devices +++ b/zephyr/Kconfig.sensor_devices @@ -4,6 +4,13 @@ menu "Sensor Devices" +config PLATFORM_EC_ACCELGYRO_BMI + bool "Config used to include common accelgyro BMI features" + help + Do not set this directly in a .conf file. This value should be set + using an `select` statement in other BMI family of drivers such as + BMI260. + config PLATFORM_EC_ACCELGYRO_ICM bool "Config used to include common accelgyro ICM features" help @@ -21,6 +28,7 @@ config PLATFORM_EC_ACCEL_BMA255 config PLATFORM_EC_ACCELGYRO_BMI260 bool "BMI260 Accelgyrometer Driver" + select PLATFORM_EC_ACCELGYRO_BMI help The driver supports Bosch's BMI260 which is an IMU consisting of a 16-bit tri-axial gyroscope and a 16-bit tri-axial accelerometer. @@ -38,6 +46,7 @@ config PLATFORM_EC_ACCELGYRO_ICM426XX The driver supports ICM425XX which provides both accelerometer and gyroscope readings. +rsource "Kconfig.accelgyro_bmi" rsource "Kconfig.accelgyro_icm" endmenu # Sensor devices diff --git a/zephyr/projects/volteer/volteer/prj.conf b/zephyr/projects/volteer/volteer/prj.conf index 32a2ac8118..ed3255049d 100644 --- a/zephyr/projects/volteer/volteer/prj.conf +++ b/zephyr/projects/volteer/volteer/prj.conf @@ -86,6 +86,7 @@ CONFIG_PLATFORM_EC_TABLET_MODE=y # Sensor Drivers CONFIG_PLATFORM_EC_ACCEL_BMA255=y CONFIG_PLATFORM_EC_ACCELGYRO_BMI260=y +CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y CONFIG_PLATFORM_EC_ALS_TCS3400=y # Temperature sensors diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 923937688b..e0ca82c1c9 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -1447,4 +1447,14 @@ #define CONFIG_ACCELGYRO_ICM_COMM_I2C #endif +#undef CONFIG_ACCELGYRO_BMI_COMM_SPI +#ifdef CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_SPI +#define CONFIG_ACCELGYRO_BMI_COMM_SPI +#endif + +#undef CONFIG_ACCELGYRO_BMI_COMM_I2C +#ifdef CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C +#define CONFIG_ACCELGYRO_BMI_COMM_I2C +#endif + #endif /* __CROS_EC_CONFIG_CHIP_H */ |