svn commit: r218763 - in head/sys/dev/ath/ath_hal: . ar5416

Adrian Chadd adrian at FreeBSD.org
Thu Feb 17 05:52:54 UTC 2011


Author: adrian
Date: Thu Feb 17 05:52:53 2011
New Revision: 218763
URL: http://svn.freebsd.org/changeset/base/218763

Log:
  Add a new parameter to selectively enable/disable the ANI operations.
  
  This was inspired by ath9k, which disables ANI anti-noise immunity
  parameter tweaking (but leaves the rest of the ANI operations alone.)

Modified:
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h	Thu Feb 17 05:30:38 2011	(r218762)
+++ head/sys/dev/ath/ath_hal/ah_internal.h	Thu Feb 17 05:52:53 2011	(r218763)
@@ -408,14 +408,15 @@ extern	HAL_BOOL ath_hal_getTxQProps(stru
 		HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi);
 
 typedef enum {
-	HAL_ANI_PRESENT,			/* is ANI support present */
-	HAL_ANI_NOISE_IMMUNITY_LEVEL,		/* set level */
-	HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,	/* enable/disable */
-	HAL_ANI_CCK_WEAK_SIGNAL_THR,		/* enable/disable */
-	HAL_ANI_FIRSTEP_LEVEL,			/* set level */
-	HAL_ANI_SPUR_IMMUNITY_LEVEL,		/* set level */
-	HAL_ANI_MODE = 6,	/* 0 => manual, 1 => auto (XXX do not change) */
-	HAL_ANI_PHYERR_RESET,			/* reset phy error stats */
+	HAL_ANI_PRESENT = 0x1,			/* is ANI support present */
+	HAL_ANI_NOISE_IMMUNITY_LEVEL = 0x2,	/* set level */
+	HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,	/* enable/disable */
+	HAL_ANI_CCK_WEAK_SIGNAL_THR = 0x8,		/* enable/disable */
+	HAL_ANI_FIRSTEP_LEVEL = 0x10,			/* set level */
+	HAL_ANI_SPUR_IMMUNITY_LEVEL = 0x20,		/* set level */
+	HAL_ANI_MODE = 0x40,	/* 0 => manual, 1 => auto (XXX do not change) */
+	HAL_ANI_PHYERR_RESET =0x80,			/* reset phy error stats */
+	HAL_ANI_ALL = 0xff
 } HAL_ANI_CMD;
 
 #define	HAL_SPUR_VAL_MASK		0x3FFF

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Thu Feb 17 05:30:38 2011	(r218762)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Thu Feb 17 05:52:53 2011	(r218763)
@@ -87,6 +87,8 @@ struct ath_hal_5416 {
 	uint32_t	ah_rx_chainmask;
 	uint32_t	ah_tx_chainmask;
 
+	HAL_ANI_CMD	ah_ani_function;
+
 	struct ar5416PerCal ah_cal;		/* periodic calibration state */
 
 	struct ar5416NfLimits nf_2g;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Thu Feb 17 05:30:38 2011	(r218762)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Thu Feb 17 05:52:53 2011	(r218763)
@@ -177,7 +177,7 @@ ar5416AniControl(struct ath_hal *ah, HAL
 
 	OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd);
 
-	switch (cmd) {
+	switch (cmd & AH5416(ah)->ah_ani_function) {
 	case HAL_ANI_NOISE_IMMUNITY_LEVEL: {
 		u_int level = param;
 
@@ -354,13 +354,15 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 	aniState = ahp->ah_curani;
 	params = aniState->params;
 	/* First, raise noise immunity level, up to max */
-	if (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel) {
+	if ((AH5416(ah)->ah_ani_function & HAL_ANI_NOISE_IMMUNITY_LEVEL) &&
+	    (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) {
 		ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 
 				 aniState->noiseImmunityLevel + 1);
 		return;
 	}
 	/* then, raise spur immunity level, up to max */
-	if (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel) {
+	if ((AH5416(ah)->ah_ani_function & HAL_ANI_SPUR_IMMUNITY_LEVEL) &&
+	    (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel)) {
 		ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
 				 aniState->spurImmunityLevel + 1);
 		return;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Thu Feb 17 05:30:38 2011	(r218762)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Thu Feb 17 05:52:53 2011	(r218763)
@@ -168,6 +168,9 @@ ar5416InitState(struct ath_hal_5416 *ahp
 	 */
 	AH5416(ah)->ah_rx_chainmask = AR5416_DEFAULT_RXCHAINMASK;
 	AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK;
+
+	/* Enable all ANI functions to begin with */
+	AH5416(ah)->ah_ani_function = HAL_ANI_ALL;
 }
 
 uint32_t


More information about the svn-src-head mailing list