summaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
blob: 775bdac6411daadb945c97fac3894daeef7e7b17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -73,6 +73,7 @@ struct ath_regulatory {
 	u16 max_power_level;
 	u16 current_rd;
 	int16_t power_limit;
+	int16_t max_antenna_gain;
 	struct reg_dmn_pair_mapping *regpair;
 };
 
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2816,7 +2816,7 @@ void ath9k_hw_apply_txpower(struct ath_h
 	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);
-	max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
+	max_gain = chan_pwr - new_pwr + reg->max_antenna_gain * 2;
 
 	ant_gain = get_antenna_gain(ah, chan);
 	if (ant_gain > max_gain)
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1272,7 +1272,10 @@ int ath9k_config(struct ieee80211_hw *hw
 	}
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
+		struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
+
 		ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
+		reg->max_antenna_gain = conf->max_antenna_gain;
 		sc->config.txpowlimit = 2 * conf->power_level;
 		ath9k_cmn_update_txpow(ah, sc->curtxpow,
 				       sc->config.txpowlimit, &sc->curtxpow);