Skip to content

Commit

Permalink
[nrf noup] boards: nordic: Add PWM support for LEDs on nRF54 DKs
Browse files Browse the repository at this point in the history
Adds support for first possible LED to be connected with HW PWM.

Upstream PR: zephyrproject-rtos/zephyr#72010

Merged as noup because of conflicts.

Signed-off-by: Karol Lasończyk <[email protected]>
(cherry picked from commit 382a1ee791e3637b5b7d25f22905017c24997438)
  • Loading branch information
kl-cruz authored and gmarull committed Apr 30, 2024
1 parent b39d487 commit 362ade3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
13 changes: 13 additions & 0 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,17 @@
<NRF_PSEL(UART_CTS, 2, 5)>;
};
};

/omit-if-no-ref/ pwm120_default: pwm120_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 9, 0)>;
};
};

/omit-if-no-ref/ pwm120_sleep: pwm120_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 9, 0)>;
low-power-enable;
};
};
};
15 changes: 15 additions & 0 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
led1 = &led1;
led2 = &led2;
led3 = &led3;
pwm-led0 = &pwm_led0;
sw0 = &button0;
sw1 = &button1;
sw2 = &button2;
Expand Down Expand Up @@ -90,6 +91,13 @@
};
};

pwmleds {
compatible = "pwm-leds";
pwm_led0: pwm_led_0 {
pwms = <&pwm120 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};
};

prng: prng {
compatible = "nordic,entropy-prng";
status = "okay";
Expand Down Expand Up @@ -194,3 +202,10 @@ ipc0: &cpuapp_cpurad_ipc {
pinctrl-names = "default", "sleep";
hw-flow-control;
};

&pwm120 {
status = "okay";
pinctrl-0 = <&pwm120_default>;
pinctrl-1 = <&pwm120_sleep>;
pinctrl-names = "default", "sleep";
};
13 changes: 13 additions & 0 deletions boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,17 @@
low-power-enable;
};
};

/omit-if-no-ref/ pwm20_default: pwm20_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 8)>;
};
};

/omit-if-no-ref/ pwm20_sleep: pwm20_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 8)>;
low-power-enable;
};
};
};
15 changes: 15 additions & 0 deletions boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
};
};

pwmleds {
compatible = "pwm-leds";
pwm_led1: pwm_led_1 {
pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};
};

buttons {
compatible = "gpio-keys";
button0: button_0 {
Expand Down Expand Up @@ -72,6 +79,7 @@
led1 = &led1;
led2 = &led2;
led3 = &led3;
pwm-led0 = &pwm_led1;
watchdog0 = &wdt30;
sw0 = &button0;
sw1 = &button1;
Expand Down Expand Up @@ -205,3 +213,10 @@
&adc {
status = "okay";
};

&pwm20 {
status = "okay";
pinctrl-0 = <&pwm20_default>;
pinctrl-1 = <&pwm20_sleep>;
pinctrl-names = "default", "sleep";
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@
&button3 {
gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&pinctrl {
/omit-if-no-ref/ pwm20_default: pwm20_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 10)>;
};
};

/omit-if-no-ref/ pwm20_sleep: pwm20_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 10)>;
low-power-enable;
};
};
};

0 comments on commit 362ade3

Please sign in to comment.