drivers: pwm: Update drivers to use devicetree Kconfig symbol

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

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
Kumar Gala 2022-07-21 16:13:45 -05:00 committed by Kumar Gala
commit 885087b328
24 changed files with 52 additions and 45 deletions

View file

@ -3,6 +3,7 @@
config PWM_TELINK_B91 config PWM_TELINK_B91
bool "Telink Semiconductor B91 PWM driver" bool "Telink Semiconductor B91 PWM driver"
depends on SOC_RISCV_TELINK_B91 default y
depends on DT_HAS_TELINK_B91_PWM_ENABLED
help help
Enables Telink B91 PWM driver. Enables Telink B91 PWM driver.

View file

@ -4,21 +4,18 @@
# Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. # Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ESPRESSIF_ESP32_LEDC := espressif,esp32-ledc
DT_COMPAT_ESPRESSIF_ESP32_MCPWM := espressif,esp32-mcpwm
config PWM_LED_ESP32 config PWM_LED_ESP32
bool "ESP32 PWM LED driver" bool "ESP32 PWM LED driver"
depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3 default y
default $(dt_compat_enabled,$(DT_COMPAT_ESPRESSIF_ESP32_LEDC)) depends on DT_HAS_ESPRESSIF_ESP32_LEDC_ENABLED
help help
This option enables the PWM LED driver for ESP32 family of This option enables the PWM LED driver for ESP32 family of
processors. processors.
config MCPWM_ESP32 config MCPWM_ESP32
bool "ESP32 MCPWM driver" bool "ESP32 MCPWM driver"
depends on SOC_ESP32 default y
default $(dt_compat_enabled,$(DT_COMPAT_ESPRESSIF_ESP32_MCPWM)) depends on DT_HAS_ESPRESSIF_ESP32_MCPWM_ENABLED
help help
This option enables the MCPWM driver for ESP32 family of This option enables the MCPWM driver for ESP32 family of
processors. processors.

View file

@ -1,11 +1,9 @@
# Copyright (c) 2021 Teslabs Engineering S.L. # Copyright (c) 2021 Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_GD_GD32_PWM := gd,gd32-pwm
config PWM_GD32 config PWM_GD32
bool "GigaDevice GD32 PWM driver" bool "GigaDevice GD32 PWM driver"
depends on (SOC_FAMILY_GD32 || SOC_SERIES_GD32VF103) default y
default $(dt_compat_enabled,$(DT_COMPAT_GD_GD32_PWM)) depends on DT_HAS_GD_GD32_PWM_ENABLED
help help
Enable the GigaDevice GD32 PWM driver. Enable the GigaDevice GD32 PWM driver.

View file

@ -5,7 +5,8 @@
config PWM_GECKO config PWM_GECKO
bool "GECKO MCU PWM driver" bool "GECKO MCU PWM driver"
depends on SOC_FAMILY_EXX32 default y
depends on DT_HAS_SILABS_GECKO_PWM_ENABLED
select SOC_GECKO_TIMER select SOC_GECKO_TIMER
help help
This option enables the PWM driver for EXX32 GECKO family of This option enables the PWM driver for EXX32 GECKO family of

View file

@ -5,6 +5,8 @@
menuconfig PWM_IMX menuconfig PWM_IMX
bool "i.MX PWM Driver" bool "i.MX PWM Driver"
default y
depends on DT_HAS_FSL_IMX27_PWM_ENABLED
help help
Enable support for i.MX pwm driver. Enable support for i.MX pwm driver.

View file

@ -5,7 +5,8 @@
config PWM_ITE_IT8XXX2 config PWM_ITE_IT8XXX2
bool "ITE IT8XXX2 embedded controller (EC) PWM driver" bool "ITE IT8XXX2 embedded controller (EC) PWM driver"
depends on SOC_IT8XXX2 default y
depends on DT_HAS_ITE_IT8XXX2_PWM_ENABLED
help help
Enable PWM driver for it8xxx2_evb. Enable PWM driver for it8xxx2_evb.
Supports three 16-bit prescalers each with 8-bit cycle timer, and Supports three 16-bit prescalers each with 8-bit cycle timer, and

View file

@ -6,8 +6,8 @@
menuconfig PWM_LITEX menuconfig PWM_LITEX
bool "LiteX PWM driver" bool "LiteX PWM driver"
depends on SOC_RISCV32_LITEX_VEXRISCV default y
depends on HAS_DTS depends on DT_HAS_LITEX_PWM_ENABLED
help help
Enable support for LiteX PWM driver Enable support for LiteX PWM driver

View file

