2011-12-14 20:21:36 +00:00
|
|
|
--- a/include/linux/ath9k_platform.h
|
|
|
|
+++ b/include/linux/ath9k_platform.h
|
2016-05-14 15:38:56 +00:00
|
|
|
@@ -45,6 +45,9 @@ struct ath9k_platform_data {
|
2011-12-14 20:21:36 +00:00
|
|
|
int (*external_reset)(void);
|
2014-05-20 09:35:17 +00:00
|
|
|
|
|
|
|
bool use_eeprom;
|
2011-12-14 20:21:36 +00:00
|
|
|
+
|
|
|
|
+ int num_leds;
|
|
|
|
+ const struct gpio_led *leds;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _LINUX_ATH9K_PLATFORM_H */
|
|
|
|
--- a/drivers/net/wireless/ath/ath9k/gpio.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -15,6 +15,7 @@
|
2011-12-14 20:21:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ath9k.h"
|
2013-06-15 20:14:06 +00:00
|
|
|
+#include <linux/ath9k_platform.h>
|
2011-12-14 20:21:36 +00:00
|
|
|
|
|
|
|
/********************************/
|
2013-06-15 20:14:06 +00:00
|
|
|
/* LED functions */
|
2016-05-14 15:38:56 +00:00
|
|
|
@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
|
2011-12-14 20:21:36 +00:00
|
|
|
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;
|
2016-05-14 15:38:56 +00:00
|
|
|
@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
|
2011-12-14 20:21:36 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2016-05-14 15:38:56 +00:00
|
|
|
@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
|
2011-12-14 20:21:36 +00:00
|
|
|
|
2016-05-14 15:38:56 +00:00
|
|
|
ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
|
|
|
!sc->sc_ah->config.led_active_high);
|
2011-12-14 20:21:36 +00:00
|
|
|
+
|
2011-12-16 23:41:44 +00:00
|
|
|
+ if (!pdata)
|
|
|
|
+ return;
|
|
|
|
+
|
2011-12-14 20:21:36 +00:00
|
|
|
+ for (i = 0; i < pdata->num_leds; i++)
|
|
|
|
+ ath_create_platform_led(sc, &pdata->leds[i]);
|
|
|
|
}
|
2016-05-14 15:38:56 +00:00
|
|
|
#endif
|
2011-12-14 20:21:36 +00:00
|
|
|
|