mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
drivers: sensor: Convert Kconfig bus 'depends on' to 'select'
This change in pattern is meant to address a misconfiguration issue that can occur for sensors that support being on multiple busses like I2C & SPI. For example, you can have a configuration in which such a sensor is on the I2C bus in the devicetree and the sensor is enabled. However the application configuration enables CONFIG_SPI=y and CONFIG_I2C=n and this will cause the sensor driver to be built by default, however since we don't have the I2C bus enabled the driver will not compile correctly. Previously we had been adding to board Kconfig.defconfig something like: config I2C default y if SENSOR This pattern doesn't scale well and may differ from what an application specific need/use is. So instead move to a pattern in which we leave the default enablement up to the devicetree "status" property for the sensor. We then have the Kconfig move from 'depends on <BUS>' to 'select <BUS>' and in the case of drivers that support multiple busses we have the Kconfig be: 'select <BUS> if $(dt_compat_on_bus,$(<DT_COMPAT>),<BUS>) for each bus type the sensor supports. This removes the need to add Kconfig logic to each board and enables the bus subsystem and bus controller driver if the sensor requires it by default in the build system. Fixes: #48518 Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
committed by
Fabio Baltieri
parent
25ed2875a8
commit
df81fef944
@@ -7,7 +7,7 @@ menuconfig ADT7420
|
||||
bool "ADT7420 Temperature Sensor"
|
||||
default y
|
||||
depends on DT_HAS_ADI_ADT7420_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable the driver for Analog Devices ADT7420 High-Accuracy
|
||||
16-bit Digital I2C Temperature Sensors.
|
||||
|
||||
@@ -7,6 +7,7 @@ config ADXL345
|
||||
bool "ADXL345 Three Axis accelerometer"
|
||||
default y
|
||||
depends on DT_HAS_ADI_ADXL345_ENABLED
|
||||
depends on I2C || SPI
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),spi)
|
||||
help
|
||||
Enable driver for ADXL345 Three-Axis Digital Accelerometer.
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig ADXL362
|
||||
bool "ADXL362 sensor"
|
||||
default y
|
||||
depends on DT_HAS_ADI_ADXL362_ENABLED
|
||||
depends on SPI
|
||||
select SPI
|
||||
help
|
||||
Enable driver for ADXL362 Three-Axis Digital Accelerometers.
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ menuconfig ADXL372
|
||||
bool "ADXL372 Three Axis High-g I2C/SPI accelerometer"
|
||||
default y
|
||||
depends on DT_HAS_ADI_ADXL372_ENABLED
|
||||
depends on I2C || SPI
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),spi)
|
||||
help
|
||||
Enable driver for ADXL372 Three-Axis Digital Accelerometers.
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@ config AK8975
|
||||
bool "AK8975 Magnetometer"
|
||||
default y
|
||||
depends on DT_HAS_ASAHI_KASEI_AK8975_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for AK8975 magnetometer.
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig AMG88XX
|
||||
bool "AMG88XX Infrared Thermopile Sensor"
|
||||
default y
|
||||
depends on DT_HAS_PANASONIC_AMG88XX_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for AMG88XX infrared thermopile sensor.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig AMS_IAQ_CORE
|
||||
bool "iAQ-core Digital VOC sensor"
|
||||
default y
|
||||
depends on DT_HAS_AMS_IAQCORE_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for iAQ-core Digital VOC sensor.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ menuconfig APDS9960
|
||||
bool "APDS9960 Sensor"
|
||||
default y
|
||||
depends on DT_HAS_AVAGO_APDS9960_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for APDS9960 sensors.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig BMA280
|
||||
bool "BMA280 Three Axis Accelerometer Family"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMA280_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for BMA280 I2C-based triaxial accelerometer sensor
|
||||
family.
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig BMC150_MAGN
|
||||
bool "BMC150_MAGN I2C Magnetometer Chip"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMC150_MAGN_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for BMC150 I2C-based magnetometer sensor.
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ menuconfig BME280
|
||||
bool "BME280/BMP280 sensor"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BME280_ENABLED
|
||||
depends on I2C || SPI
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME280),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME280),spi)
|
||||
help
|
||||
Enable driver for BME280 I2C-based or SPI-based temperature and pressure sensor.
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ menuconfig BME680
|
||||
bool "BME680 sensor"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BME680_ENABLED
|
||||
depends on I2C || SPI
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME680),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME680),spi)
|
||||
help
|
||||
Enable driver for BME680 I2C- or SPI- based temperature, pressure, humidity and gas sensor.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig BMG160
|
||||
bool "Bosch BMG160 gyroscope support"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMG160_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable Bosch BMG160 gyroscope support.
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ menuconfig BMI160
|
||||
bool "Bosch BMI160 inertial measurement unit"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMI160_ENABLED
|
||||
depends on SPI || I2C
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BMI160),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BMI160),spi)
|
||||
help
|
||||
Enable Bosch BMI160 inertial measurement unit that provides acceleration
|
||||
and angular rate measurements.
|
||||
|
||||
@@ -7,6 +7,6 @@ config BMI270
|
||||
bool "BMI270 Inertial measurement unit"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMI270_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for BMI270 I2C-based imu sensor
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig BMM150
|
||||
bool "BMM150 I2C Geomagnetic Chip"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMM150_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for BMM150 I2C-based Geomagnetic sensor.
|
||||
if BMM150
|
||||
|
||||
@@ -5,7 +5,8 @@ menuconfig BMP388
|
||||
bool "Bosch BMP388 pressure sensor"
|
||||
default y
|
||||
depends on DT_HAS_BOSCH_BMP388_ENABLED
|
||||
depends on SPI || I2C
|
||||
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BMP388),i2c)
|
||||
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BMP388),spi)
|
||||
help
|
||||
Enable driver for the Bosch BMP388 pressure sensor
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ menuconfig BQ274XX
|
||||
bool "BQ274xx Fuel Gauge"
|
||||
default y
|
||||
depends on DT_HAS_TI_BQ274XX_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable I2C-based driver for BQ274xx Fuel Gauge.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ menuconfig CCS811
|
||||
bool "CCS811 Digital Gas Sensor"
|
||||
default y
|
||||
depends on DT_HAS_AMS_CCS811_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for CCS811 Gas sensors.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ menuconfig DPS310
|
||||
bool "DPS310 sensor"
|
||||
default y
|
||||
depends on DT_HAS_INFINEON_DPS310_ENABLED
|
||||
depends on I2C
|
||||
select I2C
|
||||
help
|
||||
Enable driver for DPS310 I2C-based temperature and pressure sensor.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user