From: Florian Beier Date: Wed, 25 Oct 2017 18:12:24 +0000 (+0200) Subject: ar71xx: fix LED config for DIR-869 A1 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c4c72a9a42e07bed8f9e9eb214c0debfb5d7ab90;p=openwrt%2Fstaging%2Faparcar.git 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 --- 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 5847423891..b0894e37cc 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, }, };