ath9k: unset the default LED pin if used by platform leds
Unset the default LED gpio pin if the same gpio pin is used by a LED defined via platform LED. This prevents that the default led trigger gets assigned to this LED and the GPIO value gets changed on wifi up/down in case the led is not used for signaling the wifi state. Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
parent
af9afa2811
commit
192f0a3db8
@ -56,16 +56,21 @@
|
||||
|
||||
INIT_LIST_HEAD(&sc->leds);
|
||||
|
||||
@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
|
||||
ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
||||
!sc->sc_ah->config.led_active_high);
|
||||
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;
|
||||
+
|
||||
+ if (!pdata)
|
||||
+ ath_create_platform_led(sc, &pdata->leds[i]);
|
||||
+ }
|
||||
+
|
||||
+ if (sc->sc_ah->led_pin < 0)
|
||||
+ return;
|
||||
+
|
||||
+ for (i = 0; i < pdata->num_leds; i++)
|
||||
+ ath_create_platform_led(sc, &pdata->leds[i]);
|
||||
}
|
||||
#endif
|
||||
snprintf(led_name, sizeof(led_name), "ath9k-%s",
|
||||
wiphy_name(sc->hw->wiphy));
|
||||
|
||||
|
@ -7,15 +7,15 @@ Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
|
||||
|
||||
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
|
||||
---
|
||||
drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
|
||||
include/linux/ath9k_platform.h | 1 +
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
drivers/net/wireless/ath/ath9k/gpio.c | 7 +++++--
|
||||
include/linux/ath9k_platform.h | 1 +
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/wireless/ath/ath9k/gpio.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
|
||||
@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
|
||||
ath_fill_led_pin(sc);
|
||||
@@ -166,8 +166,11 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
if (sc->sc_ah->led_pin < 0)
|
||||
return;
|
||||
|
||||
- snprintf(led_name, sizeof(led_name), "ath9k-%s",
|
||||
- wiphy_name(sc->hw->wiphy));
|
||||
|
@ -221,12 +221,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
+ ath9k_register_gpio_chip(sc);
|
||||
+
|
||||
if (pdata && pdata->led_name)
|
||||
strncpy(led_name, pdata->led_name, sizeof(led_name));
|
||||
else
|
||||
@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
for (i = 0; i < pdata->num_leds; i++)
|
||||
ath_create_platform_led(sc, &pdata->leds[i]);
|
||||
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)
|
||||
@@ -183,6 +319,7 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
||||
!sc->sc_ah->config.led_active_high);
|
||||
}
|
||||
+
|
||||
#endif
|
||||
|
@ -123,17 +123,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
ath9k_register_gpio_chip(sc);
|
||||
+ ath9k_init_buttons(sc);
|
||||
|
||||
if (pdata && pdata->led_name)
|
||||
strncpy(led_name, pdata->led_name, sizeof(led_name));
|
||||
@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
|
||||
ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
||||
!sc->sc_ah->config.led_active_high);
|
||||
|
||||
- if (!pdata)
|
||||
+ if (!pdata || !pdata->leds || !pdata->num_leds)
|
||||
return;
|
||||
|
||||
for (i = 0; i < pdata->num_leds; i++)
|
||||
if (pdata && pdata->leds && pdata->num_leds)
|
||||
for (i = 0; i < pdata->num_leds; i++) {
|
||||
--- a/include/linux/ath9k_platform.h
|
||||
+++ b/include/linux/ath9k_platform.h
|
||||
@@ -50,6 +50,10 @@ struct ath9k_platform_data {
|
||||
|
Loading…
Reference in New Issue
Block a user