mac80211: rebase ontop of v4.18.5
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath / 365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 19 Jul 2017 08:49:31 +0200
3 Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory
4 domain
5
6 FCC regulatory rules allow for up to 3 dBi antenna gain. Account for
7 this in the EEPROM based tx power reduction code.
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/drivers/net/wireless/ath/ath9k/hw.c
13 +++ b/drivers/net/wireless/ath/ath9k/hw.c
14 @@ -2954,6 +2954,10 @@ void ath9k_hw_apply_txpower(struct ath_h
15 if (ant_gain > max_gain)
16 ant_reduction = ant_gain - max_gain;
17
18 + /* FCC allows maximum antenna gain of 3 dBi */
19 + if (reg->region == NL80211_DFS_FCC)
20 + ant_reduction = max_t(int, ant_reduction - 6, 0);
21 +
22 ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test);
23 }
24