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
b907af0d1a
commit
96b06a4162
@ -490,11 +490,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
|
|||||||
* support with a sysctl.
|
* support with a sysctl.
|
||||||
*/
|
*/
|
||||||
sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
|
sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
|
||||||
if (sc->sc_softled) {
|
ath_led_config(sc);
|
||||||
ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
|
|
||||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
|
||||||
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
|
|
||||||
}
|
|
||||||
|
|
||||||
ifp->if_softc = sc;
|
ifp->if_softc = sc;
|
||||||
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
||||||
@ -1332,11 +1328,7 @@ ath_resume(struct ath_softc *sc)
|
|||||||
} else
|
} else
|
||||||
ieee80211_resume_all(ic);
|
ieee80211_resume_all(ic);
|
||||||
}
|
}
|
||||||
if (sc->sc_softled) {
|
ath_led_config(sc);
|
||||||
ath_hal_gpioCfgOutput(ah, sc->sc_ledpin,
|
|
||||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
|
||||||
ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX beacons ? */
|
/* XXX beacons ? */
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,26 @@ __FBSDID("$FreeBSD$");
|
|||||||
* XXX TODO: move the LED sysctls here.
|
* 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
|
static void
|
||||||
ath_led_done(void *arg)
|
ath_led_done(void *arg)
|
||||||
{
|
{
|
||||||
|
@ -32,5 +32,6 @@
|
|||||||
#define __IF_ATH_LED_H__
|
#define __IF_ATH_LED_H__
|
||||||
|
|
||||||
extern void ath_led_event(struct ath_softc *sc, int rix);
|
extern void ath_led_event(struct ath_softc *sc, int rix);
|
||||||
|
extern void ath_led_config(struct ath_softc *sc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <dev/ath/ath_hal/ah_diagcodes.h>
|
#include <dev/ath/ath_hal/ah_diagcodes.h>
|
||||||
|
|
||||||
#include <dev/ath/if_ath_debug.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_misc.h>
|
||||||
#include <dev/ath/if_ath_tx.h>
|
#include <dev/ath/if_ath_tx.h>
|
||||||
#include <dev/ath/if_ath_sysctl.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 != sc->sc_softled) {
|
||||||
if (softled) {
|
if (softled) {
|
||||||
/* NB: handle any sc_ledpin change */
|
/* NB: handle any sc_ledpin change */
|
||||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
ath_led_config(sc);
|
||||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
|
||||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
|
|
||||||
!sc->sc_ledon);
|
|
||||||
}
|
}
|
||||||
sc->sc_softled = softled;
|
sc->sc_softled = softled;
|
||||||
}
|
}
|
||||||
@ -174,10 +172,7 @@ ath_sysctl_ledpin(SYSCTL_HANDLER_ARGS)
|
|||||||
if (ledpin != sc->sc_ledpin) {
|
if (ledpin != sc->sc_ledpin) {
|
||||||
sc->sc_ledpin = ledpin;
|
sc->sc_ledpin = ledpin;
|
||||||
if (sc->sc_softled) {
|
if (sc->sc_softled) {
|
||||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
ath_led_config(sc);
|
||||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
|
||||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
|
|
||||||
!sc->sc_ledon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user