1d841a763775fd96c65bc54935ca5c1c8467fc19
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sat, 18 Oct 2014 13:39:11 +0200
3 Subject: [PATCH] ath9k_hw: do not run NF and periodic calibration at the
4 same time
5
6 It can cause inconsistent calibration results or in some cases turn the
7 radio deaf.
8
9 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 ---
11
12 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
13 +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
14 @@ -660,7 +660,6 @@ static void ar9002_hw_olc_temp_compensat
15 static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
16 u8 rxchainmask, bool longcal)
17 {
18 - bool iscaldone = true;
19 struct ath9k_cal_list *currCal = ah->cal_list_curr;
20 bool nfcal, nfcal_pending = false;
21 int ret;
22 @@ -672,15 +671,13 @@ static int ar9002_hw_calibrate(struct at
23 if (currCal && !nfcal &&
24 (currCal->calState == CAL_RUNNING ||
25 currCal->calState == CAL_WAITING)) {
26 - iscaldone = ar9002_hw_per_calibration(ah, chan,
27 - rxchainmask, currCal);
28 - if (iscaldone) {
29 - ah->cal_list_curr = currCal = currCal->calNext;
30 -
31 - if (currCal->calState == CAL_WAITING) {
32 - iscaldone = false;
33 - ath9k_hw_reset_calibration(ah, currCal);
34 - }
35 + if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
36 + return 0;
37 +
38 + ah->cal_list_curr = currCal = currCal->calNext;
39 + if (currCal->calState == CAL_WAITING) {
40 + ath9k_hw_reset_calibration(ah, currCal);
41 + return 0;
42 }
43 }
44
45 @@ -710,7 +707,7 @@ static int ar9002_hw_calibrate(struct at
46 }
47 }
48
49 - return iscaldone;
50 + return 1;
51 }
52
53 /* Carrier leakage Calibration fix */