aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChaoming_Li <chaoming_li@realsil.com.cn>2011-04-25 13:53:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-26 16:13:32 -0400
commit81b290451122e93b9731bc333c6be2e49fa5bc0c (patch)
tree34285f30f00ef2ac73205f6bad9f76e1fad02447 /drivers
parentc6a9de0823e6f1335c93594f7b904f345860dafc (diff)
rtlwifi: Convert regulatory domain routines for addition of rtl8192se and rtl8192de
Convert regulatory domain routines for addition of RTL8192SE and RTL8192DE code. Signed-off-by: Chaoming_Li <chaoming_li@realsil.com.cn> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rtlwifi/regd.c97
-rw-r--r--drivers/net/wireless/rtlwifi/regd.h2
2 files changed, 78 insertions, 21 deletions
diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c
index 3336ca999dfd..714858abc4ac 100644
--- a/drivers/net/wireless/rtlwifi/regd.c
+++ b/drivers/net/wireless/rtlwifi/regd.c
@@ -66,31 +66,83 @@ static struct country_code_to_enum_rd allCountries[] = {
66 NL80211_RRF_PASSIVE_SCAN | \ 66 NL80211_RRF_PASSIVE_SCAN | \
67 NL80211_RRF_NO_OFDM) 67 NL80211_RRF_NO_OFDM)
68 68
69/* 5G chan 36 - chan 64*/
70#define RTL819x_5GHZ_5150_5350 \
71 REG_RULE(5150-10, 5350+10, 40, 0, 30, \
72 NL80211_RRF_PASSIVE_SCAN | \
73 NL80211_RRF_NO_IBSS)
74
75/* 5G chan 100 - chan 165*/
76#define RTL819x_5GHZ_5470_5850 \
77 REG_RULE(5470-10, 5850+10, 40, 0, 30, \
78 NL80211_RRF_PASSIVE_SCAN | \
79 NL80211_RRF_NO_IBSS)
80
81/* 5G chan 149 - chan 165*/
82#define RTL819x_5GHZ_5725_5850 \
83 REG_RULE(5725-10, 5850+10, 40, 0, 30, \
84 NL80211_RRF_PASSIVE_SCAN | \
85 NL80211_RRF_NO_IBSS)
86
87#define RTL819x_5GHZ_ALL \
88 (RTL819x_5GHZ_5150_5350, RTL819x_5GHZ_5470_5850)
89
69static const struct ieee80211_regdomain rtl_regdom_11 = { 90static const struct ieee80211_regdomain rtl_regdom_11 = {
70 .n_reg_rules = 1, 91 .n_reg_rules = 1,
71 .alpha2 = "99", 92 .alpha2 = "99",
72 .reg_rules = { 93 .reg_rules = {
73 RTL819x_2GHZ_CH01_11, 94 RTL819x_2GHZ_CH01_11,
74 } 95 }
96};
97
98static const struct ieee80211_regdomain rtl_regdom_12_13 = {
99 .n_reg_rules = 2,
100 .alpha2 = "99",
101 .reg_rules = {
102 RTL819x_2GHZ_CH01_11,
103 RTL819x_2GHZ_CH12_13,
104 }
75}; 105};
76 106
77static const struct ieee80211_regdomain rtl_regdom_global = { 107static const struct ieee80211_regdomain rtl_regdom_no_midband = {
78 .n_reg_rules = 3, 108 .n_reg_rules = 3,
79 .alpha2 = "99", 109 .alpha2 = "99",
80 .reg_rules = { 110 .reg_rules = {
81 RTL819x_2GHZ_CH01_11, 111 RTL819x_2GHZ_CH01_11,
82 RTL819x_2GHZ_CH12_13, 112 RTL819x_5GHZ_5150_5350,
83 RTL819x_2GHZ_CH14, 113 RTL819x_5GHZ_5725_5850,
84 } 114 }
85}; 115};
86 116
87static const struct ieee80211_regdomain rtl_regdom_world = { 117static const struct ieee80211_regdomain rtl_regdom_60_64 = {
88 .n_reg_rules = 2, 118 .n_reg_rules = 3,
89 .alpha2 = "99", 119 .alpha2 = "99",
90 .reg_rules = { 120 .reg_rules = {
91 RTL819x_2GHZ_CH01_11, 121 RTL819x_2GHZ_CH01_11,
92 RTL819x_2GHZ_CH12_13, 122 RTL819x_2GHZ_CH12_13,
93 } 123 RTL819x_5GHZ_5725_5850,
124 }
125};
126
127static const struct ieee80211_regdomain rtl_regdom_14_60_64 = {
128 .n_reg_rules = 4,
129 .alpha2 = "99",
130 .reg_rules = {
131 RTL819x_2GHZ_CH01_11,
132 RTL819x_2GHZ_CH12_13,
133 RTL819x_2GHZ_CH14,
134 RTL819x_5GHZ_5725_5850,
135 }
136};
137
138static const struct ieee80211_regdomain rtl_regdom_14 = {
139 .n_reg_rules = 3,
140 .alpha2 = "99",
141 .reg_rules = {
142 RTL819x_2GHZ_CH01_11,
143 RTL819x_2GHZ_CH12_13,
144 RTL819x_2GHZ_CH14,
145 }
94}; 146};
95 147
96static bool _rtl_is_radar_freq(u16 center_freq) 148static bool _rtl_is_radar_freq(u16 center_freq)
@@ -162,6 +214,8 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
162 u32 bandwidth = 0; 214 u32 bandwidth = 0;
163 int r; 215 int r;
164 216
217 if (!wiphy->bands[IEEE80211_BAND_2GHZ])
218 return;
165 sband = wiphy->bands[IEEE80211_BAND_2GHZ]; 219 sband = wiphy->bands[IEEE80211_BAND_2GHZ];
166 220
167 /* 221 /*
@@ -292,25 +346,26 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select(
292{ 346{
293 switch (reg->country_code) { 347 switch (reg->country_code) {
294 case COUNTRY_CODE_FCC: 348 case COUNTRY_CODE_FCC:
349 return &rtl_regdom_no_midband;
295 case COUNTRY_CODE_IC: 350 case COUNTRY_CODE_IC:
296 return &rtl_regdom_11; 351 return &rtl_regdom_11;
297 case COUNTRY_CODE_ETSI: 352 case COUNTRY_CODE_ETSI:
353 case COUNTRY_CODE_TELEC_NETGEAR:
354 return &rtl_regdom_60_64;
298 case COUNTRY_CODE_SPAIN: 355 case COUNTRY_CODE_SPAIN:
299 case COUNTRY_CODE_FRANCE: 356 case COUNTRY_CODE_FRANCE:
300 case COUNTRY_CODE_ISRAEL: 357 case COUNTRY_CODE_ISRAEL:
301 case COUNTRY_CODE_TELEC_NETGEAR: 358 case COUNTRY_CODE_WORLD_WIDE_13:
302 return &rtl_regdom_world; 359 return &rtl_regdom_12_13;
303 case COUNTRY_CODE_MKK: 360 case COUNTRY_CODE_MKK:
304 case COUNTRY_CODE_MKK1: 361 case COUNTRY_CODE_MKK1:
305 case COUNTRY_CODE_TELEC: 362 case COUNTRY_CODE_TELEC:
306 case COUNTRY_CODE_MIC: 363 case COUNTRY_CODE_MIC:
307 return &rtl_regdom_global; 364 return &rtl_regdom_14_60_64;
308 case COUNTRY_CODE_GLOBAL_DOMAIN: 365 case COUNTRY_CODE_GLOBAL_DOMAIN:
309 return &rtl_regdom_global; 366 return &rtl_regdom_14;
310 case COUNTRY_CODE_WORLD_WIDE_13:
311 return &rtl_regdom_world;
312 default: 367 default:
313 return &rtl_regdom_world; 368 return &rtl_regdom_no_midband;
314 } 369 }
315} 370}
316 371
@@ -323,9 +378,11 @@ static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg,
323 const struct ieee80211_regdomain *regd; 378 const struct ieee80211_regdomain *regd;
324 379
325 wiphy->reg_notifier = reg_notifier; 380 wiphy->reg_notifier = reg_notifier;
381
326 wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; 382 wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
327 wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; 383 wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
328 wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; 384 wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;
385
329 regd = _rtl_regdomain_select(reg); 386 regd = _rtl_regdomain_select(reg);
330 wiphy_apply_custom_regulatory(wiphy, regd); 387 wiphy_apply_custom_regulatory(wiphy, regd);
331 _rtl_reg_apply_radar_flags(wiphy); 388 _rtl_reg_apply_radar_flags(wiphy);
@@ -355,8 +412,8 @@ int rtl_regd_init(struct ieee80211_hw *hw,
355 if (wiphy == NULL || &rtlpriv->regd == NULL) 412 if (wiphy == NULL || &rtlpriv->regd == NULL)
356 return -EINVAL; 413 return -EINVAL;
357 414
358 /* force the channel plan to world wide 13 */ 415 /* init country_code from efuse channel plan */
359 rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13; 416 rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan;
360 417
361 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, 418 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE,
362 (KERN_DEBUG "rtl: EEPROM regdomain: 0x%0x\n", 419 (KERN_DEBUG "rtl: EEPROM regdomain: 0x%0x\n",
@@ -373,8 +430,8 @@ int rtl_regd_init(struct ieee80211_hw *hw,
373 country = _rtl_regd_find_country(rtlpriv->regd.country_code); 430 country = _rtl_regd_find_country(rtlpriv->regd.country_code);
374 431
375 if (country) { 432 if (country) {
376 rtlpriv->regd.alpha2[0] = country->isoName[0]; 433 rtlpriv->regd.alpha2[0] = country->iso_name[0];
377 rtlpriv->regd.alpha2[1] = country->isoName[1]; 434 rtlpriv->regd.alpha2[1] = country->iso_name[1];
378 } else { 435 } else {
379 rtlpriv->regd.alpha2[0] = '0'; 436 rtlpriv->regd.alpha2[0] = '0';
380 rtlpriv->regd.alpha2[1] = '0'; 437 rtlpriv->regd.alpha2[1] = '0';
diff --git a/drivers/net/wireless/rtlwifi/regd.h b/drivers/net/wireless/rtlwifi/regd.h
index 4cdbc4ae76d4..d23118938fac 100644
--- a/drivers/net/wireless/rtlwifi/regd.h
+++ b/drivers/net/wireless/rtlwifi/regd.h
@@ -32,7 +32,7 @@
32 32
33struct country_code_to_enum_rd { 33struct country_code_to_enum_rd {
34 u16 countrycode; 34 u16 countrycode;
35 const char *isoName; 35 const char *iso_name;
36}; 36};
37 37
38enum country_code_type_t { 38enum country_code_type_t {