iwlwifi: take valid ant for HT caps from TLV
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 22 May 2013 10:16:23 +0000 (13:16 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 29 May 2013 07:03:23 +0000 (09:03 +0200)
I forgot to take them from TLV and took them from the NVM
instead.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
drivers/net/wireless/iwlwifi/iwl-nvm-parse.h
drivers/net/wireless/iwlwifi/mvm/nvm.c

index 600c9fdd7f710fc33091971f0162e20951534e29..4c887f3659089ea3451bc9cc4f2a8dc44c764601 100644 (file)
@@ -732,17 +732,16 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
 void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
                          struct iwl_nvm_data *data,
                          struct ieee80211_sta_ht_cap *ht_info,
-                         enum ieee80211_band band)
+                         enum ieee80211_band band,
+                         u8 tx_chains, u8 rx_chains)
 {
        int max_bit_rate = 0;
-       u8 rx_chains;
-       u8 tx_chains;
 
-       tx_chains = hweight8(data->valid_tx_ant);
+       tx_chains = hweight8(tx_chains);
        if (cfg->rx_with_siso_diversity)
                rx_chains = 1;
        else
-               rx_chains = hweight8(data->valid_rx_ant);
+               rx_chains = hweight8(rx_chains);
 
        if (!(data->sku_cap_11n_enable) || !cfg->ht_params) {
                ht_info->ht_supported = false;
@@ -806,7 +805,8 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
        sband->n_bitrates = N_RATES_24;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
                                          IEEE80211_BAND_2GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ,
+                            data->valid_tx_ant, data->valid_rx_ant);
 
        sband = &data->bands[IEEE80211_BAND_5GHZ];
        sband->band = IEEE80211_BAND_5GHZ;
@@ -814,7 +814,8 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
        sband->n_bitrates = N_RATES_52;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
                                          IEEE80211_BAND_5GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ,
+                            data->valid_tx_ant, data->valid_rx_ant);
 
        if (n_channels != n_used)
                IWL_ERR_DEV(dev, "EEPROM: used only %d of %d channels\n",
index 37f115390b1923f18b9e8fb990bf6a326c55ceed..d73304a23ec203dbdf1df8cc65e7092b2d5aaa37 100644 (file)
@@ -133,6 +133,7 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
 void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
                          struct iwl_nvm_data *data,
                          struct ieee80211_sta_ht_cap *ht_info,
-                         enum ieee80211_band band);
+                         enum ieee80211_band band,
+                         u8 tx_chains, u8 rx_chains);
 
 #endif /* __iwl_eeprom_parse_h__ */
index 8f2a4e92234614a3b872b0e0a7c4168e8627ecd1..acd2665afb8cd9c942cee42527b62acc923a6749 100644 (file)
@@ -292,7 +292,7 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg,
 
 static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
                            struct iwl_nvm_data *data, const __le16 *nvm_sw,
-                           bool enable_vht)
+                           bool enable_vht, u8 tx_chains, u8 rx_chains)
 {
        int n_channels = iwl_init_channel_map(dev, cfg, data,
                        &nvm_sw[NVM_CHANNELS]);
@@ -305,7 +305,8 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
        sband->n_bitrates = N_RATES_24;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
                                          IEEE80211_BAND_2GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ,
+                            tx_chains, rx_chains);
 
        sband = &data->bands[IEEE80211_BAND_5GHZ];
        sband->band = IEEE80211_BAND_5GHZ;
@@ -313,7 +314,8 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
        sband->n_bitrates = N_RATES_52;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
                                          IEEE80211_BAND_5GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ,
+                            tx_chains, rx_chains);
        if (enable_vht)
                iwl_init_vht_hw_capab(cfg, data, &sband->vht_cap);
 
@@ -325,7 +327,7 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
 struct iwl_nvm_data *
 iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
                   const __le16 *nvm_hw, const __le16 *nvm_sw,
-                  const __le16 *nvm_calib)
+                  const __le16 *nvm_calib, u8 tx_chains, u8 rx_chains)
 {
        struct iwl_nvm_data *data;
        u8 hw_addr[ETH_ALEN];
@@ -381,8 +383,8 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
        data->hw_addr[4] = hw_addr[5];
        data->hw_addr[5] = hw_addr[4];
 
-       iwl_init_sbands(dev, cfg, data, nvm_sw,
-                       sku & NVM_SKU_CAP_11AC_ENABLE);
+       iwl_init_sbands(dev, cfg, data, nvm_sw, sku & NVM_SKU_CAP_11AC_ENABLE,
+                       tx_chains, rx_chains);
 
        data->calib_version = 255;   /* TODO:
                                        this value will prevent some checks from
index e57fb989661e0617487cd314b351f3915975e424..3325059c52d49d97c289fab319946fddd0a40c57 100644 (file)
@@ -75,6 +75,6 @@
 struct iwl_nvm_data *
 iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
                   const __le16 *nvm_hw, const __le16 *nvm_sw,
-                  const __le16 *nvm_calib);
+                  const __le16 *nvm_calib, u8 tx_chains, u8 rx_chains);
 
 #endif /* __iwl_nvm_parse_h__ */
index 2cd669c3c47aacdc1a14b4a434637a164e9c91bf..edb94ea316545f439a18e8c16e0952066336e2a2 100644 (file)
@@ -251,7 +251,9 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
        hw = (const __le16 *)sections[NVM_SECTION_TYPE_HW].data;
        sw = (const __le16 *)sections[NVM_SECTION_TYPE_SW].data;
        calib = (const __le16 *)sections[NVM_SECTION_TYPE_CALIBRATION].data;
-       return iwl_parse_nvm_data(mvm->trans->dev, mvm->cfg, hw, sw, calib);
+       return iwl_parse_nvm_data(mvm->trans->dev, mvm->cfg, hw, sw, calib,
+                                 iwl_fw_valid_tx_ant(mvm->fw),
+                                 iwl_fw_valid_rx_ant(mvm->fw));
 }
 
 #define MAX_NVM_FILE_LEN       16384