ar71xx: add correct named default wireless led by using platform leds
authorMathias Kresin <dev@kresin.me>
Wed, 22 Mar 2017 20:59:49 +0000 (21:59 +0100)
committerMathias Kresin <dev@kresin.me>
Sat, 8 Apr 2017 12:30:00 +0000 (14:30 +0200)
Instead of renaming the default wireless led attached to the wireless
chip, add a new led using the platform leds with the phy0tpt trigger
set in userspace.

When switching ar71xx to device tree, the same can be done by using the
build in GPIO controller and without adding new bindings.

Drop the now unused platform code.

Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/ar71xx/base-files/etc/board.d/01_leds
target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c
target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c

index 1ac3dc4a760acf53e73d37546e8a8ea7d1c4a31f..44d06fc1e1030006c1af22d5909eef8cf96e20ed 100755 (executable)
@@ -788,7 +788,7 @@ wnr1000-v2|\
 wnr2000-v3)
        ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
        ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0"
-       ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0"
+       ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt"
        ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
        ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
        ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
@@ -810,7 +810,7 @@ wnr2000-v4)
 wnr2200)
        ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
        ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0"
-       ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0"
+       ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt"
        ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
        ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
        ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
@@ -823,7 +823,7 @@ wnr2200)
        ;;
 wnr612-v2)
        ucidef_set_led_netdev "wan" "WAN" "netgear:green:wan" "eth0"
-       ucidef_set_led_netdev "wlan" "WLAN" "netgear:green:wlan" "wlan0"
+       ucidef_set_led_wlan "wlan" "WLAN" "netgear:green:wlan" "phy0tpt"
        ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
        ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
        ;;
index 20bb06e4867a78aae60485d0c6c7a38e82c2997c..483aed78edeae6e53136ba2a15ca67c59ba554db 100644 (file)
@@ -39,18 +39,6 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
        }
 }
 
-__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
-{
-       switch (wmac) {
-       case 0:
-               ap9x_wmac0_data.led_name = led_name;
-               break;
-       case 1:
-               ap9x_wmac1_data.led_name = led_name;
-               break;
-       }
-}
-
 __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
 {
        switch (wmac) {
index d7c018565ea9248fd69cd9ec37083c4d5887a6ca..d2a045fc1cccfe52d7f859b0f7c4f12f97fa281d 100644 (file)
@@ -20,7 +20,6 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
 void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
 void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
                              int num_leds);
-void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
 void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
                              unsigned num_btns, unsigned poll_interval);
 struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
@@ -37,8 +36,6 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
 static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
                                            struct gpio_led *leds,
                                            int num_leds) {}
-static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
-                                               const char *led_name) {}
 static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
                                            struct gpio_keys_button *btns,
                                            unsigned num_btns,
