librem5-devkit: Let LED use PWM
Subsystems (3)
PATCH 1/3 arm64: defconfig: Enable pattern LED trigger
In reply to Guido GüntherThis allows devices to easily use LED patterns from userspace.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -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
Signature · 1 line
2.35.1
PATCH 3/3 arm64: dts: librem5-devkit: Use function and color rather than label
In reply to Guido GüntherUse predefined colors and function rather than making up a random label.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +3 -1
@@ -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>; };
Signature · 1 line
2.35.1
cover librem5-devkit: Let LED use PWM
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(-)
Signature · 1 line
2.35.1
PATCH 2/3 arm64: dts: librem5-devkit: Make LED use PWM
We can use PWM instead of just GPIO allowing us to control brightness.
--- .../dts/freescale/imx8mq-librem5-devkit.dts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +11 -7
@@ -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"; };
Signature · 1 line
2.35.1
Re: [PATCH v1 1/3] arm64: defconfig: Enable pattern LED trigger
In reply to Guido GüntherQuoted 1 line · Guido Günther
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.
Quoted 3 lines
Signed-off-by Guido Günther <[email protected]>---
Best regards,
Krzysztof
Shawn Guo
AppliedRe: [PATCH v1 2/3] arm64: dts: librem5-devkit: Make LED use PWM
In reply to Guido GüntherQuoted 3 lines · Guido Günther
We can use PWM instead of just GPIO allowing us to control brightness.
Signed-off-by Guido Günther <[email protected]>
Applied, thanks!
Shawn Guo
AppliedRe: [PATCH v1 3/3] arm64: dts: librem5-devkit: Use function and color rather than label
In reply to Guido GüntherQuoted 3 lines · Guido Günther
Use predefined colors and function rather than making up a random label.
Signed-off-by Guido Günther <[email protected]>
Applied, thanks!