aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-power.c
diff options
context:
space:
mode:
authorMohamed Abbas <mohamed.abbas@intel.com>2008-07-18 01:52:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-04 15:09:06 -0400
commitca579617d81baf5865498eb5fae58e453ee77c2c (patch)
tree2d2aff22644a2369c1f0cb524a8c8457103d738d /drivers/net/wireless/iwlwifi/iwl-power.c
parentadf044c8778de98dae29c5ce9973b7e43964674f (diff)
iwlwifi: add power save to 5000 HW
This patch adds support for power save for 5000 HW. Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-power.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 2e71803e09ba..e3c71beb01ef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -112,6 +112,13 @@ static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = {
112 {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 112 {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
113}; 113};
114 114
115/* set card power command */
116static int iwl_set_power(struct iwl_priv *priv, void *cmd)
117{
118 return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD,
119 sizeof(struct iwl_powertable_cmd),
120 cmd, NULL);
121}
115/* decide the right power level according to association status 122/* decide the right power level according to association status
116 * and battery status 123 * and battery status
117 */ 124 */
@@ -162,7 +169,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
162 if (ret != 0) 169 if (ret != 0)
163 return 0; 170 return 0;
164 else { 171 else {
165 struct iwl4965_powertable_cmd *cmd; 172 struct iwl_powertable_cmd *cmd;
166 173
167 IWL_DEBUG_POWER("adjust power command flags\n"); 174 IWL_DEBUG_POWER("adjust power command flags\n");
168 175
@@ -180,7 +187,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
180 187
181/* adjust power command according to dtim period and power level*/ 188/* adjust power command according to dtim period and power level*/
182static int iwl_update_power_command(struct iwl_priv *priv, 189static int iwl_update_power_command(struct iwl_priv *priv,
183 struct iwl4965_powertable_cmd *cmd, 190 struct iwl_powertable_cmd *cmd,
184 u16 mode) 191 u16 mode)
185{ 192{
186 int ret = 0, i; 193 int ret = 0, i;
@@ -204,7 +211,7 @@ static int iwl_update_power_command(struct iwl_priv *priv,
204 range = &pow_data->pwr_range_2[0]; 211 range = &pow_data->pwr_range_2[0];
205 212
206 period = pow_data->dtim_period; 213 period = pow_data->dtim_period;
207 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd)); 214 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd));
208 215
209 if (period == 0) { 216 if (period == 0) {
210 period = 1; 217 period = 1;
@@ -280,7 +287,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh)
280 287
281 if (!iwl_is_rfkill(priv) && !setting->power_disabled && 288 if (!iwl_is_rfkill(priv) && !setting->power_disabled &&
282 ((setting->power_mode != final_mode) || refresh)) { 289 ((setting->power_mode != final_mode) || refresh)) {
283 struct iwl4965_powertable_cmd cmd; 290 struct iwl_powertable_cmd cmd;
284 291
285 if (final_mode != IWL_POWER_MODE_CAM) 292 if (final_mode != IWL_POWER_MODE_CAM)
286 set_bit(STATUS_POWER_PMI, &priv->status); 293 set_bit(STATUS_POWER_PMI, &priv->status);
@@ -291,8 +298,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh)
291 if (final_mode == IWL_POWER_INDEX_5) 298 if (final_mode == IWL_POWER_INDEX_5)
292 cmd.flags |= IWL_POWER_FAST_PD; 299 cmd.flags |= IWL_POWER_FAST_PD;
293 300
294 if (priv->cfg->ops->lib->set_power) 301 ret = iwl_set_power(priv, &cmd);
295 ret = priv->cfg->ops->lib->set_power(priv, &cmd);
296 302
297 if (final_mode == IWL_POWER_MODE_CAM) 303 if (final_mode == IWL_POWER_MODE_CAM)
298 clear_bit(STATUS_POWER_PMI, &priv->status); 304 clear_bit(STATUS_POWER_PMI, &priv->status);