Lines Matching refs:mvm

92 static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)  in iwl_send_tx_ant_cfg()  argument
98 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); in iwl_send_tx_ant_cfg()
99 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, in iwl_send_tx_ant_cfg()
103 static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) in iwl_send_rss_cfg_cmd() argument
116 if (mvm->trans->num_rx_queues == 1) in iwl_send_rss_cfg_cmd()
122 1 + (i % (mvm->trans->num_rx_queues - 1)); in iwl_send_rss_cfg_cmd()
125 return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd); in iwl_send_rss_cfg_cmd()
128 static int iwl_configure_rxq(struct iwl_mvm *mvm) in iwl_configure_rxq() argument
138 num_queues = mvm->trans->num_rx_queues - 1; in iwl_configure_rxq()
152 iwl_trans_get_rxq_dma_data(mvm->trans, i + 1, &data); in iwl_configure_rxq()
164 ret = iwl_mvm_send_cmd(mvm, &hcmd); in iwl_configure_rxq()
171 static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) in iwl_mvm_send_dqa_cmd() argument
179 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd); in iwl_mvm_send_dqa_cmd()
181 IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret); in iwl_mvm_send_dqa_cmd()
183 IWL_DEBUG_FW(mvm, "Working in DQA mode\n"); in iwl_mvm_send_dqa_cmd()
188 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, in iwl_mvm_mfu_assert_dump_notif() argument
198 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", in iwl_mvm_mfu_assert_dump_notif()
202 IWL_DEBUG_INFO(mvm, in iwl_mvm_mfu_assert_dump_notif()
212 struct iwl_mvm *mvm = in iwl_alive_fn() local
238 iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table); in iwl_alive_fn()
241 mvm->trans->dbg.lmac_error_event_table[1] = in iwl_alive_fn()
247 mvm->support_umac_log = false; in iwl_alive_fn()
249 mvm->trans->cfg->min_umac_error_event_table) { in iwl_alive_fn()
250 mvm->support_umac_log = true; in iwl_alive_fn()
252 IWL_ERR(mvm, in iwl_alive_fn()
255 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ? in iwl_alive_fn()
257 mvm->support_umac_log = false; in iwl_alive_fn()
260 if (mvm->support_umac_log) in iwl_alive_fn()
261 iwl_fw_umac_set_alive_err_table(mvm->trans, in iwl_alive_fn()
267 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
272 IWL_DEBUG_FW(mvm, "Alive ucode CDB\n"); in iwl_alive_fn()
274 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
279 iwl_fwrt_update_fw_versions(&mvm->fwrt, lmac1, umac); in iwl_alive_fn()
307 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, in iwl_mvm_load_ucode_wait_alive() argument
314 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img; in iwl_mvm_load_ucode_wait_alive()
317 ucode_type == IWL_UCODE_INIT || iwl_mvm_has_unified_ucode(mvm); in iwl_mvm_load_ucode_wait_alive()
320 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) && in iwl_mvm_load_ucode_wait_alive()
321 !(fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_load_ucode_wait_alive()
323 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER); in iwl_mvm_load_ucode_wait_alive()
325 fw = iwl_get_ucode_image(mvm->fw, ucode_type); in iwl_mvm_load_ucode_wait_alive()
328 iwl_fw_set_current_image(&mvm->fwrt, ucode_type); in iwl_mvm_load_ucode_wait_alive()
329 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_load_ucode_wait_alive()
331 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
340 ret = iwl_trans_start_fw(mvm->trans, fw, run_in_rfkill); in iwl_mvm_load_ucode_wait_alive()
342 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
343 iwl_remove_notification(&mvm->notif_wait, &alive_wait); in iwl_mvm_load_ucode_wait_alive()
351 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
354 struct iwl_trans *trans = mvm->trans; in iwl_mvm_load_ucode_wait_alive()
357 iwl_fw_dbg_error_collect(&mvm->fwrt, in iwl_mvm_load_ucode_wait_alive()
361 IWL_ERR(mvm, in iwl_mvm_load_ucode_wait_alive()
368 IWL_ERR(mvm, in iwl_mvm_load_ucode_wait_alive()
372 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
377 IWL_ERR(mvm, "Loaded ucode is not valid!\n"); in iwl_mvm_load_ucode_wait_alive()
378 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
382 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); in iwl_mvm_load_ucode_wait_alive()
393 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info)); in iwl_mvm_load_ucode_wait_alive()
400 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].tid_bitmap = in iwl_mvm_load_ucode_wait_alive()
403 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_load_ucode_wait_alive()
405 iwl_fw_set_dbg_rec_on(&mvm->fwrt); in iwl_mvm_load_ucode_wait_alive()
411 static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) in iwl_run_unified_mvm_ucode() argument
423 if (mvm->trans->cfg->tx_with_siso_diversity) in iwl_run_unified_mvm_ucode()
426 lockdep_assert_held(&mvm->mutex); in iwl_run_unified_mvm_ucode()
428 mvm->rfkill_safe_init_done = false; in iwl_run_unified_mvm_ucode()
430 iwl_init_notification_wait(&mvm->notif_wait, in iwl_run_unified_mvm_ucode()
437 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL); in iwl_run_unified_mvm_ucode()
440 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); in iwl_run_unified_mvm_ucode()
442 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); in iwl_run_unified_mvm_ucode()
445 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE, in iwl_run_unified_mvm_ucode()
451 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP, in iwl_run_unified_mvm_ucode()
456 IWL_ERR(mvm, "Failed to run init config command: %d\n", in iwl_run_unified_mvm_ucode()
462 if (mvm->nvm_file_name) { in iwl_run_unified_mvm_ucode()
463 iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name, in iwl_run_unified_mvm_ucode()
464 mvm->nvm_sections); in iwl_run_unified_mvm_ucode()
465 iwl_mvm_load_nvm_to_nic(mvm); in iwl_run_unified_mvm_ucode()
469 ret = iwl_nvm_init(mvm); in iwl_run_unified_mvm_ucode()
471 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_unified_mvm_ucode()
476 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP, in iwl_run_unified_mvm_ucode()
481 IWL_ERR(mvm, "Failed to run complete NVM access: %d\n", in iwl_run_unified_mvm_ucode()
487 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait, in iwl_run_unified_mvm_ucode()
494 mvm->nvm_data = iwl_get_nvm(mvm->trans, mvm->fw); in iwl_run_unified_mvm_ucode()
495 if (IS_ERR(mvm->nvm_data)) { in iwl_run_unified_mvm_ucode()
496 ret = PTR_ERR(mvm->nvm_data); in iwl_run_unified_mvm_ucode()
497 mvm->nvm_data = NULL; in iwl_run_unified_mvm_ucode()
498 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_unified_mvm_ucode()
503 mvm->rfkill_safe_init_done = true; in iwl_run_unified_mvm_ucode()
508 iwl_remove_notification(&mvm->notif_wait, &init_wait); in iwl_run_unified_mvm_ucode()
512 static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) in iwl_send_phy_cfg_cmd() argument
515 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img; in iwl_send_phy_cfg_cmd()
518 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); in iwl_send_phy_cfg_cmd()
521 phy_cfg_cmd.phy_cfg |= cpu_to_le32(mvm->cfg->extra_phy_cfg_flags); in iwl_send_phy_cfg_cmd()
524 mvm->fw->default_calib[ucode_type].event_trigger; in iwl_send_phy_cfg_cmd()
526 mvm->fw->default_calib[ucode_type].flow_trigger; in iwl_send_phy_cfg_cmd()
528 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", in iwl_send_phy_cfg_cmd()
531 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0, in iwl_send_phy_cfg_cmd()
535 int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) in iwl_run_init_mvm_ucode() argument
544 if (iwl_mvm_has_unified_ucode(mvm)) in iwl_run_init_mvm_ucode()
545 return iwl_run_unified_mvm_ucode(mvm, true); in iwl_run_init_mvm_ucode()
547 lockdep_assert_held(&mvm->mutex); in iwl_run_init_mvm_ucode()
549 mvm->rfkill_safe_init_done = false; in iwl_run_init_mvm_ucode()
551 iwl_init_notification_wait(&mvm->notif_wait, in iwl_run_init_mvm_ucode()
556 mvm->phy_db); in iwl_run_init_mvm_ucode()
559 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT); in iwl_run_init_mvm_ucode()
561 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret); in iwl_run_init_mvm_ucode()
565 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) { in iwl_run_init_mvm_ucode()
566 ret = iwl_mvm_send_bt_init_conf(mvm); in iwl_run_init_mvm_ucode()
573 ret = iwl_nvm_init(mvm); in iwl_run_init_mvm_ucode()
575 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_init_mvm_ucode()
581 if (mvm->nvm_file_name) in iwl_run_init_mvm_ucode()
582 iwl_mvm_load_nvm_to_nic(mvm); in iwl_run_init_mvm_ucode()
584 WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver, in iwl_run_init_mvm_ucode()
586 mvm->nvm_data->nvm_version, mvm->trans->cfg->nvm_ver); in iwl_run_init_mvm_ucode()
592 if (iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
593 IWL_DEBUG_RF_KILL(mvm, in iwl_run_init_mvm_ucode()
598 mvm->rfkill_safe_init_done = true; in iwl_run_init_mvm_ucode()
601 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_run_init_mvm_ucode()
605 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_run_init_mvm_ucode()
607 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", in iwl_run_init_mvm_ucode()
616 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, in iwl_run_init_mvm_ucode()
621 if (iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
622 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); in iwl_run_init_mvm_ucode()
625 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", in iwl_run_init_mvm_ucode()
632 iwl_remove_notification(&mvm->notif_wait, &calib_wait); in iwl_run_init_mvm_ucode()
634 mvm->rfkill_safe_init_done = false; in iwl_run_init_mvm_ucode()
635 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { in iwl_run_init_mvm_ucode()
637 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + in iwl_run_init_mvm_ucode()
641 if (!mvm->nvm_data) in iwl_run_init_mvm_ucode()
643 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels; in iwl_run_init_mvm_ucode()
644 mvm->nvm_data->bands[0].n_channels = 1; in iwl_run_init_mvm_ucode()
645 mvm->nvm_data->bands[0].n_bitrates = 1; in iwl_run_init_mvm_ucode()
646 mvm->nvm_data->bands[0].bitrates = in iwl_run_init_mvm_ucode()
647 (void *)mvm->nvm_data->channels + 1; in iwl_run_init_mvm_ucode()
648 mvm->nvm_data->bands[0].bitrates->hw_value = 10; in iwl_run_init_mvm_ucode()
654 static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) in iwl_mvm_config_ltr() argument
660 if (!mvm->trans->ltr_enabled) in iwl_mvm_config_ltr()
663 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, in iwl_mvm_config_ltr()
668 static inline int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm, in iwl_mvm_sar_set_profile() argument
688 static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_wrds_table() argument
694 data = iwl_acpi_get_object(mvm->dev, ACPI_WRDS_METHOD); in iwl_mvm_sar_get_wrds_table()
698 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, in iwl_mvm_sar_get_wrds_table()
719 ret = iwl_mvm_sar_set_profile(mvm, table, &mvm->sar_profiles[0], in iwl_mvm_sar_get_wrds_table()
726 static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_ewrd_table() argument
732 data = iwl_acpi_get_object(mvm->dev, ACPI_EWRD_METHOD); in iwl_mvm_sar_get_ewrd_table()
736 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, in iwl_mvm_sar_get_ewrd_table()
771 ret = iwl_mvm_sar_set_profile(mvm, in iwl_mvm_sar_get_ewrd_table()
773 &mvm->sar_profiles[i + 1], in iwl_mvm_sar_get_ewrd_table()
787 static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_wgds_table() argument
793 data = iwl_acpi_get_object(mvm->dev, ACPI_WGDS_METHOD); in iwl_mvm_sar_get_wgds_table()
797 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, in iwl_mvm_sar_get_wgds_table()
809 mvm->geo_rev = tbl_rev; in iwl_mvm_sar_get_wgds_table()
821 mvm->geo_profiles[i].values[j] = entry->integer.value; in iwl_mvm_sar_get_wgds_table()
830 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) in iwl_mvm_sar_select_profile() argument
846 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_sar_select_profile()
849 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_sar_select_profile()
867 prof = &mvm->sar_profiles[profs[i] - 1]; in iwl_mvm_sar_select_profile()
871 IWL_DEBUG_RADIO(mvm, "SAR profile %d is disabled.\n", in iwl_mvm_sar_select_profile()
877 IWL_DEBUG_INFO(mvm, in iwl_mvm_sar_select_profile()
880 IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i); in iwl_mvm_sar_select_profile()
885 IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n", in iwl_mvm_sar_select_profile()
890 IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); in iwl_mvm_sar_select_profile()
892 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); in iwl_mvm_sar_select_profile()
895 static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) in iwl_mvm_sar_geo_support() argument
908 return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || in iwl_mvm_sar_geo_support()
909 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17 || in iwl_mvm_sar_geo_support()
910 (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 && in iwl_mvm_sar_geo_support()
911 ((mvm->trans->hw_rev & CSR_HW_REV_TYPE_MSK) == in iwl_mvm_sar_geo_support()
915 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) in iwl_mvm_get_sar_geo_profile() argument
925 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_SAR_TABLE_VER)) { in iwl_mvm_get_sar_geo_profile()
944 if (!iwl_mvm_sar_geo_support(mvm)) in iwl_mvm_get_sar_geo_profile()
947 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_sar_geo_profile()
949 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); in iwl_mvm_get_sar_geo_profile()
957 IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret); in iwl_mvm_get_sar_geo_profile()
964 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) in iwl_mvm_sar_geo_init() argument
972 if (!iwl_mvm_sar_geo_support(mvm)) in iwl_mvm_sar_geo_init()
975 ret = iwl_mvm_sar_get_wgds_table(mvm); in iwl_mvm_sar_geo_init()
977 IWL_DEBUG_RADIO(mvm, in iwl_mvm_sar_geo_init()
984 IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); in iwl_mvm_sar_geo_init()
998 value = &mvm->geo_profiles[i].values[j * in iwl_mvm_sar_geo_init()
1003 IWL_DEBUG_RADIO(mvm, in iwl_mvm_sar_geo_init()
1009 cmd.table_revision = cpu_to_le32(mvm->geo_rev); in iwl_mvm_sar_geo_init()
1011 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_sar_geo_init()
1013 return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, in iwl_mvm_sar_geo_init()
1018 return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd), &cmd); in iwl_mvm_sar_geo_init()
1021 static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm) in iwl_mvm_get_ppag_table() argument
1027 mvm->ppag_table.enabled = cpu_to_le32(0); in iwl_mvm_get_ppag_table()
1028 data = iwl_acpi_get_object(mvm->dev, ACPI_PPAG_METHOD); in iwl_mvm_get_ppag_table()
1032 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, in iwl_mvm_get_ppag_table()
1052 mvm->ppag_table.enabled = cpu_to_le32(enabled->integer.value); in iwl_mvm_get_ppag_table()
1053 if (!mvm->ppag_table.enabled) { in iwl_mvm_get_ppag_table()
1073 mvm->ppag_table.enabled = cpu_to_le32(0); in iwl_mvm_get_ppag_table()
1077 mvm->ppag_table.gain[i][j] = ent->integer.value; in iwl_mvm_get_ppag_table()
1086 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm) in iwl_mvm_ppag_send_cmd() argument
1090 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_PPAG)) { in iwl_mvm_ppag_send_cmd()
1091 IWL_DEBUG_RADIO(mvm, in iwl_mvm_ppag_send_cmd()
1096 IWL_DEBUG_RADIO(mvm, "Sending PER_PLATFORM_ANT_GAIN_CMD\n"); in iwl_mvm_ppag_send_cmd()
1097 IWL_DEBUG_RADIO(mvm, "PPAG is %s\n", in iwl_mvm_ppag_send_cmd()
1098 mvm->ppag_table.enabled ? "enabled" : "disabled"); in iwl_mvm_ppag_send_cmd()
1102 IWL_DEBUG_RADIO(mvm, in iwl_mvm_ppag_send_cmd()
1104 i, j, mvm->ppag_table.gain[i][j]); in iwl_mvm_ppag_send_cmd()
1108 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP, in iwl_mvm_ppag_send_cmd()
1110 0, sizeof(mvm->ppag_table), in iwl_mvm_ppag_send_cmd()
1111 &mvm->ppag_table); in iwl_mvm_ppag_send_cmd()
1113 IWL_ERR(mvm, "failed to send PER_PLATFORM_ANT_GAIN_CMD (%d)\n", in iwl_mvm_ppag_send_cmd()
1119 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm) in iwl_mvm_ppag_init() argument
1123 ret = iwl_mvm_get_ppag_table(mvm); in iwl_mvm_ppag_init()
1125 IWL_DEBUG_RADIO(mvm, in iwl_mvm_ppag_init()
1130 return iwl_mvm_ppag_send_cmd(mvm); in iwl_mvm_ppag_init()
1134 static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_wrds_table() argument
1139 static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_ewrd_table() argument
1144 static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) in iwl_mvm_sar_get_wgds_table() argument
1149 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) in iwl_mvm_sar_geo_init() argument
1154 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, in iwl_mvm_sar_select_profile() argument
1160 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) in iwl_mvm_get_sar_geo_profile() argument
1165 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm) in iwl_mvm_ppag_send_cmd() argument
1170 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm) in iwl_mvm_ppag_init() argument
1176 void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags) in iwl_mvm_send_recovery_cmd() argument
1178 u32 error_log_size = mvm->fw->ucode_capa.error_log_size; in iwl_mvm_send_recovery_cmd()
1199 if (!mvm->error_recovery_buf) in iwl_mvm_send_recovery_cmd()
1202 host_cmd.data[1] = mvm->error_recovery_buf; in iwl_mvm_send_recovery_cmd()
1208 ret = iwl_mvm_send_cmd(mvm, &host_cmd); in iwl_mvm_send_recovery_cmd()
1209 kfree(mvm->error_recovery_buf); in iwl_mvm_send_recovery_cmd()
1210 mvm->error_recovery_buf = NULL; in iwl_mvm_send_recovery_cmd()
1213 IWL_ERR(mvm, "Failed to send recovery cmd %d\n", ret); in iwl_mvm_send_recovery_cmd()
1221 IWL_ERR(mvm, in iwl_mvm_send_recovery_cmd()
1227 static int iwl_mvm_sar_init(struct iwl_mvm *mvm) in iwl_mvm_sar_init() argument
1231 ret = iwl_mvm_sar_get_wrds_table(mvm); in iwl_mvm_sar_init()
1233 IWL_DEBUG_RADIO(mvm, in iwl_mvm_sar_init()
1243 ret = iwl_mvm_sar_get_ewrd_table(mvm); in iwl_mvm_sar_init()
1246 IWL_DEBUG_RADIO(mvm, in iwl_mvm_sar_init()
1251 ret = iwl_mvm_sar_select_profile(mvm, 1, 1); in iwl_mvm_sar_init()
1264 static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm) in iwl_mvm_load_rt_fw() argument
1268 if (iwl_mvm_has_unified_ucode(mvm)) in iwl_mvm_load_rt_fw()
1269 return iwl_run_unified_mvm_ucode(mvm, false); in iwl_mvm_load_rt_fw()
1271 ret = iwl_run_init_mvm_ucode(mvm, false); in iwl_mvm_load_rt_fw()
1274 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); in iwl_mvm_load_rt_fw()
1281 iwl_fw_dbg_stop_sync(&mvm->fwrt); in iwl_mvm_load_rt_fw()
1282 iwl_trans_stop_device(mvm->trans); in iwl_mvm_load_rt_fw()
1283 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_load_rt_fw()
1287 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL); in iwl_mvm_load_rt_fw()
1289 mvm->rfkill_safe_init_done = false; in iwl_mvm_load_rt_fw()
1290 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); in iwl_mvm_load_rt_fw()
1294 mvm->rfkill_safe_init_done = true; in iwl_mvm_load_rt_fw()
1296 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE, in iwl_mvm_load_rt_fw()
1299 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img); in iwl_mvm_load_rt_fw()
1302 int iwl_mvm_up(struct iwl_mvm *mvm) in iwl_mvm_up() argument
1309 lockdep_assert_held(&mvm->mutex); in iwl_mvm_up()
1311 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_up()
1315 ret = iwl_mvm_load_rt_fw(mvm); in iwl_mvm_up()
1317 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); in iwl_mvm_up()
1319 iwl_fw_dbg_error_collect(&mvm->fwrt, in iwl_mvm_up()
1324 iwl_get_shared_mem_conf(&mvm->fwrt); in iwl_mvm_up()
1326 ret = iwl_mvm_sf_update(mvm, NULL, false); in iwl_mvm_up()
1328 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); in iwl_mvm_up()
1330 if (!iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_up()
1331 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_up()
1333 if (mvm->fw->dbg.dest_tlv) in iwl_mvm_up()
1334 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE; in iwl_mvm_up()
1335 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE); in iwl_mvm_up()
1338 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_up()
1342 if (!iwl_mvm_has_unified_ucode(mvm)) { in iwl_mvm_up()
1344 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_up()
1348 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_up()
1353 ret = iwl_mvm_send_bt_init_conf(mvm); in iwl_mvm_up()
1358 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in iwl_mvm_up()
1359 ret = iwl_configure_rxq(mvm); in iwl_mvm_up()
1361 IWL_ERR(mvm, "Failed to configure RX queues: %d\n", in iwl_mvm_up()
1367 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_up()
1368 ret = iwl_send_rss_cfg_cmd(mvm); in iwl_mvm_up()
1370 IWL_ERR(mvm, "Failed to configure RSS queues: %d\n", in iwl_mvm_up()
1377 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) in iwl_mvm_up()
1378 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_up()
1380 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_up()
1383 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); in iwl_mvm_up()
1385 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_DQA_SUPPORT)) { in iwl_mvm_up()
1386 ret = iwl_mvm_send_dqa_cmd(mvm); in iwl_mvm_up()
1392 ret = iwl_mvm_add_aux_sta(mvm); in iwl_mvm_up()
1399 sband = mvm->hw->wiphy->bands[i++]; in iwl_mvm_up()
1413 ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i], in iwl_mvm_up()
1419 if (iwl_mvm_is_tt_in_fw(mvm)) { in iwl_mvm_up()
1424 iwl_mvm_send_temp_report_ths_cmd(mvm); in iwl_mvm_up()
1427 iwl_mvm_tt_tx_backoff(mvm, 0); in iwl_mvm_up()
1437 if (iwl_mvm_is_ctdp_supported(mvm)) { in iwl_mvm_up()
1438 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, in iwl_mvm_up()
1439 mvm->cooling_dev.cur_state); in iwl_mvm_up()
1445 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2)) in iwl_mvm_up()
1446 WARN_ON(iwl_mvm_config_ltr(mvm)); in iwl_mvm_up()
1448 ret = iwl_mvm_power_update_device(mvm); in iwl_mvm_up()
1456 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) { in iwl_mvm_up()
1457 ret = iwl_mvm_init_mcc(mvm); in iwl_mvm_up()
1462 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_up()
1463 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET; in iwl_mvm_up()
1464 mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET; in iwl_mvm_up()
1465 ret = iwl_mvm_config_scan(mvm); in iwl_mvm_up()
1470 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_up()
1471 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB); in iwl_mvm_up()
1473 if (iwl_acpi_get_eckv(mvm->dev, &mvm->ext_clock_valid)) in iwl_mvm_up()
1474 IWL_DEBUG_INFO(mvm, "ECKV table doesn't exist in BIOS\n"); in iwl_mvm_up()
1476 ret = iwl_mvm_ppag_init(mvm); in iwl_mvm_up()
1480 ret = iwl_mvm_sar_init(mvm); in iwl_mvm_up()
1482 ret = iwl_mvm_sar_geo_init(mvm); in iwl_mvm_up()
1483 } else if (ret > 0 && !iwl_mvm_sar_get_wgds_table(mvm)) { in iwl_mvm_up()
1490 IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n"); in iwl_mvm_up()
1496 iwl_mvm_leds_sync(mvm); in iwl_mvm_up()
1498 IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); in iwl_mvm_up()
1502 iwl_mvm_stop_device(mvm); in iwl_mvm_up()
1506 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm) in iwl_mvm_load_d3_fw() argument
1510 lockdep_assert_held(&mvm->mutex); in iwl_mvm_load_d3_fw()
1512 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_load_d3_fw()
1516 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN); in iwl_mvm_load_d3_fw()
1518 IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret); in iwl_mvm_load_d3_fw()
1522 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_load_d3_fw()
1527 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_load_d3_fw()
1531 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_load_d3_fw()
1536 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) in iwl_mvm_load_d3_fw()
1537 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_load_d3_fw()
1540 ret = iwl_mvm_add_aux_sta(mvm); in iwl_mvm_load_d3_fw()
1546 iwl_mvm_stop_device(mvm); in iwl_mvm_load_d3_fw()
1550 void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_card_state_notif() argument
1557 IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n", in iwl_mvm_rx_card_state_notif()
1564 void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_mfuart_notif() argument
1570 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_mfuart_notif()
1578 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_mfuart_notif()