Lines Matching refs:mvm
70 static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm) in iwl_mvm_enter_ctkill() argument
72 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_enter_ctkill()
73 u32 duration = mvm->thermal_throttle.params->ct_kill_duration; in iwl_mvm_enter_ctkill()
75 if (test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_enter_ctkill()
78 IWL_ERR(mvm, "Enter CT Kill\n"); in iwl_mvm_enter_ctkill()
79 iwl_mvm_set_hw_ctkill_state(mvm, true); in iwl_mvm_enter_ctkill()
88 if (!mvm->temperature_test) in iwl_mvm_enter_ctkill()
93 static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm) in iwl_mvm_exit_ctkill() argument
95 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_exit_ctkill()
98 IWL_ERR(mvm, "Exit CT Kill\n"); in iwl_mvm_exit_ctkill()
99 iwl_mvm_set_hw_ctkill_state(mvm, false); in iwl_mvm_exit_ctkill()
102 void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp) in iwl_mvm_tt_temp_changed() argument
105 if (mvm->temperature_test) in iwl_mvm_tt_temp_changed()
108 if (mvm->temperature == temp) in iwl_mvm_tt_temp_changed()
111 mvm->temperature = temp; in iwl_mvm_tt_temp_changed()
112 iwl_mvm_tt_handler(mvm); in iwl_mvm_tt_temp_changed()
115 static int iwl_mvm_temp_notif_parse(struct iwl_mvm *mvm, in iwl_mvm_temp_notif_parse() argument
123 IWL_ERR(mvm, "Invalid DTS_MEASUREMENT_NOTIFICATION\n"); in iwl_mvm_temp_notif_parse()
135 IWL_DEBUG_TEMP(mvm, "DTS_MEASUREMENT_NOTIFICATION - %d\n", temp); in iwl_mvm_temp_notif_parse()
143 struct iwl_mvm *mvm = in iwl_mvm_temp_notif_wait() local
148 ret = iwl_mvm_temp_notif_parse(mvm, pkt); in iwl_mvm_temp_notif_wait()
157 int iwl_mvm_temp_notif(struct iwl_mvm *mvm, in iwl_mvm_temp_notif() argument
165 if (test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_temp_notif()
168 temp = iwl_mvm_temp_notif_parse(mvm, pkt); in iwl_mvm_temp_notif()
172 iwl_mvm_tt_temp_changed(mvm, temp); in iwl_mvm_temp_notif()
177 static int iwl_mvm_get_temp_cmd(struct iwl_mvm *mvm) in iwl_mvm_get_temp_cmd() argument
183 return iwl_mvm_send_cmd_pdu(mvm, CMD_DTS_MEASUREMENT_TRIGGER, 0, in iwl_mvm_get_temp_cmd()
187 int iwl_mvm_get_temp(struct iwl_mvm *mvm) in iwl_mvm_get_temp() argument
193 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_temp()
195 iwl_init_notification_wait(&mvm->notif_wait, &wait_temp_notif, in iwl_mvm_get_temp()
199 ret = iwl_mvm_get_temp_cmd(mvm); in iwl_mvm_get_temp()
201 IWL_ERR(mvm, "Failed to get the temperature (err=%d)\n", ret); in iwl_mvm_get_temp()
202 iwl_remove_notification(&mvm->notif_wait, &wait_temp_notif); in iwl_mvm_get_temp()
206 ret = iwl_wait_notification(&mvm->notif_wait, &wait_temp_notif, in iwl_mvm_get_temp()
209 IWL_ERR(mvm, "Getting the temperature timed out\n"); in iwl_mvm_get_temp()
219 struct iwl_mvm *mvm; in check_exit_ctkill() local
224 mvm = container_of(tt, struct iwl_mvm, thermal_throttle); in check_exit_ctkill()
228 mutex_lock(&mvm->mutex); in check_exit_ctkill()
230 if (__iwl_mvm_mac_start(mvm)) in check_exit_ctkill()
234 if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_CHECK_CTKILL)) { in check_exit_ctkill()
235 __iwl_mvm_mac_stop(mvm); in check_exit_ctkill()
239 temp = iwl_mvm_get_temp(mvm); in check_exit_ctkill()
241 iwl_mvm_unref(mvm, IWL_MVM_REF_CHECK_CTKILL); in check_exit_ctkill()
243 __iwl_mvm_mac_stop(mvm); in check_exit_ctkill()
248 IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", temp); in check_exit_ctkill()
251 mutex_unlock(&mvm->mutex); in check_exit_ctkill()
252 iwl_mvm_exit_ctkill(mvm); in check_exit_ctkill()
257 mutex_unlock(&mvm->mutex); in check_exit_ctkill()
258 schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit, in check_exit_ctkill()
265 struct iwl_mvm *mvm = _data; in iwl_mvm_tt_smps_iterator() local
268 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tt_smps_iterator()
270 if (mvm->thermal_throttle.dynamic_smps) in iwl_mvm_tt_smps_iterator()
278 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_TT, smps_mode); in iwl_mvm_tt_smps_iterator()
281 static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable) in iwl_mvm_tt_tx_protection() argument
288 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tt_tx_protection()
289 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tt_tx_protection()
295 err = iwl_mvm_tx_protection(mvm, mvmsta, enable); in iwl_mvm_tt_tx_protection()
297 IWL_ERR(mvm, "Failed to %s Tx protection\n", in iwl_mvm_tt_tx_protection()
300 IWL_DEBUG_TEMP(mvm, "%s Tx protection\n", in iwl_mvm_tt_tx_protection()
307 void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff) in iwl_mvm_tt_tx_backoff() argument
315 backoff = max(backoff, mvm->thermal_throttle.min_backoff); in iwl_mvm_tt_tx_backoff()
317 if (iwl_mvm_send_cmd(mvm, &cmd) == 0) { in iwl_mvm_tt_tx_backoff()
318 IWL_DEBUG_TEMP(mvm, "Set Thermal Tx backoff to: %u\n", in iwl_mvm_tt_tx_backoff()
320 mvm->thermal_throttle.tx_backoff = backoff; in iwl_mvm_tt_tx_backoff()
322 IWL_ERR(mvm, "Failed to change Thermal Tx backoff\n"); in iwl_mvm_tt_tx_backoff()
326 void iwl_mvm_tt_handler(struct iwl_mvm *mvm) in iwl_mvm_tt_handler() argument
328 const struct iwl_tt_params *params = mvm->thermal_throttle.params; in iwl_mvm_tt_handler()
329 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_tt_handler()
330 s32 temperature = mvm->temperature; in iwl_mvm_tt_handler()
335 IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", mvm->temperature); in iwl_mvm_tt_handler()
338 iwl_mvm_enter_ctkill(mvm); in iwl_mvm_tt_handler()
344 iwl_mvm_exit_ctkill(mvm); in iwl_mvm_tt_handler()
351 IWL_DEBUG_TEMP(mvm, "Enable dynamic SMPS\n"); in iwl_mvm_tt_handler()
354 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tt_handler()
355 iwl_mvm_tt_smps_iterator, mvm); in iwl_mvm_tt_handler()
359 IWL_DEBUG_TEMP(mvm, "Disable dynamic SMPS\n"); in iwl_mvm_tt_handler()
362 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tt_handler()
363 iwl_mvm_tt_smps_iterator, mvm); in iwl_mvm_tt_handler()
369 iwl_mvm_tt_tx_protection(mvm, true); in iwl_mvm_tt_handler()
372 iwl_mvm_tt_tx_protection(mvm, false); in iwl_mvm_tt_handler()
387 iwl_mvm_tt_tx_backoff(mvm, tx_backoff); in iwl_mvm_tt_handler()
391 IWL_WARN(mvm, in iwl_mvm_tt_handler()
397 IWL_WARN(mvm, in iwl_mvm_tt_handler()
447 void iwl_mvm_tt_initialize(struct iwl_mvm *mvm, u32 min_backoff) in iwl_mvm_tt_initialize() argument
449 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_tt_initialize()
451 IWL_DEBUG_TEMP(mvm, "Initialize Thermal Throttling\n"); in iwl_mvm_tt_initialize()
453 if (mvm->cfg->high_temp) in iwl_mvm_tt_initialize()
464 void iwl_mvm_tt_exit(struct iwl_mvm *mvm) in iwl_mvm_tt_exit() argument
466 cancel_delayed_work_sync(&mvm->thermal_throttle.ct_kill_exit); in iwl_mvm_tt_exit()
467 IWL_DEBUG_TEMP(mvm, "Exit Thermal Throttling\n"); in iwl_mvm_tt_exit()