From b04b399d63063fa93bb09a75b6395971a4fcd2fe Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 5 May 2020 05:46:57 -0500 Subject: [PATCH] drivers: pwm: nrfx: Convert to use DTS NODELABEL for instance detection Move to using NODELABEL references to enable driver instances for PWM0..3. This will allow us to remove per-instance PWM Kconfig symbols. Signed-off-by: Kumar Gala --- drivers/pwm/Kconfig.nrfx | 8 ++++---- drivers/pwm/pwm_nrfx.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/Kconfig.nrfx b/drivers/pwm/Kconfig.nrfx index 25e0666b4a8..f925a3fc692 100644 --- a/drivers/pwm/Kconfig.nrfx +++ b/drivers/pwm/Kconfig.nrfx @@ -6,9 +6,9 @@ config PWM_NRFX default y depends on HAS_HW_NRF_PWM0 || HAS_HW_NRF_PWM1 || \ HAS_HW_NRF_PWM2 || HAS_HW_NRF_PWM3 - select NRFX_PWM0 if PWM_0 - select NRFX_PWM1 if PWM_1 - select NRFX_PWM2 if PWM_2 - select NRFX_PWM3 if PWM_3 + select NRFX_PWM0 if "$(dt_nodelabel_enabled,pwm0)" + select NRFX_PWM1 if "$(dt_nodelabel_enabled,pwm1)" + select NRFX_PWM2 if "$(dt_nodelabel_enabled,pwm2)" + select NRFX_PWM3 if "$(dt_nodelabel_enabled,pwm3)" help Enable support for nrfx Hardware PWM driver for nRF52 MCU series. diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index a786707a04a..599dc3f5114 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -422,18 +422,18 @@ static int pwm_nrfx_pm_control(struct device *dev, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &pwm_nrfx_drv_api_funcs) -#ifdef CONFIG_PWM_0 +#if DT_HAS_NODE(DT_NODELABEL(pwm0)) PWM_NRFX_DEVICE(0); #endif -#ifdef CONFIG_PWM_1 +#if DT_HAS_NODE(DT_NODELABEL(pwm1)) PWM_NRFX_DEVICE(1); #endif -#ifdef CONFIG_PWM_2 +#if DT_HAS_NODE(DT_NODELABEL(pwm2)) PWM_NRFX_DEVICE(2); #endif -#ifdef CONFIG_PWM_3 +#if DT_HAS_NODE(DT_NODELABEL(pwm3)) PWM_NRFX_DEVICE(3); #endif