linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] librem5-devkit: Let LED use PWM
@ 2022-10-09 12:26 Guido Günther
  2022-10-09 12:26 ` [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger Guido Günther
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Guido Günther @ 2022-10-09 12:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein,
	Guido Günther, Markus Niebel, Bjorn Andersson,
	Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-kernel, linux-leds,
	phone-devel, kernel

So far it used plain GPIO but we can use PWM for brightness control.
While at that use function and color (it's a single color LED) and
enable the pattern led trigger to make it more useful.



Guido Günther (3):
  arm64: defconfig: Enable pattern LED trigger
  arm64: dts: librem5-devkit: Make LED use PWM
  arm64: dts: librem5-devkit: Use function and color rather than label

 .../dts/freescale/imx8mq-librem5-devkit.dts   | 22 ++++++++++++-------
 arch/arm64/configs/defconfig                  |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger
  2022-10-09 12:26 [PATCH v1 0/3] librem5-devkit: Let LED use PWM Guido Günther
@ 2022-10-09 12:26 ` Guido Günther
  2022-10-09 15:18   ` Krzysztof Kozlowski
  2022-10-09 12:26 ` [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM Guido Günther
  2022-10-09 12:26 ` [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label Guido Günther
  2 siblings, 1 reply; 7+ messages in thread
From: Guido Günther @ 2022-10-09 12:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein,
	Guido Günther, Markus Niebel, Bjorn Andersson,
	Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-kernel, linux-leds,
	phone-devel, kernel

This allows devices to easily use LED patterns from userspace.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 5b167649097e..68642b8aac3f 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -956,6 +956,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_CPU=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_LEDS_TRIGGER_PANIC=y
+CONFIG_LEDS_TRIGGER_PATTERN=m
 CONFIG_EDAC=y
 CONFIG_EDAC_GHES=y
 CONFIG_EDAC_LAYERSCAPE=m
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM
  2022-10-09 12:26 [PATCH v1 0/3] librem5-devkit: Let LED use PWM Guido Günther
  2022-10-09 12:26 ` [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger Guido Günther
@ 2022-10-09 12:26 ` Guido Günther
  2022-10-29  1:15   ` Shawn Guo
  2022-10-09 12:26 ` [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label Guido Günther
  2 siblings, 1 reply; 7+ messages in thread
From: Guido Günther @ 2022-10-09 12:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein,
	Guido Günther, Markus Niebel, Bjorn Andersson,
	Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-kernel, linux-leds,
	phone-devel, kernel

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

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 .../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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label
  2022-10-09 12:26 [PATCH v1 0/3] librem5-devkit: Let LED use PWM Guido Günther
  2022-10-09 12:26 ` [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger Guido Günther
  2022-10-09 12:26 ` [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM Guido Günther
@ 2022-10-09 12:26 ` Guido Günther
  2022-10-29  1:18   ` Shawn Guo
  2 siblings, 1 reply; 7+ messages in thread
From: Guido Günther @ 2022-10-09 12:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein,
	Guido Günther, Markus Niebel, Bjorn Andersson,
	Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-kernel, linux-leds,
	phone-devel, kernel

Use predefined colors and function rather than making up a random label.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
index 7e4b6d65fd89..4c8904fba1c1 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
@@ -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"
@@ -64,7 +65,8 @@ leds {
 		compatible = "pwm-leds";
 
 		led1 {
-			label = "LED 1";
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_RED>;
 			max-brightness = <248>;
 			pwms = <&pwm2 0 50000 0>;
 		};
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger
  2022-10-09 12:26 ` [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger Guido Günther
@ 2022-10-09 15:18   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-09 15:18 UTC (permalink / raw)
  To: Guido Günther, Rob Herring, Krzysztof Kozlowski, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Catalin Marinas, Will Deacon, Alexander Stein,
	Markus Niebel, Bjorn Andersson, Dmitry Baryshkov,
	Marcel Ziswiler, Vinod Koul, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-kernel, linux-leds, phone-devel, kernel

On 09/10/2022 14:26, Guido Günther wrote:
> This allows devices to easily use LED patterns from userspace.

Devices could use LED patterns even before. You need to explain why this
should go to our defconfig which is used mostly by us, kernel
developers. Not by end-users.

> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM
  2022-10-09 12:26 ` [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM Guido Günther
@ 2022-10-29  1:15   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2022-10-29  1:15 UTC (permalink / raw)
  To: Guido Günther
  Cc: Rob Herring, Krzysztof Kozlowski, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein, Markus Niebel,
	Bjorn Andersson, Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul,
	Arnd Bergmann, devicetree, linux-arm-kernel, linux-kernel,
	linux-leds, phone-devel, kernel

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 <agx@sigxcpu.org>

Applied, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label
  2022-10-09 12:26 ` [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label Guido Günther
@ 2022-10-29  1:18   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2022-10-29  1:18 UTC (permalink / raw)
  To: Guido Günther
  Cc: Rob Herring, Krzysztof Kozlowski, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Catalin Marinas, Will Deacon, Alexander Stein, Markus Niebel,
	Bjorn Andersson, Dmitry Baryshkov, Marcel Ziswiler, Vinod Koul,
	Arnd Bergmann, devicetree, linux-arm-kernel, linux-kernel,
	linux-leds, phone-devel, kernel

On Sun, Oct 09, 2022 at 02:26:55PM +0200, Guido Günther wrote:
> Use predefined colors and function rather than making up a random label.
> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>

Applied, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-29  1:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 12:26 [PATCH v1 0/3] librem5-devkit: Let LED use PWM Guido Günther
2022-10-09 12:26 ` [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger Guido Günther
2022-10-09 15:18   ` Krzysztof Kozlowski
2022-10-09 12:26 ` [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM Guido Günther
2022-10-29  1:15   ` Shawn Guo
2022-10-09 12:26 ` [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label Guido Günther
2022-10-29  1:18   ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).