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 600c9fd..4c887f3 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 37f1153..d73304a 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 8f2a4e9..acd2665 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 e57fb98..3325059 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 2cd669c..edb94ea 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