Lines Matching refs:mvm

71 static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)  in iwl_mvm_enter_ctkill()  argument
73 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_enter_ctkill()
76 if (test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_enter_ctkill()
79 IWL_ERR(mvm, "Enter CT Kill\n"); in iwl_mvm_enter_ctkill()
80 iwl_mvm_set_hw_ctkill_state(mvm, true); in iwl_mvm_enter_ctkill()
89 if (!mvm->temperature_test) in iwl_mvm_enter_ctkill()
94 static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm) in iwl_mvm_exit_ctkill() argument
96 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_exit_ctkill()
99 IWL_ERR(mvm, "Exit CT Kill\n"); in iwl_mvm_exit_ctkill()
100 iwl_mvm_set_hw_ctkill_state(mvm, false); in iwl_mvm_exit_ctkill()
103 void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp) in iwl_mvm_tt_temp_changed() argument
106 if (mvm->temperature_test) in iwl_mvm_tt_temp_changed()
109 if (mvm->temperature == temp) in iwl_mvm_tt_temp_changed()
112 mvm->temperature = temp; in iwl_mvm_tt_temp_changed()
113 iwl_mvm_tt_handler(mvm); in iwl_mvm_tt_temp_changed()
116 static int iwl_mvm_temp_notif_parse(struct iwl_mvm *mvm, in iwl_mvm_temp_notif_parse() argument
124 IWL_ERR(mvm, "Invalid DTS_MEASUREMENT_NOTIFICATION\n"); in iwl_mvm_temp_notif_parse()
136 IWL_DEBUG_TEMP(mvm, "DTS_MEASUREMENT_NOTIFICATION - %d\n", temp); in iwl_mvm_temp_notif_parse()
144 struct iwl_mvm *mvm = in iwl_mvm_temp_notif_wait() local
149 ret = iwl_mvm_temp_notif_parse(mvm, pkt); in iwl_mvm_temp_notif_wait()
158 void iwl_mvm_temp_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_temp_notif() argument
164 if (test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) in iwl_mvm_temp_notif()
167 temp = iwl_mvm_temp_notif_parse(mvm, pkt); in iwl_mvm_temp_notif()
171 iwl_mvm_tt_temp_changed(mvm, temp); in iwl_mvm_temp_notif()
174 static int iwl_mvm_get_temp_cmd(struct iwl_mvm *mvm) in iwl_mvm_get_temp_cmd() argument
184 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_WIDE_CMD_HDR)) in iwl_mvm_get_temp_cmd()
190 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_get_temp_cmd()
192 return iwl_mvm_send_cmd_pdu(mvm, cmdid, 0, sizeof(cmd), &cmd); in iwl_mvm_get_temp_cmd()
194 return iwl_mvm_send_cmd_pdu(mvm, cmdid, 0, sizeof(extcmd), &extcmd); in iwl_mvm_get_temp_cmd()
197 int iwl_mvm_get_temp(struct iwl_mvm *mvm) in iwl_mvm_get_temp() argument
204 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_WIDE_CMD_HDR)) in iwl_mvm_get_temp()
207 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_temp()
209 iwl_init_notification_wait(&mvm->notif_wait, &wait_temp_notif, in iwl_mvm_get_temp()
213 ret = iwl_mvm_get_temp_cmd(mvm); in iwl_mvm_get_temp()
215 IWL_ERR(mvm, "Failed to get the temperature (err=%d)\n", ret); in iwl_mvm_get_temp()
216 iwl_remove_notification(&mvm->notif_wait, &wait_temp_notif); in iwl_mvm_get_temp()
220 ret = iwl_wait_notification(&mvm->notif_wait, &wait_temp_notif, in iwl_mvm_get_temp()
223 IWL_ERR(mvm, "Getting the temperature timed out\n"); in iwl_mvm_get_temp()
233 struct iwl_mvm *mvm; in check_exit_ctkill() local
238 mvm = container_of(tt, struct iwl_mvm, thermal_throttle); in check_exit_ctkill()
242 mutex_lock(&mvm->mutex); in check_exit_ctkill()
244 if (__iwl_mvm_mac_start(mvm)) in check_exit_ctkill()
248 if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_CHECK_CTKILL)) { in check_exit_ctkill()
249 __iwl_mvm_mac_stop(mvm); in check_exit_ctkill()
253 temp = iwl_mvm_get_temp(mvm); in check_exit_ctkill()
255 iwl_mvm_unref(mvm, IWL_MVM_REF_CHECK_CTKILL); in check_exit_ctkill()
257 __iwl_mvm_mac_stop(mvm); in check_exit_ctkill()
262 IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", temp); in check_exit_ctkill()
265 mutex_unlock(&mvm->mutex); in check_exit_ctkill()
266 iwl_mvm_exit_ctkill(mvm); in check_exit_ctkill()
271 mutex_unlock(&mvm->mutex); in check_exit_ctkill()
272 schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit, in check_exit_ctkill()
279 struct iwl_mvm *mvm = _data; in iwl_mvm_tt_smps_iterator() local
282 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tt_smps_iterator()
284 if (mvm->thermal_throttle.dynamic_smps) in iwl_mvm_tt_smps_iterator()
292 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_TT, smps_mode); in iwl_mvm_tt_smps_iterator()
295 static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable) in iwl_mvm_tt_tx_protection() argument
302 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tt_tx_protection()
303 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tt_tx_protection()
309 err = iwl_mvm_tx_protection(mvm, mvmsta, enable); in iwl_mvm_tt_tx_protection()
311 IWL_ERR(mvm, "Failed to %s Tx protection\n", in iwl_mvm_tt_tx_protection()
314 IWL_DEBUG_TEMP(mvm, "%s Tx protection\n", in iwl_mvm_tt_tx_protection()
321 void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff) in iwl_mvm_tt_tx_backoff() argument
329 backoff = max(backoff, mvm->thermal_throttle.min_backoff); in iwl_mvm_tt_tx_backoff()
331 if (iwl_mvm_send_cmd(mvm, &cmd) == 0) { in iwl_mvm_tt_tx_backoff()
332 IWL_DEBUG_TEMP(mvm, "Set Thermal Tx backoff to: %u\n", in iwl_mvm_tt_tx_backoff()
334 mvm->thermal_throttle.tx_backoff = backoff; in iwl_mvm_tt_tx_backoff()
336 IWL_ERR(mvm, "Failed to change Thermal Tx backoff\n"); in iwl_mvm_tt_tx_backoff()
340 void iwl_mvm_tt_handler(struct iwl_mvm *mvm) in iwl_mvm_tt_handler() argument
342 struct iwl_tt_params *params = &mvm->thermal_throttle.params; in iwl_mvm_tt_handler()
343 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_tt_handler()
344 s32 temperature = mvm->temperature; in iwl_mvm_tt_handler()
349 IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", mvm->temperature); in iwl_mvm_tt_handler()
352 iwl_mvm_enter_ctkill(mvm); in iwl_mvm_tt_handler()
358 iwl_mvm_exit_ctkill(mvm); in iwl_mvm_tt_handler()
365 IWL_DEBUG_TEMP(mvm, "Enable dynamic SMPS\n"); in iwl_mvm_tt_handler()
368 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tt_handler()
369 iwl_mvm_tt_smps_iterator, mvm); in iwl_mvm_tt_handler()
373 IWL_DEBUG_TEMP(mvm, "Disable dynamic SMPS\n"); in iwl_mvm_tt_handler()
376 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tt_handler()
377 iwl_mvm_tt_smps_iterator, mvm); in iwl_mvm_tt_handler()
383 iwl_mvm_tt_tx_protection(mvm, true); in iwl_mvm_tt_handler()
386 iwl_mvm_tt_tx_protection(mvm, false); in iwl_mvm_tt_handler()
401 iwl_mvm_tt_tx_backoff(mvm, tx_backoff); in iwl_mvm_tt_handler()
405 IWL_WARN(mvm, in iwl_mvm_tt_handler()
411 IWL_WARN(mvm, in iwl_mvm_tt_handler()
439 void iwl_mvm_tt_initialize(struct iwl_mvm *mvm, u32 min_backoff) in iwl_mvm_tt_initialize() argument
441 struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle; in iwl_mvm_tt_initialize()
443 IWL_DEBUG_TEMP(mvm, "Initialize Thermal Throttling\n"); in iwl_mvm_tt_initialize()
445 if (mvm->cfg->thermal_params) in iwl_mvm_tt_initialize()
446 tt->params = *mvm->cfg->thermal_params; in iwl_mvm_tt_initialize()
456 void iwl_mvm_tt_exit(struct iwl_mvm *mvm) in iwl_mvm_tt_exit() argument
458 cancel_delayed_work_sync(&mvm->thermal_throttle.ct_kill_exit); in iwl_mvm_tt_exit()
459 IWL_DEBUG_TEMP(mvm, "Exit Thermal Throttling\n"); in iwl_mvm_tt_exit()