2022-10-09 12:40:08

by Guido Günther

[permalink] [raw]
Subject: [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM

We can use PWM instead of just GPIO allowing us to control brightness.

Signed-off-by: Guido Günther <[email protected]>
---
.../dts/freescale/imx8mq-librem5-devkit.dts | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
index 6445c6b90b5b..7e4b6d65fd89 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
@@ -61,14 +61,12 @@ button-3 {
};

leds {
- compatible = "gpio-leds";
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_gpio_leds>;
+ compatible = "pwm-leds";

led1 {
label = "LED 1";
- gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
- default-state = "off";
+ max-brightness = <248>;
+ pwms = <&pwm2 0 50000 0>;
};
};

@@ -615,9 +613,9 @@ MX8MQ_IOMUXC_GPIO1_IO05_GPIO1_IO5 0x19 /* TOUCH RST */
>;
};

- pinctrl_gpio_leds: gpioledgrp {
+ pinctrl_pwm_led: pwmledgrp {
fsl,pins = <
- MX8MQ_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x16
+ MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT 0x16
>;
};

@@ -920,6 +918,12 @@ &pwm1 {
status = "okay";
};

+&pwm2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_pwm_led>;
+ status = "okay";
+};
+
&snvs_pwrkey {
status = "okay";
};
--
2.35.1


2022-10-29 01:21:45

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM

On Sun, Oct 09, 2022 at 02:26:54PM +0200, Guido G?nther wrote:
> We can use PWM instead of just GPIO allowing us to control brightness.
>
> Signed-off-by: Guido G?nther <[email protected]>

Applied, thanks!