[source] ar71xx: fix LED config for DIR-869 A1
LEDE Commits
lede-commits at lists.infradead.org
Fri Nov 3 15:05:25 PDT 2017
mkresin pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/97405237638f02e6974e30959787d3d23dead5b0
commit 97405237638f02e6974e30959787d3d23dead5b0
Author: Florian Beier <beier.florian at gmail.com>
AuthorDate: Wed Oct 25 20:12:24 2017 +0200
ar71xx: fix LED config for DIR-869 A1
This fixes the LED configuration for the D-Link DIR-869 A1. In order to
support the device I probed around using an initramfs image for the
UniFi AC. Pulling GPIO 15 to low enabled the LEDs while high disabled them.
GPIO 16 set to low meant that the color was white while pulling it to high
made the color change to orange. The past code was written based upon these
findings.
However, running a flashed image I now discovered that GPIO 15 controls the
orange LEDs while GPIO 16 controls the white ones and that both are active
when low. This means that the GPIOs were inverted and one active_low was set
wrong which this patch fixes.
Behavior of the LED front after this patch is applied:
cat /sys/devices/platform/leds-gpio/leds/d-link:white:status/brightness
0 -> white LEDs are OFF
255 -> white LEDs are ON
cat /sys/devices/platform/leds-gpio/leds/d-link:orange:status/brightness
0 -> orange LEDs are OFF
255 -> orange LEDs are ON
If the brightness of both is set to 255 the LED front will be white.
If the brightness of both is set to 0 the LED front will be off.
Signed-off-by: Florian Beier <beier.florian at gmail.com>
---
target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c
index 5847423..b0894e3 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c
@@ -42,8 +42,8 @@
#define DIR869A1_GPIO_ENABLE_SWITCH 11
-#define DIR869A1_GPIO_LED_POWER 15
-#define DIR869A1_GPIO_LED_ORANGE 16
+#define DIR869A1_GPIO_LED_ORANGE 15
+#define DIR869A1_GPIO_LED_WHITE 16
#define DIR869A1_KEYS_POLL_INTERVAL 20 /* msecs */
#define DIR869A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR869A1_KEYS_POLL_INTERVAL)
@@ -59,17 +59,14 @@
static struct gpio_led dir869a1_leds_gpio[] __initdata = {
{
- /* Actually, this GPIO controls the LED power,
- * while d-link:orange:status switches it between
- * orange and white */
.name = "d-link:white:status",
- .gpio = DIR869A1_GPIO_LED_POWER,
+ .gpio = DIR869A1_GPIO_LED_WHITE,
.active_low = 1,
},
{
.name = "d-link:orange:status",
.gpio = DIR869A1_GPIO_LED_ORANGE,
- .active_low = 0,
+ .active_low = 1,
},
};
More information about the lede-commits
mailing list