[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57d1ee28-933a-ce84-2715-7d7390920b6e@w6rz.net>
Date: Fri, 8 Jul 2022 02:21:27 -0700
From: Ron Economos <re@...z.net>
To: Emil Renner Berthing <emil.renner.berthing@...onical.com>,
linux-kernel@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Vincent Pelletier <plr.vincent@...il.com>,
Bin Meng <bin.meng@...driver.com>,
Aurelien Jarno <aurelien@...el32.net>,
Ron Economos <w6rz@...cast.net>,
Qiu Wenbo <qiuwenbo@...inos.com.cn>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Stephen L Arnold <nerdboy@...too.org>,
Jianlong Huang <jianlong.huang@...rfivetech.com>,
Mark Kettenis <kettenis@...nbsd.org>,
Sven Schwermer <sven.schwermer@...ruptive-technologies.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
David Abdurachmanov <davidlt@...osinc.com>,
linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v1 4/4] riscv: dts: sifive unmatched: Add PWM controlled
LEDs
On 7/5/22 2:01 PM, Emil Renner Berthing wrote:
> 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@...onical.com>
> ---
> .../boot/dts/sifive/hifive-unmatched-a00.dts | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts
> index c4ed9efdff03..beaefe74755a 100644
> --- a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts
> +++ b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts
> @@ -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
> @@ -44,6 +46,46 @@ gpio-poweroff {
> 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 {
Tested on HiFive Unmatched with both udev and systemd. Works good.
Tested-by: Ron Economos <re@...z.net>
Powered by blists - more mailing lists