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

Dimitri John Ledkov dimitri.ledkov at canonical.com
Fri Feb 25 20:32:49 UTC 2022


From: David Abdurachmanov <david.abdurachmanov at 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 at 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 at canonical.com>
Signed-off-by: Andrea Righi <andrea.righi at canonical.com>
(adjust backport for v5.17 removal of soc() node upstream)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
 .../boot/dts/sifive/hifive-unleashed-a00.dts  | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

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 at 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";
-- 
2.32.0




More information about the kernel-team mailing list