riscv: dts: sifive unmatched: Add PWM controlled LEDs
authorEmil Renner Berthing <emil.renner.berthing@canonical.com>
Tue, 5 Jul 2022 21:01:43 +0000 (23:01 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 11 Aug 2022 18:34:57 +0000 (11:34 -0700)
This adds the two PWM controlled LEDs to the HiFive Unmatched device
tree. D12 is just a regular green diode, but D2 is an RGB diode with 3
PWM inputs controlling the three different colours.

Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Pavel Machek <pavel@ucw.cz>
Tested-by: Ron Economos <re@w6rz.net>
Link: https://lore.kernel.org/r/20220705210143.315151-5-emil.renner.berthing@canonical.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts

index 1f386b0..07387f9 100644 (file)
@@ -4,6 +4,8 @@
 #include "fu740-c000.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.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-poweroff";
                gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
        };
+
+       led-controller-1 {
+               compatible = "pwm-leds";
+
+               led-d12 {
+                       pwms = <&pwm0 0 7812500 PWM_POLARITY_INVERTED>;
+                       active-low;
+                       color = <LED_COLOR_ID_GREEN>;
+                       max-brightness = <255>;
+                       label = "d12";
+               };
+       };
+
+       led-controller-2 {
+               compatible = "pwm-leds-multicolor";
+
+               multi-led {
+                       color = <LED_COLOR_ID_RGB>;
+                       max-brightness = <255>;
+                       label = "d2";
+
+                       led-red {
+                               pwms = <&pwm0 2 7812500 PWM_POLARITY_INVERTED>;
+                               active-low;
+                               color = <LED_COLOR_ID_RED>;
+                       };
+
+                       led-green {
+                               pwms = <&pwm0 1 7812500 PWM_POLARITY_INVERTED>;
+                               active-low;
+                               color = <LED_COLOR_ID_GREEN>;
+                       };
+
+                       led-blue {
+                               pwms = <&pwm0 3 7812500 PWM_POLARITY_INVERTED>;
+                               active-low;
+                               color = <LED_COLOR_ID_BLUE>;
+                       };
+               };
+       };
 };
 
 &uart0 {