lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue,  1 Mar 2022 01:48:37 +0800
From:   Icenowy Zheng <icenowy@...c.io>
To:     Rob Herring <robh+dt@...nel.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>
Cc:     devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Icenowy Zheng <icenowy@...c.io>
Subject: [PATCH 2/2] riscv: dts: sifive: add pwm leds for HiFive Unleashed

The PWM0 controller of HiFive Unleashed's FU540-C000 chip is connected
to 4 LEDs.

Add them to the device tree, with function and default trigger set from
the triggers used in old kernels done by SiFive.

Signed-off-by: Icenowy Zheng <icenowy@...c.io>
---
 .../boot/dts/sifive/hifive-unleashed-a00.dts  | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index 44824d7e50ac7..2935719ca169e 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -3,6 +3,8 @@
 
 #include "fu540-c000.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/pwm/pwm.h>
 
 /* Clock frequency (in Hz) of the PCB crystal for rtcclk */
 #define RTCCLK_FREQ		1000000
@@ -32,6 +34,46 @@ hfclk: hfclk {
 		clock-output-names = "hfclk";
 	};
 
+	led-controller {
+		compatible = "pwm-leds";
+
+		led-0 {
+			color = <LED_COLOR_ID_GREEN>;
+			pwms = <&pwm0 0 10000000 PWM_POLARITY_INVERTED>;
+			active-low;
+			max-brightness = <255>;
+			function = LED_FUNCTION_HEARTBEAT;
+			linux,default-trigger = "heartbeat";
+		};
+
+		led-1 {
+			color = <LED_COLOR_ID_GREEN>;
+			pwms = <&pwm0 1 10000000 PWM_POLARITY_INVERTED>;
+			active-low;
+			max-brightness = <255>;
+			function = LED_FUNCTION_MTD;
+			linux,default-trigger = "mtd";
+		};
+
+		led-2 {
+			color = <LED_COLOR_ID_GREEN>;
+			pwms = <&pwm0 2 10000000 PWM_POLARITY_INVERTED>;
+			active-low;
+			max-brightness = <255>;
+			function = LED_FUNCTION_LAN;
+			linux,default-trigger = "netdev";
+		};
+
+		led-3 {
+			color = <LED_COLOR_ID_GREEN>;
+			pwms = <&pwm0 3 10000000 PWM_POLARITY_INVERTED>;
+			active-low;
+			max-brightness = <255>;
+			function = LED_FUNCTION_PANIC;
+			linux,default-trigger = "panic";
+		};
+	};
+
 	memory@...00000 {
 		device_type = "memory";
 		reg = <0x0 0x80000000 0x2 0x00000000>;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