mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-24 13:36:31 +00:00
Add LED control through device tree overrides (#2038)
This commit is contained in:
parent
a38ee172f1
commit
558472baa3
@ -0,0 +1,41 @@
|
||||
From 01e15ae929bb8442f3c9cb31b7cad182ecc4d520 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <01e15ae929bb8442f3c9cb31b7cad182ecc4d520.1659172941.git.stefan@agner.ch>
|
||||
In-Reply-To: <2d3d8c091bc692999a1c519c1dc1570cc8be2358.1659172941.git.stefan@agner.ch>
|
||||
References: <2d3d8c091bc692999a1c519c1dc1570cc8be2358.1659172941.git.stefan@agner.ch>
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
Date: Sat, 30 Jul 2022 11:12:13 +0200
|
||||
Subject: [PATCH 12/13] gpio: raspberrypi-exp: Workaround polarity firmware bug
|
||||
|
||||
When configuring a GPIO as output, the firmware seems to invert the
|
||||
initial state when active low polarity is declared in the device tree.
|
||||
The bug has been acknowledged by the firmware team and will be fixed
|
||||
in a future firmware release:
|
||||
https://github.com/raspberrypi/linux/issues/5107
|
||||
|
||||
Fix this by inverting the polarity on our side as well to make sure
|
||||
the initial output is set correctly.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
drivers/gpio/gpio-raspberrypi-exp.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpio/gpio-raspberrypi-exp.c b/drivers/gpio/gpio-raspberrypi-exp.c
|
||||
index 64a552ecc2ad..f986940c3a5d 100644
|
||||
--- a/drivers/gpio/gpio-raspberrypi-exp.c
|
||||
+++ b/drivers/gpio/gpio-raspberrypi-exp.c
|
||||
@@ -119,6 +119,11 @@ static int rpi_exp_gpio_dir_out(struct gpio_chip *gc, unsigned int off, int val)
|
||||
return ret;
|
||||
set_out.polarity = ret; /* Retain existing setting */
|
||||
|
||||
+ /* Need to invert the GPIO in first config set if inverted polarity */
|
||||
+ /* See https://github.com/raspberrypi/linux/issues/5107 */
|
||||
+ if (set_out.polarity)
|
||||
+ set_out.state = !val;
|
||||
+
|
||||
ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_SET_GPIO_CONFIG,
|
||||
&set_out, sizeof(set_out));
|
||||
if (ret || set_out.gpio != 0) {
|
||||
--
|
||||
2.37.1
|
||||
|
@ -0,0 +1,68 @@
|
||||
From 713afd6c80d4635306682a5643799195846271b1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <713afd6c80d4635306682a5643799195846271b1.1659172941.git.stefan@agner.ch>
|
||||
In-Reply-To: <2d3d8c091bc692999a1c519c1dc1570cc8be2358.1659172941.git.stefan@agner.ch>
|
||||
References: <2d3d8c091bc692999a1c519c1dc1570cc8be2358.1659172941.git.stefan@agner.ch>
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
Date: Sat, 30 Jul 2022 11:21:31 +0200
|
||||
Subject: [PATCH 13/13] ARM: dts: bcm2711: yellow: Add LED overrides
|
||||
|
||||
Add device tree overrides for all three LEDs.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
|
||||
index f354bfb69093..2d272a02128b 100644
|
||||
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
|
||||
@@ -621,20 +621,24 @@ audio_pins: audio_pins {
|
||||
|
||||
&leds {
|
||||
act_led: led-act {
|
||||
- label = "led0";
|
||||
+ label = "act";
|
||||
linux,default-trigger = "activity";
|
||||
+ default-state = "off";
|
||||
gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
pwr_led: led-pwr {
|
||||
- label = "led1";
|
||||
+ label = "pwr";
|
||||
linux,default-trigger = "default-on";
|
||||
+ default-state = "off";
|
||||
gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
- user_led: led-user {
|
||||
- label = "led2";
|
||||
+ usr_led: led-usr {
|
||||
+ label = "usr";
|
||||
linux,default-trigger = "heartbeat";
|
||||
+ default-state = "off";
|
||||
+ panic-indicator;
|
||||
gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
@@ -670,14 +674,13 @@ cam0_reg: &cam1_reg {
|
||||
|
||||
/ {
|
||||
__overrides__ {
|
||||
- act_led_gpio = <&act_led>,"gpios:4";
|
||||
- act_led_activelow = <&act_led>,"gpios:8";
|
||||
act_led_trigger = <&act_led>,"linux,default-trigger";
|
||||
|
||||
- pwr_led_gpio = <&pwr_led>,"gpios:4";
|
||||
pwr_led_activelow = <&pwr_led>,"gpios:8";
|
||||
pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
|
||||
|
||||
+ usr_led_trigger = <&usr_led>,"linux,default-trigger";
|
||||
+
|
||||
eth_led0 = <&phy1>,"led-modes:0";
|
||||
eth_led1 = <&phy1>,"led-modes:4";
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user