Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6de66dd9 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville
Browse files

ath9k: add support for overriding LED pin and GPIO settings from platform data

parent 6fb1b1e1
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -41,12 +41,14 @@ void ath_init_leds(struct ath_softc *sc)
{
{
	int ret;
	int ret;


	if (sc->sc_ah->led_pin < 0) {
		if (AR_SREV_9287(sc->sc_ah))
		if (AR_SREV_9287(sc->sc_ah))
			sc->sc_ah->led_pin = ATH_LED_PIN_9287;
			sc->sc_ah->led_pin = ATH_LED_PIN_9287;
		else if (AR_SREV_9485(sc->sc_ah))
		else if (AR_SREV_9485(sc->sc_ah))
			sc->sc_ah->led_pin = ATH_LED_PIN_9485;
			sc->sc_ah->led_pin = ATH_LED_PIN_9485;
		else
		else
			sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
			sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
	}


	/* Configure gpio 1 for output */
	/* Configure gpio 1 for output */
	ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
	ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
+1 −1
Original line number Original line Diff line number Diff line
@@ -798,7 +798,7 @@ struct ath_hw {
	u32 originalGain[22];
	u32 originalGain[22];
	int initPDADC;
	int initPDADC;
	int PDADCdelta;
	int PDADCdelta;
	u8 led_pin;
	int led_pin;
	u32 gpio_mask;
	u32 gpio_mask;
	u32 gpio_val;
	u32 gpio_val;


+7 −1
Original line number Original line Diff line number Diff line
@@ -553,8 +553,14 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
	ah->hw_version.subsysid = subsysid;
	ah->hw_version.subsysid = subsysid;
	sc->sc_ah = ah;
	sc->sc_ah = ah;


	if (!pdata)
	if (!pdata) {
		ah->ah_flags |= AH_USE_EEPROM;
		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 = ath9k_hw_common(ah);
	common->ops = &ath9k_common_ops;
	common->ops = &ath9k_common_ops;
+4 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,10 @@
struct ath9k_platform_data {
struct ath9k_platform_data {
	u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
	u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
	u8 *macaddr;
	u8 *macaddr;

	int led_pin;
	u32 gpio_mask;
	u32 gpio_val;
};
};


#endif /* _LINUX_ATH9K_PLATFORM_H */
#endif /* _LINUX_ATH9K_PLATFORM_H */