Skip to content
Permalink
Browse files

dts: Rename PWM to PWMS

We use the following commands to rename any _PWM_{CONTROLLER,CHANNEL}
to *_PWMS_{CONTROLLER,CHANNEL}

Used the following commands to make these changes:

git grep -l '[A-Z_0-9]*_PWM_CONTROLLER' | xargs sed -i 's/\([A-Z_0-9]*\)_PWM_CONTROLLER/DT_ALIAS_\1_PWMS_CONTROLLER/g'
git grep -l '[A-Z_0-9]*_PWM_CHANNEL' | xargs sed -i 's/\([A-Z_0-9]*\)_PWM_CHANNEL/DT_ALIAS_\1_PWMS_CHANNEL/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information...
galak committed Jun 22, 2019
1 parent 6b40394 commit 24b2b594dc436f91c9d619203ba9654efd832bd7
@@ -36,10 +36,10 @@
#elif defined(CONFIG_BOARD_COLIBRI_IMX7D_M4)
#define PWM_DRIVER PWM_1_LABEL
#define PWM_CHANNEL 0
#elif defined(PWM_LED0_PWM_CONTROLLER) && defined(PWM_LED0_PWM_CHANNEL)
#elif defined(DT_ALIAS_PWM_LED0_PWMS_CONTROLLER) && defined(DT_ALIAS_PWM_LED0_PWMS_CHANNEL)
/* get the defines from dt (based on alias 'pwm-led0') */
#define PWM_DRIVER PWM_LED0_PWM_CONTROLLER
#define PWM_CHANNEL PWM_LED0_PWM_CHANNEL
#define PWM_DRIVER DT_ALIAS_PWM_LED0_PWMS_CONTROLLER
#define PWM_CHANNEL DT_ALIAS_PWM_LED0_PWMS_CHANNEL
#else
#error "Choose supported PWM driver"
#endif
@@ -34,14 +34,14 @@
#elif defined(CONFIG_SOC_ESP32)
#define PWM_DRIVER CONFIG_PWM_LED_ESP32_DEV_NAME_0
#define PWM_CHANNEL 21
#elif defined(PWM_LED0_PWM_CONTROLLER) && defined(PWM_LED0_PWM_CHANNEL)
#elif defined(DT_ALIAS_PWM_LED0_PWMS_CONTROLLER) && defined(DT_ALIAS_PWM_LED0_PWMS_CHANNEL)
/* get the defines from dt (based on alias 'pwm-led0') */
#define PWM_DRIVER PWM_LED0_PWM_CONTROLLER
#define PWM_CHANNEL PWM_LED0_PWM_CHANNEL
#define PWM_DRIVER DT_ALIAS_PWM_LED0_PWMS_CONTROLLER
#define PWM_CHANNEL DT_ALIAS_PWM_LED0_PWMS_CHANNEL
#elif defined(CONFIG_BOARD_HIFIVE1)
/* Blink the blue channel of the RGB LED */
#define PWM_DRIVER LED1_PWM_CONTROLLER
#define PWM_CHANNEL LED1_PWM_CHANNEL
#define PWM_DRIVER DT_ALIAS_LED1_PWMS_CONTROLLER
#define PWM_CHANNEL DT_ALIAS_LED1_PWMS_CHANNEL
#else
#error "Choose supported PWM driver"
#endif
@@ -2,9 +2,9 @@ sample:
name: RGB LED
tests:
sample.rgb_led:
filter: DT_PWM_LEDS_RED_PWM_LED_PWM_CONTROLLER and
DT_PWM_LEDS_GREEN_PWM_LED_PWM_CONTROLLER and
DT_PWM_LEDS_BLUE_PWM_LED_PWM_CONTROLLER
filter: DT_ALIAS_RED_PWM_LED_PWMS_CONTROLLER and
DT_ALIAS_GREEN_PWM_LED_PWMS_CONTROLLER and
DT_ALIAS_BLUE_PWM_LED_PWMS_CONTROLLER
tags: drivers pwm
depends_on: pwm
harness: led
@@ -15,21 +15,21 @@
#include <device.h>
#include <drivers/pwm.h>

#if defined(RED_PWM_LED_PWM_CONTROLLER) && \
defined(RED_PWM_LED_PWM_CHANNEL) && \
defined(GREEN_PWM_LED_PWM_CONTROLLER) && \
defined(GREEN_PWM_LED_PWM_CHANNEL) && \
defined(BLUE_PWM_LED_PWM_CONTROLLER) && \
defined(BLUE_PWM_LED_PWM_CHANNEL)
#if defined(DT_ALIAS_RED_PWM_LED_PWMS_CONTROLLER) && \
defined(DT_ALIAS_RED_PWM_LED_PWMS_CHANNEL) && \
defined(DT_ALIAS_GREEN_PWM_LED_PWMS_CONTROLLER) && \
defined(DT_ALIAS_GREEN_PWM_LED_PWMS_CHANNEL) && \
defined(DT_ALIAS_BLUE_PWM_LED_PWMS_CONTROLLER) && \
defined(DT_ALIAS_BLUE_PWM_LED_PWMS_CHANNEL)
/* Get the defines from dt (based on aliases 'red-pwm-led', 'green-pwm-led' &
* 'blue-pwm-led')
*/
#define PWM_DEV0 RED_PWM_LED_PWM_CONTROLLER
#define PWM_CH0 RED_PWM_LED_PWM_CHANNEL
#define PWM_DEV1 GREEN_PWM_LED_PWM_CONTROLLER
#define PWM_CH1 GREEN_PWM_LED_PWM_CHANNEL
#define PWM_DEV2 BLUE_PWM_LED_PWM_CONTROLLER
#define PWM_CH2 BLUE_PWM_LED_PWM_CHANNEL
#define PWM_DEV0 DT_ALIAS_RED_PWM_LED_PWMS_CONTROLLER
#define PWM_CH0 DT_ALIAS_RED_PWM_LED_PWMS_CHANNEL
#define PWM_DEV1 DT_ALIAS_GREEN_PWM_LED_PWMS_CONTROLLER
#define PWM_CH1 DT_ALIAS_GREEN_PWM_LED_PWMS_CHANNEL
#define PWM_DEV2 DT_ALIAS_BLUE_PWM_LED_PWMS_CONTROLLER
#define PWM_CH2 DT_ALIAS_BLUE_PWM_LED_PWMS_CHANNEL
#else
#error "Choose supported board or add new board for the application"
#endif

0 comments on commit 24b2b59

Please sign in to comment.
You can’t perform that action at this time.