ath9k_hw: rename mrcCCKOff to fix smatch warning
[deliverable/linux.git] / drivers / net / wireless / ath / ath9k / ar5008_phy.c
index d7d8e91991408a7a5c18fea055a4f17f1a0741cf..874186bfda41d1fd93a3838725ab3e95d3210369 100644 (file)
@@ -245,7 +245,6 @@ static int ar5008_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
        REG_WRITE(ah, AR_PHY(0x37), reg32);
 
        ah->curchan = chan;
-       ah->curchan_rad_index = -1;
 
        return 0;
 }
@@ -619,19 +618,10 @@ static void ar5008_hw_init_bb(struct ath_hw *ah,
        u32 synthDelay;
 
        synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
-       if (IS_CHAN_B(chan))
-               synthDelay = (4 * synthDelay) / 22;
-       else
-               synthDelay /= 10;
-
-       if (IS_CHAN_HALF_RATE(chan))
-               synthDelay *= 2;
-       else if (IS_CHAN_QUARTER_RATE(chan))
-               synthDelay *= 4;
 
        REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
 
-       udelay(synthDelay + BASE_ACTIVATE_DELAY);
+       ath9k_hw_synth_delay(ah, chan, synthDelay);
 }
 
 static void ar5008_hw_init_chain_masks(struct ath_hw *ah)
@@ -869,7 +859,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
        ar5008_hw_set_channel_regs(ah, chan);
        ar5008_hw_init_chain_masks(ah);
        ath9k_olc_init(ah);
-       ath9k_hw_apply_txpower(ah, chan);
+       ath9k_hw_apply_txpower(ah, chan, false);
 
        /* Write analog registers */
        if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
@@ -949,12 +939,8 @@ static bool ar5008_hw_rfbus_req(struct ath_hw *ah)
 static void ar5008_hw_rfbus_done(struct ath_hw *ah)
 {
        u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
-       if (IS_CHAN_B(ah->curchan))
-               synthDelay = (4 * synthDelay) / 22;
-       else
-               synthDelay /= 10;
 
-       udelay(synthDelay + BASE_ACTIVATE_DELAY);
+       ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
 
        REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
 }
@@ -1009,179 +995,6 @@ static u32 ar5008_hw_compute_pll_control(struct ath_hw *ah,
        return pll;
 }
 
