diff mbox series

[linux-riscv,J,PATCHv2,05/17] SiFive HiFive Unleashed: Add PWM LEDs (D1, D2, D3, D4)

Message ID 20220225205450.23844-6-dimitri.ledkov@canonical.com
State New
Headers show
Series Update SiFive dtbs | expand

Commit Message

Dimitri John Ledkov Feb. 25, 2022, 8:54 p.m. UTC
From: David Abdurachmanov <david.abdurachmanov@sifive.com>

BugLink: https://bugs.launchpad.net/bugs/1910965

By default no functions are assigned to LEDs. It's up to user/distribution
to provide udev rules to configure them.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
(backported from https://github.com/sifive/meta-sifive/blob/2020.11/recipes-kernel/linux/files/freedom-u540/0007-Add-PWM-LEDs-D1-D2-D3-D4.patch)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
(adjust backport for v5.17 removal of soc() node upstream)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 .../boot/dts/sifive/hifive-unleashed-a00.dts  | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
diff mbox series

Patch

diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index ced0d4e479..c7a3740ea6 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -3,6 +3,7 @@ 
 
 #include "fu540-c000.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 /* Clock frequency (in Hz) of the PCB crystal for rtcclk */
 #define RTCCLK_FREQ		1000000
@@ -25,6 +26,38 @@  memory@80000000 {
 		reg = <0x0 0x80000000 0x2 0x00000000>;
 	};
 
+	pwmleds {
+		compatible = "pwm-leds";
+		d1 {
+			label = "green:d1";
+			pwms = <&pwm0 0 7812500 PWM_POLARITY_INVERTED>;
+			active-low = <1>;
+			max-brightness = <255>;
+			linux,default-trigger = "none";
+		};
+		d2 {
+			label = "green:d2";
+			pwms = <&pwm0 1 7812500 PWM_POLARITY_INVERTED>;
+			active-low = <1>;
+			max-brightness = <255>;
+			linux,default-trigger = "none";
+		};
+		d3 {
+			label = "green:d3";
+			pwms = <&pwm0 2 7812500 PWM_POLARITY_INVERTED>;
+			active-low = <1>;
+			max-brightness = <255>;
+			linux,default-trigger = "none";
+		};
+		d4 {
+			label = "green:d4";
+			pwms = <&pwm0 3 7812500 PWM_POLARITY_INVERTED>;
+			active-low = <1>;
+			max-brightness = <255>;
+			linux,default-trigger = "none";
+		};
+	};
+
 	hfclk: hfclk {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";