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>
70 lines
1.4 KiB
Plaintext
70 lines
1.4 KiB
Plaintext
# MPR pressure sensor configuration options
|
|
|
|
# Copyright (c) 2020 Sven Herrmann
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig MPR
|
|
bool "MPR pressure sensor"
|
|
default y
|
|
depends on DT_HAS_HONEYWELL_MPR_ENABLED
|
|
select I2C
|
|
help
|
|
Enable driver for MPR pressure sensor.
|
|
|
|
if MPR
|
|
|
|
choice
|
|
prompt "MPR Pressure Range"
|
|
default MPR_PRESSURE_RANGE_0025
|
|
config MPR_PRESSURE_RANGE_0001
|
|
bool "0 to 1"
|
|
config MPR_PRESSURE_RANGE_01_6
|
|
bool "0 to 1.6"
|
|
config MPR_PRESSURE_RANGE_02_5
|
|
bool "0 to 2.5"
|
|
config MPR_PRESSURE_RANGE_0015
|
|
bool "0 to 15"
|
|
config MPR_PRESSURE_RANGE_0025
|
|
bool "0 to 25"
|
|
config MPR_PRESSURE_RANGE_0030
|
|
bool "0 to 30"
|
|
config MPR_PRESSURE_RANGE_0060
|
|
bool "0 to 60"
|
|
config MPR_PRESSURE_RANGE_0100
|
|
bool "0 to 100"
|
|
config MPR_PRESSURE_RANGE_0160
|
|
bool "0 to 160"
|
|
config MPR_PRESSURE_RANGE_0250
|
|
bool "0 to 250"
|
|
config MPR_PRESSURE_RANGE_0400
|
|
bool "0 to 400"
|
|
config MPR_PRESSURE_RANGE_0600
|
|
bool "0 to 600"
|
|
endchoice
|
|
|
|
choice
|
|
prompt "MPR Pressure Unit"
|
|
default MPR_PRESSURE_UNIT_P
|
|
config MPR_PRESSURE_UNIT_P
|
|
bool "psi"
|
|
config MPR_PRESSURE_UNIT_K
|
|
bool "kPa"
|
|
config MPR_PRESSURE_UNIT_B
|
|
bool "bar"
|
|
config MPR_PRESSURE_UNIT_M
|
|
bool "mbar"
|
|
endchoice
|
|
|
|
choice
|
|
prompt "MPR Transfer Function"
|
|
default MPR_TRANSFER_FUNCTION_A
|
|
config MPR_TRANSFER_FUNCTION_A
|
|
bool "A"
|
|
config MPR_TRANSFER_FUNCTION_B
|
|
bool "B"
|
|
config MPR_TRANSFER_FUNCTION_C
|
|
bool "C"
|
|
endchoice
|
|
|
|
endif # MPR
|