aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/power.c
diff options
context:
space:
mode:
authorAlexander Bondar <alexander.bondar@intel.com>2013-02-03 14:26:44 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-04-03 16:49:13 -0400
commit83bdad52a3430d0f6c35b64012062ffc4e7ceb13 (patch)
treea67078099f612ee7a42f9e9fbfff9ce7d7642aec /drivers/net/wireless/iwlwifi/mvm/power.c
parent9166b1eeb7f3e98d76ab735bf91d01a7516562da (diff)
iwlwifi: mvm: downgrade to old power management API
Current available FW still doesn't support new PM API. Therefore, to enable basic power management with the existing firmware, change the API in the driver back to the API used in the current firmware. Signed-off-by: Alexander Bondar <alexander.bondar@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/power.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index efb9a6f3faac..55eee6e505d2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -79,22 +79,18 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
79 struct iwl_powertable_cmd *cmd) 79 struct iwl_powertable_cmd *cmd)
80{ 80{
81 struct ieee80211_hw *hw = mvm->hw; 81 struct ieee80211_hw *hw = mvm->hw;
82 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
83 struct ieee80211_chanctx_conf *chanctx_conf; 82 struct ieee80211_chanctx_conf *chanctx_conf;
84 struct ieee80211_channel *chan; 83 struct ieee80211_channel *chan;
85 int dtimper, dtimper_msec; 84 int dtimper, dtimper_msec;
86 int keep_alive; 85 int keep_alive;
87 bool radar_detect = false; 86 bool radar_detect = false;
88 87
89 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
90 mvmvif->color));
91 cmd->action = cpu_to_le32(FW_CTXT_ACTION_MODIFY);
92
93 if ((!vif->bss_conf.ps) || 88 if ((!vif->bss_conf.ps) ||
94 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM)) 89 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM))
95 return; 90 return;
96 91
97 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); 92 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK |
93 POWER_FLAGS_POWER_SAVE_ENA_MSK);
98 94
99 dtimper = hw->conf.ps_dtim_period ?: 1; 95 dtimper = hw->conf.ps_dtim_period ?: 1;
100 96
@@ -110,10 +106,8 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
110 106
111 /* Check skip over DTIM conditions */ 107 /* Check skip over DTIM conditions */
112 if (!radar_detect && (dtimper <= 10) && 108 if (!radar_detect && (dtimper <= 10) &&
113 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP)) { 109 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP))
114 cmd->flags |= cpu_to_le16(POWER_FLAGS_SLEEP_OVER_DTIM_MSK); 110 cmd->flags |= cpu_to_le16(POWER_FLAGS_SLEEP_OVER_DTIM_MSK);
115 cmd->num_skip_dtim = 2;
116 }
117 111
118 /* Check that keep alive period is at least 3 * DTIM */ 112 /* Check that keep alive period is at least 3 * DTIM */
119 dtimper_msec = dtimper * vif->bss_conf.beacon_int; 113 dtimper_msec = dtimper * vif->bss_conf.beacon_int;
@@ -121,7 +115,7 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
121 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC); 115 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC);
122 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); 116 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC);
123 117
124 cmd->keep_alive_seconds = cpu_to_le16(keep_alive); 118 cmd->keep_alive_seconds = keep_alive;
125 119
126 if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) { 120 if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) {
127 /* TODO: Also for D3 (device sleep / WoWLAN) */ 121 /* TODO: Also for D3 (device sleep / WoWLAN) */
@@ -148,24 +142,18 @@ int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
148 iwl_power_build_cmd(mvm, vif, &cmd); 142 iwl_power_build_cmd(mvm, vif, &cmd);
149 143
150 IWL_DEBUG_POWER(mvm, 144 IWL_DEBUG_POWER(mvm,
151 "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", 145 "Sending power table command for power level %d, flags = 0x%X\n",
152 cmd.id_and_color, iwlmvm_mod_params.power_scheme, 146 iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags));
153 le16_to_cpu(cmd.flags));
154 147
155 if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { 148 if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) {
156 IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", 149 IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n",
157 le16_to_cpu(cmd.keep_alive_seconds)); 150 cmd.keep_alive_seconds);
158 IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", 151 IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n",
159 le32_to_cpu(cmd.rx_data_timeout)); 152 le32_to_cpu(cmd.rx_data_timeout));
160 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", 153 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n",
161 le32_to_cpu(cmd.tx_data_timeout)); 154 le32_to_cpu(cmd.tx_data_timeout));
162 IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n",
163 le32_to_cpu(cmd.rx_data_timeout_uapsd));
164 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n",
165 le32_to_cpu(cmd.tx_data_timeout_uapsd));
166 IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", 155 IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n",
167 cmd.lprx_rssi_threshold); 156 cmd.lprx_rssi_threshold);
168 IWL_DEBUG_POWER(mvm, "DTIMs to skip = %u\n", cmd.num_skip_dtim);
169 } 157 }
170 158
171 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, 159 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC,
@@ -175,7 +163,6 @@ int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
175int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 163int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
176{ 164{
177 struct iwl_powertable_cmd cmd = {}; 165 struct iwl_powertable_cmd cmd = {};
178 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
179 166
180 if (!iwlwifi_mod_params.power_save) { 167 if (!iwlwifi_mod_params.power_save) {
181 IWL_DEBUG_POWER(mvm, "Power management is not allowed\n"); 168 IWL_DEBUG_POWER(mvm, "Power management is not allowed\n");
@@ -185,14 +172,9 @@ int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
185 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) 172 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
186 return 0; 173 return 0;
187 174
188 cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
189 mvmvif->color));
190 cmd.action = cpu_to_le32(FW_CTXT_ACTION_MODIFY);
191
192 IWL_DEBUG_POWER(mvm, 175 IWL_DEBUG_POWER(mvm,
193 "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", 176 "Sending power table command power level %d, flags = 0x%X\n",
194 cmd.id_and_color, iwlmvm_mod_params.power_scheme, 177 iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags));
195 le16_to_cpu(cmd.flags));
196 178
197 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC, 179 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC,
198 sizeof(cmd), &cmd); 180 sizeof(cmd), &cmd);