diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-power.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 60a03d2d2d0e..75ca6a542174 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
@@ -39,7 +39,6 @@ | |||
39 | #include "iwl-commands.h" | 39 | #include "iwl-commands.h" |
40 | #include "iwl-debug.h" | 40 | #include "iwl-debug.h" |
41 | #include "iwl-power.h" | 41 | #include "iwl-power.h" |
42 | #include "iwl-helpers.h" | ||
43 | 42 | ||
44 | /* | 43 | /* |
45 | * Setting power level allow the card to go to sleep when not busy | 44 | * Setting power level allow the card to go to sleep when not busy |
@@ -80,7 +79,7 @@ | |||
80 | #define IWL_REDUCED_POWER_TEMPERATURE 95 | 79 | #define IWL_REDUCED_POWER_TEMPERATURE 95 |
81 | 80 | ||
82 | /* default power management (not Tx power) table values */ | 81 | /* default power management (not Tx power) table values */ |
83 | /* for tim 0-10 */ | 82 | /* for TIM 0-10 */ |
84 | static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { | 83 | static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { |
85 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 84 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
86 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, | 85 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, |
@@ -91,7 +90,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { | |||
91 | }; | 90 | }; |
92 | 91 | ||
93 | 92 | ||
94 | /* for tim = 3-10 */ | 93 | /* for TIM = 3-10 */ |
95 | static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { | 94 | static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { |
96 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 95 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
97 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, | 96 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, |
@@ -101,7 +100,7 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { | |||
101 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 7, 10, 10)}, 2} | 100 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 7, 10, 10)}, 2} |
102 | }; | 101 | }; |
103 | 102 | ||
104 | /* for tim > 11 */ | 103 | /* for TIM > 11 */ |
105 | static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { | 104 | static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { |
106 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 105 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
107 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, | 106 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, |
@@ -183,7 +182,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
183 | return 0; | 182 | return 0; |
184 | } | 183 | } |
185 | 184 | ||
186 | /* adjust power command according to dtim period and power level*/ | 185 | /* adjust power command according to DTIM period and power level*/ |
187 | static int iwl_update_power_command(struct iwl_priv *priv, | 186 | static int iwl_update_power_command(struct iwl_priv *priv, |
188 | struct iwl_powertable_cmd *cmd, | 187 | struct iwl_powertable_cmd *cmd, |
189 | u16 mode) | 188 | u16 mode) |
@@ -257,15 +256,11 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
257 | struct iwl_power_mgr *setting = &(priv->power_data); | 256 | struct iwl_power_mgr *setting = &(priv->power_data); |
258 | int ret = 0; | 257 | int ret = 0; |
259 | u16 uninitialized_var(final_mode); | 258 | u16 uninitialized_var(final_mode); |
259 | bool update_chains; | ||
260 | 260 | ||
261 | /* Don't update the RX chain when chain noise calibration is running */ | 261 | /* Don't update the RX chain when chain noise calibration is running */ |
262 | if (priv->chain_noise_data.state != IWL_CHAIN_NOISE_DONE && | 262 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || |
263 | priv->chain_noise_data.state != IWL_CHAIN_NOISE_ALIVE) { | 263 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; |
264 | IWL_DEBUG_POWER("Cannot update the power, chain noise " | ||
265 | "calibration running: %d\n", | ||
266 | priv->chain_noise_data.state); | ||
267 | return -EAGAIN; | ||
268 | } | ||
269 | 264 | ||
270 | /* If on battery, set to 3, | 265 | /* If on battery, set to 3, |
271 | * if plugged into AC power, set to CAM ("continuously aware mode"), | 266 | * if plugged into AC power, set to CAM ("continuously aware mode"), |
@@ -313,9 +308,12 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
313 | else | 308 | else |
314 | set_bit(STATUS_POWER_PMI, &priv->status); | 309 | set_bit(STATUS_POWER_PMI, &priv->status); |
315 | 310 | ||
316 | if (priv->cfg->ops->lib->update_chain_flags) | 311 | if (priv->cfg->ops->lib->update_chain_flags && update_chains) |
317 | priv->cfg->ops->lib->update_chain_flags(priv); | 312 | priv->cfg->ops->lib->update_chain_flags(priv); |
318 | 313 | else | |
314 | IWL_DEBUG_POWER("Cannot update the power, chain noise " | ||
315 | "calibration running: %d\n", | ||
316 | priv->chain_noise_data.state); | ||
319 | if (!ret) | 317 | if (!ret) |
320 | setting->power_mode = final_mode; | 318 | setting->power_mode = final_mode; |
321 | } | 319 | } |
@@ -325,7 +323,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
325 | EXPORT_SYMBOL(iwl_power_update_mode); | 323 | EXPORT_SYMBOL(iwl_power_update_mode); |
326 | 324 | ||
327 | /* Allow other iwl code to disable/enable power management active | 325 | /* Allow other iwl code to disable/enable power management active |
328 | * this will be usefull for rate scale to disable PM during heavy | 326 | * this will be useful for rate scale to disable PM during heavy |
329 | * Tx/Rx activities | 327 | * Tx/Rx activities |
330 | */ | 328 | */ |
331 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) | 329 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) |
@@ -352,8 +350,8 @@ int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) | |||
352 | EXPORT_SYMBOL(iwl_power_disable_management); | 350 | EXPORT_SYMBOL(iwl_power_disable_management); |
353 | 351 | ||
354 | /* Allow other iwl code to disable/enable power management active | 352 | /* Allow other iwl code to disable/enable power management active |
355 | * this will be usefull for rate scale to disable PM during hight | 353 | * this will be useful for rate scale to disable PM during high |
356 | * valume activities | 354 | * volume activities |
357 | */ | 355 | */ |
358 | int iwl_power_enable_management(struct iwl_priv *priv) | 356 | int iwl_power_enable_management(struct iwl_priv *priv) |
359 | { | 357 | { |
@@ -391,7 +389,7 @@ int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode) | |||
391 | } | 389 | } |
392 | EXPORT_SYMBOL(iwl_power_set_system_mode); | 390 | EXPORT_SYMBOL(iwl_power_set_system_mode); |
393 | 391 | ||
394 | /* initilize to default */ | 392 | /* initialize to default */ |
395 | void iwl_power_initialize(struct iwl_priv *priv) | 393 | void iwl_power_initialize(struct iwl_priv *priv) |
396 | { | 394 | { |
397 | 395 | ||
@@ -443,7 +441,7 @@ static void iwl_bg_set_power_save(struct work_struct *work) | |||
443 | 441 | ||
444 | mutex_lock(&priv->mutex); | 442 | mutex_lock(&priv->mutex); |
445 | 443 | ||
446 | /* on starting association we disable power managment | 444 | /* on starting association we disable power management |
447 | * until association, if association failed then this | 445 | * until association, if association failed then this |
448 | * timer will expire and enable PM again. | 446 | * timer will expire and enable PM again. |
449 | */ | 447 | */ |