[OpenWrt-Devel] [PATCH 1/2] ar71xx: fix LED setup for TL-WDR4900 v2

Adrian Schmutzler freifunk at adrianschmutzler.de
Sun Nov 17 07:11:35 EST 2019


LEDs in mach file for TL-WDR4900 v2 are just used as set up for
Archer C5/C7. However, WDR4900 uses blue front LEDs, while C7 uses
green ones. Despite, in base-files WDR4900 is actually set up with
LED labels containing "blue" for the mentioned LEDs.

This patch creates a separate LED struct for WDR4900, so the
LED can be set up correctly. Despite, the wlan5g LED is removed as
it is controlled by ath9k chip for WDR4900 (in contrast to C5/C7).

Note: While front LEDs are blue, USB LEDs (on the back) are green,
so colors seem mixed for the WDR4900 v2.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 .../files/arch/mips/ath79/mach-archer-c7.c    | 38 ++++++++++++++++++-
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
index 304a8c7057..d86cc385f5 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
@@ -105,6 +105,34 @@ static struct gpio_led archer_c7_leds_gpio[] __initdata = {
 	},
 };
 
+static struct gpio_led wdr4900_leds_gpio[] __initdata = {
+	{
+		.name		= "tp-link:blue:qss",
+		.gpio		= ARCHER_C7_GPIO_LED_QSS,
+		.active_low	= 1,
+	},
+	{
+		.name		= "tp-link:blue:system",
+		.gpio		= ARCHER_C7_GPIO_LED_SYSTEM,
+		.active_low	= 1,
+	},
+	{
+		.name		= "tp-link:blue:wlan2g",
+		.gpio		= ARCHER_C7_GPIO_LED_WLAN2G,
+		.active_low	= 1,
+	},
+	{
+		.name		= "tp-link:green:usb1",
+		.gpio		= ARCHER_C7_GPIO_LED_USB1,
+		.active_low	= 1,
+	},
+	{
+		.name		= "tp-link:green:usb2",
+		.gpio		= ARCHER_C7_GPIO_LED_USB2,
+		.active_low	= 1,
+	},
+};
+
 static struct gpio_keys_button archer_c7_gpio_keys[] __initdata = {
 	{
 		.desc		= "Reset button",
@@ -210,8 +238,6 @@ static void __init common_setup(bool pcie_slot)
 	u8 tmpmac2[ETH_ALEN];
 
 	ath79_register_m25p80(&archer_c7_flash_data);
-	ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_leds_gpio),
-				 archer_c7_leds_gpio);
 
 	if (pcie_slot) {
 		ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, mac);
@@ -263,6 +289,8 @@ static void __init archer_c5_setup(void)
 	ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(archer_c7_gpio_keys),
 					archer_c7_gpio_keys);
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_leds_gpio),
+				 archer_c7_leds_gpio);
 	common_setup(true);
 }
 
@@ -274,6 +302,8 @@ static void __init archer_c7_setup(void)
 	ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(archer_c7_gpio_keys),
 					archer_c7_gpio_keys);
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_leds_gpio),
+				 archer_c7_leds_gpio);
 	common_setup(true);
 }
 
@@ -285,6 +315,8 @@ static void __init archer_c7_v2_setup(void)
 	ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(archer_c7_v2_gpio_keys),
 					archer_c7_v2_gpio_keys);
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_leds_gpio),
+				 archer_c7_leds_gpio);
 	common_setup(true);
 }
 
@@ -296,6 +328,8 @@ static void __init tl_wdr4900_v2_setup(void)
 	ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(archer_c7_gpio_keys),
 					archer_c7_gpio_keys);
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr4900_leds_gpio),
+				 wdr4900_leds_gpio);
 	common_setup(false);
 }
 
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list