diff mbox series

[v2,2/6] arm64: dts: imx8mq-librem5: add RGB pwm notification leds

Message ID 20220902084216.1259202-3-martin.kepplinger@puri.sm (mailing list archive)
State New, archived
Headers show
Series arm64: dts: imx8mq-librem5: phone DT updates | expand

Commit Message

Martin Kepplinger Sept. 2, 2022, 8:42 a.m. UTC
From: Guido Günther <agx@sigxcpu.org>

Describe the RGB notification leds on the Librem 5 phone.
Use the common defines so we're sure to adhere to the common patterns,
use predefined led colors and functions so we're being warned in case
of deprecations.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
---
 .../boot/dts/freescale/imx8mq-librem5.dtsi    | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Pavel Machek Sept. 6, 2022, 8:45 a.m. UTC | #1
Hi!

> From: Guido Günther <agx@sigxcpu.org>
> 
> Describe the RGB notification leds on the Librem 5 phone.
> Use the common defines so we're sure to adhere to the common patterns,
> use predefined led colors and functions so we're being warned in case
> of deprecations.

I'd like LED lists to be cc-ed on patches like this, so that we can
keep userland API consistent.

In particular, RGB LED is very common feature on the phones, and it
would be good to have it consistent accross them. Can you take a look
at Documentation/leds/well-known-leds.txt, decide if your current API
is suitable, and update the file so that we get the consistency?

Thanks,
								Pavel

> +	led-controller {
> +		compatible = "pwm-leds";
> +
> +		led-0 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_BLUE>;
> +			max-brightness = <248>;
> +			pwms = <&pwm2 0 50000 0>;
> +		};
> +
> +		led-1 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_GREEN>;
> +			max-brightness = <248>;
> +			pwms = <&pwm4 0 50000 0>;
> +		};
> +
> +		led-2 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_RED>;
> +			max-brightness = <248>;
> +			pwms = <&pwm3 0 50000 0>;
> +		};
> +	};
> +
>  	reg_aud_1v8: regulator-audio-1v8 {
>  		compatible = "regulator-fixed";
>  		pinctrl-names = "default";
> -- 
> 2.30.2
Martin Kepplinger Sept. 9, 2022, 8:32 a.m. UTC | #2
Am Dienstag, dem 06.09.2022 um 10:45 +0200 schrieb Pavel Machek:
> Hi!
> 
> > From: Guido Günther <agx@sigxcpu.org>
> > 
> > Describe the RGB notification leds on the Librem 5 phone.
> > Use the common defines so we're sure to adhere to the common
> > patterns,
> > use predefined led colors and functions so we're being warned in
> > case
> > of deprecations.
> 
> I'd like LED lists to be cc-ed on patches like this, so that we can
> keep userland API consistent.
> 
> In particular, RGB LED is very common feature on the phones, and it
> would be good to have it consistent accross them. Can you take a look
> at Documentation/leds/well-known-leds.txt, decide if your current API
> is suitable, and update the file so that we get the consistency?
> 
> Thanks,
>                                                                 Pavel

thanks for the feedback Pavel, thanks for queueing up Shawn,

that indeed says that phones should use the multicolor descriptions :)
Later, I'll send changes to have a description like that:

https://source.puri.sm/Librem5/linux/-/merge_requests/623#note_212773

which should be close to what you meant, Pavel.

thanks again,

                              martin


> 
> > +       led-controller {
> > +               compatible = "pwm-leds";
> > +
> > +               led-0 {
> > +                       function = LED_FUNCTION_STATUS;
> > +                       color = <LED_COLOR_ID_BLUE>;
> > +                       max-brightness = <248>;
> > +                       pwms = <&pwm2 0 50000 0>;
> > +               };
> > +
> > +               led-1 {
> > +                       function = LED_FUNCTION_STATUS;
> > +                       color = <LED_COLOR_ID_GREEN>;
> > +                       max-brightness = <248>;
> > +                       pwms = <&pwm4 0 50000 0>;
> > +               };
> > +
> > +               led-2 {
> > +                       function = LED_FUNCTION_STATUS;
> > +                       color = <LED_COLOR_ID_RED>;
> > +                       max-brightness = <248>;
> > +                       pwms = <&pwm3 0 50000 0>;
> > +               };
> > +       };
> > +
> >         reg_aud_1v8: regulator-audio-1v8 {
> >                 compatible = "regulator-fixed";
> >                 pinctrl-names = "default";
> > -- 
> > 2.30.2
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
index 0626e4194d958..8da7b87c1aa1f 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
@@ -7,6 +7,7 @@ 
 
 #include "dt-bindings/input/input.h"
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/leds/common.h>
 #include "dt-bindings/pwm/pwm.h"
 #include "dt-bindings/usb/pd.h"
 #include "imx8mq.dtsi"
@@ -54,6 +55,31 @@  key-vol-up {
 		};
 	};
 
+	led-controller {
+		compatible = "pwm-leds";
+
+		led-0 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_BLUE>;
+			max-brightness = <248>;
+			pwms = <&pwm2 0 50000 0>;
+		};
+
+		led-1 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
+			max-brightness = <248>;
+			pwms = <&pwm4 0 50000 0>;
+		};
+
+		led-2 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_RED>;
+			max-brightness = <248>;
+			pwms = <&pwm3 0 50000 0>;
+		};
+	};
+
 	reg_aud_1v8: regulator-audio-1v8 {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";