@ -5,6 +5,7 @@
config PWM_MCUX config PWM_MCUX
bool "MCUX PWM driver" bool "MCUX PWM driver"
depends on HAS_MCUX_PWM default y
depends on DT_HAS_NXP_IMX_PWM_ENABLED
help help
Enable mcux pwm driver. Enable mcux pwm driver.

View file

@ -5,7 +5,8 @@
config PWM_MCUX_FTM config PWM_MCUX_FTM
bool "MCUX FTM PWM driver" bool "MCUX FTM PWM driver"
depends on HAS_MCUX_FTM default y
depends on DT_HAS_NXP_KINETIS_FTM_PWM_ENABLED
select PINCTRL select PINCTRL
help help
Enable support for mcux ftm pwm driver. Enable support for mcux ftm pwm driver.

View file

@ -5,7 +5,9 @@
config PWM_MCUX_PWT config PWM_MCUX_PWT
bool "MCUX PWT PWM capture driver" bool "MCUX PWT PWM capture driver"
depends on HAS_MCUX_PWT && CLOCK_CONTROL && PWM_CAPTURE default y
depends on DT_HAS_NXP_KINETIS_PWT_ENABLED
depends on CLOCK_CONTROL && PWM_CAPTURE
select PINCTRL select PINCTRL
help help
Enable the MCUX Pulse Width Timer (PWT) PWM capture driver. Enable the MCUX Pulse Width Timer (PWT) PWM capture driver.

View file

@ -3,6 +3,7 @@
config PWM_MCUX_SCTIMER config PWM_MCUX_SCTIMER
bool "MCUX SCTimer PWM driver" bool "MCUX SCTimer PWM driver"
depends on HAS_MCUX_SCTIMER default y
depends on DT_HAS_NXP_SCTIMER_PWM_ENABLED
help help
Enable sctimer based pwm driver. Enable sctimer based pwm driver.

View file

@ -5,7 +5,9 @@
config PWM_MCUX_TPM config PWM_MCUX_TPM
bool "MCUX TPM PWM driver" bool "MCUX TPM PWM driver"
depends on HAS_MCUX_TPM && CLOCK_CONTROL default y
depends on DT_HAS_NXP_KINETIS_TPM_ENABLED
depends on CLOCK_CONTROL
select PINCTRL select PINCTRL
help help
Enable the MCUX TPM PWM driver. Enable the MCUX TPM PWM driver.

View file

@ -5,7 +5,8 @@
config PWM_NPCX config PWM_NPCX
bool "Nuvoton NPCX embedded controller (EC) PWM driver" bool "Nuvoton NPCX embedded controller (EC) PWM driver"
depends on SOC_FAMILY_NPCX default y
depends on DT_HAS_NUVOTON_NPCX_PWM_ENABLED
help help
This option enables the PWM driver for NPCX family of This option enables the PWM driver for NPCX family of
processors. processors.

View file

@ -6,7 +6,8 @@
config PWM_NRF5_SW config PWM_NRF5_SW
bool "Nordic Semiconductor nRF5x series S/W PWM" bool "Nordic Semiconductor nRF5x series S/W PWM"
default y if !PWM_NRFX default y if !PWM_NRFX
depends on HAS_HW_NRF_PPI depends on DT_HAS_NORDIC_NRF_SW_PWM_ENABLED
depends on DT_HAS_NORDIC_NRF_PPI_ENABLED
select NRFX_GPIOTE select NRFX_GPIOTE
select NRFX_PPI select NRFX_PPI
help help

View file

@ -4,10 +4,7 @@
config PWM_NRFX config PWM_NRFX
bool "nRF PWM nrfx driver" bool "nRF PWM nrfx driver"
default y default y
depends on HAS_HW_NRF_PWM0 \ depends on DT_HAS_NORDIC_NRF_PWM_ENABLED
|| HAS_HW_NRF_PWM1 \
|| HAS_HW_NRF_PWM2 \
|| HAS_HW_NRF_PWM3
select NRFX_PWM0 if HAS_HW_NRF_PWM0 select NRFX_PWM0 if HAS_HW_NRF_PWM0
select NRFX_PWM1 if HAS_HW_NRF_PWM1 select NRFX_PWM1 if HAS_HW_NRF_PWM1
select NRFX_PWM2 if HAS_HW_NRF_PWM2 select NRFX_PWM2 if HAS_HW_NRF_PWM2

View file

