diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 58f237e61c01..ee17c84cce01 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -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 ? */ } diff --git a/sys/dev/ath/if_ath_led.c b/sys/dev/ath/if_ath_led.c index 796669ffdb80..e81e542a5810 100644 --- a/sys/dev/ath/if_ath_led.c +++ b/sys/dev/ath/if_ath_led.c @@ -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) { diff --git a/sys/dev/ath/if_ath_led.h b/sys/dev/ath/if_ath_led.h index 6d6df02c604c..54de4c4ac2cf 100644 --- a/sys/dev/ath/if_ath_led.h +++ b/sys/dev/ath/if_ath_led.h @@ -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 diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c index a609341214ab..22d378b16046 100644 --- a/sys/dev/ath/if_ath_sysctl.c +++ b/sys/dev/ath/if_ath_sysctl.c @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -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;