]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.128/ath9k_hw-fix-channel-maximum-power-level-test.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.9.128 / ath9k_hw-fix-channel-maximum-power-level-test.patch
1 From foo@baz Mon Sep 17 12:22:41 CEST 2018
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Mon, 30 Jul 2018 21:31:28 +0300
4 Subject: ath9k_hw: fix channel maximum power level test
5
6 From: Felix Fietkau <nbd@nbd.name>
7
8 [ Upstream commit 461d8a6bb9879b0e619752d040292e67aa06f1d2 ]
9
10 The tx power applied by set_txpower is limited by the CTL (conformance
11 test limit) entries in the EEPROM. These can change based on the user
12 configured regulatory domain.
13 Depending on the EEPROM data this can cause the tx power to become too
14 limited, if the original regdomain CTLs impose lower limits than the CTLs
15 of the user configured regdomain.
16
17 To fix this issue, set the initial channel limits without any CTL
18 restrictions and only apply the CTL at run time when setting the channel
19 and the real tx power.
20
21 Signed-off-by: Felix Fietkau <nbd@nbd.name>
22 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/net/wireless/ath/ath9k/hw.c | 7 +++++--
27 1 file changed, 5 insertions(+), 2 deletions(-)
28
29 --- a/drivers/net/wireless/ath/ath9k/hw.c
30 +++ b/drivers/net/wireless/ath/ath9k/hw.c
31 @@ -2915,16 +2915,19 @@ void ath9k_hw_apply_txpower(struct ath_h
32 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
33 struct ieee80211_channel *channel;
34 int chan_pwr, new_pwr;
35 + u16 ctl = NO_CTL;
36
37 if (!chan)
38 return;
39
40 + if (!test)
41 + ctl = ath9k_regd_get_ctl(reg, chan);
42 +
43 channel = chan->chan;
44 chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
45 new_pwr = min_t(int, chan_pwr, reg->power_limit);
46
47 - ah->eep_ops->set_txpower(ah, chan,
48 - ath9k_regd_get_ctl(reg, chan),
49 + ah->eep_ops->set_txpower(ah, chan, ctl,
50 get_antenna_gain(ah, chan), new_pwr, test);
51 }
52