Skip to content

Commit

Permalink
boards: Make GPIO pin config default for LEDs instead of PWM
Browse files Browse the repository at this point in the history
Add an additional check for CONFIG_PWM to decide if pins associated with
LED are configured for GPIO or PWM.

Fixes zephyrproject-rtos#25337

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information
galak authored and Oleg committed May 30, 2020
1 parent 381c910 commit 4bb8176
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boards/arm/frdm_k82f/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static int frdm_k82f_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif

#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay) && CONFIG_PWM
/* Red, green, blue LEDs as PWM channels */
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/hexiwear_k64/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int hexiwear_k64_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif

#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay) && CONFIG_PWM
/* Red, green, blue LEDs as PWM channels */
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/twr_ke18f/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif

#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm, okay)
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm, okay) && CONFIG_PWM
/* Tri-color LED as PWM */
pinmux_pin_set(portb, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portd, 15, PORT_PCR_MUX(kPORT_MuxAlt2));
Expand All @@ -46,7 +46,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
pinmux_pin_set(portd, 16, PORT_PCR_MUX(kPORT_MuxAsGpio));
#endif

#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay) && CONFIG_PWM
/* User LEDs as PWM */
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt2));
Expand Down
2 changes: 1 addition & 1 deletion boards/riscv/rv32m1_vega/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int rv32m1_vega_pinmux_init(struct device *dev)
pinmux_pin_set(portb, 22, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm2), okay)
#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm2), okay) && CONFIG_PWM
/* RGB LEDs as PWM */
pinmux_pin_set(porta, 22, PORT_PCR_MUX(kPORT_MuxAlt6));
pinmux_pin_set(porta, 23, PORT_PCR_MUX(kPORT_MuxAlt6));
Expand Down

0 comments on commit 4bb8176

Please sign in to comment.