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🍊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@gmail.com>
This commit is contained in:
Florian Beier 2017-10-25 20:12:24 +02:00 committed by Mathias Kresin
parent fdc7cc9907
commit c4c72a9a42

View file

@ -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,
},
};