-static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
-                                     enum ath9k_ani_cmd cmd,
-                                     int param)
-{
-       struct ar5416AniState *aniState = &ah->curchan->ani;
-       struct ath_common *common = ath9k_hw_common(ah);
-
-       switch (cmd & ah->ani_function) {
-       case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{
-               u32 level = param;
-
-               if (level >= ARRAY_SIZE(ah->totalSizeDesired)) {
-                       ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
-                               level, ARRAY_SIZE(ah->totalSizeDesired));
-                       return false;
-               }
-
-               REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
-                             AR_PHY_DESIRED_SZ_TOT_DES,
-                             ah->totalSizeDesired[level]);
-               REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
-                             AR_PHY_AGC_CTL1_COARSE_LOW,
-                             ah->coarse_low[level]);
-               REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
-                             AR_PHY_AGC_CTL1_COARSE_HIGH,
-                             ah->coarse_high[level]);
-               REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
-                             AR_PHY_FIND_SIG_FIRPWR,
-                             ah->firpwr[level]);
-
-               if (level > aniState->noiseImmunityLevel)
-                       ah->stats.ast_ani_niup++;
-               else if (level < aniState->noiseImmunityLevel)
-                       ah->stats.ast_ani_nidown++;
-               aniState->noiseImmunityLevel = level;
-               break;
-       }
-       case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{
-               static const int m1ThreshLow[] = { 127, 50 };
-               static const int m2ThreshLow[] = { 127, 40 };
-               static const int m1Thresh[] = { 127, 0x4d };
-               static const int m2Thresh[] = { 127, 0x40 };
-               static const int m2CountThr[] = { 31, 16 };
-               static const int m2CountThrLow[] = { 63, 48 };
-               u32 on = param ? 1 : 0;
-
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
-                             AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
-                             m1ThreshLow[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
-                             AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
-                             m2ThreshLow[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR,
-                             AR_PHY_SFCORR_M1_THRESH,
-                             m1Thresh[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR,
-                             AR_PHY_SFCORR_M2_THRESH,
-                             m2Thresh[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR,
-                             AR_PHY_SFCORR_M2COUNT_THR,
-                             m2CountThr[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
-                             AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
-                             m2CountThrLow[on]);
-
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
-                             AR_PHY_SFCORR_EXT_M1_THRESH_LOW,
-                             m1ThreshLow[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
-                             AR_PHY_SFCORR_EXT_M2_THRESH_LOW,
-                             m2ThreshLow[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
-                             AR_PHY_SFCORR_EXT_M1_THRESH,
-                             m1Thresh[on]);
-               REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
-                             AR_PHY_SFCORR_EXT_M2_THRESH,
-                             m2Thresh[on]);
-
-               if (on)
-                       REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
-                                   AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
-               else
-                       REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
-                                   AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
-
-               if (!on != aniState->ofdmWeakSigDetectOff) {
-                       if (on)
-                               ah->stats.ast_ani_ofdmon++;
-                       else
-                               ah->stats.ast_ani_ofdmoff++;
-                       aniState->ofdmWeakSigDetectOff = !on;
-               }
-               break;
-       }
-       case ATH9K_ANI_CCK_WEAK_SIGNAL_THR:{
-               static const int weakSigThrCck[] = { 8, 6 };
-               u32 high = param ? 1 : 0;
-
-               REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT,
-                             AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK,
-                             weakSigThrCck[high]);
-               if (high != aniState->cckWeakSigThreshold) {
-                       if (high)
-                               ah->stats.ast_ani_cckhigh++;
-                       else
-                               ah->stats.ast_ani_ccklow++;
-                       aniState->cckWeakSigThreshold = high;
-               }
-               break;
-       }
-       case ATH9K_ANI_FIRSTEP_LEVEL:{
-               static const int firstep[] = { 0, 4, 8 };
-               u32 level = param;
-
-               if (level >= ARRAY_SIZE(firstep)) {
-                       ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
-                               level, ARRAY_SIZE(firstep));
-                       return false;
-               }
-               REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
-                             AR_PHY_FIND_SIG_FIRSTEP,
-                             firstep[level]);
-               if (level > aniState->firstepLevel)
-                       ah->stats.ast_ani_stepup++;
-               else if (level < aniState->firstepLevel)
-                       ah->stats.ast_ani_stepdown++;
-               aniState->firstepLevel = level;
-               break;
-       }
-       case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{
-               static const int cycpwrThr1[] = { 2, 4, 6, 8, 10, 12, 14, 16 };
-               u32 level = param;
-
-               if (level >= ARRAY_SIZE(cycpwrThr1)) {
-                       ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
-                               level, ARRAY_SIZE(cycpwrThr1));
-                       return false;
-               }
-               REG_RMW_FIELD(ah, AR_PHY_TIMING5,
-                             AR_PHY_TIMING5_CYCPWR_THR1,
-                             cycpwrThr1[level]);
-               if (level > aniState->spurImmunityLevel)
-                       ah->stats.ast_ani_spurup++;
-               else if (level < aniState->spurImmunityLevel)
-                       ah->stats.ast_ani_spurdown++;
-               aniState->spurImmunityLevel = level;
-               break;
-       }
-       case ATH9K_ANI_PRESENT:
-               break;
-       default:
-               ath_dbg(common, ANI, "invalid cmd %u\n", cmd);
-               return false;
-       }
-
-       ath_dbg(common, ANI, "ANI parameters:\n");
-       ath_dbg(common, ANI,
-               "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n",
-               aniState->noiseImmunityLevel,
-               aniState->spurImmunityLevel,
-               !aniState->ofdmWeakSigDetectOff);
-       ath_dbg(common, ANI,
-               "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
-               aniState->cckWeakSigThreshold,
-               aniState->firstepLevel,
-               aniState->listenTime);
-       ath_dbg(common, ANI, "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n",
-               aniState->ofdmPhyErrCount,
-               aniState->cckPhyErrCount);
-
-       return true;
-}
-
 static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                                      enum ath9k_ani_cmd cmd,
                                      int param)
@@ -1258,18 +1071,18 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                        REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
                                    AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
 
-               if (!on != aniState->ofdmWeakSigDetectOff) {
+               if (on != aniState->ofdmWeakSigDetect) {
                        ath_dbg(common, ANI,
                                "** ch %d: ofdm weak signal: %s=>%s\n",
                                chan->channel,
-                               !aniState->ofdmWeakSigDetectOff ?
+                               aniState->ofdmWeakSigDetect ?
                                "on" : "off",
                                on ? "on" : "off");
                        if (on)
                                ah->stats.ast_ani_ofdmon++;
                        else
                                ah->stats.ast_ani_ofdmoff++;
-                       aniState->ofdmWeakSigDetectOff = !on;
+                       aniState->ofdmWeakSigDetect = on;
                }
                break;
        }
