]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ath9k_hw: simplify noisefloor calibration chainmask calculation
authorFelix Fietkau <nbd@openwrt.org>
Fri, 23 Jul 2010 02:31:56 +0000 (04:31 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 26 Jul 2010 19:32:42 +0000 (15:32 -0400)
The noisefloor array index always corresponds to the rx chain number it
belongs to (with an offset of 3 for the extension chain).

It's much simpler (and actually more correct) to directly use the
chainmask to calculate the bitmask for the noisefloor array, instead of
using these weird chip revision checks and hardcoded mask values.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/calib.c

index 07372462a8ea4fce9e7739f61de1c238aea9b265..139289e4e933dfba2345d74add499174274b0571 100644 (file)
@@ -172,26 +172,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
        struct ath9k_nfcal_hist *h;
        unsigned i, j;
        int32_t val;
-       u8 chainmask;
+       u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
        struct ath_common *common = ath9k_hw_common(ah);
 
-       if (AR_SREV_9300_20_OR_LATER(ah))
-               chainmask = 0x3F;
-       else if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
-               chainmask = 0x9;
-       else if (AR_SREV_9280(ah) || AR_SREV_9287(ah)) {
-               if ((ah->rxchainmask & 0x2) || (ah->rxchainmask & 0x4))
-                       chainmask = 0x1B;
-               else
-                       chainmask = 0x09;
-       } else {
-               if (ah->rxchainmask & 0x4)
-                       chainmask = 0x3F;
-               else if (ah->rxchainmask & 0x2)
-                       chainmask = 0x1B;
-               else
-                       chainmask = 0x09;
-       }
        h = ah->nfCalHist;
 
        for (i = 0; i < NUM_NF_READINGS; i++) {