aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-22 09:27:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-10-23 14:02:06 -0400
commit94e05900770c0abe31200881df93e41d296fe8bd (patch)
tree8ac0aa8649dfabc32cd38fa90e23c38df5d97169 /drivers/net/wireless
parentd514aefb8ce89562ef2d7dcddc530e5de6287c4b (diff)
ath: use CTL region from cfg80211 if unset in EEPROM
Many AP devices do not have the proper regulatory domain programmed in EEPROM. Instead they expect the software to set the appropriate region. For these devices, the country code defaults to US, and the driver uses the US CTL tables as well. On devices bought in Europe this can lead to tx power being set too high on the band edges, even if the cfg80211 regdomain is set correctly. Fix this issue by taking into account the DFS region, but only when the EEPROM regdomain is set to default. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath.h1
-rw-r--r--drivers/net/wireless/ath/regd.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index e5ba6faf3281..86907e5ba6ca 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -80,6 +80,7 @@ struct reg_dmn_pair_mapping {
80 80
81struct ath_regulatory { 81struct ath_regulatory {
82 char alpha2[2]; 82 char alpha2[2];
83 enum nl80211_dfs_regions region;
83 u16 country_code; 84 u16 country_code;
84 u16 max_power_level; 85 u16 max_power_level;
85 u16 current_rd; 86 u16 current_rd;
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 415393dfb6fc..06ea6cc9e30a 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -515,6 +515,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
515 if (!request) 515 if (!request)
516 return; 516 return;
517 517
518 reg->region = request->dfs_region;
518 switch (request->initiator) { 519 switch (request->initiator) {
519 case NL80211_REGDOM_SET_BY_CORE: 520 case NL80211_REGDOM_SET_BY_CORE:
520 /* 521 /*
@@ -779,6 +780,19 @@ u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
779 return SD_NO_CTL; 780 return SD_NO_CTL;
780 } 781 }
781 782
783 if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) {
784 switch (reg->region) {
785 case NL80211_DFS_FCC:
786 return CTL_FCC;
787 case NL80211_DFS_ETSI:
788 return CTL_ETSI;
789 case NL80211_DFS_JP:
790 return CTL_MKK;
791 default:
792 break;
793 }
794 }
795
782 switch (band) { 796 switch (band) {
783 case IEEE80211_BAND_2GHZ: 797 case IEEE80211_BAND_2GHZ:
784 return reg->regpair->reg_2ghz_ctl; 798 return reg->regpair->reg_2ghz_ctl;