svn commit: r210658 - user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416

Adrian Chadd adrian at FreeBSD.org
Fri Jul 30 15:56:01 UTC 2010


Author: adrian
Date: Fri Jul 30 15:56:00 2010
New Revision: 210658
URL: http://svn.freebsd.org/changeset/base/210658

Log:
  Fix the NF calibration to only occur if a periodic calibration is not
  in progress.
  
  Since I've also seen periodic calibrations take forever (as in, up
  to an hour to do the 64 samples needed for a percal), longcal may
  never get set during a time where there isn't an in-progress percal.
  
  To avoid this, perform a longcal immediately after the last successful
  periodic calibration sample is read. There shouldn't be any further
  periodic calibrations performed if *isCalDone is set to AH_TRUE.
  This means that there'll be at least one NF calibration and sample
  done at the end of each periodic calibration.
  
  I'm not sure whether a NF sample and/or calibration can be taken in
  between calibration samples (whether it'll upset the calibration
  process, which I don't have any documentation on atm) so I'm not
  interleaving NF and periodic calibration sampling.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:36:57 2010	(r210657)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Fri Jul 30 15:56:00 2010	(r210658)
@@ -470,8 +470,26 @@ ar5416PerCalibrationN(struct ath_hal *ah
 		}
 	}
 
-	/* Do NF cal only at longer intervals */
-	if (longcal) {
+	/*
+	 * NF calibration can only be done if there's no in-progress periodic
+	 * calibration.
+	 *
+	 * To ensure it happens, an NF calibration is done at the end of the
+	 * periodic calibration run. That way if the periodic calibrations are
+	 * taking too long to run and prevent the "longcal" tick from actually
+	 * performing a successful NF calibration, the noise floor values still
+	 * get updated.
+	 */
+
+	/* Do NF cal only at longer intervals or at the end of a successful percal */
+	/*
+	 * XXX I don't know if there's some minimum delay between completing a percal
+	 * XXX and beginning a NF calibration. -adrian
+	 */
+	if ((*isCalDone == AH_TRUE) ||
+	    (longcal && currCal == AH_NULL) ||
+	    (longcal && currCal != AH_NULL &&
+		(currCal->calState == CAL_WAITING || currCal->calState == CAL_DONE))) {
 		/*
 		 * Get the value from the previous NF cal
 		 * and update the history buffer.


More information about the svn-src-user mailing list