[source] ath9k: unset the default LED pin if used by platform leds

LEDE Commits lede-commits at lists.infradead.org
Sat Apr 8 05:30:35 PDT 2017


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/192f0a3db8598fc6faa47788d0152bda54c5109a

commit 192f0a3db8598fc6faa47788d0152bda54c5109a
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Tue Mar 21 23:21:57 2017 +0100

    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 at kresin.me>
---
 .../patches/531-ath9k_extra_platform_leds.patch     | 21 +++++++++++++--------
 .../patches/546-ath9k_platform_led_name.patch       | 12 ++++++------
 .../patches/548-ath9k_enable_gpio_chip.patch        | 12 ++++++------
 .../patches/549-ath9k_enable_gpio_buttons.patch     | 13 ++-----------
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
index 35d8e8b..8ed7ad8 100644
--- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
+++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
@@ -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;
++
++			ath_create_platform_led(sc, &pdata->leds[i]);
++		}
 +
-+	if (!pdata)
++	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));
  
diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
index ced72c6..ddb3fe6 100644
--- a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
+++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
@@ -7,15 +7,15 @@ Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
 
 Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz at 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));
diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
index d426928..4e28abb 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -221,12 +221,12 @@ Signed-off-by: Felix Fietkau <nbd at 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
diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
index f40bac9..8aefcf4 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -123,17 +123,8 @@ Signed-off-by: Felix Fietkau <nbd at 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 {



More information about the lede-commits mailing list