aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2014-08-20 10:26:58 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-09-03 15:33:13 -0400
commitb689fa799a1450056044a47d6afa6ad52f3a8997 (patch)
tree3372f878d2fe2f5d5dd056aefa4111b728f7c984
parenta4db848f2d0160a3fca08a5787dbef6bcc4ce2b3 (diff)
iwlwifi: mvm: reset the temperature when temperature test is disabled
Since we can't read the actual temperature when the firmware is running, just set the temperature to 0 when the test is disabled and disable CT Kill if it was enabled. Additionally, since we rely on iwl_mvm_tt_handler() to exit CT kill when in test mode, call iwl_mvm_exit_ctkill() in that function if the temperature is low again. Also make the iwl_mvm_enter_ctkill() and iwl_mvm_exit_ctkill() return if called when not necessary anymore (e.g. when iwl_mvm_exit_ctkill() is called when we're not in CT-kill). Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tt.c12
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index f7e44889182a..83e562b95a8e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -296,7 +296,15 @@ static ssize_t iwl_dbgfs_set_nic_temperature_write(struct iwl_mvm *mvm,
296 296
297 mutex_lock(&mvm->mutex); 297 mutex_lock(&mvm->mutex);
298 if (temperature == IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE) { 298 if (temperature == IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE) {
299 if (!mvm->temperature_test)
300 goto out;
301
299 mvm->temperature_test = false; 302 mvm->temperature_test = false;
303 /* Since we can't read the temp while awake, just set
304 * it to zero until we get the next RX stats from the
305 * firmware.
306 */
307 mvm->temperature = 0;
300 } else { 308 } else {
301 mvm->temperature_test = true; 309 mvm->temperature_test = true;
302 mvm->temperature = temperature; 310 mvm->temperature = temperature;
@@ -306,6 +314,8 @@ static ssize_t iwl_dbgfs_set_nic_temperature_write(struct iwl_mvm *mvm,
306 mvm->temperature); 314 mvm->temperature);
307 /* handle the temperature change */ 315 /* handle the temperature change */
308 iwl_mvm_tt_handler(mvm); 316 iwl_mvm_tt_handler(mvm);
317
318out:
309 mutex_unlock(&mvm->mutex); 319 mutex_unlock(&mvm->mutex);
310 320
311 return count; 321 return count;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c b/drivers/net/wireless/iwlwifi/mvm/tt.c
index 0464599c111e..d31603cbb17d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tt.c
@@ -314,6 +314,9 @@ static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)
314{ 314{
315 u32 duration = mvm->thermal_throttle.params->ct_kill_duration; 315 u32 duration = mvm->thermal_throttle.params->ct_kill_duration;
316 316
317 if (test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status))
318 return;
319
317 IWL_ERR(mvm, "Enter CT Kill\n"); 320 IWL_ERR(mvm, "Enter CT Kill\n");
318 iwl_mvm_set_hw_ctkill_state(mvm, true); 321 iwl_mvm_set_hw_ctkill_state(mvm, true);
319 schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit, 322 schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit,
@@ -322,6 +325,9 @@ static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)
322 325
323static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm) 326static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm)
324{ 327{
328 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status))
329 return;
330
325 IWL_ERR(mvm, "Exit CT Kill\n"); 331 IWL_ERR(mvm, "Exit CT Kill\n");
326 iwl_mvm_set_hw_ctkill_state(mvm, false); 332 iwl_mvm_set_hw_ctkill_state(mvm, false);
327} 333}
@@ -444,6 +450,12 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
444 return; 450 return;
445 } 451 }
446 452
453 if (params->support_ct_kill &&
454 temperature <= tt->params->ct_kill_exit) {
455 iwl_mvm_exit_ctkill(mvm);
456 return;
457 }
458
447 if (params->support_dynamic_smps) { 459 if (params->support_dynamic_smps) {
448 if (!tt->dynamic_smps && 460 if (!tt->dynamic_smps &&
449 temperature >= params->dynamic_smps_entry) { 461 temperature >= params->dynamic_smps_entry) {