aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-core.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-12-10 17:37:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-22 13:56:07 -0500
commitba37a3d0395a66b3c9164c4f4d1318317da32e96 (patch)
treea9d17eba0a6eddb3e26365c0dec3400745521fd7 /drivers/net/wireless/iwlwifi/iwl-core.c
parent11466f1342a3400dd5e03da3d8c45aa4149c62d4 (diff)
iwlwifi: use new mac80211 SMPS
Instead of hard-coding the SM PS mode per hardware, this makes iwlwifi support the new mac80211 API for controlling the SM PS mode. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index c3c31dc9fd4..e3b96b48b7f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -450,8 +450,6 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
450 if (priv->cfg->ht_greenfield_support) 450 if (priv->cfg->ht_greenfield_support)
451 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; 451 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD;
452 ht_info->cap |= IEEE80211_HT_CAP_SGI_20; 452 ht_info->cap |= IEEE80211_HT_CAP_SGI_20;
453 ht_info->cap |= (IEEE80211_HT_CAP_SM_PS &
454 (priv->cfg->sm_ps_mode << 2));
455 max_bit_rate = MAX_BIT_RATE_20_MHZ; 453 max_bit_rate = MAX_BIT_RATE_20_MHZ;
456 if (priv->hw_params.ht40_channel & BIT(band)) { 454 if (priv->hw_params.ht40_channel & BIT(band)) {
457 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 455 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
@@ -636,7 +634,7 @@ EXPORT_SYMBOL(iwlcore_rts_tx_cmd_flag);
636 634
637static bool is_single_rx_stream(struct iwl_priv *priv) 635static bool is_single_rx_stream(struct iwl_priv *priv)
638{ 636{
639 return !priv->current_ht_config.is_ht || 637 return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC ||
640 priv->current_ht_config.single_chain_sufficient; 638 priv->current_ht_config.single_chain_sufficient;
641} 639}
642 640
@@ -1003,28 +1001,18 @@ static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
1003 */ 1001 */
1004static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) 1002static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
1005{ 1003{
1006 int idle_cnt = active_cnt; 1004 /* # Rx chains when idling, depending on SMPS mode */
1007 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); 1005 switch (priv->current_ht_config.smps) {
1008 1006 case IEEE80211_SMPS_STATIC:
1009 /* # Rx chains when idling and maybe trying to save power */ 1007 case IEEE80211_SMPS_DYNAMIC:
1010 switch (priv->cfg->sm_ps_mode) { 1008 return IWL_NUM_IDLE_CHAINS_SINGLE;
1011 case WLAN_HT_CAP_SM_PS_STATIC: 1009 case IEEE80211_SMPS_OFF:
1012 idle_cnt = (is_cam) ? active_cnt : IWL_NUM_IDLE_CHAINS_SINGLE; 1010 return active_cnt;
1013 break;
1014 case WLAN_HT_CAP_SM_PS_DYNAMIC:
1015 idle_cnt = (is_cam) ? IWL_NUM_IDLE_CHAINS_DUAL :
1016 IWL_NUM_IDLE_CHAINS_SINGLE;
1017 break;
1018 case WLAN_HT_CAP_SM_PS_DISABLED:
1019 break;
1020 case WLAN_HT_CAP_SM_PS_INVALID:
1021 default: 1011 default:
1022 IWL_ERR(priv, "invalid sm_ps mode %u\n", 1012 WARN(1, "invalid SMPS mode %d",
1023 priv->cfg->sm_ps_mode); 1013 priv->current_ht_config.smps);
1024 WARN_ON(1); 1014 return active_cnt;
1025 break;
1026 } 1015 }
1027 return idle_cnt;
1028} 1016}
1029 1017
1030/* up to 4 chains */ 1018/* up to 4 chains */
@@ -2686,6 +2674,21 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2686 IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); 2674 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
2687 } 2675 }
2688 2676
2677 if (changed & (IEEE80211_CONF_CHANGE_SMPS |
2678 IEEE80211_CONF_CHANGE_CHANNEL)) {
2679 /* mac80211 uses static for non-HT which is what we want */
2680 priv->current_ht_config.smps = conf->smps_mode;
2681
2682 /*
2683 * Recalculate chain counts.
2684 *
2685 * If monitor mode is enabled then mac80211 will
2686 * set up the SM PS mode to OFF if an HT channel is
2687 * configured.
2688 */
2689 if (priv->cfg->ops->hcmd->set_rxon_chain)
2690 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2691 }
2689 2692
2690 /* during scanning mac80211 will delay channel setting until 2693 /* during scanning mac80211 will delay channel setting until
2691 * scan finish with changed = 0 2694 * scan finish with changed = 0
@@ -2782,10 +2785,6 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2782 iwl_set_tx_power(priv, conf->power_level, false); 2785 iwl_set_tx_power(priv, conf->power_level, false);
2783 } 2786 }
2784 2787
2785 /* call to ensure that 4965 rx_chain is set properly in monitor mode */
2786 if (priv->cfg->ops->hcmd->set_rxon_chain)
2787 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2788
2789 if (!iwl_is_ready(priv)) { 2788 if (!iwl_is_ready(priv)) {
2790 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 2789 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
2791 goto out; 2790 goto out;