Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Dec 2011 06:25:12 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228890 - head/sys/dev/ath
Message-ID:  <201112260625.pBQ6PCHi093112@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Dec 26 06:25:12 2011
New Revision: 228890
URL: http://svn.freebsd.org/changeset/base/228890

Log:
  Setup the initial LED state on attach and resume.
  
  Some of the NICs I have here power up with the LEDs blinking, which is
  incorrect. The blinking should only occur when the NIC is attempting
  to associate.
  
  * On powerup, set the state to HAL_LED_INIT, which turns on the "Power" MAC
    LED but leaves the "Network" MAC LED the way it is.
  
  * On resume, also init it to HAL_LED_INIT unless in station mode, where
    it's forced to HAL_LED_RUN. Hopefully the net80211 state machine will
    call newstate() at some point, which will refiddle the LEDs.
  
  I've tested this on a handful of 11n and pre-11n NICs. The blinking
  behaviour is slightly more sensible now.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon Dec 26 06:07:21 2011	(r228889)
+++ head/sys/dev/ath/if_ath.c	Mon Dec 26 06:25:12 2011	(r228890)
@@ -491,6 +491,7 @@ ath_attach(u_int16_t devid, struct ath_s
 	 */
 	sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
 	ath_led_config(sc);
+	ath_hal_setledstate(ah, HAL_LED_INIT);
 
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
@@ -1312,9 +1313,14 @@ ath_resume(struct ath_softc *sc)
 	/* Let DFS at it in case it's a DFS channel */
 	ath_dfs_radar_enable(sc, ic->ic_curchan);
 
+	/* Restore the LED configuration */
+	ath_led_config(sc);
+	ath_hal_setledstate(ah, HAL_LED_INIT);
+
 	if (sc->sc_resume_up) {
 		if (ic->ic_opmode == IEEE80211_M_STA) {
 			ath_init(sc);
+			ath_hal_setledstate(ah, HAL_LED_RUN);
 			/*
 			 * Program the beacon registers using the last rx'd
 			 * beacon frame and enable sync on the next beacon
@@ -1328,7 +1334,6 @@ ath_resume(struct ath_softc *sc)
 		} else
 			ieee80211_resume_all(ic);
 	}
-	ath_led_config(sc);
 
 	/* XXX beacons ? */
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112260625.pBQ6PCHi093112>