X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fyousong.git;a=blobdiff_plain;f=package%2Fkernel%2Fmac80211%2Fpatches%2F530-ath9k_extra_leds.patch;h=0b257496082bab62ac43daf232f83628888e04ed;hp=c78a3e55fb834589374e9f8f48bd45a6b23d9dea;hb=31e5ed4152c4aa826641b2db6b4245a03dd553b5;hpb=427ae707cdd38bc504fdadfc41e6f0cc254f8ab7 diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index c78a3e55fb..0b25749608 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -1,18 +1,18 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -554,6 +554,9 @@ static inline int ath9k_dump_btcoex(stru +@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru + #ifdef CPTCFG_MAC80211_LEDS void ath_init_leds(struct ath_softc *sc); void ath_deinit_leds(struct ath_softc *sc); - void ath_fill_led_pin(struct ath_softc *sc); +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name, -+ const char *trigger, bool active_low); ++ const char *trigger, bool active_low); + #else static inline void ath_init_leds(struct ath_softc *sc) { -@@ -692,6 +695,13 @@ void ath_ant_comb_scan(struct ath_softc - #define PS_BEACON_SYNC BIT(4) - #define PS_WAIT_FOR_ANI BIT(5) +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc + + #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ +struct ath_led { + struct list_head list; @@ -24,8 +24,8 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -731,9 +741,8 @@ struct ath_softc { - struct ath_beacon beacon; +@@ -1002,9 +1012,8 @@ struct ath_softc { + spinlock_t chan_lock; #ifdef CPTCFG_MAC80211_LEDS - bool led_registered; @@ -35,15 +35,27 @@ + struct list_head leds; #endif - struct ath9k_hw_cal_data caldata; + #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -24,40 +24,102 @@ - static void ath_led_brightness(struct led_classdev *led_cdev, - enum led_brightness brightness) +@@ -22,7 +22,7 @@ + + #ifdef CPTCFG_MAC80211_LEDS + +-void ath_fill_led_pin(struct ath_softc *sc) ++static void ath_fill_led_pin(struct ath_softc *sc) { -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, (brightness == LED_OFF)); + struct ath_hw *ah = sc->sc_ah; + +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc * + else + ah->led_pin = ATH_LED_PIN_DEF; + } ++} ++ ++static void ath_led_brightness(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev); + struct ath_softc *sc = led->sc; + @@ -68,30 +80,40 @@ + + led->sc = sc; + list_add(&led->list, &sc->leds); -+ -+ /* Configure gpio for output */ -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio, -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ + + /* Configure gpio for output */ +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led", ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, + AR_GPIO_OUTPUT_MUX_AS_OUTPUT); + +- /* LED off, active low */ +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1); + /* LED off */ + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); + + return 0; -+} -+ + } + +-static void ath_led_brightness(struct led_classdev *led_cdev, +- enum led_brightness brightness) +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name, + const char *trigger, bool active_low) -+{ + { +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); +- u32 val = (brightness == LED_OFF); + struct ath_led *led; + struct gpio_led *gpio; + char *_name; + int ret; -+ + +- if (sc->sc_ah->config.led_active_high) +- val = !val; + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1, + GFP_KERNEL); + if (!led) + return -ENOMEM; -+ + +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); + led->gpio = gpio = (struct gpio_led *) (led + 1); + _name = (char *) (led->gpio + 1); + @@ -112,15 +134,18 @@ { - if (!sc->led_registered) - return; -+ struct ath_led *led; - +- - ath_led_brightness(&sc->led_cdev, LED_OFF); - led_classdev_unregister(&sc->led_cdev); ++ struct ath_led *led; + +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + while (!list_empty(&sc->leds)) { + led = list_first_entry(&sc->leds, struct ath_led, list); + list_del(&led->list); + ath_led_brightness(&led->cdev, LED_OFF); + led_classdev_unregister(&led->cdev); ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio); + kfree(led); + } } @@ -136,7 +161,9 @@ if (AR_SREV_9100(sc->sc_ah)) return; -- if (!led_blink) + ath_fill_led_pin(sc); + +- if (!ath9k_led_blink) - sc->led_cdev.default_trigger = - ieee80211_get_radio_led_name(sc->hw); - @@ -150,19 +177,20 @@ - ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); - if (ret < 0) - return; -+ if (led_blink) ++ if (ath9k_led_blink) + trigger = sc->led_default_trigger; + else + 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, 1); ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, ++ !sc->sc_ah->config.led_active_high); } + #endif - void ath_fill_led_pin(struct ath_softc *sc) --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -811,7 +811,7 @@ int ath9k_init_device(u16 devid, struct +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ @@ -173,7 +201,7 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1577,6 +1577,61 @@ static const struct file_operations fops +@@ -1407,6 +1407,61 @@ static const struct file_operations fops .llseek = default_llseek, }; @@ -235,7 +263,7 @@ int ath9k_init_debug(struct ath_hw *ah) { -@@ -1601,6 +1656,10 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_eeprom); debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_chanbw); @@ -243,6 +271,6 @@ + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); +#endif - debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_dma); - debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, + debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, + read_file_dma); + debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,