diff mbox

[3/8,Vivid,SRU,re-spin,SAUCE] mwifiex: set regulatory info from EEPROM

Message ID 1451896654-24765-4-git-send-email-kengyu@canonical.com
State New
Headers show

Commit Message

Keng-Yu Lin Jan. 4, 2016, 8:37 a.m. UTC
From: Amitkumar Karwar <akarwar@marvell.com>

Driver gets country information from EEPROM during
initialization. We will call regulatory_hint to update
current regulatory domain.
As by default world regulatory domain is selected by
cfg80211, country '00' from EEPROM is ignored.

BugLink: https://launchpad.net/bugs/1528910

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
Tested-by: Gavin Lin <gavin.lin@canonical.com>
Reviewed-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
---
 drivers/net/wireless/mwifiex/cfg80211.c | 13 +++++++++----
 drivers/net/wireless/mwifiex/cfp.c      |  2 +-
 drivers/net/wireless/mwifiex/main.h     |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 0a7d5c5..a63464f 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -3018,10 +3018,15 @@  int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 		wiphy_info(wiphy, "driver hint alpha2: %2.2s\n", reg_alpha2);
 		regulatory_hint(wiphy, reg_alpha2);
 	} else {
-		country_code = mwifiex_11d_code_2_region(adapter->region_code);
-		if (country_code)
-			wiphy_info(wiphy, "ignoring F/W country code %2.2s\n",
-				   country_code);
+		if (adapter->region_code == 0x00) {
+			wiphy_warn(wiphy, "Ignore world regulatory domain\n");
+		} else {
+			country_code =
+				mwifiex_11d_code_2_region(adapter->region_code);
+			if (country_code &&
+			    regulatory_hint(wiphy, country_code))
+				wiphy_err(wiphy, "regulatory_hint() failed\n");
+		}
 	}
 
 	mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index b8242eb..e7329eb 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -66,7 +66,7 @@  static u8 supported_rates_bg[BG_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x0c,
 					0x12, 0x16, 0x18, 0x24, 0x30, 0x48,
 					0x60, 0x6c, 0 };
 
-u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30,
+u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x00, 0x10, 0x20, 0x30,
 						0x32, 0x40, 0x41, 0xff };
 
 static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 };
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index fc3a128..b64ee62 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -75,7 +75,7 @@  enum {
 
 #define MWIFIEX_KEY_BUFFER_SIZE			16
 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
-#define MWIFIEX_MAX_REGION_CODE         7
+#define MWIFIEX_MAX_REGION_CODE         8
 
 #define DEFAULT_BCN_AVG_FACTOR          8
 #define DEFAULT_DATA_AVG_FACTOR         8