Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: sensor: Update drivers to use devicetree Kconfig symbol #48048

Merged
merged 3 commits into from
Jul 22, 2022

Conversation

galak
Copy link
Collaborator

@galak galak commented Jul 20, 2022

No description provided.

Update sensor drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
Kconfig will default to enable the drivers based on devicetree so
we don't need to explicitly set the Kconfig symbols.

Signed-off-by: Kumar Gala <galak@kernel.org>
@galak galak force-pushed the driver-sensor-kconfig-dt branch 2 times, most recently from 95fb83c to c47589d Compare July 20, 2022 06:42
@bbilas
Copy link
Collaborator

bbilas commented Jul 20, 2022

@galak Are you gonna also remove the unnecessary Kconfig symbols from samples? For example https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/sensor/ina219/prj.conf#L5=

@galak
Copy link
Collaborator Author

galak commented Jul 20, 2022

@galak Are you gonna also remove the unnecessary Kconfig symbols from samples? For example https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/sensor/ina219/prj.conf#L5=

Not in this PR. Happy to have help from others on that.

bbilas
bbilas previously approved these changes Jul 20, 2022
Comment on lines -12 to -42
CONFIG_ADT7420=y
CONFIG_ADXL345=y
CONFIG_ADXL362=y
CONFIG_ADXL372=y
CONFIG_AK8975=y
CONFIG_AMG88XX=y
CONFIG_AMS_IAQ_CORE=y
CONFIG_APDS9960=y
CONFIG_BMA280=y
CONFIG_BMC150_MAGN=y
CONFIG_BME280=y
CONFIG_BME680=y
CONFIG_BMG160=y
CONFIG_BMI160=y
CONFIG_BMI270=y
CONFIG_BMM150=y
CONFIG_BMP388=y
CONFIG_BQ274XX=y
CONFIG_CCS811=y
CONFIG_DHT=y
CONFIG_DPS310=y
CONFIG_DS18B20=y
CONFIG_ENS210=y
CONFIG_FDC2X1X=y
CONFIG_FXAS21002=y
CONFIG_FXOS8700=y
CONFIG_HMC5883L=y
CONFIG_HP206C=y
CONFIG_HTS221=y
CONFIG_I3G4250D=y
CONFIG_ICM42605=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hooray!

Comment on lines 10 to 11
depends on (I2C && $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),i2c)) || \
(SPI && $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),spi))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand this logic. The sensor has to be on one type of bus or the other, so isn't it redundant to qualify with dt_compat_on_bus now that it depends on DT_HAS_ADI_ADXL345_ENABLED?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there was a case that the sensor was on I2C and enabled, but CONFIG_I2C=n and CONFIG_SPI=y. So DT_HAS_ADI_ADXL345_ENABLED will be 'y', so we need to qualify such a case (which is why that mess of logic).

If a test or sample enables CONFIG_SENSOR=y than any sensor on the
I2C or SPI bus should be available.  We already handle this for
SPI on the board, add I2C as well.

Signed-off-by: Kumar Gala <galak@kernel.org>
@galak galak requested a review from bbilas July 21, 2022 22:13
@galak galak merged commit 67da494 into zephyrproject-rtos:main Jul 22, 2022
@galak galak deleted the driver-sensor-kconfig-dt branch July 22, 2022 07:20
carlescufi pushed a commit that referenced this pull request Mar 31, 2023
Similar to the changes made in #48048, compile in the appropriate lora
modem driver when `CONFIG_LORA=y`. The `LORA_SX12XX` symbol has no
use now so remove. LoRa and LoRaWAN subsystems are still marked as
unstable so no additional deprecation cycle is needed.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
hsearle pushed a commit to hsearle/zephyr that referenced this pull request Apr 14, 2023
Similar to the changes made in zephyrproject-rtos#48048, compile in the appropriate lora
modem driver when `CONFIG_LORA=y`. The `LORA_SX12XX` symbol has no
use now so remove. LoRa and LoRaWAN subsystems are still marked as
unstable so no additional deprecation cycle is needed.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
hsearle pushed a commit to hsearle/zephyr that referenced this pull request Apr 17, 2023
Similar to the changes made in zephyrproject-rtos#48048, compile in the appropriate lora
modem driver when `CONFIG_LORA=y`. The `LORA_SX12XX` symbol has no
use now so remove. LoRa and LoRaWAN subsystems are still marked as
unstable so no additional deprecation cycle is needed.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants