summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212.h1
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c22
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h
index e0edcf6..86a8674 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212.h
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h
@@ -122,7 +122,6 @@ typedef struct {
uint32_t targetGain;
uint32_t loTrig;
uint32_t hiTrig;
- uint32_t gainFCorrection;
uint32_t active;
const GAIN_OPTIMIZATION_STEP *currStep;
} GAIN_VALUES;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
index 4d17eef..f9fbc9c 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
@@ -239,34 +239,36 @@ ar5212AdjustGain(struct ath_hal *ah, GAIN_VALUES *gv)
/*
* Read rf register to determine if gainF needs correction
*/
-static void
+static uint32_t
ar5212GetGainFCorrection(struct ath_hal *ah)
{
struct ath_hal_5212 *ahp = AH5212(ah);
- GAIN_VALUES *gv = &ahp->ah_gainValues;
+ uint32_t correction;
HALASSERT(IS_RADX112_REV2(ah));
- gv->gainFCorrection = 0;
+ correction = 0;
if (ar5212GetRfField(ar5212GetRfBank(ah, 7), 1, 36, 0) == 1) {
+ const GAIN_VALUES *gv = &ahp->ah_gainValues;
uint32_t mixGain = gv->currStep->paramVal[0];
uint32_t gainStep =
ar5212GetRfField(ar5212GetRfBank(ah, 7), 4, 32, 0);
switch (mixGain) {
case 0 :
- gv->gainFCorrection = 0;
+ correction = 0;
break;
case 1 :
- gv->gainFCorrection = gainStep;
+ correction = gainStep;
break;
case 2 :
- gv->gainFCorrection = 2 * gainStep - 5;
+ correction = 2 * gainStep - 5;
break;
case 3 :
- gv->gainFCorrection = 2 * gainStep;
+ correction = 2 * gainStep;
break;
}
}
+ return correction;
}
/*
@@ -303,9 +305,9 @@ ar5212GetRfgain(struct ath_hal *ah)
gv->currGain += PHY_PROBE_CCK_CORRECTION;
}
if (IS_RADX112_REV2(ah)) {
- ar5212GetGainFCorrection(ah);
- if (gv->currGain >= gv->gainFCorrection)
- gv->currGain -= gv->gainFCorrection;
+ uint32_t correct = ar5212GetGainFCorrection(ah);
+ if (gv->currGain >= correct)
+ gv->currGain -= correct;
else
gv->currGain = 0;
}
OpenPOWER on IntegriCloud