-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "mac80211: remove ath9k_platform_data"
This reverts commit fdc2c6a. Signed-off-by: Robert Marko <[email protected]>
- Loading branch information
Showing
8 changed files
with
130 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Signed-off-by: Michal Cieslakiewicz <[email protected]> | |
|
||
--- a/drivers/net/wireless/ath/ath9k/gpio.c | ||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||
@@ -73,8 +73,11 @@ static int ath_add_led(struct ath_softc | ||
@@ -74,8 +74,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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,10 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
#ifdef CPTCFG_ATH9K_DEBUGFS | ||
--- a/drivers/net/wireless/ath/ath9k/gpio.c | ||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||
@@ -15,13 +15,131 @@ | ||
*/ | ||
@@ -16,13 +16,135 @@ | ||
|
||
#include "ath9k.h" | ||
#include <linux/ath9k_platform.h> | ||
+#include <linux/gpio.h> | ||
+ | ||
+#ifdef CPTCFG_MAC80211_LEDS | ||
|
@@ -126,7 +126,9 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
+ gc->sc = sc; | ||
+ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", | ||
+ wiphy_name(sc->hw->wiphy)); | ||
+#ifdef CONFIG_OF | ||
+ gc->gchip.parent = sc->dev; | ||
+#endif | ||
+ gc->gchip.label = gc->label; | ||
+ gc->gchip.base = -1; /* determine base automatically */ | ||
+ gc->gchip.ngpio = ah->caps.num_gpio_pins; | ||
|
@@ -141,7 +143,9 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
+ return; | ||
+ } | ||
+ | ||
+#ifdef CONFIG_OF | ||
+ gc->gchip.owner = NULL; | ||
+#endif | ||
+ sc->gpiochip = gc; | ||
+} | ||
+ | ||
|
@@ -179,7 +183,7 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
static void ath_fill_led_pin(struct ath_softc *sc) | ||
{ | ||
struct ath_hw *ah = sc->sc_ah; | ||
@@ -79,6 +197,12 @@ static int ath_add_led(struct ath_softc | ||
@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc | ||
else | ||
ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); | ||
|
||
|
@@ -192,7 +196,7 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
return 0; | ||
} | ||
|
||
@@ -135,17 +259,24 @@ 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); | ||
|
@@ -212,15 +216,18 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
|
||
void ath_init_leds(struct ath_softc *sc) | ||
{ | ||
struct ath_hw *ah = sc->sc_ah; | ||
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; | ||
@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc) | ||
@@ -156,6 +291,15 @@ 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 and skip the led_pin setup */ | ||
+ if (of_property_read_bool(np, "gpio-controller")) { | ||
+ ath9k_register_gpio_chip(sc); | ||
|
@@ -229,8 +236,8 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
+ | ||
ath_fill_led_pin(sc); | ||
|
||
if (ah->leds && ah->num_leds) | ||
@@ -179,6 +316,7 @@ void ath_init_leds(struct ath_softc *sc) | ||
if (pdata && pdata->leds && pdata->num_leds) | ||
@@ -180,6 +324,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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,16 +20,16 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
|
||
--- a/drivers/net/wireless/ath/ath9k/gpio.c | ||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||
@@ -16,6 +16,8 @@ | ||
|
||
@@ -17,6 +17,8 @@ | ||
#include "ath9k.h" | ||
#include <linux/ath9k_platform.h> | ||
#include <linux/gpio.h> | ||
+#include <linux/platform_device.h> | ||
+#include <linux/gpio_keys.h> | ||
|
||
#ifdef CPTCFG_MAC80211_LEDS | ||
|
||
@@ -124,6 +126,67 @@ static void ath9k_unregister_gpio_chip(s | ||
@@ -129,6 +131,67 @@ static void ath9k_unregister_gpio_chip(s | ||
sc->gpiochip = NULL; | ||
} | ||
|
||
|
@@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
+/* add GPIO buttons */ | ||
+static void ath9k_init_buttons(struct ath_softc *sc) | ||
+{ | ||
+ struct ath_hw *ah = sc->sc_ah; | ||
+ struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||
+ struct platform_device *pdev; | ||
+ struct gpio_keys_platform_data gkpdata; | ||
+ struct gpio_keys_button *bt; | ||
|
@@ -49,28 +49,28 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
+ if (!sc->gpiochip) | ||
+ return; | ||
+ | ||
+ if (!ah->btns || !ah->num_btns) | ||
+ if (!pdata || !pdata->btns || !pdata->num_btns) | ||
+ return; | ||
+ | ||
+ bt = devm_kmemdup(sc->dev, ah->btns, | ||
+ ah->num_btns * sizeof(struct gpio_keys_button), | ||
+ bt = devm_kmemdup(sc->dev, pdata->btns, | ||
+ pdata->num_btns * sizeof(struct gpio_keys_button), | ||
+ GFP_KERNEL); | ||
+ if (!bt) | ||
+ return; | ||
+ | ||
+ for (i = 0; i < ah->num_btns; i++) { | ||
+ if (ah->btns[i].gpio == sc->sc_ah->led_pin) | ||
+ for (i = 0; i < pdata->num_btns; i++) { | ||
+ if (pdata->btns[i].gpio == sc->sc_ah->led_pin) | ||
+ sc->sc_ah->led_pin = -1; | ||
+ | ||
+ ath9k_hw_gpio_request_in(sc->sc_ah, ah->btns[i].gpio, | ||
+ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio, | ||
+ "ath9k-gpio"); | ||
+ bt[i].gpio = sc->gpiochip->gchip.base + ah->btns[i].gpio; | ||
+ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; | ||
+ } | ||
+ | ||
+ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); | ||
+ gkpdata.buttons = bt; | ||
+ gkpdata.nbuttons = ah->num_btns; | ||
+ gkpdata.poll_interval = ah->btn_poll_interval; | ||
+ gkpdata.nbuttons = pdata->num_btns; | ||
+ gkpdata.poll_interval = pdata->btn_poll_interval; | ||
+ | ||
+ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", | ||
+ PLATFORM_DEVID_AUTO, &gkpdata, | ||
|
@@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
#else /* CONFIG_GPIOLIB */ | ||
|
||
static inline void ath9k_register_gpio_chip(struct ath_softc *sc) | ||
@@ -134,6 +197,14 @@ static inline void ath9k_unregister_gpio | ||
@@ -139,6 +202,14 @@ static inline void ath9k_unregister_gpio | ||
{ | ||
} | ||
|
||
|
@@ -112,19 +112,19 @@ Signed-off-by: Felix Fietkau <[email protected]> | |
#endif /* CONFIG_GPIOLIB */ | ||
|
||
/********************************/ | ||
@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s | ||
@@ -262,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s | ||
{ | ||
struct ath_led *led; | ||
|
||
+ ath9k_deinit_buttons(sc); | ||
while (!list_empty(&sc->leds)) { | ||
led = list_first_entry(&sc->leds, struct ath_led, list); | ||
#ifdef CONFIG_GPIOLIB | ||
@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) | ||
@@ -301,6 +373,7 @@ void ath_init_leds(struct ath_softc *sc) | ||
} | ||
|
||
ath_fill_led_pin(sc); | ||
+ ath9k_init_buttons(sc); | ||
|
||
if (ah->leds && ah->num_leds) | ||
for (i = 0; i < ah->num_leds; i++) { | ||
if (pdata && pdata->leds && pdata->num_leds) | ||
for (i = 0; i < pdata->num_leds; i++) { |
Oops, something went wrong.