提交 4b82455c 编写于 作者: L Luca Coelho

iwlwifi: use flags to denote modifiers for the channel maps

Instead of having a boolean for each modifier we need to handle in the
channel maps, create a bitmask with flags that denote each
modification.
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
上级 4ae80f6c
...@@ -87,6 +87,7 @@ struct iwl_nvm_data *iwl_fw_get_nvm(struct iwl_fw_runtime *fwrt) ...@@ -87,6 +87,7 @@ struct iwl_nvm_data *iwl_fw_get_nvm(struct iwl_fw_runtime *fwrt)
fw_has_capa(&fwrt->fw->ucode_capa, fw_has_capa(&fwrt->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_LAR_SUPPORT); IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
u32 mac_flags; u32 mac_flags;
u32 sbands_flags = 0;
ret = iwl_trans_send_cmd(trans, &hcmd); ret = iwl_trans_send_cmd(trans, &hcmd);
if (ret) if (ret)
...@@ -144,15 +145,16 @@ struct iwl_nvm_data *iwl_fw_get_nvm(struct iwl_fw_runtime *fwrt) ...@@ -144,15 +145,16 @@ struct iwl_nvm_data *iwl_fw_get_nvm(struct iwl_fw_runtime *fwrt)
nvm->valid_tx_ant = (u8)le32_to_cpu(rsp->phy_sku.tx_chains); nvm->valid_tx_ant = (u8)le32_to_cpu(rsp->phy_sku.tx_chains);
nvm->valid_rx_ant = (u8)le32_to_cpu(rsp->phy_sku.rx_chains); nvm->valid_rx_ant = (u8)le32_to_cpu(rsp->phy_sku.rx_chains);
/* Initialize regulatory data */ if (le32_to_cpu(rsp->regulatory.lar_enabled) && lar_fw_supported) {
nvm->lar_enabled = nvm->lar_enabled = true;
le32_to_cpu(rsp->regulatory.lar_enabled) && lar_fw_supported; sbands_flags |= IWL_NVM_SBANDS_FLAGS_LAR;
}
iwl_init_sbands(trans->dev, trans->cfg, nvm, iwl_init_sbands(trans->dev, trans->cfg, nvm,
rsp->regulatory.channel_profile, rsp->regulatory.channel_profile,
nvm->valid_tx_ant & fwrt->fw->valid_tx_ant, nvm->valid_tx_ant & fwrt->fw->valid_tx_ant,
nvm->valid_rx_ant & fwrt->fw->valid_rx_ant, nvm->valid_rx_ant & fwrt->fw->valid_rx_ant,
nvm->lar_enabled, false); sbands_flags);
iwl_free_resp(&hcmd); iwl_free_resp(&hcmd);
return nvm; return nvm;
......
...@@ -295,7 +295,7 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz, ...@@ -295,7 +295,7 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
struct iwl_nvm_data *data, struct iwl_nvm_data *data,
const __le16 * const nvm_ch_flags, const __le16 * const nvm_ch_flags,
bool lar_supported, bool no_wide_in_5ghz) u32 sbands_flags)
{ {
int ch_idx; int ch_idx;
int n_channels = 0; int n_channels = 0;
...@@ -323,7 +323,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, ...@@ -323,7 +323,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
continue; continue;
/* workaround to disable wide channels in 5GHz */ /* workaround to disable wide channels in 5GHz */
if (no_wide_in_5ghz && is_5ghz) { if ((sbands_flags & IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ) &&
is_5ghz) {
ch_flags &= ~(NVM_CHANNEL_40MHZ | ch_flags &= ~(NVM_CHANNEL_40MHZ |
NVM_CHANNEL_80MHZ | NVM_CHANNEL_80MHZ |
NVM_CHANNEL_160MHZ); NVM_CHANNEL_160MHZ);
...@@ -332,7 +333,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, ...@@ -332,7 +333,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
if (ch_flags & NVM_CHANNEL_160MHZ) if (ch_flags & NVM_CHANNEL_160MHZ)
data->vht160_supported = true; data->vht160_supported = true;
if (!lar_supported && !(ch_flags & NVM_CHANNEL_VALID)) { if (!(sbands_flags & IWL_NVM_SBANDS_FLAGS_LAR) &&
!(ch_flags & NVM_CHANNEL_VALID)) {
/* /*
* Channels might become valid later if lar is * Channels might become valid later if lar is
* supported, hence we still want to add them to * supported, hence we still want to add them to
...@@ -362,7 +364,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, ...@@ -362,7 +364,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
channel->max_power = IWL_DEFAULT_MAX_TX_POWER; channel->max_power = IWL_DEFAULT_MAX_TX_POWER;
/* don't put limitations in case we're using LAR */ /* don't put limitations in case we're using LAR */
if (!lar_supported) if (!(sbands_flags & IWL_NVM_SBANDS_FLAGS_LAR))
channel->flags = iwl_get_channel_flags(nvm_chan[ch_idx], channel->flags = iwl_get_channel_flags(nvm_chan[ch_idx],
ch_idx, is_5ghz, ch_idx, is_5ghz,
ch_flags, cfg); ch_flags, cfg);
...@@ -460,15 +462,14 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg, ...@@ -460,15 +462,14 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg,
void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
struct iwl_nvm_data *data, const __le16 *nvm_ch_flags, struct iwl_nvm_data *data, const __le16 *nvm_ch_flags,
u8 tx_chains, u8 rx_chains, bool lar_supported, u8 tx_chains, u8 rx_chains, u32 sbands_flags)
bool no_wide_in_5ghz)
{ {
int n_channels; int n_channels;
int n_used = 0; int n_used = 0;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
n_channels = iwl_init_channel_map(dev, cfg, data, nvm_ch_flags, n_channels = iwl_init_channel_map(dev, cfg, data, nvm_ch_flags,
lar_supported, no_wide_in_5ghz); sbands_flags);
sband = &data->bands[NL80211_BAND_2GHZ]; sband = &data->bands[NL80211_BAND_2GHZ];
sband->band = NL80211_BAND_2GHZ; sband->band = NL80211_BAND_2GHZ;
sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS]; sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS];
...@@ -716,8 +717,8 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -716,8 +717,8 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
struct device *dev = trans->dev; struct device *dev = trans->dev;
struct iwl_nvm_data *data; struct iwl_nvm_data *data;
bool lar_enabled; bool lar_enabled;
bool no_wide_in_5ghz = iwl_nvm_no_wide_in_5ghz(dev, cfg, nvm_hw);
u32 sku, radio_cfg; u32 sku, radio_cfg;
u32 sbands_flags = 0;
u16 lar_config; u16 lar_config;
const __le16 *ch_section; const __le16 *ch_section;
...@@ -790,8 +791,14 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -790,8 +791,14 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
return NULL; return NULL;
} }
if (lar_fw_supported && lar_enabled)
sbands_flags |= IWL_NVM_SBANDS_FLAGS_LAR;
if (iwl_nvm_no_wide_in_5ghz(dev, cfg, nvm_hw))
sbands_flags |= IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ;
iwl_init_sbands(dev, cfg, data, ch_section, tx_chains, rx_chains, iwl_init_sbands(dev, cfg, data, ch_section, tx_chains, rx_chains,
lar_fw_supported && lar_enabled, no_wide_in_5ghz); sbands_flags);
data->calib_version = 255; data->calib_version = 255;
return data; return data;
......
...@@ -69,6 +69,17 @@ ...@@ -69,6 +69,17 @@
#include <net/cfg80211.h> #include <net/cfg80211.h>
#include "iwl-eeprom-parse.h" #include "iwl-eeprom-parse.h"
/**
* enum iwl_nvm_sbands_flags - modification flags for the channel profiles
*
* @IWL_NVM_SBANDS_FLAGS_LAR: LAR is enabled
* @IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ: disallow 40, 80 and 160MHz on 5GHz
*/
enum iwl_nvm_sbands_flags {
IWL_NVM_SBANDS_FLAGS_LAR = BIT(0),
IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ = BIT(1),
};
/** /**
* iwl_parse_nvm_data - parse NVM data and return values * iwl_parse_nvm_data - parse NVM data and return values
* *
...@@ -95,8 +106,7 @@ void iwl_set_hw_address_from_csr(struct iwl_trans *trans, ...@@ -95,8 +106,7 @@ void iwl_set_hw_address_from_csr(struct iwl_trans *trans,
*/ */
void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
struct iwl_nvm_data *data, const __le16 *nvm_ch_flags, struct iwl_nvm_data *data, const __le16 *nvm_ch_flags,
u8 tx_chains, u8 rx_chains, bool lar_supported, u8 tx_chains, u8 rx_chains, u32 sbands_flags);
bool no_wide_in_5ghz);
/** /**
* iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册