summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-01-29 13:51:33 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-01-29 13:51:33 +0000
commite146d9b3861ccf8cfdceb54c628d23537484a4f5 (patch)
tree15980e862c37a7cd71a06efb7e5e19d170561792
parenta8edd9d50e47c438e6e56c993030aab0ef1aeeea (diff)
downloadmtk-20170518-e146d9b3861ccf8cfdceb54c628d23537484a4f5.zip
mtk-20170518-e146d9b3861ccf8cfdceb54c628d23537484a4f5.tar.gz
mtk-20170518-e146d9b3861ccf8cfdceb54c628d23537484a4f5.tar.bz2
cfg80211: do not overwrite the hardware max power setting in the regulatory code, fixes reported tx power values
SVN-Revision: 25238
-rw-r--r--package/mac80211/patches/560-cfg80211_max_power.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/package/mac80211/patches/560-cfg80211_max_power.patch b/package/mac80211/patches/560-cfg80211_max_power.patch
new file mode 100644
index 0000000..82790b0
--- /dev/null
+++ b/package/mac80211/patches/560-cfg80211_max_power.patch
@@ -0,0 +1,35 @@
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -839,6 +839,12 @@ static void handle_channel(struct wiphy
+ if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40))
+ bw_flags = IEEE80211_CHAN_NO_HT40;
+
++ if (chan->orig_mpwr)
++ chan->max_power = min(chan->orig_mpwr,
++ (int) MBM_TO_DBM(power_rule->max_eirp));
++ else
++ chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
++
+ if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
+ request_wiphy && request_wiphy == wiphy &&
+ request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) {
+@@ -851,19 +857,12 @@ static void handle_channel(struct wiphy
+ map_regdom_flags(reg_rule->flags) | bw_flags;
+ chan->max_antenna_gain = chan->orig_mag =
+ (int) MBI_TO_DBI(power_rule->max_antenna_gain);
+- chan->max_power = chan->orig_mpwr =
+- (int) MBM_TO_DBM(power_rule->max_eirp);
+ return;
+ }
+
+ chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
+ chan->max_antenna_gain = min(chan->orig_mag,
+ (int) MBI_TO_DBI(power_rule->max_antenna_gain));
+- if (chan->orig_mpwr)
+- chan->max_power = min(chan->orig_mpwr,
+- (int) MBM_TO_DBM(power_rule->max_eirp));
+- else
+- chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
+ }
+
+ static void handle_band(struct wiphy *wiphy,