mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-10 15:03:07 +00:00
Revert "mac80211: ath9k: remove platform leds"
This reverts commit ad2e55e02b
.
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
04601004be
commit
caee153f8d
@ -1,9 +1,12 @@
|
|||||||
--- a/drivers/net/wireless/ath/ath9k/hw.h
|
--- a/drivers/net/wireless/ath/ath9k/hw.h
|
||||||
+++ b/drivers/net/wireless/ath/ath9k/hw.h
|
+++ b/drivers/net/wireless/ath/ath9k/hw.h
|
||||||
@@ -976,6 +976,10 @@ struct ath_hw {
|
@@ -976,6 +976,13 @@ struct ath_hw {
|
||||||
bool disable_2ghz;
|
bool disable_2ghz;
|
||||||
bool disable_5ghz;
|
bool disable_5ghz;
|
||||||
|
|
||||||
|
+ int num_leds;
|
||||||
|
+ const struct gpio_led *leds;
|
||||||
|
+
|
||||||
+ unsigned num_btns;
|
+ unsigned num_btns;
|
||||||
+ const struct gpio_keys_button *btns;
|
+ const struct gpio_keys_button *btns;
|
||||||
+ unsigned btn_poll_interval;
|
+ unsigned btn_poll_interval;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#ifdef CPTCFG_ATH9K_DEBUGFS
|
#ifdef CPTCFG_ATH9K_DEBUGFS
|
||||||
--- a/drivers/net/wireless/ath/ath9k/gpio.c
|
--- a/drivers/net/wireless/ath/ath9k/gpio.c
|
||||||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
|
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
|
||||||
@@ -39,61 +39,115 @@ static void ath_fill_led_pin(struct ath_
|
@@ -39,61 +39,111 @@ static void ath_fill_led_pin(struct ath_
|
||||||
else
|
else
|
||||||
ah->led_pin = ATH_LED_PIN_DEF;
|
ah->led_pin = ATH_LED_PIN_DEF;
|
||||||
}
|
}
|
||||||
@ -125,11 +125,11 @@
|
|||||||
{
|
{
|
||||||
- if (!sc->led_registered)
|
- if (!sc->led_registered)
|
||||||
- return;
|
- return;
|
||||||
-
|
|
||||||
- ath_led_brightness(&sc->led_cdev, LED_OFF);
|
|
||||||
- led_classdev_unregister(&sc->led_cdev);
|
|
||||||
+ struct ath_led *led;
|
+ struct ath_led *led;
|
||||||
|
|
||||||
|
- ath_led_brightness(&sc->led_cdev, LED_OFF);
|
||||||
|
- led_classdev_unregister(&sc->led_cdev);
|
||||||
|
-
|
||||||
- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
|
- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
|
||||||
+ while (!list_empty(&sc->leds)) {
|
+ while (!list_empty(&sc->leds)) {
|
||||||
+ led = list_first_entry(&sc->leds, struct ath_led, list);
|
+ led = list_first_entry(&sc->leds, struct ath_led, list);
|
||||||
@ -144,7 +144,6 @@
|
|||||||
void ath_init_leds(struct ath_softc *sc)
|
void ath_init_leds(struct ath_softc *sc)
|
||||||
{
|
{
|
||||||
- int ret;
|
- int ret;
|
||||||
+ struct ath_hw *ah = sc->sc_ah;
|
|
||||||
+ char led_name[32];
|
+ char led_name[32];
|
||||||
+ const char *trigger;
|
+ const char *trigger;
|
||||||
+
|
+
|
||||||
@ -163,21 +162,18 @@
|
|||||||
- "ath9k-%s", wiphy_name(sc->hw->wiphy));
|
- "ath9k-%s", wiphy_name(sc->hw->wiphy));
|
||||||
- sc->led_cdev.name = sc->led_name;
|
- sc->led_cdev.name = sc->led_name;
|
||||||
- sc->led_cdev.brightness_set = ath_led_brightness;
|
- sc->led_cdev.brightness_set = ath_led_brightness;
|
||||||
-
|
|
||||||
- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev);
|
|
||||||
- if (ret < 0)
|
|
||||||
+ if (ah->led_pin < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
- sc->led_registered = true;
|
|
||||||
+ snprintf(led_name, sizeof(led_name), "ath9k-%s",
|
+ snprintf(led_name, sizeof(led_name), "ath9k-%s",
|
||||||
+ wiphy_name(sc->hw->wiphy));
|
+ wiphy_name(sc->hw->wiphy));
|
||||||
+
|
|
||||||
|
- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev);
|
||||||
|
- if (ret < 0)
|
||||||
|
- return;
|
||||||
+ if (ath9k_led_blink)
|
+ if (ath9k_led_blink)
|
||||||
+ trigger = sc->led_default_trigger;
|
+ trigger = sc->led_default_trigger;
|
||||||
+ else
|
+ else
|
||||||
+ trigger = ieee80211_get_radio_led_name(sc->hw);
|
+ trigger = ieee80211_get_radio_led_name(sc->hw);
|
||||||
+
|
|
||||||
|
- sc->led_registered = true;
|
||||||
+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
|
||||||
+ !sc->sc_ah->config.led_active_high);
|
+ !sc->sc_ah->config.led_active_high);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
--- a/drivers/net/wireless/ath/ath9k/gpio.c
|
||||||
|
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
|
||||||
|
@@ -108,6 +108,24 @@ int ath_create_gpio_led(struct ath_softc
|
||||||
|
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;
|
||||||
|
@@ -124,8 +142,10 @@ void ath_deinit_leds(struct ath_softc *s
|
||||||
|
|
||||||
|
void ath_init_leds(struct ath_softc *sc)
|
||||||
|
{
|
||||||
|
+ struct ath_hw *ah = sc->sc_ah;
|
||||||
|
char led_name[32];
|
||||||
|
const char *trigger;
|
||||||
|
+ int i;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&sc->leds);
|
||||||
|
|
||||||
|
@@ -134,6 +154,17 @@ void ath_init_leds(struct ath_softc *sc)
|
||||||
|
|
||||||
|
ath_fill_led_pin(sc);
|
||||||
|
|
||||||
|
+ if (ah->leds && ah->num_leds)
|
||||||
|
+ for (i = 0; i < ah->num_leds; i++) {
|
||||||
|
+ if (ah->leds[i].gpio == ah->led_pin)
|
||||||
|
+ ah->led_pin = -1;
|
||||||
|
+
|
||||||
|
+ ath_create_platform_led(sc, &ah->leds[i]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ah->led_pin < 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
snprintf(led_name, sizeof(led_name), "ath9k-%s",
|
||||||
|
wiphy_name(sc->hw->wiphy));
|
||||||
|
|
@ -84,7 +84,7 @@
|
|||||||
bool reset_power_on;
|
bool reset_power_on;
|
||||||
bool htc_reset_init;
|
bool htc_reset_init;
|
||||||
|
|
||||||
@@ -1083,6 +1091,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
|
@@ -1086,6 +1094,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
|
||||||
bool ath9k_hw_check_alive(struct ath_hw *ah);
|
bool ath9k_hw_check_alive(struct ath_hw *ah);
|
||||||
|
|
||||||
bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
|
bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
|
||||||
|
@ -192,7 +192,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,17 +241,24 @@ void ath_deinit_leds(struct ath_softc *s
|
@@ -135,17 +259,24 @@ void ath_deinit_leds(struct ath_softc *s
|
||||||
|
|
||||||
while (!list_empty(&sc->leds)) {
|
while (!list_empty(&sc->leds)) {
|
||||||
led = list_first_entry(&sc->leds, struct ath_led, list);
|
led = list_first_entry(&sc->leds, struct ath_led, list);
|
||||||
@ -216,8 +216,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
+ struct device_node *np = sc->dev->of_node;
|
+ struct device_node *np = sc->dev->of_node;
|
||||||
char led_name[32];
|
char led_name[32];
|
||||||
const char *trigger;
|
const char *trigger;
|
||||||
|
int i;
|
||||||
@@ -136,6 +267,12 @@ void ath_init_leds(struct ath_softc *sc)
|
@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc)
|
||||||
if (AR_SREV_9100(sc->sc_ah))
|
if (AR_SREV_9100(sc->sc_ah))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -229,4 +229,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
+
|
+
|
||||||
ath_fill_led_pin(sc);
|
ath_fill_led_pin(sc);
|
||||||
|
|
||||||
if (ah->led_pin < 0)
|
if (ah->leds && ah->num_leds)
|
||||||
|
@@ -179,6 +316,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
|
||||||
|
|
||||||
|
/*******************/
|
||||||
|
@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
#endif /* CONFIG_GPIOLIB */
|
#endif /* CONFIG_GPIOLIB */
|
||||||
|
|
||||||
/********************************/
|
/********************************/
|
||||||
@@ -239,6 +310,7 @@ void ath_deinit_leds(struct ath_softc *s
|
@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s
|
||||||
{
|
{
|
||||||
struct ath_led *led;
|
struct ath_led *led;
|
||||||
|
|
||||||
@ -120,11 +120,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
while (!list_empty(&sc->leds)) {
|
while (!list_empty(&sc->leds)) {
|
||||||
led = list_first_entry(&sc->leds, struct ath_led, list);
|
led = list_first_entry(&sc->leds, struct ath_led, list);
|
||||||
#ifdef CONFIG_GPIOLIB
|
#ifdef CONFIG_GPIOLIB
|
||||||
@@ -274,6 +346,7 @@ void ath_init_leds(struct ath_softc *sc)
|
@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc)
|
||||||
}
|
}
|
||||||
|
|
||||||
ath_fill_led_pin(sc);
|
ath_fill_led_pin(sc);
|
||||||
+ ath9k_init_buttons(sc);
|
+ ath9k_init_buttons(sc);
|
||||||
|
|
||||||
if (ah->led_pin < 0)
|
if (ah->leds && ah->num_leds)
|
||||||
return;
|
for (i = 0; i < ah->num_leds; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user