riscv: dts: sifive unleashed: Add PWM controlled LEDs
authorEmil Renner Berthing <emil.renner.berthing@canonical.com>
Wed, 12 Oct 2022 11:09:28 +0000 (13:09 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 28 Oct 2022 22:27:42 +0000 (15:27 -0700)
This adds the 4 PWM controlled green LEDs to the HiFive Unleashed device
tree. The schematic doesn't specify any special function for the LEDs,
so they're added here without any default triggers and named d1, d2, d3
and d4 just like in the schematic.

Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221012110928.352910-1-emil.renner.berthing@canonical.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts

index ced0d4e479385aa54ae571be1a05c2bd519f0286..900a50526d77199930b30c6c2db1a859b30eecb8 100644 (file)
@@ -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
                compatible = "gpio-restart";
                gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
        };
+
+       led-controller {
+               compatible = "pwm-leds";
+
+               led-d1 {
+                       pwms = <&pwm0 0 7812500 PWM_POLARITY_INVERTED>;
+                       active-low;
+                       color = <LED_COLOR_ID_GREEN>;
+                       max-brightness = <255>;
+                       label = "d1";
+               };
+
+               led-d2 {
+                       pwms = <&pwm0 1 7812500 PWM_POLARITY_INVERTED>;
+                       active-low;
+                       color = <LED_COLOR_ID_GREEN>;
+                       max-brightness = <255>;
+                       label = "d2";
+               };
+
+               led-d3 {
+                       pwms = <&pwm0 2 7812500 PWM_POLARITY_INVERTED>;
+                       active-low;
+                       color = <LED_COLOR_ID_GREEN>;
+                       max-brightness = <255>;
+                       label = "d3";
+               };
+
+               led-d4 {
+                       pwms = <&pwm0 3 7812500 PWM_POLARITY_INVERTED>;
+                       active-low;
+                       color = <LED_COLOR_ID_GREEN>;
+                       max-brightness = <255>;
+                       label = "d4";
+               };
+       };
 };
 
 &uart0 {