ath9k: fix regulatory issues with multiple cards
[openwrt.git] / package / mac80211 / patches / 511-ath9k_per_chan_nf.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.h
2 +++ b/drivers/net/wireless/ath/ath9k/hw.h
3 @@ -342,7 +342,6 @@ struct ath9k_hw_cal_data {
4 int32_t CalValid;
5 int8_t iCoff;
6 int8_t qCoff;
7 - int16_t rawNoiseFloor;
8 bool paprd_done;
9 bool nfcal_pending;
10 bool nfcal_interference;
11 @@ -356,6 +355,7 @@ struct ath9k_channel {
12 u16 channel;
13 u32 channelFlags;
14 u32 chanmode;
15 + s16 noisefloor;
16 };
17
18 #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
19 --- a/drivers/net/wireless/ath/ath9k/calib.c
20 +++ b/drivers/net/wireless/ath/ath9k/calib.c
21 @@ -346,34 +346,34 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s
22 struct ieee80211_channel *c = chan->chan;
23 struct ath9k_hw_cal_data *caldata = ah->caldata;
24
25 - if (!caldata)
26 - return false;
27 -
28 chan->channelFlags &= (~CHANNEL_CW_INT);
29 if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
30 ath_print(common, ATH_DBG_CALIBRATE,
31 "NF did not complete in calibration window\n");
32 - nf = 0;
33 - caldata->rawNoiseFloor = nf;
34 return false;
35 - } else {
36 - ath9k_hw_do_getnf(ah, nfarray);
37 - ath9k_hw_nf_sanitize(ah, nfarray);
38 - nf = nfarray[0];
39 - if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh)
40 - && nf > nfThresh) {
41 - ath_print(common, ATH_DBG_CALIBRATE,
42 - "noise floor failed detected; "
43 - "detected %d, threshold %d\n",
44 - nf, nfThresh);
45 - chan->channelFlags |= CHANNEL_CW_INT;
46 - }
47 + }
48 +
49 + ath9k_hw_do_getnf(ah, nfarray);
50 + ath9k_hw_nf_sanitize(ah, nfarray);
51 + nf = nfarray[0];
52 + if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh)
53 + && nf > nfThresh) {
54 + ath_print(common, ATH_DBG_CALIBRATE,
55 + "noise floor failed detected; "
56 + "detected %d, threshold %d\n",
57 + nf, nfThresh);
58 + chan->channelFlags |= CHANNEL_CW_INT;
59 + }
60 +
61 + if (!caldata) {
62 + chan->noisefloor = nf;
63 + return false;
64 }
65
66 h = caldata->nfCalHist;
67 caldata->nfcal_pending = false;
68 ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
69 - caldata->rawNoiseFloor = h[0].privNF;
70 + chan->noisefloor = h[0].privNF;
71 return true;
72 }
73
74 @@ -401,10 +401,10 @@ void ath9k_init_nfcal_hist_buffer(struct
75
76 s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
77 {
78 - if (!ah->caldata || !ah->caldata->rawNoiseFloor)
79 + if (!ah->curchan || !ah->curchan->noisefloor)
80 return ath9k_hw_get_default_nf(ah, chan);
81
82 - return ah->caldata->rawNoiseFloor;
83 + return ah->curchan->noisefloor;
84 }
85 EXPORT_SYMBOL(ath9k_hw_getchan_noise);
86
87 --- a/drivers/net/wireless/ath/ath9k/hw.c
88 +++ b/drivers/net/wireless/ath/ath9k/hw.c
89 @@ -1251,7 +1251,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
90 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
91 return -EIO;
92
93 - if (curchan && !ah->chip_fullsleep && ah->caldata)
94 + if (curchan && !ah->chip_fullsleep)
95 ath9k_hw_getnf(ah, curchan);
96
97 ah->caldata = caldata;
This page took 0.044469 seconds and 5 git commands to generate.