index 4961026cbc0f252fe86e1e5e5c348708ae4b7d04..6c18dc6d904c915fb43a0e182b23a0e6215dbb54 100644 (file)
@@ -170,12 +170,13 @@ static struct gpio_led wnr2000v3_wmac_leds_gpio[] = {
                .name           = "netgear:amber:test",
                .gpio           = WNR2000V3_GPIO_WMAC_LED_TEST_AMBER,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
-/* Blue WLAN LED for: WNR2000v3, WNR1000v2, WPN824N */
-static const char *wnr2000v3_wmac_led_name = "netgear:blue:wlan";
-
 static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
        {
                .name           = "netgear:green:power",
@@ -196,7 +197,13 @@ static struct gpio_led wnr612v2_leds_gpio[] __initdata = {
        }
 };
 
-static const char *wnr612v2_wmac_led_name = "netgear:green:wlan";
+static struct gpio_led wnr612v2_wmac_leds_gpio[] __initdata = {
+       {
+               .name           = "netgear:green:wlan",
+               .gpio           = WNR612V2_GPIO_WMAC_LED_WLAN_GREEN,
+               .active_low     = 1,
+       }
+};
 
 static struct gpio_led wnr1000v2_leds_gpio[] __initdata = {
        {
@@ -255,6 +262,10 @@ static struct gpio_led wnr1000v2_wmac_leds_gpio[] = {
                .name           = "netgear:green:wps",
                .gpio           = WNR1000V2_GPIO_WMAC_LED_WPS_GREEN,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
@@ -323,6 +334,10 @@ static struct gpio_led wpn824n_wmac_leds_gpio[] = {
                .name           = "netgear:amber:test",
                .gpio           = WPN824N_WGPIO_LED_TEST_AMBER,
                .active_low     = 1,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WPN824N_WGPIO_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
@@ -504,9 +519,6 @@ static void __init wnr2000v3_setup(void)
                                        ARRAY_SIZE(wnr2000v3_keys_gpio),
                                        wnr2000v3_keys_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
        ap9x_pci_setup_wmac_leds(0, wnr2000v3_wmac_leds_gpio,
                                 ARRAY_SIZE(wnr2000v3_wmac_leds_gpio));
 
@@ -548,14 +560,8 @@ static void __init wnr612v2_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr612v2_leds_gpio),
                                 wnr612v2_leds_gpio);
 
-       /*
-        * This device has no buttons on AR7241 GPIO and no extra LEDs
-        * connected to AR9285 so setup is simpler than for WNR2000v3.
-        */
-       ap9x_pci_setup_wmac_led_pin(0, WNR612V2_GPIO_WMAC_LED_WLAN_GREEN);
-       ap9x_pci_setup_wmac_led_name(0, wnr612v2_wmac_led_name);
-
-       ap9x_pci_setup_wmac_leds(0, NULL, 0);
+       ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio,
+                                ARRAY_SIZE(wnr612v2_leds_gpio));
 
        ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio,
                                 ARRAY_SIZE(wnr612v2_wmac_keys_gpio),
@@ -595,9 +601,6 @@ static void __init wnr1000v2_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr1000v2_leds_gpio),
                                 wnr1000v2_leds_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
-
        ap9x_pci_setup_wmac_leds(0, wnr1000v2_wmac_leds_gpio,
                                 ARRAY_SIZE(wnr1000v2_wmac_leds_gpio));
 
@@ -624,8 +627,6 @@ static void __init wpn824n_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wpn824n_leds_gpio),
                                 wpn824n_leds_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WPN824N_WGPIO_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2000v3_wmac_led_name);
        ap9x_pci_setup_wmac_leds(0, wpn824n_wmac_leds_gpio,
                                 ARRAY_SIZE(wpn824n_wmac_leds_gpio));
        ap9x_pci_setup_wmac_btns(0, wpn824n_wmac_keys_gpio,
index 258d254cf4abfc01a4d859f3f464b2a25aeec165..54217220f70534acb5f237ecab8969ba07afe858 100644 (file)
@@ -109,8 +109,6 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = {
        }
 };
 
-static const char *wnr2200_wmac_led_name = "netgear:blue:wlan";
-
 static struct gpio_led wnr2200_wmac_leds_gpio[] = {
        {
                .name           = "netgear:amber:test",
@@ -121,6 +119,10 @@ static struct gpio_led wnr2200_wmac_leds_gpio[] = {
                .gpio           = WNR2200_GPIO_WMAC_LED_POWER_GREEN,
                .active_low     = 1,
                .default_state  = LEDS_GPIO_DEFSTATE_ON,
+       }, {
+               .name           = "netgear:blue:wlan",
+               .gpio           = WNR2200_GPIO_WMAC_LED_WLAN_BLUE,
+               .active_low     = 1,
        }
 };
 
@@ -225,9 +227,6 @@ static void __init wnr2200_setup(void)
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
                                 wnr2200_leds_gpio);
 
-       ap9x_pci_setup_wmac_led_pin(0, WNR2200_GPIO_WMAC_LED_WLAN_BLUE);
-       ap9x_pci_setup_wmac_led_name(0, wnr2200_wmac_led_name);
-
        ap9x_pci_setup_wmac_leds(0, wnr2200_wmac_leds_gpio,
                                 ARRAY_SIZE(wnr2200_wmac_leds_gpio));