[source] ath9k: enable GPIO chip only if requested via DT

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


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

commit 20b45df7ebcd18802d56f51893d40af43b687cb3
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Mar 22 07:29:32 2017 +0100

    ath9k: enable GPIO chip only if requested via DT
    
    In case that the atheros device tree binding is used, enable access to
    the GPIO chip only if the gpio-controller device tree parameter is used
    for the ath9k node.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../patches/548-ath9k_enable_gpio_chip.patch       | 25 ++++++++++++++++------
 .../patches/549-ath9k_enable_gpio_buttons.patch    |  6 +++---
 2 files changed, 21 insertions(+), 10 deletions(-)

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 4e28abb..10047a7 100644
--- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
+++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
@@ -196,7 +196,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	return 0;
  }
  
-@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
+@@ -136,17 +264,24 @@ void ath_deinit_leds(struct ath_softc *s
  
  	while (!list_empty(&sc->leds)) {
  		led = list_first_entry(&sc->leds, struct ath_led, list);
@@ -215,16 +215,27 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  }
  
  void ath_init_leds(struct ath_softc *sc)
-@@ -158,6 +292,8 @@ 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 +291,13 @@ void ath_init_leds(struct ath_softc *sc)
+ 	if (AR_SREV_9100(sc->sc_ah))
+ 		return;
  
++	if (!np)
++		ath9k_register_gpio_chip(sc);
++
++	/* setup gpio controller only if requested */
++	if (of_property_read_bool(np, "gpio-controller"))
++		ath9k_register_gpio_chip(sc);
++
  	ath_fill_led_pin(sc);
  
-+	ath9k_register_gpio_chip(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)
-@@ -183,6 +319,7 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -183,6 +325,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);
  }
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 8aefcf4..1d1efe5 100644
--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
+++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
@@ -117,10 +117,10 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	while (!list_empty(&sc->leds)) {
  		led = list_first_entry(&sc->leds, struct ath_led, list);
  #ifdef CONFIG_GPIOLIB
-@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
- 	ath_fill_led_pin(sc);
+@@ -299,6 +368,7 @@ void ath_init_leds(struct ath_softc *sc)
+ 		ath9k_register_gpio_chip(sc);
  
- 	ath9k_register_gpio_chip(sc);
+ 	ath_fill_led_pin(sc);
 +	ath9k_init_buttons(sc);
  
  	if (pdata && pdata->leds && pdata->num_leds)



More information about the lede-commits mailing list