Commit 3c68ef5b authored by Avinash Patil's avatar Avinash Patil Committed by John W. Linville

mwifiex: Add module parameter for regdomain

Allow a regulatory domain country code to be specified at boot
using a module argument.  This overrides the firmware regulatory
mode.

This patch also enables uAP to operate in 11a mode with hostapd.
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarPaul Stewart <pstew@chromium.org>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1105a13b
......@@ -20,6 +20,9 @@
#include "cfg80211.h"
#include "main.h"
static char *reg_alpha2;
module_param(reg_alpha2, charp, 0);
static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
{
.max = 2, .types = BIT(NL80211_IFTYPE_STATION),
......@@ -2485,6 +2488,17 @@ static const struct wiphy_wowlan_support mwifiex_wowlan_support = {
};
#endif
static bool mwifiex_is_valid_alpha2(const char *alpha2)
{
if (!alpha2 || strlen(alpha2) != 2)
return false;
if (isalpha(alpha2[0]) && isalpha(alpha2[1]))
return true;
return false;
}
/*
* This function registers the device with CFG802.11 subsystem.
*
......@@ -2537,6 +2551,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
WIPHY_FLAG_AP_UAPSD |
WIPHY_FLAG_CUSTOM_REGULATORY |
WIPHY_FLAG_STRICT_REGULATORY |
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
......@@ -2574,10 +2589,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
wiphy_free(wiphy);
return ret;
}
country_code = mwifiex_11d_code_2_region(priv->adapter->region_code);
if (reg_alpha2 && mwifiex_is_valid_alpha2(reg_alpha2)) {
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)
dev_info(adapter->dev,
"ignoring F/W country code %2.2s\n", country_code);
wiphy_info(wiphy, "ignoring F/W country code %2.2s\n",
country_code);
}
adapter->wiphy = wiphy;
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment