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>
160 lines
3.4 KiB
Plaintext
160 lines
3.4 KiB
Plaintext
# LIS2DH Three Axis Accelerometer configuration options
|
|
|
|
# Copyright (c) 2017 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig LIS2DH
|
|
bool "LIS2DH Three Axis Accelerometer"
|
|
default y
|
|
depends on DT_HAS_ST_LIS2DH_ENABLED
|
|
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LIS2DH),i2c)
|
|
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LIS2DH),spi)
|
|
help
|
|
Enable SPI/I2C-based driver for LIS2DH, LIS3DH, LSM303DLHC,
|
|
LIS2DH12, LSM303AGR triaxial accelerometer sensors.
|
|
|
|
if LIS2DH
|
|
|
|
choice LIS2DH_TRIGGER_MODE
|
|
prompt "Trigger mode"
|
|
help
|
|
Specify the type of triggering to be used by the driver.
|
|
|
|
config LIS2DH_TRIGGER_NONE
|
|
bool "No trigger"
|
|
|
|
config LIS2DH_TRIGGER_GLOBAL_THREAD
|
|
bool "Use global thread"
|
|
depends on GPIO
|
|
select LIS2DH_TRIGGER
|
|
|
|
config LIS2DH_TRIGGER_OWN_THREAD
|
|
bool "Use own thread"
|
|
depends on GPIO
|
|
select LIS2DH_TRIGGER
|
|
|
|
endchoice
|
|
|
|
config LIS2DH_TRIGGER
|
|
bool
|
|
|
|
config LIS2DH_THREAD_PRIORITY
|
|
int "Thread priority"
|
|
depends on LIS2DH_TRIGGER_OWN_THREAD
|
|
default 10
|
|
help
|
|
Priority of thread used by the driver to handle interrupts.
|
|
|
|
config LIS2DH_THREAD_STACK_SIZE
|
|
int "Thread stack size"
|
|
depends on LIS2DH_TRIGGER_OWN_THREAD
|
|
default 1024
|
|
help
|
|
Stack size of thread used by the driver to handle interrupts.
|
|
|
|
choice LIS2DH_ACCEL_RANGE
|
|
prompt "Acceleration measurement range"
|
|
default LIS2DH_ACCEL_RANGE_RUNTIME
|
|
help
|
|
Initial measurement full scale range for acceleration values.
|
|
|
|
config LIS2DH_ACCEL_RANGE_RUNTIME
|
|
bool "Set at runtime"
|
|
|
|
config LIS2DH_ACCEL_RANGE_2G
|
|
bool "+/-2g"
|
|
|
|
config LIS2DH_ACCEL_RANGE_4G
|
|
bool "+/-4g"
|
|
|
|
config LIS2DH_ACCEL_RANGE_8G
|
|
bool "+/-8g"
|
|
|
|
config LIS2DH_ACCEL_RANGE_16G
|
|
bool "+/-16g"
|
|
|
|
endchoice
|
|
|
|
choice LIS2DH_OPER_MODE
|
|
prompt "Operation mode"
|
|
default LIS2DH_OPER_MODE_NORMAL
|
|
help
|
|
Choose between high resolution, normal or low power operation
|
|
mode for chip at init.
|
|
|
|
config LIS2DH_OPER_MODE_HIGH_RES
|
|
bool "high resolution (12 bit)"
|
|
|
|
config LIS2DH_OPER_MODE_NORMAL
|
|
bool "normal (10 bit)"
|
|
|
|
config LIS2DH_OPER_MODE_LOW_POWER
|
|
bool "low power (8 bit)"
|
|
|
|
endchoice
|
|
|
|
choice LIS2DH_ODR
|
|
prompt "Output data rate frequency"
|
|
default LIS2DH_ODR_RUNTIME
|
|
help
|
|
Initial data rate frequency of acceleration data at initialization.
|
|
Supported values:
|
|
1Hz, 10Hz, 25Hz, 50Hz, 100Hz, 200Hz, 400Hz in all power modes
|
|
1620Hz, 5376Hz in low power mode only
|
|
1344Hz in normal power mode
|
|
|
|
config LIS2DH_ODR_RUNTIME
|
|
bool "Set at runtime"
|
|
|
|
config LIS2DH_ODR_1
|
|
bool "1Hz"
|
|
|
|
config LIS2DH_ODR_2
|
|
bool "10Hz"
|
|
|
|
config LIS2DH_ODR_3
|
|
bool "25Hz"
|
|
|
|
config LIS2DH_ODR_4
|
|
bool "50Hz"
|
|
|
|
config LIS2DH_ODR_5
|
|
bool "100Hz"
|
|
|
|
config LIS2DH_ODR_6
|
|
bool "200Hz"
|
|
|
|
config LIS2DH_ODR_7
|
|
bool "400Hz"
|
|
|
|
config LIS2DH_ODR_8
|
|
bool "1.6KHz"
|
|
depends on LIS2DH_OPER_MODE_LOW_POWER
|
|
|
|
config LIS2DH_ODR_9_NORMAL
|
|
bool "1.25KHz"
|
|
depends on LIS2DH_OPER_MODE_NORMAL || LIS2DH_OPER_MODE_HIGH_RES
|
|
|
|
config LIS2DH_ODR_9_LOW
|
|
bool "5KHz"
|
|
depends on LIS2DH_OPER_MODE_LOW_POWER
|
|
|
|
endchoice
|
|
|
|
config LIS2DH_BLOCK_DATA_UPDATE
|
|
bool "Output registers not updated until MSB and LSB read"
|
|
|
|
config LIS2DH_MEASURE_TEMPERATURE
|
|
bool "Temperature measurements"
|
|
select LIS2DH_BLOCK_DATA_UPDATE
|
|
help
|
|
The temperature sensor is most suitable for measuring
|
|
relative temperature. For example, it is X degrees C
|
|
cooler or warmer.
|
|
Each chip has an offset. This offset must be applied
|
|
to the result. The offset can be obtained by comparing the
|
|
the reported temperature to a reference.
|
|
This option does not apply to the LSM330DLHC.
|
|
|
|
endif # LIS2DH
|