drivers: pwm: nrf: Migrate Kconfig options to DT
1. Kconfig options CH pin removed. 2. Kconfig options CH inverted removed. 3. Modified pwm_nrfx.c driver to use DT defines instead of Kconfig. Signed-off-by: Gaute Gamnes <gaute.gamnes@nordicsemi.no>
This commit is contained in:
parent
7b1ebb2116
commit
d6e66d0453
2 changed files with 84 additions and 252 deletions
|
@ -196,13 +196,13 @@ static int pwm_nrfx_pm_control(struct device *dev,
|
|||
|
||||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
||||
|
||||
#define PWM_NRFX_OUTPUT_PIN(dev_idx, ch_idx) \
|
||||
(CONFIG_PWM_##dev_idx##_NRF_CH##ch_idx##_PIN | \
|
||||
(CONFIG_PWM_##dev_idx##_NRF_CH##ch_idx##_INVERTED ? \
|
||||
#define PWM_NRFX_OUTPUT_PIN(dev_idx, ch_idx) \
|
||||
(DT_NORDIC_NRF_PWM_PWM_##dev_idx##_CH##ch_idx##_PIN | \
|
||||
(DT_NORDIC_NRF_PWM_PWM_##dev_idx##_CH##ch_idx##_INVERTED ? \
|
||||
NRFX_PWM_PIN_INVERTED : 0))
|
||||
|
||||
#define PWM_NRFX_DEFAULT_VALUE(dev_idx, ch_idx) \
|
||||
(CONFIG_PWM_##dev_idx##_NRF_CH##ch_idx##_INVERTED ? \
|
||||
(DT_NORDIC_NRF_PWM_PWM_##dev_idx##_CH##ch_idx##_INVERTED ? \
|
||||
PWM_NRFX_CH_VALUE_INVERTED : PWM_NRFX_CH_VALUE_NORMAL)
|
||||
|
||||
#define PWM_NRFX_DEVICE(idx) \
|
||||
|
@ -243,65 +243,113 @@ static int pwm_nrfx_pm_control(struct device *dev,
|
|||
&pwm_nrfx_drv_api_funcs)
|
||||
|
||||
#ifdef CONFIG_PWM_0
|
||||
#ifndef CONFIG_PWM_0_NRF_CH0_INVERTED
|
||||
#define CONFIG_PWM_0_NRF_CH0_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH0_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH0_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_0_NRF_CH1_INVERTED
|
||||
#define CONFIG_PWM_0_NRF_CH1_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH0_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH0_INVERTED 0
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_0_NRF_CH2_INVERTED
|
||||
#define CONFIG_PWM_0_NRF_CH2_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH1_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH1_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_0_NRF_CH3_INVERTED
|
||||
#define CONFIG_PWM_0_NRF_CH3_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH1_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH1_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH2_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH2_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH2_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH2_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH3_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH3_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_0_CH3_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_0_CH3_INVERTED 0
|
||||
#endif
|
||||
PWM_NRFX_DEVICE(0);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PWM_1
|
||||
#ifndef CONFIG_PWM_1_NRF_CH0_INVERTED
|
||||
#define CONFIG_PWM_1_NRF_CH0_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH0_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH0_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_1_NRF_CH1_INVERTED
|
||||
#define CONFIG_PWM_1_NRF_CH1_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH0_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH0_INVERTED 0
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_1_NRF_CH2_INVERTED
|
||||
#define CONFIG_PWM_1_NRF_CH2_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH1_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH1_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_1_NRF_CH3_INVERTED
|
||||
#define CONFIG_PWM_1_NRF_CH3_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH1_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH1_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH2_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH2_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH2_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH2_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH3_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH3_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_1_CH3_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_1_CH3_INVERTED 0
|
||||
#endif
|
||||
PWM_NRFX_DEVICE(1);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PWM_2
|
||||
#ifndef CONFIG_PWM_2_NRF_CH0_INVERTED
|
||||
#define CONFIG_PWM_2_NRF_CH0_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH0_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH0_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_2_NRF_CH1_INVERTED
|
||||
#define CONFIG_PWM_2_NRF_CH1_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH0_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH0_INVERTED 0
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_2_NRF_CH2_INVERTED
|
||||
#define CONFIG_PWM_2_NRF_CH2_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH1_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH1_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_2_NRF_CH3_INVERTED
|
||||
#define CONFIG_PWM_2_NRF_CH3_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH1_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH1_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH2_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH2_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH2_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH2_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH3_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH3_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_2_CH3_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_2_CH3_INVERTED 0
|
||||
#endif
|
||||
PWM_NRFX_DEVICE(2);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PWM_3
|
||||
#ifndef CONFIG_PWM_3_NRF_CH0_INVERTED
|
||||
#define CONFIG_PWM_3_NRF_CH0_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH0_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH0_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_3_NRF_CH1_INVERTED
|
||||
#define CONFIG_PWM_3_NRF_CH1_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH0_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH0_INVERTED 0
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_3_NRF_CH2_INVERTED
|
||||
#define CONFIG_PWM_3_NRF_CH2_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH1_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH1_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef CONFIG_PWM_3_NRF_CH3_INVERTED
|
||||
#define CONFIG_PWM_3_NRF_CH3_INVERTED 0
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH1_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH1_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH2_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH2_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH2_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH2_INVERTED 0
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH3_PIN
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH3_PIN NRFX_PWM_PIN_NOT_USED
|
||||
#endif
|
||||
#ifndef DT_NORDIC_NRF_PWM_PWM_3_CH3_INVERTED
|
||||
#define DT_NORDIC_NRF_PWM_PWM_3_CH3_INVERTED 0
|
||||
#endif
|
||||
PWM_NRFX_DEVICE(3);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue