From 51d14fc6708459086a2230d351705dac2db3985f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Mon, 29 Apr 2024 16:30:01 +0200 Subject: [PATCH] [nrf fromlist] boards: nordic: Add PWM support for LEDs on nRF54 DKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for first possible LED to be connected with HW PWM. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72010 Signed-off-by: Karol Lasończyk --- .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 14 ++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 13 +++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 15 +++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi index 6c6da3fa747..cc6b5e90beb 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -50,4 +50,18 @@ ; }; }; + + /omit-if-no-ref/ pwm120_default: pwm120_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm120_sleep: pwm120_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; + }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 4b04ff8dcd4..aee17df9f8f 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -31,6 +31,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -89,6 +90,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"; @@ -193,3 +201,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"; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 31c2f820f3f..ac6cd2e4357 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -64,4 +64,17 @@ low-power-enable; }; }; + + pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f64952ba886..e5f808de44b 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -43,6 +43,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + buttons { compatible = "gpio-keys"; button0: button_0 { @@ -72,6 +79,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; watchdog0 = &wdt30; sw0 = &button0; sw1 = &button1; @@ -205,3 +213,10 @@ &adc { status = "okay"; }; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_default>; + pinctrl-1 = <&pwm20_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index d8262dde994..99ba6ff3062 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -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 = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +};