aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-08-07 18:41:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:48 -0400
commitee9f29894fc3819c1bd639fc3a886326bb809266 (patch)
tree021cdac8894d5cabfecb59e6d796116960902370 /drivers/net/wireless/iwlwifi
parenta28027cd7f169edc399fe4b76d3a33b0203049a1 (diff)
iwlwifi: fix legacy thermal throttling power index
For legacy thermal throttling, set the new Thermal Throttling state and change power index when thermal throttling manager detects temperature changed. The current implementation sets the state to the previous Thermal Throttling state, which causes system to enter wrong power index. The worse case, it will trying to set the lower power index when device reach critical temperature, it will cuase issue for both system and the device. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> 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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 9c05af77f9e..bd97a0da1cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -425,7 +425,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
425static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp) 425static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
426{ 426{
427 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 427 struct iwl_tt_mgmt *tt = &priv->power_data.tt;
428 enum iwl_tt_state new_state; 428 enum iwl_tt_state old_state;
429 struct iwl_power_mgr *setting = &priv->power_data; 429 struct iwl_power_mgr *setting = &priv->power_data;
430 430
431#ifdef CONFIG_IWLWIFI_DEBUG 431#ifdef CONFIG_IWLWIFI_DEBUG
@@ -438,26 +438,27 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
438 (temp - tt->tt_previous_temp)); 438 (temp - tt->tt_previous_temp));
439 } 439 }
440#endif 440#endif
441 old_state = tt->state;
441 /* in Celsius */ 442 /* in Celsius */
442 if (temp >= IWL_MINIMAL_POWER_THRESHOLD) 443 if (temp >= IWL_MINIMAL_POWER_THRESHOLD)
443 new_state = IWL_TI_CT_KILL; 444 tt->state = IWL_TI_CT_KILL;
444 else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_2) 445 else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_2)
445 new_state = IWL_TI_2; 446 tt->state = IWL_TI_2;
446 else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_1) 447 else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_1)
447 new_state = IWL_TI_1; 448 tt->state = IWL_TI_1;
448 else 449 else
449 new_state = IWL_TI_0; 450 tt->state = IWL_TI_0;
450 451
451#ifdef CONFIG_IWLWIFI_DEBUG 452#ifdef CONFIG_IWLWIFI_DEBUG
452 tt->tt_previous_temp = temp; 453 tt->tt_previous_temp = temp;
453#endif 454#endif
454 if (tt->state != new_state) { 455 if (tt->state != old_state) {
455 if (tt->state == IWL_TI_0) { 456 if (old_state == IWL_TI_0) {
456 tt->sys_power_mode = setting->power_mode; 457 tt->sys_power_mode = setting->power_mode;
457 IWL_DEBUG_POWER(priv, "current power mode: %u\n", 458 IWL_DEBUG_POWER(priv, "current power mode: %u\n",
458 setting->power_mode); 459 setting->power_mode);
459 } 460 }
460 switch (new_state) { 461 switch (tt->state) {
461 case IWL_TI_0: 462 case IWL_TI_0:
462 /* when system ready to go back to IWL_TI_0 state 463 /* when system ready to go back to IWL_TI_0 state
463 * using system power mode instead of TT power mode 464 * using system power mode instead of TT power mode
@@ -486,15 +487,15 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
486 /* TT state not updated 487 /* TT state not updated
487 * try again during next temperature read 488 * try again during next temperature read
488 */ 489 */
490 tt->state = old_state;
489 IWL_ERR(priv, "Cannot update power mode, " 491 IWL_ERR(priv, "Cannot update power mode, "
490 "TT state not updated\n"); 492 "TT state not updated\n");
491 } else { 493 } else {
492 if (new_state == IWL_TI_CT_KILL) 494 if (tt->state == IWL_TI_CT_KILL)
493 iwl_perform_ct_kill_task(priv, true); 495 iwl_perform_ct_kill_task(priv, true);
494 else if (tt->state == IWL_TI_CT_KILL && 496 else if (old_state == IWL_TI_CT_KILL &&
495 new_state != IWL_TI_CT_KILL) 497 tt->state != IWL_TI_CT_KILL)
496 iwl_perform_ct_kill_task(priv, false); 498 iwl_perform_ct_kill_task(priv, false);
497 tt->state = new_state;
498 IWL_DEBUG_POWER(priv, "Temperature state changed %u\n", 499 IWL_DEBUG_POWER(priv, "Temperature state changed %u\n",
499 tt->state); 500 tt->state);
500 IWL_DEBUG_POWER(priv, "Power Index change to %u\n", 501 IWL_DEBUG_POWER(priv, "Power Index change to %u\n",