iwlwifi: generic scan TX antenna forcing
authorJohannes Berg <johannes.berg@intel.com>
Tue, 18 May 2010 09:48:36 +0000 (02:48 -0700)
committerReinette Chatre <reinette.chatre@intel.com>
Sun, 6 Jun 2010 06:19:44 +0000 (23:19 -0700)
In "iwlwifi: make scan antenna forcing more generic"
I introduced generic scan RX antenna forcing, which
here I rename to make it more evident. Also add scan
TX antenna forcing, since I will need that as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h

index a51c4b8e65c770c9fe8fda79054cbda43ae2fcfe..83e6a42ca2da9d085082802435b9571c532169c6 100644 (file)
@@ -2326,7 +2326,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
         * Force use of chains B and C for scan RX on 5 GHz band
         * because the device has off-channel reception on chain A.
         */
-       .scan_antennas[IEEE80211_BAND_5GHZ] = ANT_BC,
+       .scan_rx_antennas[IEEE80211_BAND_5GHZ] = ANT_BC,
 };
 
 /* Module firmware */
index 5bec72a91fd726e8e394030253aac3bdd1a9e3f6..d339881e1d8fa8127de0137a20e78f50ef542fe2 100644 (file)
@@ -1150,6 +1150,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
        bool is_active = false;
        int  chan_mod;
        u8 active_chains;
+       u8 scan_tx_antennas = priv->hw_params.valid_tx_ant;
 
        conf = ieee80211_get_hw_conf(priv->hw);
 
@@ -1301,11 +1302,14 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
 
        band = priv->scan_band;
 
-       if (priv->cfg->scan_antennas[band])
-               rx_ant = priv->cfg->scan_antennas[band];
+       if (priv->cfg->scan_rx_antennas[band])
+               rx_ant = priv->cfg->scan_rx_antennas[band];
 
-       priv->scan_tx_ant[band] =
-                       iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]);
+       if (priv->cfg->scan_tx_antennas[band])
+               scan_tx_antennas = priv->cfg->scan_tx_antennas[band];
+
+       priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band],
+                                                   scan_tx_antennas);
        rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]);
        scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
 
index 0037a52f2e377df97fe0f127d8a4929cb56b2c72..0d3e13b2442f78b662adcdb6ec4e9a9d89e45ff6 100644 (file)
@@ -469,7 +469,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
        }
 
        /* Set up antennas */
-       priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant);
+       priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
+                                             priv->hw_params.valid_tx_ant);
        rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
 
        /* Set the rate in the TX cmd */
index a0e995ec453af91dae23a32f04169fc4ab51cc1d..ac5fade28c8de74a56066650698933e3c62b33fd 100644 (file)
@@ -367,7 +367,8 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
 
        /* Set up packet rate and flags */
        rate = iwl_rate_get_lowest_plcp(priv);
-       priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant);
+       priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
+                                             priv->hw_params.valid_tx_ant);
        rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
        if ((rate >= IWL_FIRST_CCK_RATE) && (rate <= IWL_LAST_CCK_RATE))
                rate_flags |= RATE_MCS_CCK_MSK;
index ec0f39c931069a3e5b2cdba3f52e816a4d40b3b6..00b2cdd3c11e051c3faf71d812db9a2959d54fc4 100644 (file)
@@ -141,13 +141,14 @@ int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
 }
 EXPORT_SYMBOL(iwl_hwrate_to_plcp_idx);
 
-u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant)
+u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
 {
        int i;
        u8 ind = ant;
+
        for (i = 0; i < RATE_ANT_NUM - 1; i++) {
                ind = (ind + 1) < RATE_ANT_NUM ?  ind + 1 : 0;
-               if (priv->hw_params.valid_tx_ant & BIT(ind))
+               if (valid & BIT(ind))
                        return ind;
        }
        return ant;
index 9fe08ecdc14bf852d30abfd722144fcda52612df..87dd5731e515d40333fdcd93179219333b95a1ce 100644 (file)
@@ -328,7 +328,8 @@ struct iwl_cfg {
        const bool ucode_tracing;
        const bool sensitivity_calib_by_driver;
        const bool chain_noise_calib_by_driver;
-       u8 scan_antennas[IEEE80211_NUM_BANDS];
+       u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
+       u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
 };
 
 /***************************
@@ -499,7 +500,7 @@ int iwl_hwrate_to_plcp_idx(u32 rate_n_flags);
 
 u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv);
 
-u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx);
+u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid);
 
 static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
 {