aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-04-09 23:06:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-12 15:10:28 -0400
commit9e04a7c6d45fd70be55fcb48ec49f55dad9928f7 (patch)
tree2cb4cf2ca4279b493fa92c3a9ee1cb226a64668b /drivers/net
parentd35ccaa4768ee39f7bb3c23394703d1da587c731 (diff)
mwifiex: set default regulatory domain
Driver gets region code from FW during initialisation. This patch makes use of it for settting default regulatory domain using regulatory_hint() API. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c6
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c31
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index c7e89188c350..bd07030d5430 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1422,6 +1422,7 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
1422 void *wdev_priv; 1422 void *wdev_priv;
1423 struct wireless_dev *wdev; 1423 struct wireless_dev *wdev;
1424 struct ieee80211_sta_ht_cap *ht_info; 1424 struct ieee80211_sta_ht_cap *ht_info;
1425 u8 *country_code;
1425 1426
1426 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 1427 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
1427 if (!wdev) { 1428 if (!wdev) {
@@ -1484,6 +1485,11 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
1484 "info: successfully registered wiphy device\n"); 1485 "info: successfully registered wiphy device\n");
1485 } 1486 }
1486 1487
1488 country_code = mwifiex_11d_code_2_region(priv->adapter->region_code);
1489 if (country_code && regulatory_hint(wdev->wiphy, country_code))
1490 dev_err(priv->adapter->dev,
1491 "%s: regulatory_hint failed\n", __func__);
1492
1487 priv->wdev = wdev; 1493 priv->wdev = wdev;
1488 1494
1489 return ret; 1495 return ret;
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index 2fe1c33765b8..560871b0e236 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -71,6 +71,37 @@ u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30,
71 71
72static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 }; 72static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 };
73 73
74struct region_code_mapping {
75 u8 code;
76 u8 region[IEEE80211_COUNTRY_STRING_LEN];
77};
78
79static struct region_code_mapping region_code_mapping_t[] = {
80 { 0x10, "US " }, /* US FCC */
81 { 0x20, "CA " }, /* IC Canada */
82 { 0x30, "EU " }, /* ETSI */
83 { 0x31, "ES " }, /* Spain */
84 { 0x32, "FR " }, /* France */
85 { 0x40, "JP " }, /* Japan */
86 { 0x41, "JP " }, /* Japan */
87 { 0x50, "CN " }, /* China */
88};
89
90/* This function converts integer code to region string */
91u8 *mwifiex_11d_code_2_region(u8 code)
92{
93 u8 i;
94 u8 size = sizeof(region_code_mapping_t)/
95 sizeof(struct region_code_mapping);
96
97 /* Look for code in mapping table */
98 for (i = 0; i < size; i++)
99 if (region_code_mapping_t[i].code == code)
100 return region_code_mapping_t[i].region;
101
102 return NULL;
103}
104
74/* 105/*
75 * This function maps an index in supported rates table into 106 * This function maps an index in supported rates table into
76 * the corresponding data rate. 107 * the corresponding data rate.
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index fcccf6b1373f..e601c46a1018 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -965,6 +965,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
965 u32 *flags, struct vif_params *params); 965 u32 *flags, struct vif_params *params);
966int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev); 966int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev);
967 967
968u8 *mwifiex_11d_code_2_region(u8 code);
968 969
969#ifdef CONFIG_DEBUG_FS 970#ifdef CONFIG_DEBUG_FS
970void mwifiex_debugfs_init(void); 971void mwifiex_debugfs_init(void);