ath9k: add noise floor parameter to ath9k_hw_getchan_noise
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Fri, 11 Oct 2013 12:09:54 +0000 (14:09 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 18 Oct 2013 18:03:53 +0000 (14:03 -0400)
Add nf parameter to ath9k_hw_getchan_noise() in order to compute NF for EXT
chains with the same scale of noise floor calculated on CTL chains.
ath9k_hw_getchan_noise() will be used in ath_process_fft() for spectral scan on
HT40 channels

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/calib.c
drivers/net/wireless/ath/ath9k/calib.h
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/link.c

index d8db74b0ef6654587fb7bdbc1b23b6db77849b94..278365b8a8955dda362292b99949e63155be354c 100644 (file)
@@ -63,13 +63,13 @@ static s16 ath9k_hw_get_default_nf(struct ath_hw *ah,
        return ath9k_hw_get_nf_limits(ah, chan)->nominal;
 }
 
-s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
+s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan,
+                          s16 nf)
 {
        s8 noise = ATH_DEFAULT_NOISE_FLOOR;
 
-       if (chan && chan->noisefloor) {
-               s8 delta = chan->noisefloor -
-                          ATH9K_NF_CAL_NOISE_THRESH -
+       if (nf) {
+               s8 delta = nf - ATH9K_NF_CAL_NOISE_THRESH -
                           ath9k_hw_get_default_nf(ah, chan);
                if (delta > 0)
                        noise += delta;
@@ -392,7 +392,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
        clear_bit(NFCAL_PENDING, &caldata->cal_flags);
        ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
        chan->noisefloor = h[0].privNF;
-       ah->noise = ath9k_hw_getchan_noise(ah, chan);
+       ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor);
        return true;
 }
 EXPORT_SYMBOL(ath9k_hw_getnf);
index 3d70b8c2bcdd0a3ddad872f0ceff9c241f59f0a4..b8ed95e9a335d90d86e8d0dd4031e5abc2e8dffc 100644 (file)
@@ -116,7 +116,8 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
 void ath9k_hw_bstuck_nfcal(struct ath_hw *ah);
 void ath9k_hw_reset_calibration(struct ath_hw *ah,
                                struct ath9k_cal_list *currCal);
-s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
+s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan,
+                          s16 nf);
 
 
 #endif /* CALIB_H */
index dcdbab48709ec7f5c9081caaedf967df65fdb1e5..54b04155e43b1058575aa44df3e6ece1ab18e55e 100644 (file)
@@ -1885,7 +1885,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
        } else if (caldata) {
                clear_bit(PAPRD_PACKET_SENT, &caldata->cal_flags);
        }
-       ah->noise = ath9k_hw_getchan_noise(ah, chan);
+       ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor);
 
        if (fastcc) {
                r = ath9k_hw_do_fastcc(ah, chan);
index 84a60644f93acd05ab8ff5fe08bdc01b48fd814e..b7975195d740678de80ed2ff339070bfed3f41ab 100644 (file)
@@ -518,7 +518,8 @@ void ath_update_survey_nf(struct ath_softc *sc, int channel)
 
        if (chan->noisefloor) {
                survey->filled |= SURVEY_INFO_NOISE_DBM;
-               survey->noise = ath9k_hw_getchan_noise(ah, chan);
+               survey->noise = ath9k_hw_getchan_noise(ah, chan,
+                                                      chan->noisefloor);
        }
 }