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.)
This commit is contained in:
Adrian Chadd 2011-02-17 05:52:53 +00:00
parent 4f343ec80f
commit 744996fcf1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218763
4 changed files with 19 additions and 11 deletions

View File

@ -408,14 +408,15 @@ extern HAL_BOOL ath_hal_getTxQProps(struct ath_hal *ah,
HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi); HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi);
typedef enum { typedef enum {
HAL_ANI_PRESENT, /* is ANI support present */ HAL_ANI_PRESENT = 0x1, /* is ANI support present */
HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */ HAL_ANI_NOISE_IMMUNITY_LEVEL = 0x2, /* set level */
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */ HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, /* enable/disable */
HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */ HAL_ANI_CCK_WEAK_SIGNAL_THR = 0x8, /* enable/disable */
HAL_ANI_FIRSTEP_LEVEL, /* set level */ HAL_ANI_FIRSTEP_LEVEL = 0x10, /* set level */
HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */ HAL_ANI_SPUR_IMMUNITY_LEVEL = 0x20, /* set level */
HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */ HAL_ANI_MODE = 0x40, /* 0 => manual, 1 => auto (XXX do not change) */
HAL_ANI_PHYERR_RESET, /* reset phy error stats */ HAL_ANI_PHYERR_RESET =0x80, /* reset phy error stats */
HAL_ANI_ALL = 0xff
} HAL_ANI_CMD; } HAL_ANI_CMD;
#define HAL_SPUR_VAL_MASK 0x3FFF #define HAL_SPUR_VAL_MASK 0x3FFF

View File

@ -87,6 +87,8 @@ struct ath_hal_5416 {
uint32_t ah_rx_chainmask; uint32_t ah_rx_chainmask;
uint32_t ah_tx_chainmask; uint32_t ah_tx_chainmask;
HAL_ANI_CMD ah_ani_function;
struct ar5416PerCal ah_cal; /* periodic calibration state */ struct ar5416PerCal ah_cal; /* periodic calibration state */
struct ar5416NfLimits nf_2g; struct ar5416NfLimits nf_2g;

View File

@ -177,7 +177,7 @@ ar5416AniControl(struct ath_hal *ah, HAL_ANI_CMD cmd, int param)
OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd);
switch (cmd) { switch (cmd & AH5416(ah)->ah_ani_function) {
case HAL_ANI_NOISE_IMMUNITY_LEVEL: { case HAL_ANI_NOISE_IMMUNITY_LEVEL: {
u_int level = param; u_int level = param;
@ -354,13 +354,15 @@ ar5416AniOfdmErrTrigger(struct ath_hal *ah)
aniState = ahp->ah_curani; aniState = ahp->ah_curani;
params = aniState->params; params = aniState->params;
/* First, raise noise immunity level, up to max */ /* 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, ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL,
aniState->noiseImmunityLevel + 1); aniState->noiseImmunityLevel + 1);
return; return;
} }
/* then, raise spur immunity level, up to max */ /* 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, ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
aniState->spurImmunityLevel + 1); aniState->spurImmunityLevel + 1);
return; return;

View File

@ -168,6 +168,9 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc,
*/ */
AH5416(ah)->ah_rx_chainmask = AR5416_DEFAULT_RXCHAINMASK; AH5416(ah)->ah_rx_chainmask = AR5416_DEFAULT_RXCHAINMASK;
AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK; 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 uint32_t