ath9k: add support for overriding LED pin and GPIO settings from platform data
authorFelix Fietkau <nbd@openwrt.org>
Sat, 19 Mar 2011 12:55:40 +0000 (13:55 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 30 Mar 2011 18:15:15 +0000 (14:15 -0400)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/gpio.c
drivers/net/wireless/ath/ath9k/hw.h
drivers/net/wireless/ath/ath9k/init.c
include/linux/ath9k_platform.h

index 0fb8f8ac275aceeaac60bc595cc0657b6e8ce8d9..44a0a886124d1738f6316eb671596bacb9d37088 100644 (file)
@@ -41,12 +41,14 @@ void ath_init_leds(struct ath_softc *sc)
 {
        int ret;
 
-       if (AR_SREV_9287(sc->sc_ah))
-               sc->sc_ah->led_pin = ATH_LED_PIN_9287;
-       else if (AR_SREV_9485(sc->sc_ah))
-               sc->sc_ah->led_pin = ATH_LED_PIN_9485;
-       else
-               sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
+       if (sc->sc_ah->led_pin < 0) {
+               if (AR_SREV_9287(sc->sc_ah))
+                       sc->sc_ah->led_pin = ATH_LED_PIN_9287;
+               else if (AR_SREV_9485(sc->sc_ah))
+                       sc->sc_ah->led_pin = ATH_LED_PIN_9485;
+               else
+                       sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
+       }
 
        /* Configure gpio 1 for output */
        ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
index 775c0eb10b953d4d603ec75f8b82e8f9ea9f24d3..3d9fc6e391a73e4916304b8a73879b44ad58059a 100644 (file)
@@ -798,7 +798,7 @@ struct ath_hw {
        u32 originalGain[22];
        int initPDADC;
        int PDADCdelta;
-       u8 led_pin;
+       int led_pin;
        u32 gpio_mask;
        u32 gpio_val;
 
index e22e8215d94166c8b7a7107bfa92179f6fdab0ce..cdb0f1c89a0efc7237e387c1d5d9b622d96d8e96 100644 (file)
@@ -553,8 +553,14 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
        ah->hw_version.subsysid = subsysid;
        sc->sc_ah = ah;
 
-       if (!pdata)
+       if (!pdata) {
                ah->ah_flags |= AH_USE_EEPROM;
+               sc->sc_ah->led_pin = -1;
+       } else {
+               sc->sc_ah->gpio_mask = pdata->gpio_mask;
+               sc->sc_ah->gpio_val = pdata->gpio_val;
+               sc->sc_ah->led_pin = pdata->led_pin;
+       }
 
        common = ath9k_hw_common(ah);
        common->ops = &ath9k_common_ops;
index b5f06583a1bac5c997b30dfcb66bf82f4e82c569..020387a114e34b738ae519c1391c1e7276ee24e8 100644 (file)
 struct ath9k_platform_data {
        u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
        u8 *macaddr;
+
+       int led_pin;
+       u32 gpio_mask;
+       u32 gpio_val;
 };
 
 #endif /* _LINUX_ATH9K_PLATFORM_H */