Skip to content

Commit

Permalink
ath9k: add support for overriding LED pin and GPIO settings from plat…
Browse files Browse the repository at this point in the history
…form data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Felix Fietkau authored and linvjw committed Mar 30, 2011
1 parent 6fb1b1e commit 6de66dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
14 changes: 8 additions & 6 deletions drivers/net/wireless/ath/ath9k/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion drivers/net/wireless/ath/ath9k/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions include/linux/ath9k_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
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 */

0 comments on commit 6de66dd

Please sign in to comment.