+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/gpio.c
-+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -15,6 +15,7 @@
- */
-
- #include "ath9k.h"
-+#include <linux/ath9k_platform.h>
-
- /********************************/
- /* LED functions */
-@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
- return ret;
- }
-
-+static int ath_create_platform_led(struct ath_softc *sc,
-+ const struct gpio_led *gpio)
-+{
-+ struct ath_led *led;
-+ int ret;
-+
-+ led = kzalloc(sizeof(*led), GFP_KERNEL);
-+ if (!led)
-+ return -ENOMEM;
-+
-+ led->gpio = gpio;
-+ ret = ath_add_led(sc, led);
-+ if (ret < 0)
-+ kfree(led);
-+
-+ return ret;
-+}
-+
- void ath_deinit_leds(struct ath_softc *sc)
- {
- struct ath_led *led;
-@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
-
- void ath_init_leds(struct ath_softc *sc)
- {
-+ struct ath9k_platform_data *pdata = sc->dev->platform_data;
- char led_name[32];
- const char *trigger;
-+ int i;
-
- INIT_LIST_HEAD(&sc->leds);
-
-@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc)
-
- ath_fill_led_pin(sc);
-
-+ if (pdata && pdata->leds && pdata->num_leds)
-+ for (i = 0; i < pdata->num_leds; i++) {
-+ if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
-+ sc->sc_ah->led_pin = -1;
-+
-+ ath_create_platform_led(sc, &pdata->leds[i]);
-+ }
-+
-+ if (sc->sc_ah->led_pin < 0)
-+ return;
-+
- snprintf(led_name, sizeof(led_name), "ath9k-%s",
- wiphy_name(sc->hw->wiphy));
-
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
+@@ -73,8 +73,11 @@ static int ath_add_led(struct ath_softc
ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
#ifdef CPTCFG_ATH9K_DEBUGFS
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -17,12 +17,120 @@
+@@ -16,12 +16,120 @@
+
#include "ath9k.h"
- #include <linux/ath9k_platform.h>
+#ifdef CPTCFG_MAC80211_LEDS
+
static void ath_fill_led_pin(struct ath_softc *sc)
{
struct ath_hw *ah = sc->sc_ah;
-@@ -80,6 +188,12 @@ static int ath_add_led(struct ath_softc
+@@ -79,6 +187,12 @@ static int ath_add_led(struct ath_softc
else
ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
return 0;
}
-@@ -136,17 +250,24 @@ void ath_deinit_leds(struct ath_softc *s
+@@ -117,16 +231,23 @@ void ath_deinit_leds(struct ath_softc *s
while (!list_empty(&sc->leds)) {
led = list_first_entry(&sc->leds, struct ath_led, list);
void ath_init_leds(struct ath_softc *sc)
{
- struct ath9k_platform_data *pdata = sc->dev->platform_data;
+ struct device_node *np = sc->dev->of_node;
char led_name[32];
const char *trigger;
- int i;
-@@ -156,6 +277,15 @@ void ath_init_leds(struct ath_softc *sc)
+
+@@ -135,6 +256,15 @@ void ath_init_leds(struct ath_softc *sc)
if (AR_SREV_9100(sc->sc_ah))
return;
+
ath_fill_led_pin(sc);
- if (pdata && pdata->leds && pdata->num_leds)
+ snprintf(led_name, sizeof(led_name), "ath9k-%s",
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -16,6 +16,8 @@
+@@ -15,6 +15,9 @@
+ */
#include "ath9k.h"
- #include <linux/ath9k_platform.h>
++#include <linux/ath9k_platform.h>
+#include <linux/platform_device.h>
+#include <linux/gpio_keys.h>
#ifdef CPTCFG_MAC80211_LEDS
-@@ -115,6 +117,67 @@ static void ath9k_unregister_gpio_chip(s
+@@ -114,6 +117,67 @@ static void ath9k_unregister_gpio_chip(s
kfree(gc);
}
#else /* CONFIG_GPIOLIB */
static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
-@@ -125,6 +188,14 @@ static inline void ath9k_unregister_gpio
+@@ -124,6 +188,14 @@ static inline void ath9k_unregister_gpio
{
}
#endif /* CONFIG_GPIOLIB */
/********************************/
-@@ -248,6 +319,7 @@ void ath_deinit_leds(struct ath_softc *s
+@@ -229,6 +301,7 @@ void ath_deinit_leds(struct ath_softc *s
{
struct ath_led *led;
while (!list_empty(&sc->leds)) {
led = list_first_entry(&sc->leds, struct ath_led, list);
#ifdef CONFIG_GPIOLIB
-@@ -287,6 +359,7 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -266,6 +339,7 @@ void ath_init_leds(struct ath_softc *sc)
}
ath_fill_led_pin(sc);
+ ath9k_init_buttons(sc);
- if (pdata && pdata->leds && pdata->num_leds)
- for (i = 0; i < pdata->num_leds; i++) {
+ snprintf(led_name, sizeof(led_name), "ath9k-%s",
+ wiphy_name(sc->hw->wiphy));
bool use_eeprom;
- int num_leds;
- const struct gpio_led *leds;
-
unsigned num_btns;
const struct gpio_keys_button *btns;
unsigned btn_poll_interval;