mwifiex: download per country tx power table to firmware
authorBing Zhao <bzhao@marvell.com>
Sat, 14 Dec 2013 02:33:02 +0000 (18:33 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 18 Dec 2013 20:23:11 +0000 (15:23 -0500)
When driver gets regulatory domain change notifications or before
associates to an AP with Country IE, the txpwrlimit table stored
in device tree for that country is downloaded to firmware.

The txpwrlimit downloading will happen only at the first time
when the alpha2 country code is changed. World regulatory domain
"00" notification doesn't trigger the downloading. This behavior
is same as domain_info command.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_cmd.c
drivers/net/wireless/mwifiex/sta_ioctl.c

index ae12aaa793a1c6d30d806de9ee6430b901c47276..b994679abce0a2685dbe74098580e2efcef6076e 100644 (file)
@@ -538,6 +538,8 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy,
                                 struct regulatory_request *request)
 {
        struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
+       struct mwifiex_private *priv = mwifiex_get_priv(adapter,
+                                                       MWIFIEX_BSS_ROLE_ANY);
 
        wiphy_dbg(wiphy, "info: cfg80211 regulatory domain callback for %c%c\n",
                  request->alpha2[0], request->alpha2[1]);
@@ -561,6 +563,14 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy,
                memcpy(adapter->country_code, request->alpha2,
                       sizeof(request->alpha2));
                mwifiex_send_domain_info_cmd_fw(wiphy);
+
+               if (adapter->dt_node) {
+                       char txpwr[] = {"marvell,00_txpwrlimit"};
+
+                       memcpy(&txpwr[8], adapter->country_code, 2);
+                       mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
+                                               txpwr);
+               }
        }
 }
 
index 2f5035492ef9235256ff42e7ba591f2310f9df75..ab3416449bfd3c0f2668d312df9854cb3281eb9d 100644 (file)
@@ -1153,6 +1153,8 @@ void mwifiex_uap_del_sta_data(struct mwifiex_private *priv,
 void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
                              struct mwifiex_bssdescriptor *bss_desc);
 int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv);
+int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
+                           struct device_node *node, const char *prefix);
 
 extern const struct ethtool_ops mwifiex_ethtool_ops;
 
index 6a9508695bbfc0aabe9825c47de1f25a0f32b958..9c2404cd755f34dcfd85922c4b7c9bf8a816dbb8 100644 (file)
@@ -1156,8 +1156,8 @@ static u32 mwifiex_parse_cal_cfg(u8 *src, size_t len, u8 *dst)
        return d - dst;
 }
 
-static int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
-                                  struct device_node *node, const char *prefix)
+int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
+                           struct device_node *node, const char *prefix)
 {
 #ifdef CONFIG_OF
        struct property *prop;
index 85f419825ecf8c929aa6f57ba25b2e7e1387e9b7..3edc92fad319ab21c4e1dd04aa9d65a0235e4c4c 100644 (file)
@@ -234,6 +234,13 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv,
                return -1;
        }
 
+       if (priv->adapter->dt_node) {
+               char txpwr[] = {"marvell,00_txpwrlimit"};
+
+               memcpy(&txpwr[8], priv->adapter->country_code, 2);
+               mwifiex_dnld_dt_cfgdata(priv, priv->adapter->dt_node, txpwr);
+       }
+
        return 0;
 }