@ -1,13 +1,10 @@
# Copyright (c) 2022, Joep Buruma # Copyright (c) 2022, Joep Buruma
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# Workaround for not being able to have commas in macro arguments
DT_COMPAT_RPI_PICO_PWM := raspberrypi,pico-pwm
config PWM_RPI_PICO config PWM_RPI_PICO
bool "RPi Pico PWM" bool "RPi Pico PWM"
default $(dt_compat_enabled,$(DT_COMPAT_RPI_PICO_PWM)) default y
depends on SOC_SERIES_RP2XXX depends on DT_HAS_RASPBERRYPI_PICO_PWM_ENABLED
depends on RESET depends on RESET
select PICOSDK_USE_PWM select PICOSDK_USE_PWM
help help

View file

@ -5,6 +5,8 @@
config PWM_RV32M1_TPM config PWM_RV32M1_TPM
bool "RV32M1 TPM PWM driver" bool "RV32M1 TPM PWM driver"
depends on HAS_RV32M1_TPM && CLOCK_CONTROL default y
depends on DT_HAS_OPENISA_RV32M1_TPM_ENABLED
depends on CLOCK_CONTROL
help help
Enable the RV32M1 TPM PWM driver. Enable the RV32M1 TPM PWM driver.

View file

@ -5,6 +5,7 @@
config PWM_SAM config PWM_SAM
bool "Atmel SAM MCU Family PWM Driver" bool "Atmel SAM MCU Family PWM Driver"
depends on SOC_FAMILY_SAM default y
depends on DT_HAS_ATMEL_SAM_PWM_ENABLED
help help
Enable PWM driver for Atmel SAM MCUs. Enable PWM driver for Atmel SAM MCUs.

View file

@ -5,6 +5,7 @@
config PWM_SAM0_TCC config PWM_SAM0_TCC
bool "Atmel SAM0 MCU Family TCC PWM Driver" bool "Atmel SAM0 MCU Family TCC PWM Driver"
depends on SOC_FAMILY_SAM0 default y
depends on DT_HAS_ATMEL_SAM0_TCC_PWM_ENABLED
help help
Enable PWM driver for Atmel SAM0 MCUs using the TCC timer/counter. Enable PWM driver for Atmel SAM0 MCUs using the TCC timer/counter.

View file

@ -5,8 +5,8 @@
menuconfig PWM_SIFIVE menuconfig PWM_SIFIVE
bool "SiFive Freedom PWM driver" bool "SiFive Freedom PWM driver"
depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM default y
depends on HAS_DTS depends on DT_HAS_SIFIVE_PWM0_ENABLED
help help
Enable the PWM driver for the SiFive Freedom platform Enable the PWM driver for the SiFive Freedom platform

View file

@ -5,7 +5,8 @@
config PWM_STM32 config PWM_STM32
bool "STM32 MCU PWM driver" bool "STM32 MCU PWM driver"
depends on SOC_FAMILY_STM32 default y
depends on DT_HAS_ST_STM32_PWM_ENABLED
select USE_STM32_LL_TIM select USE_STM32_LL_TIM
select USE_STM32_LL_RCC if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X select USE_STM32_LL_RCC if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X
help help

View file

@ -2,9 +2,8 @@
# Organisation (CSIRO) ABN 41 687 119 230. # Organisation (CSIRO) ABN 41 687 119 230.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_VND_PWM := vnd,pwm
# Hidden option for turning on the dummy driver for vnd,pwm devices # Hidden option for turning on the dummy driver for vnd,pwm devices
# used in testing. # used in testing.
config PWM_TEST config PWM_TEST
def_bool $(dt_compat_enabled,$(DT_COMPAT_VND_PWM)) def_bool DT_HAS_VND_PWM_ENABLED
depends on DT_HAS_VND_PWM_ENABLED

View file

@ -3,11 +3,9 @@
# Copyright (c) 2019 Intel Corporation # Copyright (c) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_PWM_XEC := microchip,xec-pwm
config PWM_XEC config PWM_XEC
bool "Microchip XEC PWM" bool "Microchip XEC PWM"
depends on SOC_FAMILY_MEC default y
default $(dt_compat_enabled,${DT_COMPAT_PWM_XEC}) depends on DT_HAS_MICROCHIP_XEC_PWM_ENABLED
help help
Enable driver to utilize PWM on the Microchip XEC IP block. Enable driver to utilize PWM on the Microchip XEC IP block.

View file

@ -5,5 +5,7 @@
config PWM_XLNX_AXI_TIMER config PWM_XLNX_AXI_TIMER
bool "Xilinx AXI Timer driver" bool "Xilinx AXI Timer driver"
default y
depends on DT_HAS_XLNX_XPS_TIMER_1_00_A_PWM_ENABLED
help help
Enable PWM support for the Xilinx AXI Timer v2.0 IP. Enable PWM support for the Xilinx AXI Timer v2.0 IP.