Commit d7203a83 authored by Prameela Rani Garnepudi's avatar Prameela Rani Garnepudi Committed by Kalle Valo

rsi: regulatory enhancements

Below regulatory changes are included this patch
* Country code is saved as it will be used in bgscan.
* Region codes are mapped according to RSI region codes.
* Radar flag settings are moved under the check if 5GHZ band
  is enabled.
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 86583258
...@@ -1163,6 +1163,21 @@ static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw, ...@@ -1163,6 +1163,21 @@ static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw,
return 0; return 0;
} }
static int rsi_map_region_code(enum nl80211_dfs_regions region_code)
{
switch (region_code) {
case NL80211_DFS_FCC:
return RSI_REGION_FCC;
case NL80211_DFS_ETSI:
return RSI_REGION_ETSI;
case NL80211_DFS_JP:
return RSI_REGION_TELEC;
case NL80211_DFS_UNSET:
return RSI_REGION_WORLD;
}
return RSI_REGION_WORLD;
}
static void rsi_reg_notify(struct wiphy *wiphy, static void rsi_reg_notify(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
...@@ -1170,23 +1185,33 @@ static void rsi_reg_notify(struct wiphy *wiphy, ...@@ -1170,23 +1185,33 @@ static void rsi_reg_notify(struct wiphy *wiphy,
struct ieee80211_channel *ch; struct ieee80211_channel *ch;
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct rsi_hw * adapter = hw->priv; struct rsi_hw * adapter = hw->priv;
struct rsi_common *common = adapter->priv;
int i; int i;
sband = wiphy->bands[NL80211_BAND_5GHZ];
for (i = 0; i < sband->n_channels; i++) { mutex_lock(&common->mutex);
ch = &sband->channels[i];
if (ch->flags & IEEE80211_CHAN_DISABLED) rsi_dbg(INFO_ZONE, "country = %s dfs_region = %d\n",
continue; request->alpha2, request->dfs_region);
if (common->num_supp_bands > 1) {
sband = wiphy->bands[NL80211_BAND_5GHZ];
if (ch->flags & IEEE80211_CHAN_RADAR) for (i = 0; i < sband->n_channels; i++) {
ch->flags |= IEEE80211_CHAN_NO_IR; ch = &sband->channels[i];
if (ch->flags & IEEE80211_CHAN_DISABLED)
continue;
if (ch->flags & IEEE80211_CHAN_RADAR)
ch->flags |= IEEE80211_CHAN_NO_IR;
}
} }
adapter->dfs_region = rsi_map_region_code(request->dfs_region);
rsi_dbg(INFO_ZONE, "RSI region code = %d\n", adapter->dfs_region);
rsi_dbg(INFO_ZONE, adapter->country[0] = request->alpha2[0];
"country = %s dfs_region = %d\n", adapter->country[1] = request->alpha2[1];
request->alpha2, request->dfs_region);
adapter->dfs_region = request->dfs_region; mutex_unlock(&common->mutex);
} }
static struct ieee80211_ops mac80211_ops = { static struct ieee80211_ops mac80211_ops = {
......
...@@ -170,6 +170,13 @@ struct xtended_desc { ...@@ -170,6 +170,13 @@ struct xtended_desc {
u16 reserved; u16 reserved;
}; };
enum rsi_dfs_regions {
RSI_REGION_FCC = 0,
RSI_REGION_ETSI,
RSI_REGION_TELEC,
RSI_REGION_WORLD
};
struct rsi_hw; struct rsi_hw;
struct rsi_common { struct rsi_common {
...@@ -287,6 +294,7 @@ struct rsi_hw { ...@@ -287,6 +294,7 @@ struct rsi_hw {
struct eepromrw_info eeprom; struct eepromrw_info eeprom;
u32 interrupt_status; u32 interrupt_status;
u8 dfs_region; u8 dfs_region;
char country[2];
void *rsi_dev; void *rsi_dev;
struct rsi_host_intf_ops *host_intf_ops; struct rsi_host_intf_ops *host_intf_ops;
int (*check_hw_queue_status)(struct rsi_hw *adapter, u8 q_num); int (*check_hw_queue_status)(struct rsi_hw *adapter, u8 q_num);
......
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