Lines Matching refs:mvm
361 iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif) in iwl_get_coex_type() argument
388 if (mvm->cfg->bt_shared_single_ant) { in iwl_get_coex_type()
394 primary_ch_phy_id = le32_to_cpu(mvm->last_bt_ci_cmd.primary_ch_phy_id); in iwl_get_coex_type()
396 le32_to_cpu(mvm->last_bt_ci_cmd.secondary_ch_phy_id); in iwl_get_coex_type()
399 ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut); in iwl_get_coex_type()
401 ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut); in iwl_get_coex_type()
409 int iwl_send_bt_init_conf(struct iwl_mvm *mvm) in iwl_send_bt_init_conf() argument
420 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_send_bt_init_conf()
421 return iwl_send_bt_init_conf_old(mvm); in iwl_send_bt_init_conf()
428 lockdep_assert_held(&mvm->mutex); in iwl_send_bt_init_conf()
430 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { in iwl_send_bt_init_conf()
431 switch (mvm->bt_force_ant_mode) { in iwl_send_bt_init_conf()
454 if (iwl_mvm_bt_is_plcr_supported(mvm)) in iwl_send_bt_init_conf()
466 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_send_bt_init_conf()
467 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_send_bt_init_conf()
469 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_send_bt_init_conf()
475 static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, in iwl_mvm_bt_coex_reduced_txp() argument
483 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); in iwl_mvm_bt_coex_reduced_txp()
496 IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n", in iwl_mvm_bt_coex_reduced_txp()
502 ret = iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP, CMD_ASYNC, in iwl_mvm_bt_coex_reduced_txp()
510 struct iwl_mvm *mvm; member
517 void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_enable_rssi_event() argument
536 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_bt_notif_iterator() local
543 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_notif_iterator()
563 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
565 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_notif_iterator()
567 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
583 IWL_COEX_IS_RRC_ON(mvm->last_bt_notif.ttc_rrc_status, in iwl_mvm_bt_notif_iterator()
587 IWL_DEBUG_COEX(data->mvm, in iwl_mvm_bt_notif_iterator()
592 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
641 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || in iwl_mvm_bt_notif_iterator()
642 mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || in iwl_mvm_bt_notif_iterator()
643 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) { in iwl_mvm_bt_notif_iterator()
644 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); in iwl_mvm_bt_notif_iterator()
645 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
656 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true)) in iwl_mvm_bt_notif_iterator()
657 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
659 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) in iwl_mvm_bt_notif_iterator()
660 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
664 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi); in iwl_mvm_bt_notif_iterator()
667 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_notif_handle() argument
670 .mvm = mvm, in iwl_mvm_bt_coex_notif_handle()
671 .notif = &mvm->last_bt_notif, in iwl_mvm_bt_coex_notif_handle()
677 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_coex_notif_handle()
682 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_bt_coex_notif_handle()
734 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { in iwl_mvm_bt_coex_notif_handle()
735 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, in iwl_mvm_bt_coex_notif_handle()
737 IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); in iwl_mvm_bt_coex_notif_handle()
738 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); in iwl_mvm_bt_coex_notif_handle()
742 int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_bt_coex_notif() argument
749 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_rx_bt_coex_notif()
750 return iwl_mvm_rx_bt_coex_notif_old(mvm, rxb, dev_cmd); in iwl_mvm_rx_bt_coex_notif()
752 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); in iwl_mvm_rx_bt_coex_notif()
753 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); in iwl_mvm_rx_bt_coex_notif()
754 IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
756 IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
758 IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n", in iwl_mvm_rx_bt_coex_notif()
762 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); in iwl_mvm_rx_bt_coex_notif()
764 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_rx_bt_coex_notif()
778 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_bt_rssi_iterator() local
799 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], in iwl_mvm_bt_rssi_iterator()
800 lockdep_is_held(&mvm->mutex)); in iwl_mvm_bt_rssi_iterator()
809 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_bt_rssi_event() argument
814 .mvm = mvm, in iwl_mvm_bt_rssi_event()
818 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { in iwl_mvm_bt_rssi_event()
819 iwl_mvm_bt_rssi_event_old(mvm, vif, rssi_event); in iwl_mvm_bt_rssi_event()
823 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_rssi_event()
826 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_rssi_event()
837 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) in iwl_mvm_bt_rssi_event()
840 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, in iwl_mvm_bt_rssi_event()
847 if (rssi_event == RSSI_EVENT_LOW || mvm->cfg->bt_shared_single_ant || in iwl_mvm_bt_rssi_event()
848 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT) in iwl_mvm_bt_rssi_event()
849 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_rssi_event()
852 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true); in iwl_mvm_bt_rssi_event()
855 IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n"); in iwl_mvm_bt_rssi_event()
858 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_bt_rssi_event()
865 u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, in iwl_mvm_coex_agg_time_limit() argument
873 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_coex_agg_time_limit()
874 return iwl_mvm_coex_agg_time_limit_old(mvm, sta); in iwl_mvm_coex_agg_time_limit()
876 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) in iwl_mvm_coex_agg_time_limit()
879 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_coex_agg_time_limit()
883 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_coex_agg_time_limit()
892 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_mimo_allowed() argument
900 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_bt_coex_is_mimo_allowed()
901 return iwl_mvm_bt_coex_is_mimo_allowed_old(mvm, sta); in iwl_mvm_bt_coex_is_mimo_allowed()
903 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) in iwl_mvm_bt_coex_is_mimo_allowed()
906 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_mimo_allowed()
917 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_bt_coex_is_mimo_allowed()
921 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant) in iwl_mvm_bt_coex_is_ant_avail() argument
924 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_ant_avail()
927 if (ant & mvm->cfg->non_shared_ant) in iwl_mvm_bt_coex_is_ant_avail()
930 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_bt_coex_is_ant_avail()
931 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); in iwl_mvm_bt_coex_is_ant_avail()
933 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_ant_avail()
937 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_is_shared_ant_avail() argument
940 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_shared_ant_avail()
943 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_bt_coex_is_shared_ant_avail()
944 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); in iwl_mvm_bt_coex_is_shared_ant_avail()
946 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF; in iwl_mvm_bt_coex_is_shared_ant_avail()
949 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_tpc_allowed() argument
952 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); in iwl_mvm_bt_coex_is_tpc_allowed()
954 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_bt_coex_is_tpc_allowed()
955 return iwl_mvm_bt_coex_is_tpc_allowed_old(mvm, band); in iwl_mvm_bt_coex_is_tpc_allowed()
963 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, in iwl_mvm_bt_coex_tx_prio() argument
971 if (unlikely(mvm->bt_tx_prio)) in iwl_mvm_bt_coex_tx_prio()
972 return mvm->bt_tx_prio - 1; in iwl_mvm_bt_coex_tx_prio()
995 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_vif_change() argument
997 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { in iwl_mvm_bt_coex_vif_change()
998 iwl_mvm_bt_coex_vif_change_old(mvm); in iwl_mvm_bt_coex_vif_change()
1002 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_bt_coex_vif_change()
1005 int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_ant_coupling_notif() argument
1015 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) in iwl_mvm_rx_ant_coupling_notif()
1016 return iwl_mvm_rx_ant_coupling_notif_old(mvm, rxb, dev_cmd); in iwl_mvm_rx_ant_coupling_notif()
1018 if (!iwl_mvm_bt_is_plcr_supported(mvm)) in iwl_mvm_rx_ant_coupling_notif()
1021 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_ant_coupling_notif()
1024 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_rx_ant_coupling_notif()
1027 if (ant_isolation == mvm->last_ant_isol) in iwl_mvm_rx_ant_coupling_notif()
1041 IWL_DEBUG_COEX(mvm, "Antenna isolation=%d in range [%d,%d[, lut=%d\n", in iwl_mvm_rx_ant_coupling_notif()
1044 mvm->last_ant_isol = ant_isolation; in iwl_mvm_rx_ant_coupling_notif()
1046 if (mvm->last_corun_lut == lut) in iwl_mvm_rx_ant_coupling_notif()
1049 mvm->last_corun_lut = lut; in iwl_mvm_rx_ant_coupling_notif()
1058 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_CORUN_LUT, 0, in iwl_mvm_rx_ant_coupling_notif()