summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2017-03-22 20:46:14 +0100
committerFelix Fietkau <nbd@nbd.name>2017-03-22 20:49:29 +0100
commit09ae540cd4726ecf2514d9d77e6ac3142dbfbc67 (patch)
treeb0580d4ea34ac0e0d2702da45a0f5a9f1390aff3
parent79a768a90fa94c0a38c9def1992cc974c091e286 (diff)
downloadmtk-20170518-09ae540cd4726ecf2514d9d77e6ac3142dbfbc67.zip
mtk-20170518-09ae540cd4726ecf2514d9d77e6ac3142dbfbc67.tar.gz
mtk-20170518-09ae540cd4726ecf2514d9d77e6ac3142dbfbc67.tar.bz2
ath9k: fix power limits on init
The tx power applied by set_txpower is limited by the CTL (conformance test limit) entries in the EEPROM. These can change based on the user configured regulatory domain. Depending on the EEPROM data this can cause the tx power to become too limited, if the original regdomain CTLs impose lowr limits than the CTLs of the user configured regdomain. To fix this issue, set the initial channel limits without any CTL restrictions and only apply the CTL at run time when setting the channel and the real tx power. Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/kernel/mac80211/patches/324-ath9k_hw-fix-channel-maximum-power-level-test.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/324-ath9k_hw-fix-channel-maximum-power-level-test.patch b/package/kernel/mac80211/patches/324-ath9k_hw-fix-channel-maximum-power-level-test.patch
new file mode 100644
index 0000000..67cbe92
--- /dev/null
+++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-channel-maximum-power-level-test.patch
@@ -0,0 +1,47 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 22 Mar 2017 20:37:04 +0100
+Subject: [PATCH] ath9k_hw: fix channel maximum power level test
+
+The tx power applied by set_txpower is limited by the CTL (conformance
+test limit) entries in the EEPROM. These can change based on the user
+configured regulatory domain.
+Depending on the EEPROM data this can cause the tx power to become too
+limited, if the original regdomain CTLs impose lowr limits than the CTLs
+of the user configured regdomain.
+
+To fix this issue, set the initial channel limits without any CTL
+restrictions and only apply the CTL at run time when setting the channel
+and the real tx power.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -2937,10 +2937,14 @@ void ath9k_hw_apply_txpower(struct ath_h
+ struct ieee80211_channel *channel;
+ int chan_pwr, new_pwr, max_gain;
+ int ant_gain, ant_reduction = 0;
++ u16 ctl = NO_CTL;
+
+ if (!chan)
+ return;
+
++ if (!test)
++ ctl = ath9k_regd_get_ctl(reg, chan);
++
+ channel = chan->chan;
+ chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
+ new_pwr = min_t(int, chan_pwr, reg->power_limit);
+@@ -2950,9 +2954,7 @@ void ath9k_hw_apply_txpower(struct ath_h
+ if (ant_gain > max_gain)
+ ant_reduction = ant_gain - max_gain;
+
+- ah->eep_ops->set_txpower(ah, chan,
+- ath9k_regd_get_ctl(reg, chan),
+- ant_reduction, new_pwr, test);
++ ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test);
+ }
+
+ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)