Refactor out the software LED config code into a common function, called
ath_led_config(). The eventual aim is to have both software and hardware based LED configuration done here.
This commit is contained in:
parent
c65ee21d46
commit
6558ffd99a
@ -490,11 +490,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
|
||||
* support with a sysctl.
|
||||
*/
|
||||
sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
|
||||
if (sc->sc_softled) {
|
||||
ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
|
||||
}
|
||||
ath_led_config(sc);
|
||||
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
||||
@ -1332,11 +1328,7 @@ ath_resume(struct ath_softc *sc)
|
||||
} else
|
||||
ieee80211_resume_all(ic);
|
||||
}
|
||||
if (sc->sc_softled) {
|
||||
ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
|
||||
}
|
||||
ath_led_config(sc);
|
||||
|
||||
/* XXX beacons ? */
|
||||
}
|
||||
|
@ -110,6 +110,26 @@ __FBSDID("$FreeBSD$");
|
||||
* XXX TODO: move the LED sysctls here.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Configure the hardware for software and/or LED blinking.
|
||||
*
|
||||
* This requires the configuration to be set beforehand.
|
||||
*/
|
||||
void
|
||||
ath_led_config(struct ath_softc *sc)
|
||||
{
|
||||
/* Software LED blinking - GPIO controlled LED */
|
||||
if (sc->sc_softled) {
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin, !sc->sc_ledon);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Hardware LED blinking - MAC controlled LED */
|
||||
}
|
||||
|
||||
static void
|
||||
ath_led_done(void *arg)
|
||||
{
|
||||
|
@ -32,5 +32,6 @@
|
||||
#define __IF_ATH_LED_H__
|
||||
|
||||
extern void ath_led_event(struct ath_softc *sc, int rix);
|
||||
extern void ath_led_config(struct ath_softc *sc);
|
||||
|
||||
#endif
|
||||
|
@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/ath/ath_hal/ah_diagcodes.h>
|
||||
|
||||
#include <dev/ath/if_ath_debug.h>
|
||||
#include <dev/ath/if_ath_led.h>
|
||||
#include <dev/ath/if_ath_misc.h>
|
||||
#include <dev/ath/if_ath_tx.h>
|
||||
#include <dev/ath/if_ath_sysctl.h>
|
||||
@ -151,10 +152,7 @@ ath_sysctl_softled(SYSCTL_HANDLER_ARGS)
|
||||
if (softled != sc->sc_softled) {
|
||||
if (softled) {
|
||||
/* NB: handle any sc_ledpin change */
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
|
||||
!sc->sc_ledon);
|
||||
ath_led_config(sc);
|
||||
}
|
||||
sc->sc_softled = softled;
|
||||
}
|
||||
@ -174,10 +172,7 @@ ath_sysctl_ledpin(SYSCTL_HANDLER_ARGS)
|
||||
if (ledpin != sc->sc_ledpin) {
|
||||
sc->sc_ledpin = ledpin;
|
||||
if (sc->sc_softled) {
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
|
||||
!sc->sc_ledon);
|
||||
ath_led_config(sc);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user