[ath_hal_ar9300] Add the missing bits from the previous HAL commit.

Noticed by: 75+ emails telling me I messed up.
This commit is contained in:
Adrian Chadd 2019-03-06 08:52:02 +00:00
parent 28adfbfe13
commit 34d5464b85
2 changed files with 56 additions and 5 deletions

View File

@ -462,13 +462,55 @@ ar9300_ani_control(struct ath_hal *ah, HAL_ANI_CMD cmd, int param)
u_int level = param; u_int level = param;
u_int is_on; u_int is_on;
HALDEBUG(ah, HAL_DEBUG_ANI, "%s: cmd=%d, param=%d, chan=%p, funcmask=0x%08x\n",
__func__,
cmd,
param,
chan,
ahp->ah_ani_function);
if (chan == NULL && cmd != HAL_ANI_MODE) { if (chan == NULL && cmd != HAL_ANI_MODE) {
HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, HALDEBUG(ah, HAL_DEBUG_UNMASKABLE,
"%s: ignoring cmd 0x%02x - no channel\n", __func__, cmd); "%s: ignoring cmd 0x%02x - no channel\n", __func__, cmd);
return AH_FALSE; return AH_FALSE;
} }
switch (cmd & ahp->ah_ani_function) { /*
* These two control the top-level cck/ofdm immunity levels and will
* program the rest of the values.
*/
if (cmd == HAL_ANI_NOISE_IMMUNITY_LEVEL) {
if (param > HAL_ANI_OFDM_NUM_LEVEL)
return AH_FALSE;
ar9300_ani_set_odfm_noise_immunity_level(ah, param);
return AH_TRUE;
}
if (cmd == HAL_ANI_CCK_NOISE_IMMUNITY_LEVEL) {
if (param > HAL_ANI_CCK_NUM_LEVEL)
return AH_FALSE;
ar9300_ani_set_cck_noise_immunity_level(ah, param);
return AH_TRUE;
}
/*
* Check to see if this command is available in the
* current operating mode.
*/
if (((1 << cmd) & ahp->ah_ani_function) == 0) {
HALDEBUG(ah, HAL_DEBUG_ANI,
"%s: early check: invalid cmd 0x%02x (allowed=0x%02x)\n",
__func__, cmd, ahp->ah_ani_function);
return AH_FALSE;
}
/*
* The rest of these program in the requested parameter values
* into the PHY.
*/
switch (cmd) {
case HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION: case HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION:
{ {
int m1_thresh_low, m2_thresh_low; int m1_thresh_low, m2_thresh_low;
@ -887,13 +929,16 @@ ar9300_ani_reset(struct ath_hal *ah, HAL_BOOL is_scanning)
/* only allow a subset of functions in AP mode */ /* only allow a subset of functions in AP mode */
if (AH_PRIVATE(ah)->ah_opmode == HAL_M_HOSTAP) { if (AH_PRIVATE(ah)->ah_opmode == HAL_M_HOSTAP) {
if (IS_CHAN_2GHZ(ichan)) { if (IS_CHAN_2GHZ(ichan)) {
ahp->ah_ani_function = (HAL_ANI_SPUR_IMMUNITY_LEVEL | ahp->ah_ani_function = (1 << HAL_ANI_SPUR_IMMUNITY_LEVEL) |
HAL_ANI_FIRSTEP_LEVEL | (1 << HAL_ANI_FIRSTEP_LEVEL) |
HAL_ANI_MRC_CCK); (1 << HAL_ANI_MRC_CCK);
} else { } else {
ahp->ah_ani_function = 0; ahp->ah_ani_function = 0;
} }
} else {
ahp->ah_ani_function = HAL_ANI_ALL;
} }
/* always allow mode (on/off) to be controlled */ /* always allow mode (on/off) to be controlled */
ahp->ah_ani_function |= HAL_ANI_MODE; ahp->ah_ani_function |= HAL_ANI_MODE;

View File

@ -1268,7 +1268,7 @@ ar9300_get_diag_state(struct ath_hal *ah, int request,
ahp->ext_ani_state.spurImmunityLevel = ani->spur_immunity_level; ahp->ext_ani_state.spurImmunityLevel = ani->spur_immunity_level;
ahp->ext_ani_state.firstepLevel = ani->firstep_level; ahp->ext_ani_state.firstepLevel = ani->firstep_level;
ahp->ext_ani_state.ofdmWeakSigDetectOff = ani->ofdm_weak_sig_detect_off; ahp->ext_ani_state.ofdmWeakSigDetectOff = ani->ofdm_weak_sig_detect_off;
ahp->ext_ani_state.mrcCckOff = ani->mrc_cck_off; ahp->ext_ani_state.mrcCck = !! ani->mrc_cck_off;
ahp->ext_ani_state.cckNoiseImmunityLevel = ani->cck_noise_immunity_level; ahp->ext_ani_state.cckNoiseImmunityLevel = ani->cck_noise_immunity_level;
ahp->ext_ani_state.listenTime = ani->listen_time; ahp->ext_ani_state.listenTime = ani->listen_time;
@ -1287,12 +1287,18 @@ ar9300_get_diag_state(struct ath_hal *ah, int request,
0 : sizeof(HAL_ANI_STATS); 0 : sizeof(HAL_ANI_STATS);
return AH_TRUE; return AH_TRUE;
case HAL_DIAG_ANI_CMD: case HAL_DIAG_ANI_CMD:
{
HAL_ANI_CMD savefunc = ahp->ah_ani_function;
if (argsize != 2*sizeof(u_int32_t)) { if (argsize != 2*sizeof(u_int32_t)) {
return AH_FALSE; return AH_FALSE;
} }
/* temporarly allow all functions so we can override */
ahp->ah_ani_function = HAL_ANI_ALL;
ar9300_ani_control( ar9300_ani_control(
ah, ((const u_int32_t *)args)[0], ((const u_int32_t *)args)[1]); ah, ((const u_int32_t *)args)[0], ((const u_int32_t *)args)[1]);
ahp->ah_ani_function = savefunc;
return AH_TRUE; return AH_TRUE;
}
#if 0 #if 0
case HAL_DIAG_TXCONT: case HAL_DIAG_TXCONT:
/*AR9300_CONTTXMODE(ah, (struct ath_desc *)args, argsize );*/ /*AR9300_CONTTXMODE(ah, (struct ath_desc *)args, argsize );*/