@@ -1288,7 +1101,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                 * from INI file & cap value
                 */
                value = firstep_table[level] -
-                       firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] +
+                       firstep_table[ATH9K_ANI_FIRSTEP_LVL] +
                        aniState->iniDef.firstep;
                if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN)
                        value = ATH9K_SIG_FIRSTEP_SETTING_MIN;
@@ -1303,7 +1116,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                 * from INI file & cap value
                 */
                value2 = firstep_table[level] -
-                        firstep_table[ATH9K_ANI_FIRSTEP_LVL_NEW] +
+                        firstep_table[ATH9K_ANI_FIRSTEP_LVL] +
                         aniState->iniDef.firstepLow;
                if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN)
                        value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN;
@@ -1319,7 +1132,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                                chan->channel,
                                aniState->firstepLevel,
                                level,
-                               ATH9K_ANI_FIRSTEP_LVL_NEW,
+                               ATH9K_ANI_FIRSTEP_LVL,
                                value,
                                aniState->iniDef.firstep);
                        ath_dbg(common, ANI,
@@ -1327,7 +1140,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                                chan->channel,
                                aniState->firstepLevel,
                                level,
-                               ATH9K_ANI_FIRSTEP_LVL_NEW,
+                               ATH9K_ANI_FIRSTEP_LVL,
                                value2,
                                aniState->iniDef.firstepLow);
                        if (level > aniState->firstepLevel)
@@ -1352,7 +1165,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                 * from INI file & cap value
                 */
                value = cycpwrThr1_table[level] -
-                       cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] +
+                       cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
                        aniState->iniDef.cycpwrThr1;
                if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
                        value = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
@@ -1368,7 +1181,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                 * from INI file & cap value
                 */
                value2 = cycpwrThr1_table[level] -
-                        cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL_NEW] +
+                        cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
                         aniState->iniDef.cycpwrThr1Ext;
                if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
                        value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
@@ -1383,7 +1196,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                                chan->channel,
                                aniState->spurImmunityLevel,
                                level,
-                               ATH9K_ANI_SPUR_IMMUNE_LVL_NEW,
+                               ATH9K_ANI_SPUR_IMMUNE_LVL,
                                value,
                                aniState->iniDef.cycpwrThr1);
                        ath_dbg(common, ANI,
@@ -1391,7 +1204,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
                                chan->channel,
                                aniState->spurImmunityLevel,
                                level,
-                               ATH9K_ANI_SPUR_IMMUNE_LVL_NEW,
+                               ATH9K_ANI_SPUR_IMMUNE_LVL,
                                value2,
                                aniState->iniDef.cycpwrThr1Ext);
                        if (level > aniState->spurImmunityLevel)
@@ -1419,9 +1232,9 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
        ath_dbg(common, ANI,
                "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
                aniState->spurImmunityLevel,
-               !aniState->ofdmWeakSigDetectOff ? "on" : "off",
+               aniState->ofdmWeakSigDetect ? "on" : "off",
                aniState->firstepLevel,
-               !aniState->mrcCCKOff ? "on" : "off",
+               aniState->mrcCCK ? "on" : "off",
                aniState->listenTime,
                aniState->ofdmPhyErrCount,
                aniState->cckPhyErrCount);
@@ -1506,10 +1319,10 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah)
                                               AR_PHY_EXT_TIMING5_CYCPWR_THR1);
 
        /* these levels just got reset to defaults by the INI */
-       aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
-       aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
-       aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG;
-       aniState->mrcCCKOff = true; /* not available on pre AR9003 */
+       aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
+       aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
+       aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
+       aniState->mrcCCK = false; /* not available on pre AR9003 */
 }
 
 static void ar5008_hw_set_nf_limits(struct ath_hw *ah)
@@ -1597,11 +1410,8 @@ void ar5008_hw_attach_phy_ops(struct ath_hw *ah)
        priv_ops->do_getnf = ar5008_hw_do_getnf;
        priv_ops->set_radar_params = ar5008_hw_set_radar_params;
 
-       if (modparam_force_new_ani) {
-               priv_ops->ani_control = ar5008_hw_ani_control_new;
-               priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs;
-       } else
-               priv_ops->ani_control = ar5008_hw_ani_control_old;
+       priv_ops->ani_control = ar5008_hw_ani_control_new;
+       priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs;
 
        if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah))
                priv_ops->compute_pll_control = ar9160_hw_compute_pll_control;
This page took 0.039747 seconds and 5 git commands to generate.