From: Mathias Kresin Date: Tue, 21 Mar 2017 22:21:57 +0000 (+0100) Subject: ath9k: unset the default LED pin if used by platform leds X-Git-Tag: v19.07.0-rc1~6719 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=192f0a3db8598fc6faa47788d0152bda54c5109a;p=openwrt%2Fstaging%2Fhauke.git 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 --- 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 35d8e8bd42..8ed7ad8a09 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 ced72c6c69..ddb3fe60e8 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 --- - 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 d4269282d9..4e28abbc35 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 + 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 f40bac93c3..8aefcf4d07 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 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 {