Lines Matching +full:skip +full:- +full:sz +full:- +full:protect +full:- +full:en
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2019-2020 Realtek Corporation
220 #define RTW89_DEFAULT_BTC_VER_IDX (ARRAY_SIZE(rtw89_btc_ver_defs) - 1)
442 /* TDMA off + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo */
445 /* TDMA off + pri: WL_Hi-Tx > BT, BT_Hi > other-WL > BT_Lo */
448 /* TDMA off + pri: WL_Hi-Tx = BT */
451 /* TDMA off + pri: WL > BT, Block-BT*/
454 /* TDMA off+Bcn-Protect + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo*/
457 /* TDMA off + Ext-Ctrl + pri: default */
460 /* TDMA off + Ext-Ctrl + pri: E2G-slot block all BT */
463 /* TDMA off + Ext-Ctrl + pri: default */
466 /* TDMA off + Ext-Ctrl + pri: E2G-slot block all BT */
469 /* TDMA off + Ext-Ctrl + pri: E2G-slot WL > BT */
472 /* TDMA off + Ext-Ctrl + pri: E2G/EBT-slot WL > BT */
475 /* TDMA off + Ext-Ctrl + pri: default */
478 /* TDMA Fix slot-0: W1:B1 = 30:30 */
481 /* TDMA Fix slot-1: W1:B1 = 50:50 */
484 /* TDMA Fix slot-2: W1:B1 = 20:30 */
487 /* TDMA Fix slot-3: W1:B1 = 40:10 */
490 /* TDMA Fix slot-4: W1:B1 = 70:10 */
493 /* TDMA Fix slot-5: W1:B1 = 20:60 */
496 /* TDMA Fix slot-6: W1:B1 = 30:60 */
499 /* TDMA Fix slot-7: W1:B1 = 20:80 */
502 /* TDMA Fix slot-8: W1:B1 = user-define */
505 /* TDMA Fix slot-9: W1:B1 = 40:10 */
508 /* TDMA Fix slot-10: W1:B1 = 40:10 */
511 /* TDMA Fix slot-11: W1:B1 = 40:10 */
514 /* PS-TDMA Fix slot-0: W1:B1 = 30:30 */
517 /* PS-TDMA Fix slot-1: W1:B1 = 50:50 */
520 /* PS-TDMA Fix slot-2: W1:B1 = 20:30 */
523 /* PS-TDMA Fix slot-3: W1:B1 = 20:60 */
526 /* PS-TDMA Fix slot-4: W1:B1 = 30:70 */
529 /* PS-TDMA Fix slot-5: W1:B1 = 20:80 */
532 /* PS-TDMA Fix slot-6: W1:B1 = user-define */
535 /* TDMA Auto slot-0: W1:B1 = 50:200 */
538 /* TDMA Auto slot-1: W1:B1 = 60:200 */
541 /* TDMA Auto slot-2: W1:B1 = 20:200 */
544 /* TDMA Auto slot-3: W1:B1 = user-define */
547 /* PS-TDMA Auto slot-0: W1:B1 = 50:200 */
550 /* PS-TDMA Auto slot-1: W1:B1 = 60:200 */
553 /* PS-TDMA Auto slot-2: W1:B1 = 20:200 */
556 /* PS-TDMA Auto slot-3: W1:B1 = user-define */
559 /* TDMA Auto slot2-0: W1:B4 = 30:50 */
562 /* TDMA Auto slot2-1: W1:B4 = 30:70 */
565 /* TDMA Auto slot2-2: W1:B4 = 50:50 */
568 /* TDMA Auto slot2-3: W1:B4 = 60:60 */
571 /* TDMA Auto slot2-4: W1:B4 = 20:80 */
574 /* TDMA Auto slot2-5: W1:B4 = user-define */
577 /* PS-TDMA Auto slot2-0: W1:B4 = 30:50 */
580 /* PS-TDMA Auto slot2-1: W1:B4 = 30:70 */
583 /* PS-TDMA Auto slot2-2: W1:B4 = 50:50 */
586 /* PS-TDMA Auto slot2-3: W1:B4 = 60:60 */
589 /* PS-TDMA Auto slot2-4: W1:B4 = 20:80 */
592 /* PS-TDMA Auto slot2-5: W1:B4 = user-define */
759 BTC_ACT_NUM = BTC_ACT_LAST - BTC_ACT_NONE,
777 struct rtw89_btc *btc = &rtwdev->btc; in _send_fw_cmd()
778 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _send_fw_cmd()
779 struct rtw89_btc_cx *cx = &btc->cx; in _send_fw_cmd()
780 struct rtw89_btc_wl_info *wl = &cx->wl; in _send_fw_cmd()
781 struct rtw89_btc_dm *dm = &btc->dm; in _send_fw_cmd()
785 btc->fwinfo.cnt_h2c_fail++; in _send_fw_cmd()
786 dm->error.map.h2c_buffer_over = true; in _send_fw_cmd()
787 return -EINVAL; in _send_fw_cmd()
788 } else if (!wl->status.map.init_ok) { in _send_fw_cmd()
791 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
792 return -EINVAL; in _send_fw_cmd()
793 } else if ((wl->status.map.rf_off_pre == BTC_LPS_RF_OFF && in _send_fw_cmd()
794 wl->status.map.rf_off == BTC_LPS_RF_OFF) || in _send_fw_cmd()
795 (wl->status.map.lps_pre == BTC_LPS_RF_OFF && in _send_fw_cmd()
796 wl->status.map.lps == BTC_LPS_RF_OFF)) { in _send_fw_cmd()
799 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
800 return -EINVAL; in _send_fw_cmd()
806 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
808 pfwinfo->cnt_h2c++; in _send_fw_cmd()
815 struct rtw89_btc *btc = &rtwdev->btc; in _reset_btc_var()
816 const struct rtw89_btc_ver *ver = btc->ver; in _reset_btc_var()
817 struct rtw89_btc_cx *cx = &btc->cx; in _reset_btc_var()
818 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _reset_btc_var()
819 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _reset_btc_var()
820 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _reset_btc_var()
833 memset(&btc->ctrl, 0, sizeof(btc->ctrl)); in _reset_btc_var()
834 btc->manual_ctrl = false; in _reset_btc_var()
835 if (ver->fcxctrl != 7) in _reset_btc_var()
836 btc->ctrl.ctrl.trace_step = FCXDEF_STEP; in _reset_btc_var()
841 memset(&btc->dm, 0, sizeof(btc->dm)); in _reset_btc_var()
842 memset(bt_linfo->rssi_state, 0, sizeof(bt_linfo->rssi_state)); in _reset_btc_var()
844 if (btc->ver->fwlrole == 8) in _reset_btc_var()
845 wl_linfo = &wl->rlink_info[i][0]; in _reset_btc_var()
847 wl_linfo = &wl->link_info[i]; in _reset_btc_var()
848 memset(wl_linfo->rssi_state, 0, sizeof(wl_linfo->rssi_state)); in _reset_btc_var()
852 btc->dm.tdma_now = t_def[CXTD_OFF]; in _reset_btc_var()
853 btc->dm.tdma = t_def[CXTD_OFF]; in _reset_btc_var()
854 if (ver->fcxslots >= 7) { in _reset_btc_var()
856 btc->dm.slot.v7[i].dur = s_def[i].dur; in _reset_btc_var()
857 btc->dm.slot.v7[i].cxtype = s_def[i].cxtype; in _reset_btc_var()
858 btc->dm.slot.v7[i].cxtbl = s_def[i].cxtbl; in _reset_btc_var()
860 memcpy(&btc->dm.slot_now.v7, &btc->dm.slot.v7, in _reset_btc_var()
861 sizeof(btc->dm.slot_now.v7)); in _reset_btc_var()
863 memcpy(&btc->dm.slot_now.v1, s_def, in _reset_btc_var()
864 sizeof(btc->dm.slot_now.v1)); in _reset_btc_var()
865 memcpy(&btc->dm.slot.v1, s_def, in _reset_btc_var()
866 sizeof(btc->dm.slot.v1)); in _reset_btc_var()
869 btc->policy_len = 0; in _reset_btc_var()
870 btc->bt_req_len = 0; in _reset_btc_var()
872 btc->dm.coex_info_map = BTC_COEX_INFO_ALL; in _reset_btc_var()
873 btc->dm.wl_tx_limit.tx_time = BTC_MAX_TX_TIME_DEF; in _reset_btc_var()
874 btc->dm.wl_tx_limit.tx_retry = BTC_MAX_TX_RETRY_DEF; in _reset_btc_var()
875 btc->dm.wl_pre_agc_rb = BTC_PREAGC_NOTFOUND; in _reset_btc_var()
876 btc->dm.wl_btg_rx_rb = BTC_BTGCTRL_BB_GNT_NOTFOUND; in _reset_btc_var()
880 memset(&btc->mdinfo, 0, sizeof(btc->mdinfo)); in _reset_btc_var()
885 const struct rtw89_chip_info *chip = rtwdev->chip; in _search_reg_index()
889 if (le16_to_cpu(chip->mon_reg[i].type) == reg_type && in _search_reg_index()
890 le32_to_cpu(chip->mon_reg[i].offset) == target) { in _search_reg_index()
898 struct rtw89_btc *btc = &rtwdev->btc; in _get_reg_status()
899 const struct rtw89_btc_ver *ver = btc->ver; in _get_reg_status()
900 union rtw89_btc_module_info *md = &btc->mdinfo; in _get_reg_status()
906 if (ver->fcxinit == 7) in _get_reg_status()
907 switch_type = md->md_v7.switch_type; in _get_reg_status()
909 switch_type = md->md.switch_type; in _get_reg_status()
911 if (btc->btg_pos == RF_PATH_A) in _get_reg_status()
928 if (!btc->fwinfo.rpt_fbtc_mregval.cinfo.valid) in _get_reg_status()
931 pmreg = &btc->fwinfo.rpt_fbtc_mregval.finfo; in _get_reg_status()
932 if (ver->fcxmreg == 1) { in _get_reg_status()
933 idx = _search_reg_index(rtwdev, pmreg->v1.reg_num, in _get_reg_status()
938 reg_val = le32_to_cpu(pmreg->v1.mreg_val[idx]); in _get_reg_status()
941 } else if (ver->fcxmreg == 2) { in _get_reg_status()
942 idx = _search_reg_index(rtwdev, pmreg->v2.reg_num, in _get_reg_status()
947 reg_val = le32_to_cpu(pmreg->v2.mreg_val[idx]); in _get_reg_status()
958 if (!btc->fwinfo.rpt_fbtc_mregval.cinfo.valid) in _get_reg_status()
961 pmreg = &btc->fwinfo.rpt_fbtc_mregval.finfo; in _get_reg_status()
962 if (ver->fcxmreg == 1) { in _get_reg_status()
963 idx = _search_reg_index(rtwdev, pmreg->v1.reg_num, in _get_reg_status()
968 reg_val = le32_to_cpu(pmreg->v1.mreg_val[idx]) & in _get_reg_status()
972 } else if (ver->fcxmreg == 2) { in _get_reg_status()
973 idx = _search_reg_index(rtwdev, pmreg->v2.reg_num, in _get_reg_status()
978 reg_val = le32_to_cpu(pmreg->v2.mreg_val[idx]) & in _get_reg_status()
996 struct rtw89_btc *btc = &rtwdev->btc; in _chk_btc_err()
997 struct rtw89_btc_cx *cx = &btc->cx; in _chk_btc_err()
998 struct rtw89_btc_bt_info *bt = &cx->bt; in _chk_btc_err()
999 struct rtw89_btc_wl_info *wl = &cx->wl; in _chk_btc_err()
1000 struct rtw89_btc_dm *dm = &btc->dm; in _chk_btc_err()
1008 if ((wl->ver_info.fw_coex & 0xffff0000) != in _chk_btc_err()
1009 rtwdev->chip->wlcx_desired) { in _chk_btc_err()
1010 wl->fw_ver_mismatch = true; in _chk_btc_err()
1011 dm->error.map.wl_ver_mismatch = true; in _chk_btc_err()
1013 wl->fw_ver_mismatch = false; in _chk_btc_err()
1014 dm->error.map.wl_ver_mismatch = false; in _chk_btc_err()
1018 if (dm->cnt_dm[BTC_DCNT_RPT] == cnt && btc->fwinfo.rpt_en_map) in _chk_btc_err()
1019 dm->cnt_dm[BTC_DCNT_RPT_HANG]++; in _chk_btc_err()
1021 dm->cnt_dm[BTC_DCNT_RPT_HANG] = 0; in _chk_btc_err()
1023 if (dm->cnt_dm[BTC_DCNT_RPT_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1024 dm->error.map.wl_fw_hang = true; in _chk_btc_err()
1026 dm->error.map.wl_fw_hang = false; in _chk_btc_err()
1028 dm->cnt_dm[BTC_DCNT_RPT] = cnt; in _chk_btc_err()
1031 if (dm->cnt_dm[BTC_DCNT_CYCLE] == cnt && in _chk_btc_err()
1032 (dm->tdma_now.type != CXTDMA_OFF || in _chk_btc_err()
1033 dm->tdma_now.ext_ctrl == CXECTL_EXT)) in _chk_btc_err()
1034 dm->cnt_dm[BTC_DCNT_CYCLE_HANG]++; in _chk_btc_err()
1036 dm->cnt_dm[BTC_DCNT_CYCLE_HANG] = 0; in _chk_btc_err()
1038 if (dm->cnt_dm[BTC_DCNT_CYCLE_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1039 dm->error.map.cycle_hang = true; in _chk_btc_err()
1041 dm->error.map.cycle_hang = false; in _chk_btc_err()
1043 dm->cnt_dm[BTC_DCNT_CYCLE] = cnt; in _chk_btc_err()
1046 if (dm->cnt_dm[BTC_DCNT_W1] == cnt && in _chk_btc_err()
1047 dm->tdma_now.type != CXTDMA_OFF) in _chk_btc_err()
1048 dm->cnt_dm[BTC_DCNT_W1_HANG]++; in _chk_btc_err()
1050 dm->cnt_dm[BTC_DCNT_W1_HANG] = 0; in _chk_btc_err()
1052 if (dm->cnt_dm[BTC_DCNT_W1_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1053 dm->error.map.w1_hang = true; in _chk_btc_err()
1055 dm->error.map.w1_hang = false; in _chk_btc_err()
1057 dm->cnt_dm[BTC_DCNT_W1] = cnt; in _chk_btc_err()
1060 if (dm->cnt_dm[BTC_DCNT_B1] == cnt && in _chk_btc_err()
1061 dm->tdma_now.type != CXTDMA_OFF) in _chk_btc_err()
1062 dm->cnt_dm[BTC_DCNT_B1_HANG]++; in _chk_btc_err()
1064 dm->cnt_dm[BTC_DCNT_B1_HANG] = 0; in _chk_btc_err()
1066 if (dm->cnt_dm[BTC_DCNT_B1_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1067 dm->error.map.b1_hang = true; in _chk_btc_err()
1069 dm->error.map.b1_hang = false; in _chk_btc_err()
1071 dm->cnt_dm[BTC_DCNT_B1] = cnt; in _chk_btc_err()
1074 if (dm->cnt_dm[BTC_DCNT_E2G] == cnt && in _chk_btc_err()
1075 dm->tdma_now.ext_ctrl == CXECTL_EXT) in _chk_btc_err()
1076 dm->cnt_dm[BTC_DCNT_E2G_HANG]++; in _chk_btc_err()
1078 dm->cnt_dm[BTC_DCNT_E2G_HANG] = 0; in _chk_btc_err()
1080 if (dm->cnt_dm[BTC_DCNT_E2G_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1081 dm->error.map.wl_e2g_hang = true; in _chk_btc_err()
1083 dm->error.map.wl_e2g_hang = false; in _chk_btc_err()
1085 dm->cnt_dm[BTC_DCNT_E2G] = cnt; in _chk_btc_err()
1089 dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC]++; in _chk_btc_err()
1091 dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC] = 0; in _chk_btc_err()
1093 if (dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1094 dm->error.map.tdma_no_sync = true; in _chk_btc_err()
1096 dm->error.map.tdma_no_sync = false; in _chk_btc_err()
1100 dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC]++; in _chk_btc_err()
1102 dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC] = 0; in _chk_btc_err()
1104 if (dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1105 dm->error.map.slot_no_sync = true; in _chk_btc_err()
1107 dm->error.map.slot_no_sync = false; in _chk_btc_err()
1110 cnt = cx->cnt_bt[BTC_BCNT_LOPRI_TX]; in _chk_btc_err()
1112 if (cnt == 0 && bt->link_info.slave_role) in _chk_btc_err()
1113 dm->cnt_dm[BTC_DCNT_BTTX_HANG]++; in _chk_btc_err()
1115 dm->cnt_dm[BTC_DCNT_BTTX_HANG] = 0; in _chk_btc_err()
1117 if (dm->cnt_dm[BTC_DCNT_BTTX_HANG] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1118 dm->error.map.bt_tx_hang = true; in _chk_btc_err()
1120 dm->error.map.bt_tx_hang = false; in _chk_btc_err()
1123 cnt = cx->cnt_bt[BTC_BCNT_HIPRI_RX] + in _chk_btc_err()
1124 cx->cnt_bt[BTC_BCNT_HIPRI_TX] + in _chk_btc_err()
1125 cx->cnt_bt[BTC_BCNT_LOPRI_RX] + in _chk_btc_err()
1126 cx->cnt_bt[BTC_BCNT_LOPRI_TX]; in _chk_btc_err()
1129 dm->cnt_dm[BTC_DCNT_BTCNT_HANG]++; in _chk_btc_err()
1131 dm->cnt_dm[BTC_DCNT_BTCNT_HANG] = 0; in _chk_btc_err()
1133 if ((dm->cnt_dm[BTC_DCNT_BTCNT_HANG] >= BTC_CHK_HANG_MAX && in _chk_btc_err()
1134 bt->enable.now) || (!dm->cnt_dm[BTC_DCNT_BTCNT_HANG] && in _chk_btc_err()
1135 !bt->enable.now)) in _chk_btc_err()
1140 dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT]++; in _chk_btc_err()
1142 dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT] = 0; in _chk_btc_err()
1144 if (dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1145 dm->error.map.wl_slot_drift = true; in _chk_btc_err()
1147 dm->error.map.wl_slot_drift = false; in _chk_btc_err()
1151 dm->cnt_dm[BTC_DCNT_BT_SLOT_DRIFT]++; in _chk_btc_err()
1153 dm->cnt_dm[BTC_DCNT_BT_SLOT_DRIFT] = 0; in _chk_btc_err()
1155 if (dm->cnt_dm[BTC_DCNT_BT_SLOT_DRIFT] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
1156 dm->error.map.bt_slot_drift = true; in _chk_btc_err()
1158 dm->error.map.bt_slot_drift = false; in _chk_btc_err()
1166 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_report()
1167 const struct rtw89_btc_ver *ver = btc->ver; in _update_bt_report()
1168 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _update_bt_report()
1169 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _update_bt_report()
1170 struct rtw89_btc_bt_a2dp_desc *a2dp = &bt_linfo->a2dp_desc; in _update_bt_report()
1171 union rtw89_btc_fbtc_btver *pver = &btc->fwinfo.rpt_fbtc_btver.finfo; in _update_bt_report()
1188 if (ver->fcxbtver == 7) { in _update_bt_report()
1189 pver->v7 = *(struct rtw89_btc_fbtc_btver_v7 *)pfinfo; in _update_bt_report()
1190 bt->ver_info.fw = le32_to_cpu(pver->v7.fw_ver); in _update_bt_report()
1191 bt->ver_info.fw_coex = le32_get_bits(pver->v7.coex_ver, in _update_bt_report()
1193 bt->feature = le32_to_cpu(pver->v7.feature); in _update_bt_report()
1195 pver->v1 = *(struct rtw89_btc_fbtc_btver_v1 *)pfinfo; in _update_bt_report()
1196 bt->ver_info.fw = le32_to_cpu(pver->v1.fw_ver); in _update_bt_report()
1197 bt->ver_info.fw_coex = le32_get_bits(pver->v1.coex_ver, in _update_bt_report()
1199 bt->feature = le32_to_cpu(pver->v1.feature); in _update_bt_report()
1203 if (ver->fcxbtscan == 1) { in _update_bt_report()
1206 bt->scan_info_v1[i] = pscan_v1->scan[i]; in _update_bt_report()
1207 if (bt->scan_info_v1[i].win == 0 && in _update_bt_report()
1208 bt->scan_info_v1[i].intvl == 0) in _update_bt_report()
1211 } else if (ver->fcxbtscan == 2) { in _update_bt_report()
1214 bt->scan_info_v2[i] = pscan_v2->para[i]; in _update_bt_report()
1215 if ((pscan_v2->type & BIT(i)) && in _update_bt_report()
1216 pscan_v2->para[i].win == 0 && in _update_bt_report()
1217 pscan_v2->para[i].intvl == 0) in _update_bt_report()
1220 } else if (ver->fcxbtscan == 7) { in _update_bt_report()
1223 bt->scan_info_v2[i] = pscan_v7->para[i]; in _update_bt_report()
1224 if ((pscan_v7->type & BIT(i)) && in _update_bt_report()
1225 pscan_v7->para[i].win == 0 && in _update_bt_report()
1226 pscan_v7->para[i].intvl == 0) in _update_bt_report()
1231 bt->scan_info_update = 1; in _update_bt_report()
1234 if (ver->fcxbtafh == 2) { in _update_bt_report()
1236 if (pafh_v2->map_type & RPT_BT_AFH_SEQ_LEGACY) { in _update_bt_report()
1237 memcpy(&bt_linfo->afh_map[0], pafh_v2->afh_l, 4); in _update_bt_report()
1238 memcpy(&bt_linfo->afh_map[4], pafh_v2->afh_m, 4); in _update_bt_report()
1239 memcpy(&bt_linfo->afh_map[8], pafh_v2->afh_h, 2); in _update_bt_report()
1241 if (pafh_v2->map_type & RPT_BT_AFH_SEQ_LE) { in _update_bt_report()
1242 memcpy(&bt_linfo->afh_map_le[0], pafh_v2->afh_le_a, 4); in _update_bt_report()
1243 memcpy(&bt_linfo->afh_map_le[4], pafh_v2->afh_le_b, 1); in _update_bt_report()
1245 } else if (ver->fcxbtafh == 7) { in _update_bt_report()
1247 if (pafh_v7->map_type & RPT_BT_AFH_SEQ_LEGACY) { in _update_bt_report()
1248 memcpy(&bt_linfo->afh_map[0], pafh_v7->afh_l, 4); in _update_bt_report()
1249 memcpy(&bt_linfo->afh_map[4], pafh_v7->afh_m, 4); in _update_bt_report()
1250 memcpy(&bt_linfo->afh_map[8], pafh_v7->afh_h, 2); in _update_bt_report()
1252 if (pafh_v7->map_type & RPT_BT_AFH_SEQ_LE) { in _update_bt_report()
1253 memcpy(&bt_linfo->afh_map_le[0], pafh_v7->afh_le_a, 4); in _update_bt_report()
1254 memcpy(&bt_linfo->afh_map_le[4], pafh_v7->afh_le_b, 1); in _update_bt_report()
1256 } else if (ver->fcxbtafh == 1) { in _update_bt_report()
1258 memcpy(&bt_linfo->afh_map[0], pafh_v1->afh_l, 4); in _update_bt_report()
1259 memcpy(&bt_linfo->afh_map[4], pafh_v1->afh_m, 4); in _update_bt_report()
1260 memcpy(&bt_linfo->afh_map[8], pafh_v1->afh_h, 2); in _update_bt_report()
1265 a2dp->device_name = le32_to_cpu(pdev->dev_name); in _update_bt_report()
1266 a2dp->vendor_id = le16_to_cpu(pdev->vendor_id); in _update_bt_report()
1267 a2dp->flush_time = le32_to_cpu(pdev->flush_time); in _update_bt_report()
1276 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_fw_rpt_evnt_ver()
1277 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_fw_rpt_evnt_ver()
1279 if (ver->fwevntrptl == 1) in rtw89_btc_fw_rpt_evnt_ver()
1303 struct rtw89_btc *btc = &rtwdev->btc; in _chk_btc_report()
1304 const struct rtw89_btc_ver *ver = btc->ver; in _chk_btc_report()
1305 struct rtw89_btc_dm *dm = &btc->dm; in _chk_btc_report()
1307 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _chk_btc_report()
1308 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _chk_btc_report()
1324 pfwinfo->err[BTFRE_INVALID_INPUT]++; in _chk_btc_report()
1329 rpt_type = btc_prpt->type; in _chk_btc_report()
1330 rpt_len = le16_to_cpu(btc_prpt->len); in _chk_btc_report()
1331 rpt_content = btc_prpt->content; in _chk_btc_report()
1341 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _chk_btc_report()
1342 prpt = &pfwinfo->rpt_ctrl.finfo; in _chk_btc_report()
1343 if (ver->fcxbtcrpt == 1) { in _chk_btc_report()
1344 pfinfo = &pfwinfo->rpt_ctrl.finfo.v1; in _chk_btc_report()
1345 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v1); in _chk_btc_report()
1346 } else if (ver->fcxbtcrpt == 4) { in _chk_btc_report()
1347 pfinfo = &pfwinfo->rpt_ctrl.finfo.v4; in _chk_btc_report()
1348 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v4); in _chk_btc_report()
1349 } else if (ver->fcxbtcrpt == 5) { in _chk_btc_report()
1350 pfinfo = &pfwinfo->rpt_ctrl.finfo.v5; in _chk_btc_report()
1351 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v5); in _chk_btc_report()
1352 } else if (ver->fcxbtcrpt == 105) { in _chk_btc_report()
1353 pfinfo = &pfwinfo->rpt_ctrl.finfo.v105; in _chk_btc_report()
1354 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v105); in _chk_btc_report()
1355 pcinfo->req_fver = 5; in _chk_btc_report()
1357 } else if (ver->fcxbtcrpt == 8) { in _chk_btc_report()
1358 pfinfo = &pfwinfo->rpt_ctrl.finfo.v8; in _chk_btc_report()
1359 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v8); in _chk_btc_report()
1361 } else if (ver->fcxbtcrpt == 7) { in _chk_btc_report()
1362 pfinfo = &pfwinfo->rpt_ctrl.finfo.v7; in _chk_btc_report()
1363 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v7); in _chk_btc_report()
1368 pcinfo->req_fver = ver->fcxbtcrpt; in _chk_btc_report()
1371 pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo; in _chk_btc_report()
1372 if (ver->fcxtdma == 1) { in _chk_btc_report()
1373 pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo.v1; in _chk_btc_report()
1374 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo.v1); in _chk_btc_report()
1375 } else if (ver->fcxtdma == 3 || ver->fcxtdma == 7) { in _chk_btc_report()
1376 pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo.v3; in _chk_btc_report()
1377 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo.v3); in _chk_btc_report()
1381 pcinfo->req_fver = ver->fcxtdma; in _chk_btc_report()
1384 pcinfo = &pfwinfo->rpt_fbtc_slots.cinfo; in _chk_btc_report()
1385 if (ver->fcxslots == 1) { in _chk_btc_report()
1386 pfinfo = &pfwinfo->rpt_fbtc_slots.finfo.v1; in _chk_btc_report()
1387 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_slots.finfo.v1); in _chk_btc_report()
1388 } else if (ver->fcxslots == 7) { in _chk_btc_report()
1389 pfinfo = &pfwinfo->rpt_fbtc_slots.finfo.v7; in _chk_btc_report()
1390 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_slots.finfo.v7); in _chk_btc_report()
1394 pcinfo->req_fver = ver->fcxslots; in _chk_btc_report()
1397 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _chk_btc_report()
1398 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo; in _chk_btc_report()
1399 if (ver->fcxcysta == 2) { in _chk_btc_report()
1400 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v2; in _chk_btc_report()
1401 pcysta->v2 = pfwinfo->rpt_fbtc_cysta.finfo.v2; in _chk_btc_report()
1402 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v2); in _chk_btc_report()
1403 } else if (ver->fcxcysta == 3) { in _chk_btc_report()
1404 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v3; in _chk_btc_report()
1405 pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3; in _chk_btc_report()
1406 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v3); in _chk_btc_report()
1407 } else if (ver->fcxcysta == 4) { in _chk_btc_report()
1408 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v4; in _chk_btc_report()
1409 pcysta->v4 = pfwinfo->rpt_fbtc_cysta.finfo.v4; in _chk_btc_report()
1410 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v4); in _chk_btc_report()
1411 } else if (ver->fcxcysta == 5) { in _chk_btc_report()
1412 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v5; in _chk_btc_report()
1413 pcysta->v5 = pfwinfo->rpt_fbtc_cysta.finfo.v5; in _chk_btc_report()
1414 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v5); in _chk_btc_report()
1415 } else if (ver->fcxcysta == 7) { in _chk_btc_report()
1416 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v7; in _chk_btc_report()
1417 pcysta->v7 = pfwinfo->rpt_fbtc_cysta.finfo.v7; in _chk_btc_report()
1418 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v7); in _chk_btc_report()
1422 pcinfo->req_fver = ver->fcxcysta; in _chk_btc_report()
1425 pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; in _chk_btc_report()
1426 if (ver->fcxctrl != 7) in _chk_btc_report()
1427 trace_step = btc->ctrl.ctrl.trace_step; in _chk_btc_report()
1429 if (ver->fcxstep == 2) { in _chk_btc_report()
1430 pfinfo = &pfwinfo->rpt_fbtc_step.finfo.v2; in _chk_btc_report()
1431 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_step.finfo.v2.step[0]) * in _chk_btc_report()
1434 } else if (ver->fcxstep == 3) { in _chk_btc_report()
1435 pfinfo = &pfwinfo->rpt_fbtc_step.finfo.v3; in _chk_btc_report()
1436 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_step.finfo.v3.step[0]) * in _chk_btc_report()
1442 pcinfo->req_fver = ver->fcxstep; in _chk_btc_report()
1445 pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo; in _chk_btc_report()
1446 if (ver->fcxnullsta == 1) { in _chk_btc_report()
1447 pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo.v1; in _chk_btc_report()
1448 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo.v1); in _chk_btc_report()
1449 } else if (ver->fcxnullsta == 2) { in _chk_btc_report()
1450 pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo.v2; in _chk_btc_report()
1451 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo.v2); in _chk_btc_report()
1452 } else if (ver->fcxnullsta == 7) { in _chk_btc_report()
1453 pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo.v7; in _chk_btc_report()
1454 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo.v7); in _chk_btc_report()
1458 pcinfo->req_fver = ver->fcxnullsta; in _chk_btc_report()
1461 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _chk_btc_report()
1462 if (ver->fcxmreg == 1) { in _chk_btc_report()
1463 pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo.v1; in _chk_btc_report()
1464 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo.v1); in _chk_btc_report()
1465 } else if (ver->fcxmreg == 2) { in _chk_btc_report()
1466 pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo.v2; in _chk_btc_report()
1467 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo.v2); in _chk_btc_report()
1468 } else if (ver->fcxmreg == 7) { in _chk_btc_report()
1469 pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo.v7; in _chk_btc_report()
1470 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo.v7); in _chk_btc_report()
1474 pcinfo->req_fver = ver->fcxmreg; in _chk_btc_report()
1477 pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo; in _chk_btc_report()
1478 if (ver->fcxgpiodbg == 7) { in _chk_btc_report()
1479 pfinfo = &pfwinfo->rpt_fbtc_gpio_dbg.finfo.v7; in _chk_btc_report()
1480 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_gpio_dbg.finfo.v7); in _chk_btc_report()
1482 pfinfo = &pfwinfo->rpt_fbtc_gpio_dbg.finfo.v1; in _chk_btc_report()
1483 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_gpio_dbg.finfo.v1); in _chk_btc_report()
1485 pcinfo->req_fver = ver->fcxgpiodbg; in _chk_btc_report()
1488 pcinfo = &pfwinfo->rpt_fbtc_btver.cinfo; in _chk_btc_report()
1489 if (ver->fcxbtver == 1) { in _chk_btc_report()
1490 pfinfo = &pfwinfo->rpt_fbtc_btver.finfo.v1; in _chk_btc_report()
1491 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo.v1); in _chk_btc_report()
1492 } else if (ver->fcxbtver == 7) { in _chk_btc_report()
1493 pfinfo = &pfwinfo->rpt_fbtc_btver.finfo.v7; in _chk_btc_report()
1494 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo.v7); in _chk_btc_report()
1496 pcinfo->req_fver = ver->fcxbtver; in _chk_btc_report()
1499 pcinfo = &pfwinfo->rpt_fbtc_btscan.cinfo; in _chk_btc_report()
1500 if (ver->fcxbtscan == 1) { in _chk_btc_report()
1501 pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo.v1; in _chk_btc_report()
1502 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo.v1); in _chk_btc_report()
1503 } else if (ver->fcxbtscan == 2) { in _chk_btc_report()
1504 pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo.v2; in _chk_btc_report()
1505 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo.v2); in _chk_btc_report()
1506 } else if (ver->fcxbtscan == 7) { in _chk_btc_report()
1507 pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo.v7; in _chk_btc_report()
1508 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo.v7); in _chk_btc_report()
1512 pcinfo->req_fver = ver->fcxbtscan; in _chk_btc_report()
1515 pcinfo = &pfwinfo->rpt_fbtc_btafh.cinfo; in _chk_btc_report()
1516 if (ver->fcxbtafh == 1) { in _chk_btc_report()
1517 pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v1; in _chk_btc_report()
1518 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v1); in _chk_btc_report()
1519 } else if (ver->fcxbtafh == 2) { in _chk_btc_report()
1520 pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v2; in _chk_btc_report()
1521 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v2); in _chk_btc_report()
1525 pcinfo->req_fver = ver->fcxbtafh; in _chk_btc_report()
1528 pcinfo = &pfwinfo->rpt_fbtc_btdev.cinfo; in _chk_btc_report()
1529 pfinfo = &pfwinfo->rpt_fbtc_btdev.finfo; in _chk_btc_report()
1530 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btdev.finfo); in _chk_btc_report()
1531 pcinfo->req_fver = ver->fcxbtdevinfo; in _chk_btc_report()
1534 pfwinfo->err[BTFRE_UNDEF_TYPE]++; in _chk_btc_report()
1538 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1539 pcinfo->rx_cnt++; in _chk_btc_report()
1541 if (rpt_len != pcinfo->req_len) { in _chk_btc_report()
1543 pfwinfo->len_mismch |= (0x1 << rpt_type); in _chk_btc_report()
1545 pfwinfo->len_mismch |= BIT(31); in _chk_btc_report()
1548 __func__, rpt_type, rpt_len, pcinfo->req_len); in _chk_btc_report()
1550 pcinfo->valid = 0; in _chk_btc_report()
1552 } else if (!pfinfo || !rpt_content || !pcinfo->req_len) { in _chk_btc_report()
1553 pfwinfo->err[BTFRE_EXCEPTION]++; in _chk_btc_report()
1554 pcinfo->valid = 0; in _chk_btc_report()
1558 memcpy(pfinfo, rpt_content, pcinfo->req_len); in _chk_btc_report()
1559 pcinfo->valid = 1; in _chk_btc_report()
1563 if (ver->fcxbtcrpt == 1) { in _chk_btc_report()
1564 prpt->v1 = pfwinfo->rpt_ctrl.finfo.v1; in _chk_btc_report()
1565 btc->fwinfo.rpt_en_map = prpt->v1.rpt_enable; in _chk_btc_report()
1566 wl->ver_info.fw_coex = prpt->v1.wl_fw_coex_ver; in _chk_btc_report()
1567 wl->ver_info.fw = prpt->v1.wl_fw_ver; in _chk_btc_report()
1568 dm->wl_fw_cx_offload = !!prpt->v1.wl_fw_cx_offload; in _chk_btc_report()
1571 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1573 /* To avoid I/O if WL LPS or power-off */ in _chk_btc_report()
1574 if (wl->status.map.lps != BTC_LPS_RF_OFF && in _chk_btc_report()
1575 !wl->status.map.rf_off) { in _chk_btc_report()
1576 rtwdev->chip->ops->btc_update_bt_cnt(rtwdev); in _chk_btc_report()
1579 btc->cx.cnt_bt[BTC_BCNT_POLUT] = in _chk_btc_report()
1583 } else if (ver->fcxbtcrpt == 4) { in _chk_btc_report()
1584 prpt->v4 = pfwinfo->rpt_ctrl.finfo.v4; in _chk_btc_report()
1585 btc->fwinfo.rpt_en_map = le32_to_cpu(prpt->v4.rpt_info.en); in _chk_btc_report()
1586 wl->ver_info.fw_coex = le32_to_cpu(prpt->v4.wl_fw_info.cx_ver); in _chk_btc_report()
1587 wl->ver_info.fw = le32_to_cpu(prpt->v4.wl_fw_info.fw_ver); in _chk_btc_report()
1588 dm->wl_fw_cx_offload = !!le32_to_cpu(prpt->v4.wl_fw_info.cx_offload); in _chk_btc_report()
1591 memcpy(&dm->gnt.band[i], &prpt->v4.gnt_val[i], in _chk_btc_report()
1592 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1594 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = in _chk_btc_report()
1595 le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_HI_TX]); in _chk_btc_report()
1596 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = in _chk_btc_report()
1597 le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_HI_RX]); in _chk_btc_report()
1598 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = in _chk_btc_report()
1599 le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_LO_TX]); in _chk_btc_report()
1600 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = in _chk_btc_report()
1601 le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_LO_RX]); in _chk_btc_report()
1602 btc->cx.cnt_bt[BTC_BCNT_POLUT] = in _chk_btc_report()
1603 le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_POLLUTED]); in _chk_btc_report()
1607 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1609 if (le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0) in _chk_btc_report()
1610 bt->rfk_info.map.timeout = 1; in _chk_btc_report()
1612 bt->rfk_info.map.timeout = 0; in _chk_btc_report()
1614 dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout; in _chk_btc_report()
1615 } else if (ver->fcxbtcrpt == 5) { in _chk_btc_report()
1616 prpt->v5 = pfwinfo->rpt_ctrl.finfo.v5; in _chk_btc_report()
1617 pfwinfo->rpt_en_map = le32_to_cpu(prpt->v5.rpt_info.en); in _chk_btc_report()
1618 wl->ver_info.fw_coex = le32_to_cpu(prpt->v5.rpt_info.cx_ver); in _chk_btc_report()
1619 wl->ver_info.fw = le32_to_cpu(prpt->v5.rpt_info.fw_ver); in _chk_btc_report()
1620 dm->wl_fw_cx_offload = 0; in _chk_btc_report()
1623 memcpy(&dm->gnt.band[i], &prpt->v5.gnt_val[i][0], in _chk_btc_report()
1624 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1626 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = in _chk_btc_report()
1627 le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_TX]); in _chk_btc_report()
1628 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = in _chk_btc_report()
1629 le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_RX]); in _chk_btc_report()
1630 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = in _chk_btc_report()
1631 le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_TX]); in _chk_btc_report()
1632 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = in _chk_btc_report()
1633 le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_RX]); in _chk_btc_report()
1634 btc->cx.cnt_bt[BTC_BCNT_POLUT] = in _chk_btc_report()
1635 le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_POLLUTED]); in _chk_btc_report()
1639 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1641 dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout; in _chk_btc_report()
1642 } else if (ver->fcxbtcrpt == 105) { in _chk_btc_report()
1643 prpt->v105 = pfwinfo->rpt_ctrl.finfo.v105; in _chk_btc_report()
1644 pfwinfo->rpt_en_map = le32_to_cpu(prpt->v105.rpt_info.en); in _chk_btc_report()
1645 wl->ver_info.fw_coex = le32_to_cpu(prpt->v105.rpt_info.cx_ver); in _chk_btc_report()
1646 wl->ver_info.fw = le32_to_cpu(prpt->v105.rpt_info.fw_ver); in _chk_btc_report()
1647 dm->wl_fw_cx_offload = 0; in _chk_btc_report()
1650 memcpy(&dm->gnt.band[i], &prpt->v105.gnt_val[i][0], in _chk_btc_report()
1651 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1653 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = in _chk_btc_report()
1654 le16_to_cpu(prpt->v105.bt_cnt[BTC_BCNT_HI_TX_V105]); in _chk_btc_report()
1655 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = in _chk_btc_report()
1656 le16_to_cpu(prpt->v105.bt_cnt[BTC_BCNT_HI_RX_V105]); in _chk_btc_report()
1657 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = in _chk_btc_report()
1658 le16_to_cpu(prpt->v105.bt_cnt[BTC_BCNT_LO_TX_V105]); in _chk_btc_report()
1659 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = in _chk_btc_report()
1660 le16_to_cpu(prpt->v105.bt_cnt[BTC_BCNT_LO_RX_V105]); in _chk_btc_report()
1661 btc->cx.cnt_bt[BTC_BCNT_POLUT] = in _chk_btc_report()
1662 le16_to_cpu(prpt->v105.bt_cnt[BTC_BCNT_POLLUTED_V105]); in _chk_btc_report()
1666 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1668 dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout; in _chk_btc_report()
1669 } else if (ver->fcxbtcrpt == 7) { in _chk_btc_report()
1670 prpt->v7 = pfwinfo->rpt_ctrl.finfo.v7; in _chk_btc_report()
1671 pfwinfo->rpt_en_map = le32_to_cpu(prpt->v7.rpt_info.en); in _chk_btc_report()
1672 wl->ver_info.fw_coex = le32_to_cpu(prpt->v7.rpt_info.cx_ver); in _chk_btc_report()
1673 wl->ver_info.fw = le32_to_cpu(prpt->v7.rpt_info.fw_ver); in _chk_btc_report()
1676 memcpy(&dm->gnt.band[i], &prpt->v7.gnt_val[i][0], in _chk_btc_report()
1677 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1679 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = in _chk_btc_report()
1680 le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_HI_TX_V105]); in _chk_btc_report()
1681 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = in _chk_btc_report()
1682 le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_HI_RX_V105]); in _chk_btc_report()
1683 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = in _chk_btc_report()
1684 le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_LO_TX_V105]); in _chk_btc_report()
1685 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = in _chk_btc_report()
1686 le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_LO_RX_V105]); in _chk_btc_report()
1688 val1 = le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_POLLUTED_V105]); in _chk_btc_report()
1689 if (val1 > btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW]) in _chk_btc_report()
1690 val1 -= btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW]; /* diff */ in _chk_btc_report()
1692 btc->cx.cnt_bt[BTC_BCNT_POLUT_DIFF] = val1; in _chk_btc_report()
1693 btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW] = in _chk_btc_report()
1694 le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_POLLUTED_V105]); in _chk_btc_report()
1696 val1 = pfwinfo->event[BTF_EVNT_RPT]; in _chk_btc_report()
1701 } else if (ver->fcxbtcrpt == 8) { in _chk_btc_report()
1702 prpt->v8 = pfwinfo->rpt_ctrl.finfo.v8; in _chk_btc_report()
1703 pfwinfo->rpt_en_map = le32_to_cpu(prpt->v8.rpt_info.en); in _chk_btc_report()
1704 wl->ver_info.fw_coex = le32_to_cpu(prpt->v8.rpt_info.cx_ver); in _chk_btc_report()
1705 wl->ver_info.fw = le32_to_cpu(prpt->v8.rpt_info.fw_ver); in _chk_btc_report()
1708 memcpy(&dm->gnt.band[i], &prpt->v8.gnt_val[i][0], in _chk_btc_report()
1709 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1711 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = in _chk_btc_report()
1712 le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_HI_TX_V105]); in _chk_btc_report()
1713 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = in _chk_btc_report()
1714 le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_HI_RX_V105]); in _chk_btc_report()
1715 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = in _chk_btc_report()
1716 le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_LO_TX_V105]); in _chk_btc_report()
1717 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = in _chk_btc_report()
1718 le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_LO_RX_V105]); in _chk_btc_report()
1720 val1 = le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_POLLUTED_V105]); in _chk_btc_report()
1721 if (val1 > btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW]) in _chk_btc_report()
1722 val1 -= btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW]; /* diff */ in _chk_btc_report()
1724 btc->cx.cnt_bt[BTC_BCNT_POLUT_DIFF] = val1; in _chk_btc_report()
1725 btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW] = in _chk_btc_report()
1726 le16_to_cpu(prpt->v8.bt_cnt[BTC_BCNT_POLLUTED_V105]); in _chk_btc_report()
1728 val1 = pfwinfo->event[BTF_EVNT_RPT]; in _chk_btc_report()
1729 if (((prpt->v8.rpt_len_max_h << 8) + in _chk_btc_report()
1730 prpt->v8.rpt_len_max_l) != ver->info_buf) in _chk_btc_report()
1731 dm->error.map.h2c_c2h_buffer_mismatch = true; in _chk_btc_report()
1733 dm->error.map.h2c_c2h_buffer_mismatch = false; in _chk_btc_report()
1747 sizeof(dm->tdma_now)); in _chk_btc_report()
1748 if (ver->fcxtdma == 1) in _chk_btc_report()
1750 memcmp(&dm->tdma_now, in _chk_btc_report()
1751 &pfwinfo->rpt_fbtc_tdma.finfo.v1, in _chk_btc_report()
1752 sizeof(dm->tdma_now))); in _chk_btc_report()
1753 else if (ver->fcxtdma == 3 || ver->fcxtdma == 7) in _chk_btc_report()
1755 memcmp(&dm->tdma_now, in _chk_btc_report()
1756 &pfwinfo->rpt_fbtc_tdma.finfo.v3.tdma, in _chk_btc_report()
1757 sizeof(dm->tdma_now))); in _chk_btc_report()
1762 if (ver->fcxslots == 7) { in _chk_btc_report()
1766 sizeof(dm->slot_now.v7)); in _chk_btc_report()
1768 memcmp(dm->slot_now.v7, in _chk_btc_report()
1769 pfwinfo->rpt_fbtc_slots.finfo.v7.slot, in _chk_btc_report()
1770 sizeof(dm->slot_now.v7))); in _chk_btc_report()
1771 } else if (ver->fcxslots == 1) { in _chk_btc_report()
1775 sizeof(dm->slot_now.v1)); in _chk_btc_report()
1777 memcmp(dm->slot_now.v1, in _chk_btc_report()
1778 pfwinfo->rpt_fbtc_slots.finfo.v1.slot, in _chk_btc_report()
1779 sizeof(dm->slot_now.v1))); in _chk_btc_report()
1783 if (ver->fcxcysta == 2) { in _chk_btc_report()
1784 if (le16_to_cpu(pcysta->v2.cycles) < BTC_CYSTA_CHK_PERIOD) in _chk_btc_report()
1786 /* Check Leak-AP */ in _chk_btc_report()
1787 if (le32_to_cpu(pcysta->v2.slot_cnt[CXST_LK]) != 0 && in _chk_btc_report()
1788 le32_to_cpu(pcysta->v2.leakrx_cnt) != 0 && dm->tdma_now.rxflctrl) { in _chk_btc_report()
1789 if (le32_to_cpu(pcysta->v2.slot_cnt[CXST_LK]) < in _chk_btc_report()
1790 BTC_LEAK_AP_TH * le32_to_cpu(pcysta->v2.leakrx_cnt)) in _chk_btc_report()
1791 dm->leak_ap = 1; in _chk_btc_report()
1795 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1796 dm->tdma_now.ext_ctrl == CXECTL_EXT) { in _chk_btc_report()
1797 if (ver->fcxslots == 1) in _chk_btc_report()
1798 wl_slot_set = le16_to_cpu(dm->slot_now.v1[CXST_E2G].dur); in _chk_btc_report()
1799 else if (ver->fcxslots == 7) in _chk_btc_report()
1800 wl_slot_set = le16_to_cpu(dm->slot_now.v7[CXST_E2G].dur); in _chk_btc_report()
1802 if (ver->fcxslots == 1) in _chk_btc_report()
1803 wl_slot_set = le16_to_cpu(dm->slot_now.v1[CXST_W1].dur); in _chk_btc_report()
1804 else if (ver->fcxslots == 7) in _chk_btc_report()
1805 wl_slot_set = le16_to_cpu(dm->slot_now.v7[CXST_W1].dur); in _chk_btc_report()
1808 if (le16_to_cpu(pcysta->v2.tavg_cycle[CXT_WL]) > wl_slot_set) { in _chk_btc_report()
1809 diff_t = le16_to_cpu(pcysta->v2.tavg_cycle[CXT_WL]) - wl_slot_set; in _chk_btc_report()
1815 le32_to_cpu(pcysta->v2.slot_cnt[CXST_W1])); in _chk_btc_report()
1817 le32_to_cpu(pcysta->v2.slot_cnt[CXST_B1])); in _chk_btc_report()
1819 le16_to_cpu(pcysta->v2.cycles)); in _chk_btc_report()
1820 } else if (ver->fcxcysta == 3) { in _chk_btc_report()
1821 if (le16_to_cpu(pcysta->v3.cycles) < BTC_CYSTA_CHK_PERIOD) in _chk_btc_report()
1824 cnt_leak_slot = le32_to_cpu(pcysta->v3.slot_cnt[CXST_LK]); in _chk_btc_report()
1825 cnt_rx_imr = le32_to_cpu(pcysta->v3.leak_slot.cnt_rximr); in _chk_btc_report()
1827 /* Check Leak-AP */ in _chk_btc_report()
1829 dm->tdma_now.rxflctrl) { in _chk_btc_report()
1831 dm->leak_ap = 1; in _chk_btc_report()
1835 if (dm->tdma_now.type == CXTDMA_OFF) { in _chk_btc_report()
1836 if (ver->fcxslots == 1) in _chk_btc_report()
1837 wl_slot_set = le16_to_cpu(dm->slot_now.v1[CXST_W1].dur); in _chk_btc_report()
1838 else if (ver->fcxslots == 7) in _chk_btc_report()
1839 wl_slot_set = le16_to_cpu(dm->slot_now.v7[CXST_W1].dur); in _chk_btc_report()
1840 wl_slot_real = le16_to_cpu(pcysta->v3.cycle_time.tavg[CXT_WL]); in _chk_btc_report()
1842 diff_t = wl_slot_real - wl_slot_set; in _chk_btc_report()
1848 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1849 dm->tdma_now.ext_ctrl == CXECTL_EXT && in _chk_btc_report()
1850 btc->bt_req_len != 0) { in _chk_btc_report()
1851 bt_slot_real = le16_to_cpu(pcysta->v3.cycle_time.tavg[CXT_BT]); in _chk_btc_report()
1852 if (btc->bt_req_len > bt_slot_real) { in _chk_btc_report()
1853 diff_t = btc->bt_req_len - bt_slot_real; in _chk_btc_report()
1859 le32_to_cpu(pcysta->v3.slot_cnt[CXST_W1])); in _chk_btc_report()
1861 le32_to_cpu(pcysta->v3.slot_cnt[CXST_B1])); in _chk_btc_report()
1863 le16_to_cpu(pcysta->v3.cycles)); in _chk_btc_report()
1864 } else if (ver->fcxcysta == 4) { in _chk_btc_report()
1865 if (le16_to_cpu(pcysta->v4.cycles) < BTC_CYSTA_CHK_PERIOD) in _chk_btc_report()
1868 cnt_leak_slot = le16_to_cpu(pcysta->v4.slot_cnt[CXST_LK]); in _chk_btc_report()
1869 cnt_rx_imr = le32_to_cpu(pcysta->v4.leak_slot.cnt_rximr); in _chk_btc_report()
1871 /* Check Leak-AP */ in _chk_btc_report()
1873 dm->tdma_now.rxflctrl) { in _chk_btc_report()
1875 dm->leak_ap = 1; in _chk_btc_report()
1879 if (dm->tdma_now.type == CXTDMA_OFF) { in _chk_btc_report()
1880 if (ver->fcxslots == 1) in _chk_btc_report()
1881 wl_slot_set = le16_to_cpu(dm->slot_now.v1[CXST_W1].dur); in _chk_btc_report()
1882 else if (ver->fcxslots == 7) in _chk_btc_report()
1883 wl_slot_set = le16_to_cpu(dm->slot_now.v7[CXST_W1].dur); in _chk_btc_report()
1884 wl_slot_real = le16_to_cpu(pcysta->v4.cycle_time.tavg[CXT_WL]); in _chk_btc_report()
1886 diff_t = wl_slot_real - wl_slot_set; in _chk_btc_report()
1892 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1893 dm->tdma_now.ext_ctrl == CXECTL_EXT && in _chk_btc_report()
1894 btc->bt_req_len != 0) { in _chk_btc_report()
1895 bt_slot_real = le16_to_cpu(pcysta->v4.cycle_time.tavg[CXT_BT]); in _chk_btc_report()
1897 if (btc->bt_req_len > bt_slot_real) { in _chk_btc_report()
1898 diff_t = btc->bt_req_len - bt_slot_real; in _chk_btc_report()
1904 le16_to_cpu(pcysta->v4.slot_cnt[CXST_W1])); in _chk_btc_report()
1906 le16_to_cpu(pcysta->v4.slot_cnt[CXST_B1])); in _chk_btc_report()
1908 le16_to_cpu(pcysta->v4.cycles)); in _chk_btc_report()
1909 } else if (ver->fcxcysta == 5) { in _chk_btc_report()
1910 if (dm->fddt_train == BTC_FDDT_ENABLE) in _chk_btc_report()
1912 cnt_leak_slot = le16_to_cpu(pcysta->v5.slot_cnt[CXST_LK]); in _chk_btc_report()
1913 cnt_rx_imr = le32_to_cpu(pcysta->v5.leak_slot.cnt_rximr); in _chk_btc_report()
1915 /* Check Leak-AP */ in _chk_btc_report()
1917 dm->tdma_now.rxflctrl) { in _chk_btc_report()
1918 if (le16_to_cpu(pcysta->v5.cycles) >= BTC_CYSTA_CHK_PERIOD && in _chk_btc_report()
1920 dm->leak_ap = 1; in _chk_btc_report()
1924 if (dm->tdma_now.type == CXTDMA_OFF) { in _chk_btc_report()
1925 if (ver->fcxslots == 1) in _chk_btc_report()
1926 wl_slot_set = le16_to_cpu(dm->slot_now.v1[CXST_W1].dur); in _chk_btc_report()
1927 else if (ver->fcxslots == 7) in _chk_btc_report()
1928 wl_slot_set = le16_to_cpu(dm->slot_now.v7[CXST_W1].dur); in _chk_btc_report()
1929 wl_slot_real = le16_to_cpu(pcysta->v5.cycle_time.tavg[CXT_WL]); in _chk_btc_report()
1932 diff_t = wl_slot_real - wl_slot_set; in _chk_btc_report()
1934 diff_t = wl_slot_set - wl_slot_real; in _chk_btc_report()
1939 bt_slot_set = btc->bt_req_len; in _chk_btc_report()
1940 bt_slot_real = le16_to_cpu(pcysta->v5.cycle_time.tavg[CXT_BT]); in _chk_btc_report()
1942 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1943 dm->tdma_now.ext_ctrl == CXECTL_EXT && in _chk_btc_report()
1946 diff_t = bt_slot_set - bt_slot_real; in _chk_btc_report()
1948 diff_t = bt_slot_real - bt_slot_set; in _chk_btc_report()
1953 le16_to_cpu(pcysta->v5.slot_cnt[CXST_E2G])); in _chk_btc_report()
1955 le16_to_cpu(pcysta->v5.slot_cnt[CXST_W1])); in _chk_btc_report()
1957 le16_to_cpu(pcysta->v5.slot_cnt[CXST_B1])); in _chk_btc_report()
1959 le16_to_cpu(pcysta->v5.cycles)); in _chk_btc_report()
1960 } else if (ver->fcxcysta == 7) { in _chk_btc_report()
1961 if (dm->fddt_train == BTC_FDDT_ENABLE) in _chk_btc_report()
1964 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo; in _chk_btc_report()
1966 if (dm->tdma_now.type != CXTDMA_OFF) { in _chk_btc_report()
1968 val16 = le16_to_cpu(pcysta->v7.cycle_time.tavg[CXT_WL]); in _chk_btc_report()
1971 /* Check Leak-AP */ in _chk_btc_report()
1972 val1 = le32_to_cpu(pcysta->v7.leak_slot.cnt_rximr) * in _chk_btc_report()
1974 val2 = le16_to_cpu(pcysta->v7.slot_cnt[CXST_LK]); in _chk_btc_report()
1976 val16 = le16_to_cpu(pcysta->v7.cycles); in _chk_btc_report()
1977 if (dm->tdma_now.rxflctrl && in _chk_btc_report()
1979 dm->leak_ap = 1; in _chk_btc_report()
1980 } else if (dm->tdma_now.ext_ctrl == CXECTL_EXT) { in _chk_btc_report()
1981 val16 = le16_to_cpu(pcysta->v7.cycle_time.tavg[CXT_BT]); in _chk_btc_report()
1986 val1 = le16_to_cpu(pcysta->v7.a2dp_ept.cnt_timeout) * in _chk_btc_report()
1988 val2 = le16_to_cpu(pcysta->v7.a2dp_ept.cnt); in _chk_btc_report()
1990 val16 = le16_to_cpu(pcysta->v7.cycles); in _chk_btc_report()
1992 dm->slot_req_more = 1; in _chk_btc_report()
1993 else if (bt->link_info.status.map.connect == 0) in _chk_btc_report()
1994 dm->slot_req_more = 0; in _chk_btc_report()
1998 le16_to_cpu(pcysta->v7.slot_cnt[CXST_E2G])); in _chk_btc_report()
2000 le16_to_cpu(pcysta->v7.slot_cnt[CXST_W1])); in _chk_btc_report()
2002 le16_to_cpu(pcysta->v7.slot_cnt[CXST_B1])); in _chk_btc_report()
2004 /* "BT_SLOT_FLOOD" error-check MUST before "CYCLE_HANG" */ in _chk_btc_report()
2006 le16_to_cpu(pcysta->v7.cycles)); in _chk_btc_report()
2008 le16_to_cpu(pcysta->v7.cycles)); in _chk_btc_report()
2014 if (ver->fcxmreg == 7) in _chk_btc_report()
2017 if (dm->wl_btg_rx == BTC_BTGCTRL_BB_GNT_FWCTRL) in _chk_btc_report()
2018 dm->wl_btg_rx_rb = BTC_BTGCTRL_BB_GNT_FWCTRL; in _chk_btc_report()
2020 dm->wl_btg_rx_rb = val; in _chk_btc_report()
2023 if (dm->wl_pre_agc == BTC_PREAGC_BB_FWCTRL) in _chk_btc_report()
2024 dm->wl_pre_agc_rb = BTC_PREAGC_BB_FWCTRL; in _chk_btc_report()
2026 dm->wl_pre_agc_rb = val; in _chk_btc_report()
2047 const struct rtw89_btc_ver *ver = rtwdev->btc.ver; in _parse_btc_report()
2057 if (index + 2 >= ver->info_buf) in _parse_btc_report()
2060 rpt_len = le16_to_cpu(btc_prpt->len); in _parse_btc_report()
2076 struct rtw89_btc *btc = &rtwdev->btc; in _append_tdma()
2077 const struct rtw89_btc_ver *ver = btc->ver; in _append_tdma()
2078 struct rtw89_btc_dm *dm = &btc->dm; in _append_tdma()
2083 u16 len = btc->policy_len; in _append_tdma()
2085 if (!btc->update_policy_force && in _append_tdma()
2086 !memcmp(&dm->tdma, &dm->tdma_now, sizeof(dm->tdma))) { in _append_tdma()
2093 tlv = (struct rtw89_btc_btf_tlv *)&btc->policy[len]; in _append_tdma()
2094 tlv->type = CXPOLICY_TDMA; in _append_tdma()
2095 if (ver->fcxtdma == 1) { in _append_tdma()
2096 v = (struct rtw89_btc_fbtc_tdma *)&tlv->val[0]; in _append_tdma()
2097 tlv->len = sizeof(*v); in _append_tdma()
2098 *v = dm->tdma; in _append_tdma()
2099 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v); in _append_tdma()
2100 } else if (ver->fcxtdma == 7) { in _append_tdma()
2101 tlv_v7 = (struct rtw89_btc_btf_tlv_v7 *)&btc->policy[len]; in _append_tdma()
2102 tlv_v7->len = sizeof(dm->tdma); in _append_tdma()
2103 tlv_v7->ver = ver->fcxtdma; in _append_tdma()
2104 tlv_v7->type = CXPOLICY_TDMA; in _append_tdma()
2105 memcpy(tlv_v7->val, &dm->tdma, tlv_v7->len); in _append_tdma()
2106 btc->policy_len += BTC_TLV_HDR_LEN_V7 + tlv_v7->len; in _append_tdma()
2108 tlv->len = sizeof(*v3); in _append_tdma()
2109 v3 = (struct rtw89_btc_fbtc_tdma_v3 *)&tlv->val[0]; in _append_tdma()
2110 v3->fver = ver->fcxtdma; in _append_tdma()
2111 v3->tdma = dm->tdma; in _append_tdma()
2112 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v3); in _append_tdma()
2117 __func__, dm->tdma.type, dm->tdma.rxflctrl, in _append_tdma()
2118 dm->tdma.txpause, dm->tdma.wtgle_n, dm->tdma.leak_n, in _append_tdma()
2119 dm->tdma.ext_ctrl); in _append_tdma()
2124 struct rtw89_btc *btc = &rtwdev->btc; in _append_slot_v1()
2125 struct rtw89_btc_dm *dm = &btc->dm; in _append_slot_v1()
2132 "[BTC], %s(): A:btc->policy_len = %d\n", in _append_slot_v1()
2133 __func__, btc->policy_len); in _append_slot_v1()
2136 if (!btc->update_policy_force && in _append_slot_v1()
2137 !memcmp(&dm->slot.v1[i], &dm->slot_now.v1[i], in _append_slot_v1()
2138 sizeof(dm->slot.v1[i]))) in _append_slot_v1()
2141 len = btc->policy_len; in _append_slot_v1()
2143 tlv = (struct rtw89_btc_btf_tlv *)&btc->policy[len]; in _append_slot_v1()
2144 v = (struct btc_fbtc_1slot *)&tlv->val[0]; in _append_slot_v1()
2145 tlv->type = CXPOLICY_SLOT; in _append_slot_v1()
2146 tlv->len = sizeof(*v); in _append_slot_v1()
2148 v->fver = btc->ver->fcxslots; in _append_slot_v1()
2149 v->sid = i; in _append_slot_v1()
2150 v->slot = dm->slot.v1[i]; in _append_slot_v1()
2153 "[BTC], %s(): slot-%d: dur=%d, table=0x%08x, type=%d\n", in _append_slot_v1()
2154 __func__, i, dm->slot.v1[i].dur, dm->slot.v1[i].cxtbl, in _append_slot_v1()
2155 dm->slot.v1[i].cxtype); in _append_slot_v1()
2158 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v); in _append_slot_v1()
2170 struct rtw89_btc *btc = &rtwdev->btc; in _append_slot_v7()
2171 struct rtw89_btc_dm *dm = &btc->dm; in _append_slot_v7()
2176 if (!btc->update_policy_force && in _append_slot_v7()
2177 !memcmp(&dm->slot.v7[i], &dm->slot_now.v7[i], in _append_slot_v7()
2178 sizeof(dm->slot.v7[i]))) in _append_slot_v7()
2181 len = btc->policy_len; in _append_slot_v7()
2190 tlv = (struct rtw89_btc_btf_tlv_v7 *)&btc->policy[len]; in _append_slot_v7()
2191 tlv->type = CXPOLICY_SLOT; in _append_slot_v7()
2192 tlv->ver = btc->ver->fcxslots; in _append_slot_v7()
2193 tlv->len = sizeof(dm->slot.v7[0]) + BTC_TLV_SLOT_ID_LEN_V7; in _append_slot_v7()
2197 if ((len + (u16)tlv->len) > RTW89_BTC_POLICY_MAXLEN) { in _append_slot_v7()
2203 btc->policy[len] = i; /* slot-id */ in _append_slot_v7()
2204 memcpy(&btc->policy[len + 1], &dm->slot.v7[i], in _append_slot_v7()
2205 sizeof(dm->slot.v7[0])); in _append_slot_v7()
2206 len += tlv->len; in _append_slot_v7()
2209 "[BTC], %s: policy_len=%d, slot-%d: dur=%d, type=%d, table=0x%08x\n", in _append_slot_v7()
2210 __func__, btc->policy_len, i, dm->slot.v7[i].dur, in _append_slot_v7()
2211 dm->slot.v7[i].cxtype, dm->slot.v7[i].cxtbl); in _append_slot_v7()
2213 btc->policy_len = len; /* update total length */ in _append_slot_v7()
2219 __func__, cnt, btc->policy_len); in _append_slot_v7()
2224 struct rtw89_btc *btc = &rtwdev->btc; in _append_slot()
2226 if (btc->ver->fcxslots == 7) in _append_slot()
2234 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_fw_rpt_ver()
2235 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_fw_rpt_ver()
2255 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2269 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2283 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2295 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2311 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2325 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2341 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2357 switch (ver->frptmap) { in rtw89_btc_fw_rpt_ver()
2379 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_fw_set_slots()
2380 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_fw_set_slots()
2383 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_fw_set_slots()
2386 if (ver->fcxslots == 7) { in rtw89_btc_fw_set_slots()
2387 len = sizeof(*tlv_v7) + sizeof(dm->slot.v7); in rtw89_btc_fw_set_slots()
2392 tlv_v7->type = SET_SLOT_TABLE; in rtw89_btc_fw_set_slots()
2393 tlv_v7->ver = ver->fcxslots; in rtw89_btc_fw_set_slots()
2394 tlv_v7->len = ARRAY_SIZE(dm->slot.v7); in rtw89_btc_fw_set_slots()
2395 memcpy(tlv_v7->val, dm->slot.v7, sizeof(dm->slot.v7)); in rtw89_btc_fw_set_slots()
2406 tbl->fver = BTF_SET_SLOT_TABLE_VER; in rtw89_btc_fw_set_slots()
2407 tbl->tbl_num = CXST_MAX; in rtw89_btc_fw_set_slots()
2408 memcpy(tbl->tbls, dm->slot.v1, flex_array_size(tbl, tbls, CXST_MAX)); in rtw89_btc_fw_set_slots()
2419 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_fw_en_rpt()
2420 struct rtw89_btc_wl_smap *wl_smap = &btc->cx.wl.status.map; in rtw89_btc_fw_en_rpt()
2421 struct rtw89_btc_btf_fwinfo *fwinfo = &btc->fwinfo; in rtw89_btc_fw_en_rpt()
2426 if ((wl_smap->rf_off || wl_smap->lps != BTC_LPS_OFF) && rpt_state != 0) in rtw89_btc_fw_en_rpt()
2436 val = fwinfo->rpt_en_map | bit_map; in rtw89_btc_fw_en_rpt()
2438 val = fwinfo->rpt_en_map & ~bit_map; in rtw89_btc_fw_en_rpt()
2440 if (val == fwinfo->rpt_en_map) in rtw89_btc_fw_en_rpt()
2443 if (btc->ver->fcxbtcrpt == 7 || btc->ver->fcxbtcrpt == 8) { in rtw89_btc_fw_en_rpt()
2445 r.v8.fver = btc->ver->fcxbtcrpt; in rtw89_btc_fw_en_rpt()
2451 if (btc->ver->fcxbtcrpt == 105) in rtw89_btc_fw_en_rpt()
2454 r.v1.fver = btc->ver->fcxbtcrpt; in rtw89_btc_fw_en_rpt()
2462 fwinfo->rpt_en_map = val; in rtw89_btc_fw_en_rpt()
2467 const struct rtw89_chip_info *chip = rtwdev->chip; in btc_fw_set_monreg()
2468 const struct rtw89_btc_ver *ver = rtwdev->btc.ver; in btc_fw_set_monreg()
2472 u16 sz = 0; in btc_fw_set_monreg() local
2474 n = chip->mon_reg_num; in btc_fw_set_monreg()
2478 if (ver->fcxmreg == 1) in btc_fw_set_monreg()
2492 if (ver->fcxmreg == 7) { in btc_fw_set_monreg()
2493 sz = struct_size(v7, regs, n); in btc_fw_set_monreg()
2494 v7 = kmalloc(sz, GFP_KERNEL); in btc_fw_set_monreg()
2495 v7->type = RPT_EN_MREG; in btc_fw_set_monreg()
2496 v7->fver = ver->fcxmreg; in btc_fw_set_monreg()
2497 v7->len = n; in btc_fw_set_monreg()
2499 v7->regs[i].type = chip->mon_reg[i].type; in btc_fw_set_monreg()
2500 v7->regs[i].bytes = chip->mon_reg[i].bytes; in btc_fw_set_monreg()
2501 v7->regs[i].offset = chip->mon_reg[i].offset; in btc_fw_set_monreg()
2504 _send_fw_cmd(rtwdev, BTFC_SET, SET_MREG_TABLE, v7, sz); in btc_fw_set_monreg()
2507 sz = struct_size(v1, regs, n); in btc_fw_set_monreg()
2508 v1 = kmalloc(sz, GFP_KERNEL); in btc_fw_set_monreg()
2509 v1->fver = ver->fcxmreg; in btc_fw_set_monreg()
2510 v1->reg_num = n; in btc_fw_set_monreg()
2511 memcpy(v1->regs, chip->mon_reg, flex_array_size(v1, regs, n)); in btc_fw_set_monreg()
2513 _send_fw_cmd(rtwdev, BTFC_SET, SET_MREG_TABLE, v1, sz); in btc_fw_set_monreg()
2518 "[BTC], %s(): sz=%d ulen=%d n=%d\n", in btc_fw_set_monreg()
2519 __func__, sz, ulen, n); in btc_fw_set_monreg()
2527 struct rtw89_btc *btc = &rtwdev->btc; in _update_dm_step()
2528 struct rtw89_btc_dm *dm = &btc->dm; in _update_dm_step()
2530 /* use ring-structure to store dm step */ in _update_dm_step()
2531 dm->dm_step.step[dm->dm_step.step_pos] = reason_or_action; in _update_dm_step()
2532 dm->dm_step.step_pos++; in _update_dm_step()
2534 if (dm->dm_step.step_pos >= ARRAY_SIZE(dm->dm_step.step)) { in _update_dm_step()
2535 dm->dm_step.step_pos = 0; in _update_dm_step()
2536 dm->dm_step.step_ov = true; in _update_dm_step()
2543 struct rtw89_btc *btc = &rtwdev->btc; in _fw_set_policy()
2544 struct rtw89_btc_dm *dm = &btc->dm; in _fw_set_policy()
2547 dm->run_action = action; in _fw_set_policy()
2552 btc->policy_len = 0; in _fw_set_policy()
2553 btc->policy_type = policy_type; in _fw_set_policy()
2558 if (btc->policy_len == 0 || btc->policy_len > RTW89_BTC_POLICY_MAXLEN) in _fw_set_policy()
2562 "[BTC], %s(): action = %d -> policy type/len: 0x%04x/%d\n", in _fw_set_policy()
2563 __func__, action, policy_type, btc->policy_len); in _fw_set_policy()
2565 if (dm->tdma.rxflctrl == CXFLC_NULLP || in _fw_set_policy()
2566 dm->tdma.rxflctrl == CXFLC_QOSNULL) in _fw_set_policy()
2567 btc->lps = 1; in _fw_set_policy()
2569 btc->lps = 0; in _fw_set_policy()
2571 if (btc->lps == 1) in _fw_set_policy()
2572 rtw89_set_coex_ctrl_lps(rtwdev, btc->lps); in _fw_set_policy()
2575 btc->policy, btc->policy_len); in _fw_set_policy()
2577 memcpy(&dm->tdma_now, &dm->tdma, sizeof(dm->tdma_now)); in _fw_set_policy()
2578 if (btc->ver->fcxslots == 7) in _fw_set_policy()
2579 memcpy(&dm->slot_now.v7, &dm->slot.v7, sizeof(dm->slot_now.v7)); in _fw_set_policy()
2581 memcpy(&dm->slot_now.v1, &dm->slot.v1, sizeof(dm->slot_now.v1)); in _fw_set_policy()
2584 if (btc->update_policy_force) in _fw_set_policy()
2585 btc->update_policy_force = false; in _fw_set_policy()
2587 if (btc->lps == 0) in _fw_set_policy()
2588 rtw89_set_coex_ctrl_lps(rtwdev, btc->lps); in _fw_set_policy()
2593 struct rtw89_btc *btc = &rtwdev->btc; in _fw_set_drv_info()
2594 const struct rtw89_btc_ver *ver = btc->ver; in _fw_set_drv_info()
2595 struct rtw89_btc_dm *dm = &btc->dm; in _fw_set_drv_info()
2596 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _fw_set_drv_info()
2597 struct rtw89_btc_rf_trx_para rf_para = dm->rf_trx_para; in _fw_set_drv_info()
2601 if (ver->fcxinit == 7) in _fw_set_drv_info()
2607 if (ver->fwlrole == 0) in _fw_set_drv_info()
2609 else if (ver->fwlrole == 1) in _fw_set_drv_info()
2611 else if (ver->fwlrole == 2) in _fw_set_drv_info()
2613 else if (ver->fwlrole == 7) in _fw_set_drv_info()
2615 else if (ver->fwlrole == 8) in _fw_set_drv_info()
2619 if (ver->drvinfo_type == 1) in _fw_set_drv_info()
2622 if (ver->fcxctrl == 7) in _fw_set_drv_info()
2628 if (ver->drvinfo_type == 1) in _fw_set_drv_info()
2631 dm->trx_info.tx_power = u32_get_bits(rf_para.wl_tx_power, in _fw_set_drv_info()
2633 dm->trx_info.rx_gain = u32_get_bits(rf_para.wl_rx_gain, in _fw_set_drv_info()
2635 dm->trx_info.bt_tx_power = u32_get_bits(rf_para.bt_tx_power, in _fw_set_drv_info()
2637 dm->trx_info.bt_rx_gain = u32_get_bits(rf_para.bt_rx_gain, in _fw_set_drv_info()
2639 dm->trx_info.cn = wl->cn_report; in _fw_set_drv_info()
2640 dm->trx_info.nhm = wl->nhm.pwr; in _fw_set_drv_info()
2644 if (ver->drvinfo_type == 1) in _fw_set_drv_info()
2661 struct rtw89_btc *btc = &rtwdev->btc; in btc_fw_event()
2662 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in btc_fw_event()
2682 struct rtw89_btc *btc = &rtwdev->btc; in _set_gnt()
2683 struct rtw89_btc_dm *dm = &btc->dm; in _set_gnt()
2684 struct rtw89_mac_ax_gnt *g = dm->gnt.band; in _set_gnt()
2725 rtw89_chip_mac_cfg_gnt(rtwdev, &dm->gnt); in _set_gnt()
2731 struct rtw89_btc *btc = &rtwdev->btc; in _set_gnt_v1()
2732 struct rtw89_btc_dm *dm = &btc->dm; in _set_gnt_v1()
2733 struct rtw89_mac_ax_gnt *g = dm->gnt.band; in _set_gnt_v1()
2734 u8 i, bt_idx = dm->bt_select + 1; in _set_gnt_v1()
2774 if (rtwdev->chip->para_ver & BTC_FEAT_WLAN_ACT_MUX) { in _set_gnt_v1()
2781 dm->gnt.bt[i].wlan_act_en = 0; in _set_gnt_v1()
2782 dm->gnt.bt[i].wlan_act = 0; in _set_gnt_v1()
2785 dm->gnt.bt[i].wlan_act_en = 1; in _set_gnt_v1()
2786 dm->gnt.bt[i].wlan_act = 0; in _set_gnt_v1()
2789 dm->gnt.bt[i].wlan_act_en = 1; in _set_gnt_v1()
2790 dm->gnt.bt[i].wlan_act = 1; in _set_gnt_v1()
2795 rtw89_mac_cfg_gnt_v2(rtwdev, &dm->gnt); in _set_gnt_v1()
2819 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_tx_power()
2820 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_tx_power()
2821 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_wl_tx_power()
2824 if (wl->rf_para.tx_pwr_freerun == level) in _set_wl_tx_power()
2827 wl->rf_para.tx_pwr_freerun = level; in _set_wl_tx_power()
2828 btc->dm.rf_trx_para.wl_tx_power = level; in _set_wl_tx_power()
2846 chip->ops->btc_set_wl_txpwr_ctrl(rtwdev, pwr_val); in _set_wl_tx_power()
2851 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_rx_gain()
2852 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_rx_gain()
2853 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_wl_rx_gain()
2855 if (wl->rf_para.rx_gain_freerun == level) in _set_wl_rx_gain()
2858 wl->rf_para.rx_gain_freerun = level; in _set_wl_rx_gain()
2859 btc->dm.rf_trx_para.wl_rx_gain = level; in _set_wl_rx_gain()
2865 chip->ops->btc_set_wl_rx_gain(rtwdev, level); in _set_wl_rx_gain()
2870 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_tx_power()
2871 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_tx_power()
2875 if (btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE] == 0) in _set_bt_tx_power()
2878 if (bt->rf_para.tx_pwr_freerun == level) in _set_bt_tx_power()
2885 buf = (s8)(-level); in _set_bt_tx_power()
2888 bt->rf_para.tx_pwr_freerun = level; in _set_bt_tx_power()
2889 btc->dm.rf_trx_para.bt_tx_power = level; in _set_bt_tx_power()
2897 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_gain()
2898 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_gain()
2900 if (btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE] == 0) in _set_bt_rx_gain()
2903 if ((bt->rf_para.rx_gain_freerun == level || in _set_bt_rx_gain()
2905 (!rtwdev->chip->scbd || bt->lna_constrain == level)) in _set_bt_rx_gain()
2908 bt->rf_para.rx_gain_freerun = level; in _set_bt_rx_gain()
2909 btc->dm.rf_trx_para.bt_rx_gain = level; in _set_bt_rx_gain()
2925 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_rf_trx_para()
2926 struct rtw89_btc *btc = &rtwdev->btc; in _set_rf_trx_para()
2927 const struct rtw89_btc_ver *ver = btc->ver; in _set_rf_trx_para()
2928 struct rtw89_btc_dm *dm = &btc->dm; in _set_rf_trx_para()
2929 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_rf_trx_para()
2930 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_rf_trx_para()
2931 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _set_rf_trx_para()
2932 struct rtw89_btc_wl_smap *wl_smap = &wl->status.map; in _set_rf_trx_para()
2937 if (ver->fwlrole == 0) { in _set_rf_trx_para()
2938 link_mode = wl->role_info.link_mode; in _set_rf_trx_para()
2940 if (wl->dbcc_info.real_band[i] == RTW89_BAND_2G) in _set_rf_trx_para()
2943 } else if (ver->fwlrole == 1) { in _set_rf_trx_para()
2944 link_mode = wl->role_info_v1.link_mode; in _set_rf_trx_para()
2945 dbcc_2g_phy = wl->role_info_v1.dbcc_2g_phy; in _set_rf_trx_para()
2946 } else if (ver->fwlrole == 2) { in _set_rf_trx_para()
2947 link_mode = wl->role_info_v2.link_mode; in _set_rf_trx_para()
2948 dbcc_2g_phy = wl->role_info_v2.dbcc_2g_phy; in _set_rf_trx_para()
2952 if (btc->ant_type == BTC_ANT_SHARED) { in _set_rf_trx_para()
2954 if ((btc->dm.wl_btg_rx && b->profile_cnt.now != 0) || in _set_rf_trx_para()
2955 dm->bt_only == 1) in _set_rf_trx_para()
2956 dm->trx_para_level = 1; /* for better BT ACI issue */ in _set_rf_trx_para()
2958 dm->trx_para_level = 0; in _set_rf_trx_para()
2959 } else { /* non-shared antenna */ in _set_rf_trx_para()
2960 dm->trx_para_level = 5; in _set_rf_trx_para()
2961 /* modify trx_para if WK 2.4G-STA-DL + bt link */ in _set_rf_trx_para()
2962 if (b->profile_cnt.now != 0 && in _set_rf_trx_para()
2964 wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { /* uplink */ in _set_rf_trx_para()
2965 if (wl->rssi_level == 4 && bt->rssi_level > 2) in _set_rf_trx_para()
2966 dm->trx_para_level = 6; in _set_rf_trx_para()
2967 else if (wl->rssi_level == 3 && bt->rssi_level > 3) in _set_rf_trx_para()
2968 dm->trx_para_level = 7; in _set_rf_trx_para()
2972 level_id = dm->trx_para_level; in _set_rf_trx_para()
2973 if (level_id >= chip->rf_para_dlink_num || in _set_rf_trx_para()
2974 level_id >= chip->rf_para_ulink_num) { in _set_rf_trx_para()
2981 if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) in _set_rf_trx_para()
2982 para = chip->rf_para_ulink[level_id]; in _set_rf_trx_para()
2984 para = chip->rf_para_dlink[level_id]; in _set_rf_trx_para()
2986 if (dm->fddt_train) { in _set_rf_trx_para()
2996 if (!bt->enable.now || dm->wl_only || wl_smap->rf_off || in _set_rf_trx_para()
2997 wl_smap->lps == BTC_LPS_RF_OFF || in _set_rf_trx_para()
3000 (rtwdev->dbcc_en && dbcc_2g_phy != RTW89_PHY_1)) in _set_rf_trx_para()
3005 if (wl_stb_chg != dm->wl_stb_chg) { in _set_rf_trx_para()
3006 dm->wl_stb_chg = wl_stb_chg; in _set_rf_trx_para()
3007 chip->ops->btc_wl_s1_standby(rtwdev, dm->wl_stb_chg); in _set_rf_trx_para()
3013 struct rtw89_btc *btc = &rtwdev->btc; in _update_btc_state_map()
3014 struct rtw89_btc_cx *cx = &btc->cx; in _update_btc_state_map()
3015 struct rtw89_btc_wl_info *wl = &cx->wl; in _update_btc_state_map()
3016 struct rtw89_btc_bt_info *bt = &cx->bt; in _update_btc_state_map()
3017 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _update_btc_state_map()
3019 if (wl->status.map.connecting || wl->status.map._4way || in _update_btc_state_map()
3020 wl->status.map.roaming) { in _update_btc_state_map()
3021 cx->state_map = BTC_WLINKING; in _update_btc_state_map()
3022 } else if (wl->status.map.scan) { /* wl scan */ in _update_btc_state_map()
3023 if (bt_linfo->status.map.inq_pag) in _update_btc_state_map()
3024 cx->state_map = BTC_WSCAN_BSCAN; in _update_btc_state_map()
3026 cx->state_map = BTC_WSCAN_BNOSCAN; in _update_btc_state_map()
3027 } else if (wl->status.map.busy) { /* only busy */ in _update_btc_state_map()
3028 if (bt_linfo->status.map.inq_pag) in _update_btc_state_map()
3029 cx->state_map = BTC_WBUSY_BSCAN; in _update_btc_state_map()
3031 cx->state_map = BTC_WBUSY_BNOSCAN; in _update_btc_state_map()
3033 cx->state_map = BTC_WIDLE; in _update_btc_state_map()
3039 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_bt_afh_info()
3040 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_afh_info()
3041 const struct rtw89_btc_ver *ver = btc->ver; in _set_bt_afh_info()
3042 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_bt_afh_info()
3043 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_afh_info()
3044 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _set_bt_afh_info()
3045 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_bt_afh_info()
3046 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_bt_afh_info()
3047 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _set_bt_afh_info()
3048 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _set_bt_afh_info()
3049 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _set_bt_afh_info()
3055 u8 en = 0, i, ch = 0, bw = 0; in _set_bt_afh_info() local
3058 if (btc->manual_ctrl || wl->status.map.scan) in _set_bt_afh_info()
3061 if (ver->fwlrole == 0) { in _set_bt_afh_info()
3062 mode = wl_rinfo->link_mode; in _set_bt_afh_info()
3063 connect_cnt = wl_rinfo->connect_cnt; in _set_bt_afh_info()
3064 } else if (ver->fwlrole == 1) { in _set_bt_afh_info()
3065 mode = wl_rinfo_v1->link_mode; in _set_bt_afh_info()
3066 connect_cnt = wl_rinfo_v1->connect_cnt; in _set_bt_afh_info()
3067 } else if (ver->fwlrole == 2) { in _set_bt_afh_info()
3068 mode = wl_rinfo_v2->link_mode; in _set_bt_afh_info()
3069 connect_cnt = wl_rinfo_v2->connect_cnt; in _set_bt_afh_info()
3070 } else if (ver->fwlrole == 7) { in _set_bt_afh_info()
3071 mode = wl_rinfo_v7->link_mode; in _set_bt_afh_info()
3072 connect_cnt = wl_rinfo_v7->connect_cnt; in _set_bt_afh_info()
3073 } else if (ver->fwlrole == 8) { in _set_bt_afh_info()
3074 mode = wl_rinfo_v8->link_mode; in _set_bt_afh_info()
3075 connect_cnt = wl_rinfo_v8->connect_cnt; in _set_bt_afh_info()
3080 if (wl->status.map.rf_off || bt->whql_test || in _set_bt_afh_info()
3083 en = false; in _set_bt_afh_info()
3085 en = true; in _set_bt_afh_info()
3088 r = &wl_rinfo->active_role[i]; in _set_bt_afh_info()
3089 r1 = &wl_rinfo_v1->active_role_v1[i]; in _set_bt_afh_info()
3090 r2 = &wl_rinfo_v2->active_role_v2[i]; in _set_bt_afh_info()
3091 r7 = &wl_rinfo_v7->active_role[i]; in _set_bt_afh_info()
3092 rlink = &wl_rinfo_v8->rlink[i][0]; in _set_bt_afh_info()
3094 if (ver->fwlrole == 0 && in _set_bt_afh_info()
3095 (r->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
3096 r->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
3097 ch = r->ch; in _set_bt_afh_info()
3098 bw = r->bw; in _set_bt_afh_info()
3100 } else if (ver->fwlrole == 1 && in _set_bt_afh_info()
3101 (r1->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
3102 r1->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
3103 ch = r1->ch; in _set_bt_afh_info()
3104 bw = r1->bw; in _set_bt_afh_info()
3106 } else if (ver->fwlrole == 2 && in _set_bt_afh_info()
3107 (r2->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
3108 r2->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
3109 ch = r2->ch; in _set_bt_afh_info()
3110 bw = r2->bw; in _set_bt_afh_info()
3112 } else if (ver->fwlrole == 7 && in _set_bt_afh_info()
3113 (r7->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
3114 r7->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
3115 ch = r7->ch; in _set_bt_afh_info()
3116 bw = r7->bw; in _set_bt_afh_info()
3118 } else if (ver->fwlrole == 8 && in _set_bt_afh_info()
3119 (rlink->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
3120 rlink->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
3121 ch = rlink->ch; in _set_bt_afh_info()
3122 bw = rlink->bw; in _set_bt_afh_info()
3127 en = true; in _set_bt_afh_info()
3130 r = &wl_rinfo->active_role[i]; in _set_bt_afh_info()
3131 r1 = &wl_rinfo_v1->active_role_v1[i]; in _set_bt_afh_info()
3132 r2 = &wl_rinfo_v2->active_role_v2[i]; in _set_bt_afh_info()
3133 r7 = &wl_rinfo_v7->active_role[i]; in _set_bt_afh_info()
3134 rlink = &wl_rinfo_v8->rlink[i][0]; in _set_bt_afh_info()
3136 if (ver->fwlrole == 0 && in _set_bt_afh_info()
3137 r->connected && r->band == RTW89_BAND_2G) { in _set_bt_afh_info()
3138 ch = r->ch; in _set_bt_afh_info()
3139 bw = r->bw; in _set_bt_afh_info()
3141 } else if (ver->fwlrole == 1 && in _set_bt_afh_info()
3142 r1->connected && r1->band == RTW89_BAND_2G) { in _set_bt_afh_info()
3143 ch = r1->ch; in _set_bt_afh_info()
3144 bw = r1->bw; in _set_bt_afh_info()
3146 } else if (ver->fwlrole == 2 && in _set_bt_afh_info()
3147 r2->connected && r2->band == RTW89_BAND_2G) { in _set_bt_afh_info()
3148 ch = r2->ch; in _set_bt_afh_info()
3149 bw = r2->bw; in _set_bt_afh_info()
3151 } else if (ver->fwlrole == 7 && in _set_bt_afh_info()
3152 r7->connected && r7->band == RTW89_BAND_2G) { in _set_bt_afh_info()
3153 ch = r7->ch; in _set_bt_afh_info()
3154 bw = r7->bw; in _set_bt_afh_info()
3156 } else if (ver->fwlrole == 8 && in _set_bt_afh_info()
3157 rlink->connected && rlink->rf_band == RTW89_BAND_2G) { in _set_bt_afh_info()
3158 ch = rlink->ch; in _set_bt_afh_info()
3159 bw = rlink->bw; in _set_bt_afh_info()
3167 bw = 20 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
3170 bw = 40 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
3173 bw = 5 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
3176 bw = 10 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
3180 en = false; /* turn off AFH info if BW > 40 */ in _set_bt_afh_info()
3184 if (wl->afh_info.en == en && in _set_bt_afh_info()
3185 wl->afh_info.ch == ch && in _set_bt_afh_info()
3186 wl->afh_info.bw == bw && in _set_bt_afh_info()
3187 b->profile_cnt.last == b->profile_cnt.now) { in _set_bt_afh_info()
3194 wl->afh_info.en = en; in _set_bt_afh_info()
3195 wl->afh_info.ch = ch; in _set_bt_afh_info()
3196 wl->afh_info.bw = bw; in _set_bt_afh_info()
3198 _send_fw_cmd(rtwdev, BTFC_SET, SET_BT_WL_CH_INFO, &wl->afh_info, 3); in _set_bt_afh_info()
3201 "[BTC], %s(): en=%d, ch=%d, bw=%d\n", in _set_bt_afh_info()
3202 __func__, en, ch, bw); in _set_bt_afh_info()
3203 btc->cx.cnt_wl[BTC_WCNT_CH_UPDATE]++; in _set_bt_afh_info()
3208 struct rtw89_btc *btc = &rtwdev->btc; in _check_freerun()
3209 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _check_freerun()
3210 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _check_freerun()
3211 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _check_freerun()
3212 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _check_freerun()
3213 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _check_freerun()
3214 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _check_freerun()
3215 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _check_freerun()
3216 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _check_freerun()
3217 struct rtw89_btc_bt_hid_desc *hid = &bt_linfo->hid_desc; in _check_freerun()
3218 union rtw89_btc_module_info *md = &btc->mdinfo; in _check_freerun()
3219 const struct rtw89_btc_ver *ver = btc->ver; in _check_freerun()
3222 if (ver->fcxinit == 7) in _check_freerun()
3223 isolation = md->md_v7.ant.isolation; in _check_freerun()
3225 isolation = md->md.ant.isolation; in _check_freerun()
3227 if (ver->fwlrole == 0) in _check_freerun()
3228 connect_cnt = wl_rinfo->connect_cnt; in _check_freerun()
3229 else if (ver->fwlrole == 1) in _check_freerun()
3230 connect_cnt = wl_rinfo_v1->connect_cnt; in _check_freerun()
3231 else if (ver->fwlrole == 2) in _check_freerun()
3232 connect_cnt = wl_rinfo_v2->connect_cnt; in _check_freerun()
3233 else if (ver->fwlrole == 7) in _check_freerun()
3234 connect_cnt = wl_rinfo_v7->connect_cnt; in _check_freerun()
3235 else if (ver->fwlrole == 8) in _check_freerun()
3236 connect_cnt = wl_rinfo_v8->connect_cnt; in _check_freerun()
3238 if (btc->ant_type == BTC_ANT_SHARED) { in _check_freerun()
3239 btc->dm.trx_para_level = 0; in _check_freerun()
3245 btc->dm.trx_para_level = 5; in _check_freerun()
3249 if (bt_linfo->profile_cnt.now == 0) { in _check_freerun()
3250 btc->dm.trx_para_level = 5; in _check_freerun()
3254 if (hid->pair_cnt > BTC_TDMA_BTHID_MAX) { in _check_freerun()
3255 btc->dm.trx_para_level = 5; in _check_freerun()
3261 btc->dm.trx_para_level = 5; in _check_freerun()
3265 if (!wl->status.map.busy) {/* wl idle -> freerun */ in _check_freerun()
3266 btc->dm.trx_para_level = 5; in _check_freerun()
3268 } else if (wl->rssi_level > 1) {/* WL rssi < 50% (-60dBm) */ in _check_freerun()
3269 btc->dm.trx_para_level = 0; in _check_freerun()
3271 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _check_freerun()
3272 if (wl->rssi_level == 0 && bt_linfo->rssi > 31) { in _check_freerun()
3273 btc->dm.trx_para_level = 6; in _check_freerun()
3275 } else if (wl->rssi_level == 1 && bt_linfo->rssi > 36) { in _check_freerun()
3276 btc->dm.trx_para_level = 7; in _check_freerun()
3279 btc->dm.trx_para_level = 0; in _check_freerun()
3281 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_DL)) { in _check_freerun()
3282 if (bt_linfo->rssi > 28) { in _check_freerun()
3283 btc->dm.trx_para_level = 6; in _check_freerun()
3288 btc->dm.trx_para_level = 0; in _check_freerun()
3292 #define _tdma_set_flctrl(btc, flc) ({(btc)->dm.tdma.rxflctrl = flc; })
3293 #define _tdma_set_flctrl_role(btc, role) ({(btc)->dm.tdma.rxflctrl_role = role; })
3294 #define _tdma_set_tog(btc, wtg) ({(btc)->dm.tdma.wtgle_n = wtg; })
3295 #define _tdma_set_lek(btc, lek) ({(btc)->dm.tdma.leak_n = lek; })
3359 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_policy()
3361 chip->ops->btc_set_policy(rtwdev, policy_type); in _set_policy()
3368 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_set_policy()
3369 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_set_policy()
3370 struct rtw89_btc_fbtc_tdma *t = &dm->tdma; in rtw89_btc_set_policy()
3371 struct rtw89_btc_fbtc_slot *s = dm->slot.v1; in rtw89_btc_set_policy()
3375 if (btc->ant_type == BTC_ANT_SHARED) { in rtw89_btc_set_policy()
3376 if (btc->cx.wl.status.map._4way) in rtw89_btc_set_policy()
3389 btc->bt_req_en = false; in rtw89_btc_set_policy()
3396 btc->update_policy_force = true; in rtw89_btc_set_policy()
3433 case BTC_CXP_OFFB: /* TDMA off + beacon protect */ in rtw89_btc_set_policy()
3443 case BTC_CXP_OFFE: /* TDMA off + beacon protect + Ext_control */ in rtw89_btc_set_policy()
3444 btc->bt_req_en = true; in rtw89_btc_set_policy()
3462 case BTC_CXP_FIX: /* TDMA Fix-Slot */ in rtw89_btc_set_policy()
3510 case BTC_CXP_FIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
3511 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
3513 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
3518 case BTC_CXP_PFIX: /* PS-TDMA Fix-Slot */ in rtw89_btc_set_policy()
3521 if (btc->cx.wl.role_info.role_map.role.ap) in rtw89_btc_set_policy()
3551 case BTC_CXP_AUTO: /* TDMA Auto-Slot */ in rtw89_btc_set_policy()
3567 case BTC_CXP_AUTO_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
3568 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
3570 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
3575 case BTC_CXP_PAUTO: /* PS-TDMA Auto-Slot */ in rtw89_btc_set_policy()
3592 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
3594 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
3599 case BTC_CXP_AUTO2: /* TDMA Auto-Slot2 */ in rtw89_btc_set_policy()
3628 case BTC_CXP_AUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
3629 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
3631 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy()
3636 case BTC_CXP_PAUTO2: /* PS-TDMA Auto-Slot2 */ in rtw89_btc_set_policy()
3665 case BTC_CXP_PAUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
3666 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
3668 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy()
3679 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_set_policy_v1()
3680 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_set_policy_v1()
3681 struct rtw89_btc_fbtc_tdma *t = &dm->tdma; in rtw89_btc_set_policy_v1()
3682 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &btc->cx.wl.role_info_v1; in rtw89_btc_set_policy_v1()
3683 struct rtw89_btc_bt_hid_desc *hid = &btc->cx.bt.link_info.hid_desc; in rtw89_btc_set_policy_v1()
3684 struct rtw89_btc_bt_hfp_desc *hfp = &btc->cx.bt.link_info.hfp_desc; in rtw89_btc_set_policy_v1()
3685 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_set_policy_v1()
3692 if (btc->ant_type == BTC_ANT_SHARED) { in rtw89_btc_set_policy_v1()
3693 if (btc->cx.wl.status.map._4way) in rtw89_btc_set_policy_v1()
3695 else if (hid->exist && hid->type == BTC_HID_218) in rtw89_btc_set_policy_v1()
3696 tbl_w1 = cxtbl[7]; /* Ack/BA no break bt Hi-Pri-rx */ in rtw89_btc_set_policy_v1()
3700 if (dm->leak_ap && in rtw89_btc_set_policy_v1()
3704 } else if (hid->exist && hid->type == BTC_HID_218) { in rtw89_btc_set_policy_v1()
3705 tbl_b1 = cxtbl[4]; /* Ack/BA no break bt Hi-Pri-rx */ in rtw89_btc_set_policy_v1()
3715 if (wl->bg_mode) in rtw89_btc_set_policy_v1()
3717 else if ((wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) && in rtw89_btc_set_policy_v1()
3718 hid->exist) in rtw89_btc_set_policy_v1()
3724 btc->bt_req_en = false; in rtw89_btc_set_policy_v1()
3728 btc->update_policy_force = true; in rtw89_btc_set_policy_v1()
3776 case BTC_CXP_OFFB: /* TDMA off + beacon protect */ in rtw89_btc_set_policy_v1()
3790 case BTC_CXP_OFFE: /* TDMA off + beacon protect + Ext_control */ in rtw89_btc_set_policy_v1()
3791 btc->bt_req_en = true; in rtw89_btc_set_policy_v1()
3795 /* To avoid wl-s0 tx break by hid/hfp tx */ in rtw89_btc_set_policy_v1()
3796 if (hid->exist || hfp->exist) in rtw89_btc_set_policy_v1()
3799 dur_2 = dm->e2g_slot_limit; in rtw89_btc_set_policy_v1()
3802 case BTC_CXP_OFFE_2GBWISOB: /* for normal-case */ in rtw89_btc_set_policy_v1()
3808 case BTC_CXP_OFFE_2GISOB: /* for bt no-link */ in rtw89_btc_set_policy_v1()
3838 case BTC_CXP_OFFE_WL: /* for 4-way */ in rtw89_btc_set_policy_v1()
3848 case BTC_CXP_FIX: /* TDMA Fix-Slot */ in rtw89_btc_set_policy_v1()
3897 case BTC_CXP_FIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
3898 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
3900 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
3907 case BTC_CXP_PFIX: /* PS-TDMA Fix-Slot */ in rtw89_btc_set_policy_v1()
3936 case BTC_CXP_PFIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
3937 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
3939 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
3946 case BTC_CXP_AUTO: /* TDMA Auto-Slot */ in rtw89_btc_set_policy_v1()
3963 case BTC_CXP_AUTO_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
3964 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
3966 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
3973 case BTC_CXP_PAUTO: /* PS-TDMA Auto-Slot */ in rtw89_btc_set_policy_v1()
3991 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
3993 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
4000 case BTC_CXP_AUTO2: /* TDMA Auto-Slot2 */ in rtw89_btc_set_policy_v1()
4030 case BTC_CXP_AUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
4031 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
4033 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
4035 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy_v1()
4042 case BTC_CXP_PAUTO2: /* PS-TDMA Auto-Slot2 */ in rtw89_btc_set_policy_v1()
4072 case BTC_CXP_PAUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
4073 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
4075 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
4077 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy_v1()
4086 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC && dm->tdma.rxflctrl) { in rtw89_btc_set_policy_v1()
4087 null_role = FIELD_PREP(0x0f, dm->wl_scc.null_role1) | in rtw89_btc_set_policy_v1()
4088 FIELD_PREP(0xf0, dm->wl_scc.null_role2); in rtw89_btc_set_policy_v1()
4092 /* enter leak_slot after each null-1 */ in rtw89_btc_set_policy_v1()
4093 if (dm->leak_ap && dm->tdma.leak_n > 1) in rtw89_btc_set_policy_v1()
4096 if (dm->tdma_instant_excute) { in rtw89_btc_set_policy_v1()
4097 btc->dm.tdma.option_ctrl |= BIT(0); in rtw89_btc_set_policy_v1()
4098 btc->update_policy_force = true; in rtw89_btc_set_policy_v1()
4106 struct rtw89_btc_wl_info *wl = &rtwdev->btc.cx.wl; in _set_bt_plut()
4112 if (rtwdev->btc.ver->fwlrole == 8) { in _set_bt_plut()
4113 plt.band = wl->pta_req_mac; in _set_bt_plut()
4114 if (wl->bt_polut_type[plt.band] == tx_val) in _set_bt_plut()
4117 wl->bt_polut_type[plt.band] = tx_val; in _set_bt_plut()
4125 if (!rtwdev->dbcc_en) in _set_bt_plut()
4137 struct rtw89_btc *btc = &rtwdev->btc; in _set_ant_v0()
4138 struct rtw89_btc_dm *dm = &btc->dm; in _set_ant_v0()
4139 struct rtw89_btc_cx *cx = &btc->cx; in _set_ant_v0()
4140 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_ant_v0()
4141 struct rtw89_btc_bt_info *bt = &cx->bt; in _set_ant_v0()
4142 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _set_ant_v0()
4149 if (btc->ver->fwlrole == 1) in _set_ant_v0()
4150 dbcc_chg = wl->role_info_v1.dbcc_chg; in _set_ant_v0()
4151 else if (btc->ver->fwlrole == 2) in _set_ant_v0()
4152 dbcc_chg = wl->role_info_v2.dbcc_chg; in _set_ant_v0()
4153 else if (btc->ver->fwlrole == 7) in _set_ant_v0()
4154 dbcc_chg = wl->role_info_v7.dbcc_chg; in _set_ant_v0()
4155 else if (btc->ver->fwlrole == 8) in _set_ant_v0()
4156 dbcc_chg = wl->role_info_v8.dbcc_chg; in _set_ant_v0()
4158 if (btc->dm.run_reason == BTC_RSN_NTFY_POWEROFF || in _set_ant_v0()
4159 btc->dm.run_reason == BTC_RSN_NTFY_RADIO_STATE || in _set_ant_v0()
4160 btc->dm.run_reason == BTC_RSN_CMD_SET_COEX || dbcc_chg) in _set_ant_v0()
4163 if (!force_exec && ant_path_type == dm->set_ant_path) { in _set_ant_v0()
4168 } else if (bt->rfk_info.map.run) { in _set_ant_v0()
4172 } else if (btc->dm.run_reason != BTC_RSN_NTFY_WL_RFK && in _set_ant_v0()
4173 wl->rfk_info.state != BTC_WRFK_STOP) { in _set_ant_v0()
4179 dm->set_ant_path = ant_path_type; in _set_ant_v0()
4184 __func__, phy_map, dm->set_ant_path & 0xff); in _set_ant_v0()
4191 if (bt->enable.now) in _set_ant_v0()
4210 if (rtwdev->dbcc_en) { in _set_ant_v0()
4212 b2g = (wl_dinfo->real_band[i] == RTW89_BAND_2G); in _set_ant_v0()
4218 wl_dinfo->real_band[0] == RTW89_BAND_2G && in _set_ant_v0()
4219 wl_dinfo->real_band[1] == RTW89_BAND_5G) in _set_ant_v0()
4266 struct rtw89_btc *btc = &rtwdev->btc; in _set_ant_v1()
4267 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_ant_v1()
4268 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_ant_v1()
4269 struct rtw89_btc_wl_role_info_v8 *wl_rinfo = &wl->role_info_v8; in _set_ant_v1()
4271 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _set_ant_v1()
4272 struct rtw89_btc_dm *dm = &btc->dm; in _set_ant_v1()
4275 if (btc->dm.run_reason == BTC_RSN_NTFY_POWEROFF || in _set_ant_v1()
4276 btc->dm.run_reason == BTC_RSN_NTFY_RADIO_STATE || in _set_ant_v1()
4277 btc->dm.run_reason == BTC_RSN_CMD_SET_COEX || wl_rinfo->dbcc_chg) in _set_ant_v1()
4280 if (wl_rinfo->link_mode != BTC_WLINK_25G_MCC && in _set_ant_v1()
4281 btc->dm.wl_btg_rx == 2) in _set_ant_v1()
4284 if (!force_exec && ant_path_type == dm->set_ant_path) { in _set_ant_v1()
4289 } else if (bt->rfk_info.map.run) { in _set_ant_v1()
4293 } else if (btc->dm.run_reason != BTC_RSN_NTFY_WL_RFK && in _set_ant_v1()
4294 wl->rfk_info.state != BTC_WRFK_STOP) { in _set_ant_v1()
4300 dm->set_ant_path = ant_path_type; in _set_ant_v1()
4304 __func__, phy_map, dm->set_ant_path & 0xff); in _set_ant_v1()
4309 if (bt->enable.now && bt->run_patch_code) in _set_ant_v1()
4326 if (wl_rinfo->dbcc_en) { in _set_ant_v1()
4327 if (wl_dinfo->real_band[RTW89_PHY_0] == RTW89_BAND_2G) in _set_ant_v1()
4333 if (wl_dinfo->real_band[RTW89_PHY_1] == RTW89_BAND_2G) in _set_ant_v1()
4356 BTC_WLACT_SW_HI); /* no BT-Tx */ in _set_ant_v1()
4368 if (rtwdev->chip->chip_id == RTL8922A) in _set_ant()
4390 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_off()
4391 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_off()
4395 if (wl->status.map.rf_off || btc->dm.bt_only) { in _action_wl_off()
4397 } else if (wl->status.map.lps == BTC_LPS_RF_ON) { in _action_wl_off()
4406 } else if (wl->status.map.lps == BTC_LPS_RF_ON) { in _action_wl_off()
4407 if (btc->cx.bt.link_info.a2dp_desc.active) in _action_wl_off()
4418 struct rtw89_btc *btc = &rtwdev->btc; in _action_freerun()
4425 btc->dm.freerun = true; in _action_freerun()
4446 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_idle()
4447 struct rtw89_btc_bt_link_info *b = &btc->cx.bt.link_info; in _action_bt_idle()
4448 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_bt_idle()
4452 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_bt_idle()
4453 switch (btc->cx.state_map) { in _action_bt_idle()
4454 case BTC_WBUSY_BNOSCAN: /*wl-busy + bt idle*/ in _action_bt_idle()
4455 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-idle */ in _action_bt_idle()
4456 if (b->status.map.connect) in _action_bt_idle()
4458 else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_DL)) in _action_bt_idle()
4463 case BTC_WBUSY_BSCAN: /*wl-busy + bt-inq */ in _action_bt_idle()
4467 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq */ in _action_bt_idle()
4471 case BTC_WLINKING: /* wl-connecting + bt-inq or bt-idle */ in _action_bt_idle()
4475 case BTC_WIDLE: /* wl-idle + bt-idle */ in _action_bt_idle()
4479 } else { /* dedicated-antenna */ in _action_bt_idle()
4486 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_hfp()
4487 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_bt_hfp()
4491 if (btc->ant_type == BTC_ANT_SHARED) { in _action_bt_hfp()
4492 if (btc->cx.wl.status.map._4way) { in _action_bt_hfp()
4494 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _action_bt_hfp()
4495 btc->cx.bt.scan_rx_low_pri = true; in _action_bt_hfp()
4501 if (wl->bg_mode) in _action_bt_hfp()
4503 else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) in _action_bt_hfp()
4512 const struct rtw89_chip_info *chip = rtwdev->chip; in _action_bt_hid()
4513 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_hid()
4514 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_bt_hid()
4515 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_bt_hid()
4516 struct rtw89_btc_bt_hid_desc *hid = &bt->link_info.hid_desc; in _action_bt_hid()
4521 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_bt_hid()
4522 if (wl->status.map._4way) { in _action_bt_hid()
4524 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _action_bt_hid()
4525 btc->cx.bt.scan_rx_low_pri = true; in _action_bt_hid()
4526 if (hid->type & BTC_HID_BLE) in _action_bt_hid()
4530 } else if (hid->type == BTC_HID_218) { in _action_bt_hid()
4531 bt->scan_rx_low_pri = true; in _action_bt_hid()
4533 } else if (chip->para_ver == 0x1) { in _action_bt_hid()
4538 } else { /* dedicated-antenna */ in _action_bt_hid()
4539 if (wl->bg_mode) in _action_bt_hid()
4541 else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) in _action_bt_hid()
4552 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp()
4553 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _action_bt_a2dp()
4554 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_bt_a2dp()
4555 struct rtw89_btc_dm *dm = &btc->dm; in _action_bt_a2dp()
4559 switch (btc->cx.state_map) { in _action_bt_a2dp()
4560 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP */ in _action_bt_a2dp()
4561 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp()
4562 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp()
4563 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp()
4571 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP */ in _action_bt_a2dp()
4574 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP */ in _action_bt_a2dp()
4577 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP */ in _action_bt_a2dp()
4578 case BTC_WLINKING: /* wl-connecting + bt-A2DP */ in _action_bt_a2dp()
4579 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp()
4580 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp()
4581 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp()
4589 case BTC_WIDLE: /* wl-idle + bt-A2DP */ in _action_bt_a2dp()
4597 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dpsink()
4601 switch (btc->cx.state_map) { in _action_bt_a2dpsink()
4602 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4605 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4608 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4611 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4614 case BTC_WLINKING: /* wl-connecting + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4617 case BTC_WIDLE: /* wl-idle + bt-A2dp_Sink */ in _action_bt_a2dpsink()
4625 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_pan()
4629 switch (btc->cx.state_map) { in _action_bt_pan()
4630 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-PAN */ in _action_bt_pan()
4633 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-PAN */ in _action_bt_pan()
4636 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-PAN */ in _action_bt_pan()
4639 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-PAN */ in _action_bt_pan()
4642 case BTC_WLINKING: /* wl-connecting + bt-PAN */ in _action_bt_pan()
4645 case BTC_WIDLE: /* wl-idle + bt-pan */ in _action_bt_pan()
4653 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_hid()
4654 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _action_bt_a2dp_hid()
4655 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_bt_a2dp_hid()
4656 struct rtw89_btc_dm *dm = &btc->dm; in _action_bt_a2dp_hid()
4660 switch (btc->cx.state_map) { in _action_bt_a2dp_hid()
4661 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+HID */ in _action_bt_a2dp_hid()
4662 case BTC_WIDLE: /* wl-idle + bt-A2DP */ in _action_bt_a2dp_hid()
4663 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp_hid()
4664 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp_hid()
4665 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp_hid()
4673 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+HID */ in _action_bt_a2dp_hid()
4677 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+HID */ in _action_bt_a2dp_hid()
4680 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+HID */ in _action_bt_a2dp_hid()
4681 case BTC_WLINKING: /* wl-connecting + bt-A2DP+HID */ in _action_bt_a2dp_hid()
4682 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp_hid()
4683 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp_hid()
4684 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp_hid()
4697 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_pan()
4701 switch (btc->cx.state_map) { in _action_bt_a2dp_pan()
4702 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4705 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4708 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4711 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4714 case BTC_WLINKING: /* wl-connecting + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4717 case BTC_WIDLE: /* wl-idle + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
4725 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_pan_hid()
4729 switch (btc->cx.state_map) { in _action_bt_pan_hid()
4730 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-PAN+HID */ in _action_bt_pan_hid()
4733 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-PAN+HID */ in _action_bt_pan_hid()
4736 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-PAN+HID */ in _action_bt_pan_hid()
4739 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-PAN+HID */ in _action_bt_pan_hid()
4742 case BTC_WLINKING: /* wl-connecting + bt-PAN+HID */ in _action_bt_pan_hid()
4745 case BTC_WIDLE: /* wl-idle + bt-PAN+HID */ in _action_bt_pan_hid()
4753 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_pan_hid()
4757 switch (btc->cx.state_map) { in _action_bt_a2dp_pan_hid()
4758 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4762 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4766 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4770 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4771 case BTC_WLINKING: /* wl-connecting + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4775 case BTC_WIDLE: /* wl-idle + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
4790 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_other()
4794 if (btc->ant_type == BTC_ANT_SHARED) in _action_wl_other()
4808 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_rfk()
4809 struct rtw89_btc_wl_rfk_info rfk = btc->cx.wl.rfk_info; in _action_wl_rfk()
4823 struct rtw89_btc *btc = &rtwdev->btc; in _set_btg_ctrl()
4824 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_btg_ctrl()
4825 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_btg_ctrl()
4826 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _set_btg_ctrl()
4827 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _set_btg_ctrl()
4828 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _set_btg_ctrl()
4829 struct rtw89_btc_wl_role_info *wl_rinfo_v0 = &wl->role_info; in _set_btg_ctrl()
4830 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _set_btg_ctrl()
4831 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_btg_ctrl()
4832 const struct rtw89_btc_ver *ver = btc->ver; in _set_btg_ctrl()
4833 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_btg_ctrl()
4834 struct rtw89_btc_dm *dm = &btc->dm; in _set_btg_ctrl()
4836 u32 run_reason = btc->dm.run_reason; in _set_btg_ctrl()
4840 if (btc->manual_ctrl) in _set_btg_ctrl()
4843 if (ver->fwlrole == 0) in _set_btg_ctrl()
4844 wl_rinfo.link_mode = wl_rinfo_v0->link_mode; in _set_btg_ctrl()
4845 else if (ver->fwlrole == 1) in _set_btg_ctrl()
4846 wl_rinfo.link_mode = wl_rinfo_v1->link_mode; in _set_btg_ctrl()
4847 else if (ver->fwlrole == 2) in _set_btg_ctrl()
4848 wl_rinfo.link_mode = wl_rinfo_v2->link_mode; in _set_btg_ctrl()
4849 else if (ver->fwlrole == 7) in _set_btg_ctrl()
4850 wl_rinfo.link_mode = wl_rinfo_v7->link_mode; in _set_btg_ctrl()
4851 else if (ver->fwlrole == 8) in _set_btg_ctrl()
4852 wl_rinfo.link_mode = wl_rinfo_v8->link_mode; in _set_btg_ctrl()
4856 if (rtwdev->dbcc_en) { in _set_btg_ctrl()
4857 if (ver->fwlrole == 0) { in _set_btg_ctrl()
4859 if (wl_dinfo->real_band[i] == RTW89_BAND_2G) in _set_btg_ctrl()
4862 } else if (ver->fwlrole == 1) { in _set_btg_ctrl()
4863 wl_rinfo.dbcc_2g_phy = wl_rinfo_v1->dbcc_2g_phy; in _set_btg_ctrl()
4864 } else if (ver->fwlrole == 2) { in _set_btg_ctrl()
4865 wl_rinfo.dbcc_2g_phy = wl_rinfo_v2->dbcc_2g_phy; in _set_btg_ctrl()
4866 } else if (ver->fwlrole == 7) { in _set_btg_ctrl()
4867 wl_rinfo.dbcc_2g_phy = wl_rinfo_v7->dbcc_2g_phy; in _set_btg_ctrl()
4868 } else if (ver->fwlrole == 8) { in _set_btg_ctrl()
4869 wl_rinfo.dbcc_2g_phy = wl_rinfo_v8->dbcc_2g_phy; in _set_btg_ctrl()
4877 else if (!(bt->run_patch_code && bt->enable.now)) in _set_btg_ctrl()
4881 else if (dm->freerun) in _set_btg_ctrl()
4883 else if (rtwdev->dbcc_en && wl_rinfo.dbcc_2g_phy != RTW89_PHY_1) in _set_btg_ctrl()
4888 if (dm->wl_btg_rx_rb != dm->wl_btg_rx && in _set_btg_ctrl()
4889 dm->wl_btg_rx_rb != BTC_BTGCTRL_BB_GNT_NOTFOUND) { in _set_btg_ctrl()
4891 dm->wl_btg_rx_rb = val; in _set_btg_ctrl()
4896 dm->wl_btg_rx_rb != dm->wl_btg_rx || in _set_btg_ctrl()
4897 is_btg != dm->wl_btg_rx) { in _set_btg_ctrl()
4899 dm->wl_btg_rx = is_btg; in _set_btg_ctrl()
4904 chip->ops->ctrl_btg_bt_rx(rtwdev, is_btg, RTW89_PHY_0); in _set_btg_ctrl()
4910 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_preagc_ctrl()
4911 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _set_wl_preagc_ctrl()
4912 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_wl_preagc_ctrl()
4913 struct rtw89_btc_wl_role_info_v2 *rinfo_v2 = &wl->role_info_v2; in _set_wl_preagc_ctrl()
4914 struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7; in _set_wl_preagc_ctrl()
4915 struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &wl->role_info_v8; in _set_wl_preagc_ctrl()
4916 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_preagc_ctrl()
4917 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_wl_preagc_ctrl()
4918 struct rtw89_btc_dm *dm = &btc->dm; in _set_wl_preagc_ctrl()
4920 u8 role_ver = rtwdev->btc.ver->fwlrole; in _set_wl_preagc_ctrl()
4923 if (btc->manual_ctrl) in _set_wl_preagc_ctrl()
4927 dbcc_en = rinfo_v2->dbcc_en; in _set_wl_preagc_ctrl()
4928 link_mode = rinfo_v2->link_mode; in _set_wl_preagc_ctrl()
4929 dbcc_2g_phy = rinfo_v2->dbcc_2g_phy; in _set_wl_preagc_ctrl()
4931 dbcc_en = rinfo_v7->dbcc_en; in _set_wl_preagc_ctrl()
4932 link_mode = rinfo_v7->link_mode; in _set_wl_preagc_ctrl()
4933 dbcc_2g_phy = rinfo_v7->dbcc_2g_phy; in _set_wl_preagc_ctrl()
4935 dbcc_en = rinfo_v8->dbcc_en; in _set_wl_preagc_ctrl()
4936 link_mode = rinfo_v8->link_mode; in _set_wl_preagc_ctrl()
4937 dbcc_2g_phy = rinfo_v7->dbcc_2g_phy; in _set_wl_preagc_ctrl()
4944 } else if (!(bt->run_patch_code && bt->enable.now)) { in _set_wl_preagc_ctrl()
4949 btc->cx.bt.link_info.profile_cnt.now == 0) { in _set_wl_preagc_ctrl()
4951 } else if (dm->tdma_now.type != CXTDMA_OFF && in _set_wl_preagc_ctrl()
4952 !bt_linfo->hfp_desc.exist && in _set_wl_preagc_ctrl()
4953 !bt_linfo->hid_desc.exist && in _set_wl_preagc_ctrl()
4954 dm->fddt_train == BTC_FDDT_DISABLE) { in _set_wl_preagc_ctrl()
4958 } else if (btc->ant_type == BTC_ANT_SHARED) { in _set_wl_preagc_ctrl()
4964 if (dm->wl_pre_agc_rb != dm->wl_pre_agc && in _set_wl_preagc_ctrl()
4965 dm->wl_pre_agc_rb != BTC_PREAGC_NOTFOUND) { in _set_wl_preagc_ctrl()
4967 dm->wl_pre_agc_rb = val; in _set_wl_preagc_ctrl()
4970 if ((wl->coex_mode == BTC_MODE_NORMAL && in _set_wl_preagc_ctrl()
4971 (dm->run_reason == BTC_RSN_NTFY_INIT || in _set_wl_preagc_ctrl()
4972 dm->run_reason == BTC_RSN_NTFY_SWBAND || in _set_wl_preagc_ctrl()
4973 dm->wl_pre_agc_rb != dm->wl_pre_agc)) || in _set_wl_preagc_ctrl()
4974 is_preagc != dm->wl_pre_agc) { in _set_wl_preagc_ctrl()
4975 dm->wl_pre_agc = is_preagc; in _set_wl_preagc_ctrl()
4979 chip->ops->ctrl_nbtg_bt_tx(rtwdev, dm->wl_pre_agc, RTW89_PHY_0); in _set_wl_preagc_ctrl()
4994 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; in rtw89_tx_time_iter()
4997 struct rtw89_dev *rtwdev = iter_data->rtwdev; in rtw89_tx_time_iter()
4998 struct rtw89_vif *rtwvif = rtwsta->rtwvif; in rtw89_tx_time_iter()
4999 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_tx_time_iter()
5000 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_tx_time_iter()
5001 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_tx_time_iter()
5003 u8 port = rtwvif->port; in rtw89_tx_time_iter()
5004 u32 tx_time = iter_data->tx_time; in rtw89_tx_time_iter()
5005 u8 tx_retry = iter_data->tx_retry; in rtw89_tx_time_iter()
5006 u16 enable = iter_data->enable; in rtw89_tx_time_iter()
5007 bool reenable = iter_data->reenable; in rtw89_tx_time_iter()
5009 if (btc->ver->fwlrole == 8) in rtw89_tx_time_iter()
5010 plink = &wl->rlink_info[port][0]; in rtw89_tx_time_iter()
5012 plink = &wl->link_info[port]; in rtw89_tx_time_iter()
5017 if (!plink->connected) { in rtw89_tx_time_iter()
5020 __func__, plink->connected); in rtw89_tx_time_iter()
5024 /* backup the original tx time before tx-limit on */ in rtw89_tx_time_iter()
5026 rtw89_mac_get_tx_time(rtwdev, rtwsta, &plink->tx_time); in rtw89_tx_time_iter()
5027 rtw89_mac_get_tx_retry_limit(rtwdev, rtwsta, &plink->tx_retry); in rtw89_tx_time_iter()
5030 __func__, plink->tx_time, plink->tx_retry); in rtw89_tx_time_iter()
5033 /* restore the original tx time if no tx-limit */ in rtw89_tx_time_iter()
5035 rtw89_mac_set_tx_time(rtwdev, rtwsta, true, plink->tx_time); in rtw89_tx_time_iter()
5037 plink->tx_retry); in rtw89_tx_time_iter()
5040 __func__, plink->tx_time, plink->tx_retry); in rtw89_tx_time_iter()
5053 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_tx_limit()
5054 const struct rtw89_btc_ver *ver = btc->ver; in _set_wl_tx_limit()
5055 struct rtw89_btc_cx *cx = &btc->cx; in _set_wl_tx_limit()
5056 struct rtw89_btc_dm *dm = &btc->dm; in _set_wl_tx_limit()
5057 struct rtw89_btc_wl_info *wl = &cx->wl; in _set_wl_tx_limit()
5058 struct rtw89_btc_bt_info *bt = &cx->bt; in _set_wl_tx_limit()
5059 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _set_wl_tx_limit()
5060 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in _set_wl_tx_limit()
5061 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in _set_wl_tx_limit()
5062 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_wl_tx_limit()
5063 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_wl_tx_limit()
5064 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _set_wl_tx_limit()
5065 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _set_wl_tx_limit()
5066 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _set_wl_tx_limit()
5073 if (btc->manual_ctrl) in _set_wl_tx_limit()
5076 if (ver->fwlrole == 0) in _set_wl_tx_limit()
5077 mode = wl_rinfo->link_mode; in _set_wl_tx_limit()
5078 else if (ver->fwlrole == 1) in _set_wl_tx_limit()
5079 mode = wl_rinfo_v1->link_mode; in _set_wl_tx_limit()
5080 else if (ver->fwlrole == 2) in _set_wl_tx_limit()
5081 mode = wl_rinfo_v2->link_mode; in _set_wl_tx_limit()
5082 else if (ver->fwlrole == 7) in _set_wl_tx_limit()
5083 mode = wl_rinfo_v7->link_mode; in _set_wl_tx_limit()
5084 else if (ver->fwlrole == 8) in _set_wl_tx_limit()
5085 mode = wl_rinfo_v8->link_mode; in _set_wl_tx_limit()
5089 if (ver->fcxctrl == 7) in _set_wl_tx_limit()
5090 igno_bt = btc->ctrl.ctrl_v7.igno_bt; in _set_wl_tx_limit()
5092 igno_bt = btc->ctrl.ctrl.igno_bt; in _set_wl_tx_limit()
5094 if (btc->dm.freerun || igno_bt || b->profile_cnt.now == 0 || in _set_wl_tx_limit()
5099 } else if ((hfp->exist && hid->exist) || hid->pair_cnt > 1) { in _set_wl_tx_limit()
5103 } else if (hfp->exist || hid->exist) { in _set_wl_tx_limit()
5113 if (dm->wl_tx_limit.enable == enable && in _set_wl_tx_limit()
5114 dm->wl_tx_limit.tx_time == tx_time && in _set_wl_tx_limit()
5115 dm->wl_tx_limit.tx_retry == tx_retry) in _set_wl_tx_limit()
5118 if (!dm->wl_tx_limit.enable && enable) in _set_wl_tx_limit()
5121 dm->wl_tx_limit.enable = enable; in _set_wl_tx_limit()
5122 dm->wl_tx_limit.tx_time = tx_time; in _set_wl_tx_limit()
5123 dm->wl_tx_limit.tx_retry = tx_retry; in _set_wl_tx_limit()
5130 ieee80211_iterate_stations_atomic(rtwdev->hw, in _set_wl_tx_limit()
5137 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_agc()
5138 const struct rtw89_btc_ver *ver = btc->ver; in _set_bt_rx_agc()
5139 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_bt_rx_agc()
5140 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_bt_rx_agc()
5141 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_bt_rx_agc()
5142 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _set_bt_rx_agc()
5143 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _set_bt_rx_agc()
5144 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _set_bt_rx_agc()
5145 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_agc()
5149 if (ver->fwlrole == 0) in _set_bt_rx_agc()
5150 mode = wl_rinfo->link_mode; in _set_bt_rx_agc()
5151 else if (ver->fwlrole == 1) in _set_bt_rx_agc()
5152 mode = wl_rinfo_v1->link_mode; in _set_bt_rx_agc()
5153 else if (ver->fwlrole == 2) in _set_bt_rx_agc()
5154 mode = wl_rinfo_v2->link_mode; in _set_bt_rx_agc()
5155 else if (ver->fwlrole == 7) in _set_bt_rx_agc()
5156 mode = wl_rinfo_v7->link_mode; in _set_bt_rx_agc()
5157 else if (ver->fwlrole == 8) in _set_bt_rx_agc()
5158 mode = wl_rinfo_v8->link_mode; in _set_bt_rx_agc()
5162 if (mode != BTC_WLINK_NOLINK && btc->dm.wl_btg_rx) in _set_bt_rx_agc()
5165 if (bt_hi_lna_rx == bt->hi_lna_rx) in _set_bt_rx_agc()
5173 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_scan_pri()
5174 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_scan_pri()
5176 _write_scbd(rtwdev, BTC_WSCB_RXSCAN_PRI, (bool)(!!bt->scan_rx_low_pri)); in _set_bt_rx_scan_pri()
5181 struct rtw89_btc *btc = &rtwdev->btc; in _action_common()
5182 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_common()
5183 struct rtw89_btc_wl_smap *wl_smap = &wl->status.map; in _action_common()
5184 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_common()
5185 struct rtw89_btc_dm *dm = &btc->dm; in _action_common()
5196 bt_rom_code_id = chip_id_to_bt_rom_code_id(rtwdev->btc.ver->chip_id); in _action_common()
5197 bt_fw_ver = bt->ver_info.fw & 0xffff; in _action_common()
5198 if (bt->enable.now && in _action_common()
5200 (bt_fw_ver == bt_rom_code_id && bt->run_patch_code && rtwdev->chip->scbd))) in _action_common()
5205 if (dm->run_reason == BTC_RSN_NTFY_INIT || in _action_common()
5206 dm->run_reason == BTC_RSN_NTFY_RADIO_STATE || in _action_common()
5207 dm->run_reason == BTC_RSN_NTFY_POWEROFF) { in _action_common()
5210 if (wl_smap->rf_off == 1 || wl_smap->lps != BTC_LPS_OFF) in _action_common()
5216 if (wl->scbd_change) { in _action_common()
5217 rtw89_mac_cfg_sb(rtwdev, wl->scbd); in _action_common()
5219 wl->scbd); in _action_common()
5220 wl->scbd_change = false; in _action_common()
5221 btc->cx.cnt_wl[BTC_WCNT_SCBDUPDATE]++; in _action_common()
5223 btc->dm.tdma_instant_excute = 0; in _action_common()
5228 struct rtw89_btc *btc = &rtwdev->btc; in _action_by_bt()
5229 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_by_bt()
5230 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _action_by_bt()
5231 struct rtw89_btc_bt_hid_desc hid = bt_linfo->hid_desc; in _action_by_bt()
5232 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_by_bt()
5233 struct rtw89_btc_bt_pan_desc pan = bt_linfo->pan_desc; in _action_by_bt()
5236 if (bt_linfo->hfp_desc.exist) in _action_by_bt()
5239 if (bt_linfo->hid_desc.exist) in _action_by_bt()
5242 if (bt_linfo->a2dp_desc.exist) in _action_by_bt()
5245 if (bt_linfo->pan_desc.exist) in _action_by_bt()
5275 else if (bt_linfo->multi_link.now && !hid.pair_cnt) in _action_by_bt()
5314 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_25g_mcc()
5317 if (btc->ant_type == BTC_ANT_SHARED) { in _action_wl_25g_mcc()
5318 if (btc->cx.wl.status.map._4way) in _action_wl_25g_mcc()
5320 else if (btc->cx.wl.status.val & btc_scanning_map.val) in _action_wl_25g_mcc()
5322 else if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_25g_mcc()
5326 } else { /* dedicated-antenna */ in _action_wl_25g_mcc()
5330 btc->dm.e2g_slot_limit = BTC_E2G_LIMIT_DEF; in _action_wl_25g_mcc()
5338 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_scan()
5339 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_scan()
5340 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _action_wl_scan()
5342 if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) { in _action_wl_scan()
5345 } else if (rtwdev->dbcc_en) { in _action_wl_scan()
5346 if (wl_dinfo->real_band[RTW89_PHY_0] != RTW89_BAND_2G && in _action_wl_scan()
5347 wl_dinfo->real_band[RTW89_PHY_1] != RTW89_BAND_2G) in _action_wl_scan()
5352 if (wl->scan_info.band[RTW89_PHY_0] != RTW89_BAND_2G) in _action_wl_scan()
5360 { struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_mcc()
5364 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_mcc()
5365 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_mcc()
5371 } else { /* dedicated-antenna */ in _action_wl_2g_mcc()
5378 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc()
5382 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_scc()
5383 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_scc()
5389 } else { /* dedicated-antenna */ in _action_wl_2g_scc()
5396 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc_v1()
5397 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_2g_scc_v1()
5398 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_wl_2g_scc_v1()
5399 struct rtw89_btc_dm *dm = &btc->dm; in _action_wl_2g_scc_v1()
5400 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &wl->role_info_v1; in _action_wl_2g_scc_v1()
5404 if (btc->ant_type == BTC_ANT_DEDICATED) { in _action_wl_2g_scc_v1()
5407 /* shared-antenna */ in _action_wl_2g_scc_v1()
5408 switch (wl_rinfo->mrole_type) { in _action_wl_2g_scc_v1()
5410 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
5411 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_P2P_CLIENT; in _action_wl_2g_scc_v1()
5412 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v1()
5416 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
5417 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
5418 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v1()
5424 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
5425 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_NONE; in _action_wl_2g_scc_v1()
5426 dur = wl_rinfo->mrole_noa_duration; in _action_wl_2g_scc_v1()
5428 if (wl->status.map._4way) { in _action_wl_2g_scc_v1()
5429 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
5431 } else if (bt->link_info.status.map.connect == 0) { in _action_wl_2g_scc_v1()
5432 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
5434 } else if (bt->link_info.a2dp_desc.exist && in _action_wl_2g_scc_v1()
5435 dur < btc->bt_req_len) { in _action_wl_2g_scc_v1()
5436 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v1()
5438 } else if (bt->link_info.a2dp_desc.exist || in _action_wl_2g_scc_v1()
5439 bt->link_info.pan_desc.exist) { in _action_wl_2g_scc_v1()
5440 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v1()
5443 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
5458 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc_v2()
5459 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_2g_scc_v2()
5460 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_wl_2g_scc_v2()
5461 struct rtw89_btc_dm *dm = &btc->dm; in _action_wl_2g_scc_v2()
5462 struct rtw89_btc_wl_role_info_v2 *rinfo_v2 = &wl->role_info_v2; in _action_wl_2g_scc_v2()
5463 struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7; in _action_wl_2g_scc_v2()
5467 if (btc->ver->fwlrole == 2) { in _action_wl_2g_scc_v2()
5468 mrole_type = rinfo_v2->mrole_type; in _action_wl_2g_scc_v2()
5469 mrole_noa_duration = rinfo_v2->mrole_noa_duration; in _action_wl_2g_scc_v2()
5470 } else if (btc->ver->fwlrole == 7) { in _action_wl_2g_scc_v2()
5471 mrole_type = rinfo_v7->mrole_type; in _action_wl_2g_scc_v2()
5472 mrole_noa_duration = rinfo_v7->mrole_noa_duration; in _action_wl_2g_scc_v2()
5477 if (btc->ant_type == BTC_ANT_DEDICATED) { in _action_wl_2g_scc_v2()
5480 /* shared-antenna */ in _action_wl_2g_scc_v2()
5483 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v2()
5484 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_P2P_CLIENT; in _action_wl_2g_scc_v2()
5485 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v2()
5489 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v2()
5490 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v2()
5491 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v2()
5497 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v2()
5498 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_NONE; in _action_wl_2g_scc_v2()
5501 if (wl->status.map._4way) { in _action_wl_2g_scc_v2()
5502 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v2()
5504 } else if (bt->link_info.status.map.connect == 0) { in _action_wl_2g_scc_v2()
5505 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v2()
5507 } else if (bt->link_info.a2dp_desc.exist && in _action_wl_2g_scc_v2()
5508 dur < btc->bt_req_len) { in _action_wl_2g_scc_v2()
5509 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v2()
5511 } else if (bt->link_info.a2dp_desc.exist || in _action_wl_2g_scc_v2()
5512 bt->link_info.pan_desc.exist) { in _action_wl_2g_scc_v2()
5513 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v2()
5516 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v2()
5531 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc_v8()
5532 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_2g_scc_v8()
5533 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_wl_2g_scc_v8()
5534 struct rtw89_btc_dm *dm = &btc->dm; in _action_wl_2g_scc_v8()
5537 if (btc->ant_type == BTC_ANT_SHARED) { in _action_wl_2g_scc_v8()
5538 if (wl->status.map._4way) in _action_wl_2g_scc_v8()
5540 else if (bt->link_info.status.map.connect == 0) in _action_wl_2g_scc_v8()
5548 dm->e2g_slot_limit = BTC_E2G_LIMIT_DEF; in _action_wl_2g_scc_v8()
5556 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_ap()
5560 if (btc->ant_type == BTC_ANT_SHARED) { in _action_wl_2g_ap()
5561 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_ap()
5566 } else {/* dedicated-antenna */ in _action_wl_2g_ap()
5573 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_go()
5577 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_go()
5578 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_go()
5584 } else { /* dedicated-antenna */ in _action_wl_2g_go()
5591 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_gc()
5595 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_gc()
5597 } else {/* dedicated-antenna */ in _action_wl_2g_gc()
5604 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_nan()
5608 if (btc->ant_type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_nan()
5609 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_nan()
5615 } else { /* dedicated-antenna */ in _action_wl_2g_nan()
5622 const struct rtw89_chip_info *chip = rtwdev->chip; in _read_scbd()
5623 struct rtw89_btc *btc = &rtwdev->btc; in _read_scbd()
5626 if (!chip->scbd) in _read_scbd()
5633 btc->cx.cnt_bt[BTC_BCNT_SCBDREAD]++; in _read_scbd()
5639 const struct rtw89_chip_info *chip = rtwdev->chip; in _write_scbd()
5640 struct rtw89_btc *btc = &rtwdev->btc; in _write_scbd()
5641 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _write_scbd()
5645 if (!chip->scbd) in _write_scbd()
5648 scbd_val = state ? wl->scbd | val : wl->scbd & ~val; in _write_scbd()
5653 if (scbd_val != wl->scbd || force_exec) { in _write_scbd()
5654 wl->scbd = scbd_val; in _write_scbd()
5655 wl->scbd_change = true; in _write_scbd()
5662 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_rssi_state()
5663 u8 next_state, tol = chip->rssi_tol; in _update_rssi_state()
5692 struct rtw89_btc *btc = &rtwdev->btc; in _update_dbcc_band()
5694 btc->cx.wl.dbcc_info.real_band[phy_idx] = in _update_dbcc_band()
5695 btc->cx.wl.scan_info.phy_map & BIT(phy_idx) ? in _update_dbcc_band()
5696 btc->cx.wl.dbcc_info.scan_band[phy_idx] : in _update_dbcc_band()
5697 btc->cx.wl.dbcc_info.op_band[phy_idx]; in _update_dbcc_band()
5702 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info()
5703 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info()
5704 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info()
5705 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _update_wl_info()
5706 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info()
5720 wl_rinfo->active_role[cnt_active - 1].role = wl_linfo[i].role; in _update_wl_info()
5721 wl_rinfo->active_role[cnt_active - 1].pid = wl_linfo[i].pid; in _update_wl_info()
5722 wl_rinfo->active_role[cnt_active - 1].phy = wl_linfo[i].phy; in _update_wl_info()
5723 wl_rinfo->active_role[cnt_active - 1].band = wl_linfo[i].band; in _update_wl_info()
5724 wl_rinfo->active_role[cnt_active - 1].noa = (u8)wl_linfo[i].noa; in _update_wl_info()
5725 wl_rinfo->active_role[cnt_active - 1].connected = 0; in _update_wl_info()
5727 wl->port_id[wl_linfo[i].role] = wl_linfo[i].pid; in _update_wl_info()
5732 if (rtwdev->dbcc_en && phy < RTW89_PHY_MAX) { in _update_wl_info()
5733 wl_dinfo->role[phy] = wl_linfo[i].role; in _update_wl_info()
5734 wl_dinfo->op_band[phy] = wl_linfo[i].band; in _update_wl_info()
5751 wl_rinfo->role_map.val |= BIT(wl_linfo[i].role); in _update_wl_info()
5752 wl_rinfo->active_role[cnt_active - 1].ch = wl_linfo[i].ch; in _update_wl_info()
5753 wl_rinfo->active_role[cnt_active - 1].bw = wl_linfo[i].bw; in _update_wl_info()
5754 wl_rinfo->active_role[cnt_active - 1].connected = 1; in _update_wl_info()
5758 if (cnt_5g <= ARRAY_SIZE(wl_5g_ch) - 1) in _update_wl_info()
5763 if (cnt_2g <= ARRAY_SIZE(wl_2g_ch) - 1) in _update_wl_info()
5770 wl_rinfo->connect_cnt = cnt_connect; in _update_wl_info()
5774 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info()
5775 wl_rinfo->role_map.role.none = 1; in _update_wl_info()
5777 wl_rinfo->link_mode = BTC_WLINK_5G; in _update_wl_info()
5778 } else if (wl_rinfo->role_map.role.nan) { in _update_wl_info()
5779 wl_rinfo->link_mode = BTC_WLINK_2G_NAN; in _update_wl_info()
5781 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
5783 if (rtwdev->dbcc_en) { in _update_wl_info()
5784 switch (wl_dinfo->role[RTW89_PHY_0]) { in _update_wl_info()
5786 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
5789 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info()
5792 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info()
5795 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info()
5798 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
5802 wl_rinfo->link_mode = BTC_WLINK_25G_MCC; in _update_wl_info()
5805 if (wl_rinfo->role_map.role.station && in _update_wl_info()
5806 (wl_rinfo->role_map.role.p2p_go || in _update_wl_info()
5807 wl_rinfo->role_map.role.p2p_gc || in _update_wl_info()
5808 wl_rinfo->role_map.role.ap)) { in _update_wl_info()
5810 wl_rinfo->link_mode = BTC_WLINK_2G_SCC; in _update_wl_info()
5812 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info()
5814 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info()
5817 if (wl_rinfo->role_map.role.station) in _update_wl_info()
5818 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
5819 else if (wl_rinfo->role_map.role.ap) in _update_wl_info()
5820 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info()
5821 else if (wl_rinfo->role_map.role.p2p_go) in _update_wl_info()
5822 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info()
5823 else if (wl_rinfo->role_map.role.p2p_gc) in _update_wl_info()
5824 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info()
5826 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
5829 /* if no client_joined, don't care P2P-GO/AP role */ in _update_wl_info()
5830 if (wl_rinfo->role_map.role.p2p_go || wl_rinfo->role_map.role.ap) { in _update_wl_info()
5832 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC || in _update_wl_info()
5833 wl_rinfo->link_mode == BTC_WLINK_2G_MCC) { in _update_wl_info()
5834 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
5835 wl_rinfo->connect_cnt = 1; in _update_wl_info()
5836 } else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO || in _update_wl_info()
5837 wl_rinfo->link_mode == BTC_WLINK_2G_AP) { in _update_wl_info()
5838 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info()
5839 wl_rinfo->connect_cnt = 0; in _update_wl_info()
5846 cnt_connect, cnt_connecting, wl_rinfo->link_mode); in _update_wl_info()
5853 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info_v1()
5854 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info_v1()
5855 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info_v1()
5856 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &wl->role_info_v1; in _update_wl_info_v1()
5857 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info_v1()
5871 wl_rinfo->active_role_v1[cnt_active - 1].role = wl_linfo[i].role; in _update_wl_info_v1()
5872 wl_rinfo->active_role_v1[cnt_active - 1].pid = wl_linfo[i].pid; in _update_wl_info_v1()
5873 wl_rinfo->active_role_v1[cnt_active - 1].phy = wl_linfo[i].phy; in _update_wl_info_v1()
5874 wl_rinfo->active_role_v1[cnt_active - 1].band = wl_linfo[i].band; in _update_wl_info_v1()
5875 wl_rinfo->active_role_v1[cnt_active - 1].noa = (u8)wl_linfo[i].noa; in _update_wl_info_v1()
5876 wl_rinfo->active_role_v1[cnt_active - 1].connected = 0; in _update_wl_info_v1()
5878 wl->port_id[wl_linfo[i].role] = wl_linfo[i].pid; in _update_wl_info_v1()
5882 if (rtwdev->dbcc_en && phy < RTW89_PHY_MAX) { in _update_wl_info_v1()
5883 wl_dinfo->role[phy] = wl_linfo[i].role; in _update_wl_info_v1()
5884 wl_dinfo->op_band[phy] = wl_linfo[i].band; in _update_wl_info_v1()
5901 wl_rinfo->role_map.val |= BIT(wl_linfo[i].role); in _update_wl_info_v1()
5902 wl_rinfo->active_role_v1[cnt_active - 1].ch = wl_linfo[i].ch; in _update_wl_info_v1()
5903 wl_rinfo->active_role_v1[cnt_active - 1].bw = wl_linfo[i].bw; in _update_wl_info_v1()
5904 wl_rinfo->active_role_v1[cnt_active - 1].connected = 1; in _update_wl_info_v1()
5908 if (cnt_5g <= ARRAY_SIZE(wl_5g_ch) - 1) in _update_wl_info_v1()
5913 if (cnt_2g <= ARRAY_SIZE(wl_2g_ch) - 1) in _update_wl_info_v1()
5920 wl_rinfo->connect_cnt = cnt_connect; in _update_wl_info_v1()
5924 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v1()
5925 wl_rinfo->role_map.role.none = 1; in _update_wl_info_v1()
5927 wl_rinfo->link_mode = BTC_WLINK_5G; in _update_wl_info_v1()
5928 } else if (wl_rinfo->role_map.role.nan) { in _update_wl_info_v1()
5929 wl_rinfo->link_mode = BTC_WLINK_2G_NAN; in _update_wl_info_v1()
5931 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
5933 if (rtwdev->dbcc_en) { in _update_wl_info_v1()
5934 switch (wl_dinfo->role[RTW89_PHY_0]) { in _update_wl_info_v1()
5936 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
5939 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v1()
5942 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v1()
5945 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v1()
5948 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
5952 wl_rinfo->link_mode = BTC_WLINK_25G_MCC; in _update_wl_info_v1()
5955 if (wl_rinfo->role_map.role.station && in _update_wl_info_v1()
5956 (wl_rinfo->role_map.role.p2p_go || in _update_wl_info_v1()
5957 wl_rinfo->role_map.role.p2p_gc || in _update_wl_info_v1()
5958 wl_rinfo->role_map.role.ap)) { in _update_wl_info_v1()
5960 wl_rinfo->link_mode = BTC_WLINK_2G_SCC; in _update_wl_info_v1()
5962 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v1()
5964 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v1()
5967 if (wl_rinfo->role_map.role.station) in _update_wl_info_v1()
5968 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
5969 else if (wl_rinfo->role_map.role.ap) in _update_wl_info_v1()
5970 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v1()
5971 else if (wl_rinfo->role_map.role.p2p_go) in _update_wl_info_v1()
5972 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v1()
5973 else if (wl_rinfo->role_map.role.p2p_gc) in _update_wl_info_v1()
5974 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v1()
5976 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
5979 /* if no client_joined, don't care P2P-GO/AP role */ in _update_wl_info_v1()
5980 if (wl_rinfo->role_map.role.p2p_go || wl_rinfo->role_map.role.ap) { in _update_wl_info_v1()
5982 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC || in _update_wl_info_v1()
5983 wl_rinfo->link_mode == BTC_WLINK_2G_MCC) { in _update_wl_info_v1()
5984 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
5985 wl_rinfo->connect_cnt = 1; in _update_wl_info_v1()
5986 } else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO || in _update_wl_info_v1()
5987 wl_rinfo->link_mode == BTC_WLINK_2G_AP) { in _update_wl_info_v1()
5988 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v1()
5989 wl_rinfo->connect_cnt = 0; in _update_wl_info_v1()
5996 cnt_connect, cnt_connecting, wl_rinfo->link_mode); in _update_wl_info_v1()
6003 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info_v2()
6004 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info_v2()
6005 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info_v2()
6006 struct rtw89_btc_wl_role_info_v2 *wl_rinfo = &wl->role_info_v2; in _update_wl_info_v2()
6007 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info_v2()
6021 wl_rinfo->active_role_v2[cnt_active - 1].role = wl_linfo[i].role; in _update_wl_info_v2()
6022 wl_rinfo->active_role_v2[cnt_active - 1].pid = wl_linfo[i].pid; in _update_wl_info_v2()
6023 wl_rinfo->active_role_v2[cnt_active - 1].phy = wl_linfo[i].phy; in _update_wl_info_v2()
6024 wl_rinfo->active_role_v2[cnt_active - 1].band = wl_linfo[i].band; in _update_wl_info_v2()
6025 wl_rinfo->active_role_v2[cnt_active - 1].noa = (u8)wl_linfo[i].noa; in _update_wl_info_v2()
6026 wl_rinfo->active_role_v2[cnt_active - 1].connected = 0; in _update_wl_info_v2()
6028 wl->port_id[wl_linfo[i].role] = wl_linfo[i].pid; in _update_wl_info_v2()
6032 if (rtwdev->dbcc_en && phy < RTW89_PHY_MAX) { in _update_wl_info_v2()
6033 wl_dinfo->role[phy] = wl_linfo[i].role; in _update_wl_info_v2()
6034 wl_dinfo->op_band[phy] = wl_linfo[i].band; in _update_wl_info_v2()
6051 wl_rinfo->role_map.val |= BIT(wl_linfo[i].role); in _update_wl_info_v2()
6052 wl_rinfo->active_role_v2[cnt_active - 1].ch = wl_linfo[i].ch; in _update_wl_info_v2()
6053 wl_rinfo->active_role_v2[cnt_active - 1].bw = wl_linfo[i].bw; in _update_wl_info_v2()
6054 wl_rinfo->active_role_v2[cnt_active - 1].connected = 1; in _update_wl_info_v2()
6058 if (cnt_5g <= ARRAY_SIZE(wl_5g_ch) - 1) in _update_wl_info_v2()
6063 if (cnt_2g <= ARRAY_SIZE(wl_2g_ch) - 1) in _update_wl_info_v2()
6070 wl_rinfo->connect_cnt = cnt_connect; in _update_wl_info_v2()
6074 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v2()
6075 wl_rinfo->role_map.role.none = 1; in _update_wl_info_v2()
6077 wl_rinfo->link_mode = BTC_WLINK_5G; in _update_wl_info_v2()
6078 } else if (wl_rinfo->role_map.role.nan) { in _update_wl_info_v2()
6079 wl_rinfo->link_mode = BTC_WLINK_2G_NAN; in _update_wl_info_v2()
6081 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v2()
6083 if (rtwdev->dbcc_en) { in _update_wl_info_v2()
6084 switch (wl_dinfo->role[RTW89_PHY_0]) { in _update_wl_info_v2()
6086 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v2()
6089 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v2()
6092 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v2()
6095 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v2()
6098 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v2()
6102 wl_rinfo->link_mode = BTC_WLINK_25G_MCC; in _update_wl_info_v2()
6105 if (wl_rinfo->role_map.role.station && in _update_wl_info_v2()
6106 (wl_rinfo->role_map.role.p2p_go || in _update_wl_info_v2()
6107 wl_rinfo->role_map.role.p2p_gc || in _update_wl_info_v2()
6108 wl_rinfo->role_map.role.ap)) { in _update_wl_info_v2()
6110 wl_rinfo->link_mode = BTC_WLINK_2G_SCC; in _update_wl_info_v2()
6112 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v2()
6114 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v2()
6117 if (wl_rinfo->role_map.role.station) in _update_wl_info_v2()
6118 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v2()
6119 else if (wl_rinfo->role_map.role.ap) in _update_wl_info_v2()
6120 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v2()
6121 else if (wl_rinfo->role_map.role.p2p_go) in _update_wl_info_v2()
6122 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v2()
6123 else if (wl_rinfo->role_map.role.p2p_gc) in _update_wl_info_v2()
6124 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v2()
6126 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v2()
6129 /* if no client_joined, don't care P2P-GO/AP role */ in _update_wl_info_v2()
6130 if (wl_rinfo->role_map.role.p2p_go || wl_rinfo->role_map.role.ap) { in _update_wl_info_v2()
6132 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC || in _update_wl_info_v2()
6133 wl_rinfo->link_mode == BTC_WLINK_2G_MCC) { in _update_wl_info_v2()
6134 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v2()
6135 wl_rinfo->connect_cnt = 1; in _update_wl_info_v2()
6136 } else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO || in _update_wl_info_v2()
6137 wl_rinfo->link_mode == BTC_WLINK_2G_AP) { in _update_wl_info_v2()
6138 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v2()
6139 wl_rinfo->connect_cnt = 0; in _update_wl_info_v2()
6146 cnt_connect, cnt_connecting, wl_rinfo->link_mode); in _update_wl_info_v2()
6173 if (r1->chan != r2->chan) { /* primary ch is different */ in _chk_role_ch_group()
6175 } else if (r1->bw == RTW89_CHANNEL_WIDTH_40 && in _chk_role_ch_group()
6176 r2->bw == RTW89_CHANNEL_WIDTH_40) { in _chk_role_ch_group()
6177 if (r1->offset != r2->offset) in _chk_role_ch_group()
6186 struct rtw89_btc_wl_info *wl = &rtwdev->btc.cx.wl; in _chk_dbcc()
6187 struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7; in _chk_dbcc()
6188 struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &wl->role_info_v8; in _chk_dbcc()
6192 if (rtwdev->btc.ver->fwlrole == 7) in _chk_dbcc()
6193 connect_cnt = rinfo_v7->connect_cnt; in _chk_dbcc()
6194 else if (rtwdev->btc.ver->fwlrole == 8) in _chk_dbcc()
6195 connect_cnt = rinfo_v8->connect_cnt; in _chk_dbcc()
6199 /* find out the 2G-PHY by connect-id ->ch */ in _chk_dbcc()
6207 /* If no any 2G-port exist, it's impossible because 5G-exclude */ in _chk_dbcc()
6218 /* find the other-port in the 2G-PHY, ex: PHY-0:6G, PHY1: mcc/scc */ in _chk_dbcc()
6230 /* Single-role in 2G-PHY */ in _chk_dbcc()
6234 /* 2-role in 2G-PHY */ in _chk_dbcc()
6246 struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &rtwdev->btc.cx.wl.role_info_v8; in _update_role_link_mode()
6247 struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &rtwdev->btc.cx.wl.role_info_v7; in _update_role_link_mode()
6248 u8 role_ver = rtwdev->btc.ver->fwlrole; in _update_role_link_mode()
6254 wl_role = rinfo_v7->role_map; in _update_role_link_mode()
6255 link_mode = rinfo_v7->link_mode; in _update_role_link_mode()
6256 connect_cnt = rinfo_v7->connect_cnt; in _update_role_link_mode()
6258 wl_role = rinfo_v8->role_map; in _update_role_link_mode()
6259 link_mode = rinfo_v8->link_mode; in _update_role_link_mode()
6260 connect_cnt = rinfo_v8->connect_cnt; in _update_role_link_mode()
6265 /* if no client_joined, don't care P2P-GO/AP role */ in _update_role_link_mode()
6270 rinfo_v7->link_mode = BTC_WLINK_2G_STA; in _update_role_link_mode()
6271 rinfo_v7->connect_cnt--; in _update_role_link_mode()
6273 rinfo_v8->link_mode = BTC_WLINK_2G_STA; in _update_role_link_mode()
6274 rinfo_v8->connect_cnt--; in _update_role_link_mode()
6279 rinfo_v7->link_mode = BTC_WLINK_NOLINK; in _update_role_link_mode()
6280 rinfo_v7->connect_cnt--; in _update_role_link_mode()
6282 rinfo_v8->link_mode = BTC_WLINK_NOLINK; in _update_role_link_mode()
6283 rinfo_v8->connect_cnt--; in _update_role_link_mode()
6288 /* Identify 2-Role type */ in _update_role_link_mode()
6306 rinfo_v7->mrole_type = type; in _update_role_link_mode()
6307 rinfo_v7->mrole_noa_duration = dur; in _update_role_link_mode()
6309 rinfo_v8->mrole_type = type; in _update_role_link_mode()
6310 rinfo_v8->mrole_noa_duration = dur; in _update_role_link_mode()
6317 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info_v7()
6318 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info_v7()
6319 struct rtw89_btc_wl_role_info_v7 *wl_rinfo = &wl->role_info_v7; in _update_wl_info_v7()
6320 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info_v7()
6321 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info_v7()
6337 act_role = &wl_rinfo->active_role[i]; in _update_wl_info_v7()
6338 act_role->role = wl_linfo[i].role; in _update_wl_info_v7()
6342 act_role->connected = 0; in _update_wl_info_v7()
6349 act_role->connected = 1; in _update_wl_info_v7()
6350 act_role->pid = wl_linfo[i].pid; in _update_wl_info_v7()
6351 act_role->phy = wl_linfo[i].phy; in _update_wl_info_v7()
6352 act_role->band = wl_linfo[i].band; in _update_wl_info_v7()
6353 act_role->ch = wl_linfo[i].ch; in _update_wl_info_v7()
6354 act_role->bw = wl_linfo[i].bw; in _update_wl_info_v7()
6355 act_role->noa = wl_linfo[i].noa; in _update_wl_info_v7()
6356 act_role->noa_dur = wl_linfo[i].noa_duration; in _update_wl_info_v7()
6357 cid_ch[cnt - 1] = wl_linfo[i].chdef; in _update_wl_info_v7()
6358 cid_phy[cnt - 1] = wl_linfo[i].phy; in _update_wl_info_v7()
6359 cid_role[cnt - 1] = wl_linfo[i].role; in _update_wl_info_v7()
6360 wl_rinfo->role_map |= BIT(wl_linfo[i].role); in _update_wl_info_v7()
6363 phy_now = act_role->phy; in _update_wl_info_v7()
6372 act_role->client_cnt = wl_linfo[i].client_cnt; in _update_wl_info_v7()
6374 act_role->client_cnt = 0; in _update_wl_info_v7()
6377 if (act_role->noa && act_role->noa_dur > 0) in _update_wl_info_v7()
6378 noa_duration = act_role->noa_dur; in _update_wl_info_v7()
6380 if (rtwdev->dbcc_en) { in _update_wl_info_v7()
6382 wl_dinfo->role[phy_dbcc] |= BIT(wl_linfo[i].role); in _update_wl_info_v7()
6383 wl_dinfo->op_band[phy_dbcc] = wl_linfo[i].chdef.band; in _update_wl_info_v7()
6394 wl_rinfo->p2p_2g = 1; in _update_wl_info_v7()
6398 wl->bg_mode = 1; in _update_wl_info_v7()
6400 wl->he_mode = true; in _update_wl_info_v7()
6406 if (act_role->band == RTW89_BAND_5G && act_role->ch >= 100) in _update_wl_info_v7()
6407 wl->is_5g_hi_channel = 1; in _update_wl_info_v7()
6409 wl->is_5g_hi_channel = 0; in _update_wl_info_v7()
6412 wl_rinfo->connect_cnt = cnt; in _update_wl_info_v7()
6413 wl->client_cnt_inc_2g = client_inc_2g; in _update_wl_info_v7()
6417 wl_rinfo->role_map = BIT(RTW89_WIFI_ROLE_NONE); in _update_wl_info_v7()
6420 } else if (wl_rinfo->role_map & BIT(RTW89_WIFI_ROLE_NAN)) { in _update_wl_info_v7()
6424 } else if (rtwdev->dbcc_en) { in _update_wl_info_v7()
6427 /* correct 2G-located PHY band for gnt ctrl */ in _update_wl_info_v7()
6429 wl_dinfo->op_band[dbcc_2g_phy] = RTW89_BAND_2G; in _update_wl_info_v7()
6433 if (_chk_role_ch_group(&cid_ch[0], &cid_ch[cnt - 1])) in _update_wl_info_v7()
6443 wl_rinfo->link_mode = mode; in _update_wl_info_v7()
6451 if (wl_rinfo->dbcc_en != rtwdev->dbcc_en) { in _update_wl_info_v7()
6452 wl_rinfo->dbcc_chg = 1; in _update_wl_info_v7()
6453 wl_rinfo->dbcc_en = rtwdev->dbcc_en; in _update_wl_info_v7()
6454 btc->cx.cnt_wl[BTC_WCNT_DBCC_CHG]++; in _update_wl_info_v7()
6457 if (rtwdev->dbcc_en) { in _update_wl_info_v7()
6458 wl_rinfo->dbcc_2g_phy = dbcc_2g_phy; in _update_wl_info_v7()
6473 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info_v8()
6474 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info_v8()
6476 struct rtw89_btc_wl_role_info_v8 *wl_rinfo = &wl->role_info_v8; in _update_wl_info_v8()
6477 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info_v8()
6492 /* Extract wl->link_info[role_id][rlink_id] to wl->role_info in _update_wl_info_v8()
6494 * rlink_id: rlink index (= HW-band index) in _update_wl_info_v8()
6498 wl_linfo = &wl->rlink_info[role_id][rlink_id]; in _update_wl_info_v8()
6499 if (wl_linfo->connected == MLME_LINKING) in _update_wl_info_v8()
6502 rlink = &wl_rinfo->rlink[role_id][rlink_id]; in _update_wl_info_v8()
6503 rlink->role = wl_linfo->role; in _update_wl_info_v8()
6504 rlink->active = wl_linfo->active; /* Doze or not */ in _update_wl_info_v8()
6505 rlink->pid = wl_linfo->pid; in _update_wl_info_v8()
6506 rlink->phy = wl_linfo->phy; in _update_wl_info_v8()
6507 rlink->rf_band = wl_linfo->band; in _update_wl_info_v8()
6508 rlink->ch = wl_linfo->ch; in _update_wl_info_v8()
6509 rlink->bw = wl_linfo->bw; in _update_wl_info_v8()
6510 rlink->noa = wl_linfo->noa; in _update_wl_info_v8()
6511 rlink->noa_dur = wl_linfo->noa_duration / 1000; in _update_wl_info_v8()
6512 rlink->client_cnt = wl_linfo->client_cnt; in _update_wl_info_v8()
6513 rlink->mode = wl_linfo->mode; in _update_wl_info_v8()
6515 switch (wl_linfo->connected) { in _update_wl_info_v8()
6517 rlink->connected = 0; in _update_wl_info_v8()
6518 if (rlink->role == RTW89_WIFI_ROLE_STATION) in _update_wl_info_v8()
6519 btc->dm.leak_ap = 0; in _update_wl_info_v8()
6522 rlink->connected = 1; in _update_wl_info_v8()
6528 wl->is_5g_hi_channel = false; in _update_wl_info_v8()
6529 wl->bg_mode = false; in _update_wl_info_v8()
6530 wl_rinfo->role_map = 0; in _update_wl_info_v8()
6531 wl_rinfo->p2p_2g = 0; in _update_wl_info_v8()
6536 rlink = &wl_rinfo->rlink[i][j]; in _update_wl_info_v8()
6538 if (!rlink->active || !rlink->connected) in _update_wl_info_v8()
6542 wl_rinfo->role_map |= BIT(rlink->role); in _update_wl_info_v8()
6544 /* only if client connect for p2p-Go/AP */ in _update_wl_info_v8()
6545 if ((rlink->role == RTW89_WIFI_ROLE_P2P_GO || in _update_wl_info_v8()
6546 rlink->role == RTW89_WIFI_ROLE_AP) && in _update_wl_info_v8()
6547 rlink->client_cnt > 1) in _update_wl_info_v8()
6550 /* Identufy if P2P-Go (GO/GC/AP) exist at 2G band*/ in _update_wl_info_v8()
6551 if (rlink->rf_band == RTW89_BAND_2G && in _update_wl_info_v8()
6552 (client_joined || rlink->role == RTW89_WIFI_ROLE_P2P_CLIENT)) in _update_wl_info_v8()
6553 wl_rinfo->p2p_2g = 1; in _update_wl_info_v8()
6555 /* only one noa-role exist */ in _update_wl_info_v8()
6556 if (rlink->noa && rlink->noa_dur > 0) in _update_wl_info_v8()
6557 noa_dur = rlink->noa_dur; in _update_wl_info_v8()
6559 /* for WL 5G-Rx interfered with BT issue */ in _update_wl_info_v8()
6560 if (rlink->rf_band == RTW89_BAND_5G && rlink->ch >= 100) in _update_wl_info_v8()
6561 wl->is_5g_hi_channel = 1; in _update_wl_info_v8()
6563 if ((rlink->mode & BIT(BTC_WL_MODE_11B)) || in _update_wl_info_v8()
6564 (rlink->mode & BIT(BTC_WL_MODE_11G))) in _update_wl_info_v8()
6565 wl->bg_mode = 1; in _update_wl_info_v8()
6567 if (rtwdev->chip->para_ver & BTC_FEAT_MLO_SUPPORT) in _update_wl_info_v8()
6570 cid_ch[cnt - 1] = wl_linfo->chdef; in _update_wl_info_v8()
6571 cid_phy[cnt - 1] = rlink->phy; in _update_wl_info_v8()
6572 cid_role[cnt - 1] = rlink->role; in _update_wl_info_v8()
6574 if (rlink->rf_band != RTW89_BAND_2G) { in _update_wl_info_v8()
6584 if (rtwdev->chip->para_ver & BTC_FEAT_MLO_SUPPORT) { in _update_wl_info_v8()
6589 dbcc_en = rtwdev->dbcc_en; in _update_wl_info_v8()
6596 } else if (wl_rinfo->role_map & BIT(RTW89_WIFI_ROLE_NAN)) { in _update_wl_info_v8()
6606 if (_chk_role_ch_group(&cid_ch[0], &cid_ch[cnt - 1])) in _update_wl_info_v8()
6615 wl_rinfo->link_mode = mode; in _update_wl_info_v8()
6616 wl_rinfo->connect_cnt = cnt; in _update_wl_info_v8()
6617 if (wl_rinfo->connect_cnt == 0) in _update_wl_info_v8()
6618 wl_rinfo->role_map = BIT(RTW89_WIFI_ROLE_NONE); in _update_wl_info_v8()
6621 wl_rinfo->dbcc_2g_phy = dbcc_2g_phy; in _update_wl_info_v8()
6622 if (wl_rinfo->dbcc_en != dbcc_en) { in _update_wl_info_v8()
6623 wl_rinfo->dbcc_en = dbcc_en; in _update_wl_info_v8()
6624 wl_rinfo->dbcc_chg = 1; in _update_wl_info_v8()
6625 btc->cx.cnt_wl[BTC_WCNT_DBCC_CHG]++; in _update_wl_info_v8()
6627 wl_rinfo->dbcc_chg = 0; in _update_wl_info_v8()
6630 if (wl_rinfo->dbcc_en) { in _update_wl_info_v8()
6635 wl_dinfo->op_band[RTW89_PHY_0] = RTW89_BAND_5G; in _update_wl_info_v8()
6636 wl_dinfo->op_band[RTW89_PHY_1] = RTW89_BAND_2G; in _update_wl_info_v8()
6637 } else if (wl_rinfo->dbcc_2g_phy == RTW89_PHY_1) { in _update_wl_info_v8()
6639 wl_dinfo->op_band[RTW89_PHY_0] = RTW89_BAND_5G; in _update_wl_info_v8()
6640 wl_dinfo->op_band[RTW89_PHY_1] = RTW89_BAND_2G; in _update_wl_info_v8()
6643 wl_dinfo->op_band[RTW89_PHY_0] = RTW89_BAND_2G; in _update_wl_info_v8()
6644 wl_dinfo->op_band[RTW89_PHY_1] = RTW89_BAND_5G; in _update_wl_info_v8()
6650 wl_rinfo->pta_req_band = pta_req_band; in _update_wl_info_v8()
6658 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_act1_work()
6659 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_act1_work()
6660 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_coex_act1_work()
6661 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_coex_act1_work()
6663 mutex_lock(&rtwdev->mutex); in rtw89_coex_act1_work()
6665 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_act1_work()
6666 if (wl->status.map._4way) in rtw89_coex_act1_work()
6667 wl->status.map._4way = false; in rtw89_coex_act1_work()
6668 if (wl->status.map.connecting) in rtw89_coex_act1_work()
6669 wl->status.map.connecting = false; in rtw89_coex_act1_work()
6672 mutex_unlock(&rtwdev->mutex); in rtw89_coex_act1_work()
6679 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_bt_devinfo_work()
6680 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_bt_devinfo_work()
6681 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in rtw89_coex_bt_devinfo_work()
6683 mutex_lock(&rtwdev->mutex); in rtw89_coex_bt_devinfo_work()
6685 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_bt_devinfo_work()
6686 a2dp->play_latency = 0; in rtw89_coex_bt_devinfo_work()
6688 mutex_unlock(&rtwdev->mutex); in rtw89_coex_bt_devinfo_work()
6695 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_rfk_chk_work()
6696 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_rfk_chk_work()
6697 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_coex_rfk_chk_work()
6698 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_coex_rfk_chk_work()
6700 mutex_lock(&rtwdev->mutex); in rtw89_coex_rfk_chk_work()
6702 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_rfk_chk_work()
6703 if (wl->rfk_info.state != BTC_WRFK_STOP) { in rtw89_coex_rfk_chk_work()
6706 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]++; in rtw89_coex_rfk_chk_work()
6707 dm->error.map.wl_rfk_timeout = true; in rtw89_coex_rfk_chk_work()
6708 wl->rfk_info.state = BTC_WRFK_STOP; in rtw89_coex_rfk_chk_work()
6712 mutex_unlock(&rtwdev->mutex); in rtw89_coex_rfk_chk_work()
6717 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_bt_scbd()
6718 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_scbd()
6719 struct rtw89_btc_cx *cx = &btc->cx; in _update_bt_scbd()
6720 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _update_bt_scbd()
6724 if (!chip->scbd) in _update_bt_scbd()
6738 bt->enable.now = 0; in _update_bt_scbd()
6740 bt->enable.now = 1; in _update_bt_scbd()
6742 if (bt->enable.now != bt->enable.last) in _update_bt_scbd()
6745 /* reset bt info if bt re-enable */ in _update_bt_scbd()
6746 if (bt->enable.now && !bt->enable.last) { in _update_bt_scbd()
6748 cx->cnt_bt[BTC_BCNT_REENABLE]++; in _update_bt_scbd()
6749 bt->enable.now = 1; in _update_bt_scbd()
6752 bt->enable.last = bt->enable.now; in _update_bt_scbd()
6753 bt->scbd = val; in _update_bt_scbd()
6754 bt->mbx_avl = !!(val & BTC_BSCB_ACT); in _update_bt_scbd()
6756 if (bt->whql_test != !!(val & BTC_BSCB_WHQL)) in _update_bt_scbd()
6759 bt->whql_test = !!(val & BTC_BSCB_WHQL); in _update_bt_scbd()
6760 bt->btg_type = val & BTC_BSCB_BT_S1 ? BTC_BT_BTG : BTC_BT_ALONE; in _update_bt_scbd()
6761 bt->link_info.a2dp_desc.exist = !!(val & BTC_BSCB_A2DP_ACT); in _update_bt_scbd()
6763 bt->lna_constrain = !!(val & BTC_BSCB_BT_LNAB0) + in _update_bt_scbd()
6766 /* if rfk run 1->0 */ in _update_bt_scbd()
6767 if (bt->rfk_info.map.run && !(val & BTC_BSCB_RFK_RUN)) in _update_bt_scbd()
6770 bt->rfk_info.map.run = !!(val & BTC_BSCB_RFK_RUN); in _update_bt_scbd()
6771 bt->rfk_info.map.req = !!(val & BTC_BSCB_RFK_REQ); in _update_bt_scbd()
6772 bt->hi_lna_rx = !!(val & BTC_BSCB_BT_HILNA); in _update_bt_scbd()
6773 bt->link_info.status.map.connect = !!(val & BTC_BSCB_BT_CONNECT); in _update_bt_scbd()
6774 bt->run_patch_code = !!(val & BTC_BSCB_PATCH_CODE); in _update_bt_scbd()
6782 struct rtw89_btc *btc = &rtwdev->btc; in _chk_wl_rfk_request()
6783 struct rtw89_btc_cx *cx = &btc->cx; in _chk_wl_rfk_request()
6784 struct rtw89_btc_bt_info *bt = &cx->bt; in _chk_wl_rfk_request()
6788 cx->cnt_wl[BTC_WCNT_RFK_REQ]++; in _chk_wl_rfk_request()
6790 if ((bt->rfk_info.map.run || bt->rfk_info.map.req) && in _chk_wl_rfk_request()
6791 !bt->rfk_info.map.timeout) { in _chk_wl_rfk_request()
6792 cx->cnt_wl[BTC_WCNT_RFK_REJECT]++; in _chk_wl_rfk_request()
6794 cx->cnt_wl[BTC_WCNT_RFK_GO]++; in _chk_wl_rfk_request()
6803 struct rtw89_btc *btc = &rtwdev->btc; in _run_coex()
6804 const struct rtw89_btc_ver *ver = btc->ver; in _run_coex()
6805 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in _run_coex()
6806 struct rtw89_btc_cx *cx = &btc->cx; in _run_coex()
6807 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _run_coex()
6808 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _run_coex()
6809 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _run_coex()
6810 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _run_coex()
6811 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _run_coex()
6812 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _run_coex()
6813 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _run_coex()
6816 lockdep_assert_held(&rtwdev->mutex); in _run_coex()
6818 dm->run_reason = reason; in _run_coex()
6822 if (ver->fwlrole == 0) in _run_coex()
6823 mode = wl_rinfo->link_mode; in _run_coex()
6824 else if (ver->fwlrole == 1) in _run_coex()
6825 mode = wl_rinfo_v1->link_mode; in _run_coex()
6826 else if (ver->fwlrole == 2) in _run_coex()
6827 mode = wl_rinfo_v2->link_mode; in _run_coex()
6828 else if (ver->fwlrole == 7) in _run_coex()
6829 mode = wl_rinfo_v7->link_mode; in _run_coex()
6830 else if (ver->fwlrole == 8) in _run_coex()
6831 mode = wl_rinfo_v8->link_mode; in _run_coex()
6835 if (ver->fcxctrl == 7) { in _run_coex()
6836 igno_bt = btc->ctrl.ctrl_v7.igno_bt; in _run_coex()
6837 always_freerun = btc->ctrl.ctrl_v7.always_freerun; in _run_coex()
6839 igno_bt = btc->ctrl.ctrl.igno_bt; in _run_coex()
6840 always_freerun = btc->ctrl.ctrl.always_freerun; in _run_coex()
6846 __func__, dm->wl_only, dm->bt_only); in _run_coex()
6849 if (btc->manual_ctrl) { in _run_coex()
6865 if (!wl->status.map.init_ok) { in _run_coex()
6872 if (wl->status.map.rf_off_pre == wl->status.map.rf_off && in _run_coex()
6873 wl->status.map.lps_pre == wl->status.map.lps) { in _run_coex()
6881 if (wl->status.map.rf_off == 1 || in _run_coex()
6882 wl->status.map.lps == BTC_LPS_RF_OFF) { in _run_coex()
6890 dm->freerun = false; in _run_coex()
6891 dm->cnt_dm[BTC_DCNT_RUN]++; in _run_coex()
6892 dm->fddt_train = BTC_FDDT_DISABLE; in _run_coex()
6893 bt->scan_rx_low_pri = false; in _run_coex()
6902 if (dm->wl_only) { in _run_coex()
6908 if (wl->status.map.rf_off || wl->status.map.lps || dm->bt_only) { in _run_coex()
6919 if (!cx->bt.enable.now && !cx->other.type) { in _run_coex()
6924 if (cx->bt.whql_test) { in _run_coex()
6929 if (wl->rfk_info.state != BTC_WRFK_STOP) { in _run_coex()
6934 if (cx->state_map == BTC_WLINKING) { in _run_coex()
6938 bt->scan_rx_low_pri = false; in _run_coex()
6943 if (wl->status.map.scan) { in _run_coex()
6945 bt->scan_rx_low_pri = false; in _run_coex()
6954 if (wl->status.map.traffic_dir & BIT(RTW89_TFC_DL)) in _run_coex()
6955 bt->scan_rx_low_pri = true; in _run_coex()
6959 bt->scan_rx_low_pri = true; in _run_coex()
6963 bt->scan_rx_low_pri = true; in _run_coex()
6967 bt->scan_rx_low_pri = true; in _run_coex()
6971 bt->scan_rx_low_pri = true; in _run_coex()
6972 if (ver->fwlrole == 0) in _run_coex()
6974 else if (ver->fwlrole == 1) in _run_coex()
6976 else if (ver->fwlrole == 2 || ver->fwlrole == 7) in _run_coex()
6978 else if (ver->fwlrole == 8) in _run_coex()
6982 bt->scan_rx_low_pri = true; in _run_coex()
6986 bt->scan_rx_low_pri = true; in _run_coex()
7002 if (ver->fcxctrl == 7) in _run_coex()
7003 btc->ctrl.ctrl_v7.igno_bt = igno_bt; in _run_coex()
7005 btc->ctrl.ctrl.igno_bt = igno_bt; in _run_coex()
7011 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_poweron()
7014 btc->dm.cnt_notify[BTC_NCNT_POWER_ON]++; in rtw89_btc_ntfy_poweron()
7019 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_poweroff()
7020 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_poweroff()
7023 btc->dm.cnt_notify[BTC_NCNT_POWER_OFF]++; in rtw89_btc_ntfy_poweroff()
7025 btc->cx.wl.status.map.rf_off = 1; in rtw89_btc_ntfy_poweroff()
7026 btc->cx.wl.status.map.busy = 0; in rtw89_btc_ntfy_poweroff()
7027 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_poweroff()
7034 btc->cx.wl.status.map.rf_off_pre = btc->cx.wl.status.map.rf_off; in rtw89_btc_ntfy_poweroff()
7039 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_init_info()
7040 struct rtw89_btc *btc = &rtwdev->btc; in _set_init_info()
7041 const struct rtw89_btc_ver *ver = btc->ver; in _set_init_info()
7042 struct rtw89_btc_dm *dm = &btc->dm; in _set_init_info()
7043 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_init_info()
7045 if (ver->fcxinit == 7) { in _set_init_info()
7046 dm->init_info.init_v7.wl_only = (u8)dm->wl_only; in _set_init_info()
7047 dm->init_info.init_v7.bt_only = (u8)dm->bt_only; in _set_init_info()
7048 dm->init_info.init_v7.wl_init_ok = (u8)wl->status.map.init_ok; in _set_init_info()
7049 dm->init_info.init_v7.cx_other = btc->cx.other.type; in _set_init_info()
7050 dm->init_info.init_v7.wl_guard_ch = chip->afh_guard_ch; in _set_init_info()
7051 dm->init_info.init_v7.module = btc->mdinfo.md_v7; in _set_init_info()
7053 dm->init_info.init.wl_only = (u8)dm->wl_only; in _set_init_info()
7054 dm->init_info.init.bt_only = (u8)dm->bt_only; in _set_init_info()
7055 dm->init_info.init.wl_init_ok = (u8)wl->status.map.init_ok; in _set_init_info()
7056 dm->init_info.init.dbcc_en = rtwdev->dbcc_en; in _set_init_info()
7057 dm->init_info.init.cx_other = btc->cx.other.type; in _set_init_info()
7058 dm->init_info.init.wl_guard_ch = chip->afh_guard_ch; in _set_init_info()
7059 dm->init_info.init.module = btc->mdinfo.md; in _set_init_info()
7065 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_init()
7066 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_btc_ntfy_init()
7067 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_init()
7068 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_init()
7069 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_ntfy_init()
7072 btc->dm.run_reason = BTC_RSN_NONE; in rtw89_btc_ntfy_init()
7073 btc->dm.run_action = BTC_ACT_NONE; in rtw89_btc_ntfy_init()
7074 if (ver->fcxctrl == 7) in rtw89_btc_ntfy_init()
7075 btc->ctrl.ctrl_v7.igno_bt = true; in rtw89_btc_ntfy_init()
7077 btc->ctrl.ctrl.igno_bt = true; in rtw89_btc_ntfy_init()
7082 wl->coex_mode = mode; in rtw89_btc_ntfy_init()
7083 dm->cnt_notify[BTC_NCNT_INIT_COEX]++; in rtw89_btc_ntfy_init()
7084 dm->wl_only = mode == BTC_MODE_WL ? 1 : 0; in rtw89_btc_ntfy_init()
7085 dm->bt_only = mode == BTC_MODE_BT ? 1 : 0; in rtw89_btc_ntfy_init()
7086 wl->status.map.rf_off = mode == BTC_MODE_WLOFF ? 1 : 0; in rtw89_btc_ntfy_init()
7088 chip->ops->btc_set_rfe(rtwdev); in rtw89_btc_ntfy_init()
7089 chip->ops->btc_init_cfg(rtwdev); in rtw89_btc_ntfy_init()
7091 if (!wl->status.map.init_ok) { in rtw89_btc_ntfy_init()
7095 dm->error.map.init = true; in rtw89_btc_ntfy_init()
7106 dm->error.map.pta_owner = true; in rtw89_btc_ntfy_init()
7121 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_scan_start()
7122 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_scan_start()
7131 btc->dm.cnt_notify[BTC_NCNT_SCAN_START]++; in rtw89_btc_ntfy_scan_start()
7132 wl->status.map.scan = true; in rtw89_btc_ntfy_scan_start()
7133 wl->scan_info.band[phy_idx] = band; in rtw89_btc_ntfy_scan_start()
7134 wl->scan_info.phy_map |= BIT(phy_idx); in rtw89_btc_ntfy_scan_start()
7137 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_scan_start()
7138 wl->dbcc_info.scan_band[phy_idx] = band; in rtw89_btc_ntfy_scan_start()
7148 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_scan_finish()
7149 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_scan_finish()
7153 btc->dm.cnt_notify[BTC_NCNT_SCAN_FINISH]++; in rtw89_btc_ntfy_scan_finish()
7155 wl->status.map.scan = false; in rtw89_btc_ntfy_scan_finish()
7156 wl->scan_info.phy_map &= ~BIT(phy_idx); in rtw89_btc_ntfy_scan_finish()
7159 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_scan_finish()
7169 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_switch_band()
7170 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_switch_band()
7179 btc->dm.cnt_notify[BTC_NCNT_SWITCH_BAND]++; in rtw89_btc_ntfy_switch_band()
7181 wl->scan_info.band[phy_idx] = band; in rtw89_btc_ntfy_switch_band()
7182 wl->scan_info.phy_map |= BIT(phy_idx); in rtw89_btc_ntfy_switch_band()
7185 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_switch_band()
7186 wl->dbcc_info.scan_band[phy_idx] = band; in rtw89_btc_ntfy_switch_band()
7196 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_specific_packet()
7197 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_btc_ntfy_specific_packet()
7198 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_btc_ntfy_specific_packet()
7199 struct rtw89_btc_bt_link_info *b = &cx->bt.link_info; in rtw89_btc_ntfy_specific_packet()
7200 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in rtw89_btc_ntfy_specific_packet()
7201 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in rtw89_btc_ntfy_specific_packet()
7208 cnt = ++cx->cnt_wl[BTC_WCNT_DHCP]; in rtw89_btc_ntfy_specific_packet()
7211 wl->status.map.connecting = true; in rtw89_btc_ntfy_specific_packet()
7215 cnt = ++cx->cnt_wl[BTC_WCNT_EAPOL]; in rtw89_btc_ntfy_specific_packet()
7218 wl->status.map._4way = true; in rtw89_btc_ntfy_specific_packet()
7220 if (hfp->exist || hid->exist) in rtw89_btc_ntfy_specific_packet()
7224 cnt = ++cx->cnt_wl[BTC_WCNT_EAPOL]; in rtw89_btc_ntfy_specific_packet()
7228 wl->status.map._4way = false; in rtw89_btc_ntfy_specific_packet()
7229 cancel_delayed_work(&rtwdev->coex_act1_work); in rtw89_btc_ntfy_specific_packet()
7232 cnt = ++cx->cnt_wl[BTC_WCNT_ARP]; in rtw89_btc_ntfy_specific_packet()
7248 cancel_delayed_work(&rtwdev->coex_act1_work); in rtw89_btc_ntfy_specific_packet()
7249 ieee80211_queue_delayed_work(rtwdev->hw, in rtw89_btc_ntfy_specific_packet()
7250 &rtwdev->coex_act1_work, delay); in rtw89_btc_ntfy_specific_packet()
7253 btc->dm.cnt_notify[BTC_NCNT_SPECIAL_PACKET]++; in rtw89_btc_ntfy_specific_packet()
7262 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_eapol_packet_work()
7265 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_eapol_packet_work()
7273 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_arp_packet_work()
7275 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_arp_packet_work()
7283 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_dhcp_packet_work()
7286 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_dhcp_packet_work()
7294 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_icmp_packet_work()
7297 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_icmp_packet_work()
7302 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_bt_rssi_level()
7303 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_rssi_level()
7304 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _update_bt_rssi_level()
7309 * if rssi >= 40% (-60dBm) --> rssi_level = 4 in _update_bt_rssi_level()
7310 * if 36% <= rssi < 40% --> rssi_level = 3 in _update_bt_rssi_level()
7311 * if 31% <= rssi < 36% --> rssi_level = 2 in _update_bt_rssi_level()
7312 * if 28% <= rssi < 31% --> rssi_level = 1 in _update_bt_rssi_level()
7313 * if rssi < 28% --> rssi_level = 0 in _update_bt_rssi_level()
7318 rssi_th = chip->bt_rssi_thres[i]; in _update_bt_rssi_level()
7319 rssi_st = &bt->link_info.rssi_state[i]; in _update_bt_rssi_level()
7324 rssi_level = BTC_BT_RSSI_THMAX - i; in _update_bt_rssi_level()
7333 u8 mode = rtwdev->btc.cx.wl.role_info.link_mode; in _update_zb_coex_tbl()
7336 if (mode == BTC_WLINK_5G || rtwdev->btc.dm.freerun) { in _update_zb_coex_tbl()
7351 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_bt_info()
7352 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_info()
7353 struct rtw89_btc_cx *cx = &btc->cx; in _update_bt_info()
7354 struct rtw89_btc_bt_info *bt = &cx->bt; in _update_bt_info()
7355 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _update_bt_info()
7356 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in _update_bt_info()
7357 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in _update_bt_info()
7358 struct rtw89_btc_bt_a2dp_desc *a2dp = &b->a2dp_desc; in _update_bt_info()
7359 struct rtw89_btc_bt_pan_desc *pan = &b->pan_desc; in _update_bt_info()
7365 if (!memcmp(bt->raw_info, buf, BTC_BTINFO_MAX)) { in _update_bt_info()
7367 "[BTC], %s(): return by bt-info duplicate!!\n", in _update_bt_info()
7369 cx->cnt_bt[BTC_BCNT_INFOSAME]++; in _update_bt_info()
7373 memcpy(bt->raw_info, buf, BTC_BTINFO_MAX); in _update_bt_info()
7377 __func__, bt->raw_info[2]); in _update_bt_info()
7379 /* reset to mo-connect before update */ in _update_bt_info()
7380 b->status.val = BTC_BLINK_NOCONNECT; in _update_bt_info()
7381 b->profile_cnt.last = b->profile_cnt.now; in _update_bt_info()
7382 b->relink.last = b->relink.now; in _update_bt_info()
7383 a2dp->exist_last = a2dp->exist; in _update_bt_info()
7384 b->multi_link.last = b->multi_link.now; in _update_bt_info()
7385 bt->inq_pag.last = bt->inq_pag.now; in _update_bt_info()
7386 b->profile_cnt.now = 0; in _update_bt_info()
7387 hid->type = 0; in _update_bt_info()
7389 /* parse raw info low-Byte2 */ in _update_bt_info()
7390 btinfo.val = bt->raw_info[BTC_BTINFO_L2]; in _update_bt_info()
7391 b->status.map.connect = btinfo.lb2.connect; in _update_bt_info()
7392 b->status.map.sco_busy = btinfo.lb2.sco_busy; in _update_bt_info()
7393 b->status.map.acl_busy = btinfo.lb2.acl_busy; in _update_bt_info()
7394 b->status.map.inq_pag = btinfo.lb2.inq_pag; in _update_bt_info()
7395 bt->inq_pag.now = btinfo.lb2.inq_pag; in _update_bt_info()
7396 cx->cnt_bt[BTC_BCNT_INQPAG] += !!(bt->inq_pag.now && !bt->inq_pag.last); in _update_bt_info()
7398 hfp->exist = btinfo.lb2.hfp; in _update_bt_info()
7399 b->profile_cnt.now += (u8)hfp->exist; in _update_bt_info()
7400 hid->exist = btinfo.lb2.hid; in _update_bt_info()
7401 b->profile_cnt.now += (u8)hid->exist; in _update_bt_info()
7402 a2dp->exist = btinfo.lb2.a2dp; in _update_bt_info()
7403 b->profile_cnt.now += (u8)a2dp->exist; in _update_bt_info()
7404 pan->active = btinfo.lb2.pan; in _update_bt_info()
7405 btc->dm.trx_info.bt_profile = u32_get_bits(btinfo.val, BT_PROFILE_PROTOCOL_MASK); in _update_bt_info()
7407 /* parse raw info low-Byte3 */ in _update_bt_info()
7408 btinfo.val = bt->raw_info[BTC_BTINFO_L3]; in _update_bt_info()
7410 cx->cnt_bt[BTC_BCNT_RETRY]++; in _update_bt_info()
7411 b->cqddr = btinfo.lb3.cqddr; in _update_bt_info()
7412 cx->cnt_bt[BTC_BCNT_INQ] += !!(btinfo.lb3.inq && !bt->inq); in _update_bt_info()
7413 bt->inq = btinfo.lb3.inq; in _update_bt_info()
7414 cx->cnt_bt[BTC_BCNT_PAGE] += !!(btinfo.lb3.pag && !bt->pag); in _update_bt_info()
7415 bt->pag = btinfo.lb3.pag; in _update_bt_info()
7417 b->status.map.mesh_busy = btinfo.lb3.mesh_busy; in _update_bt_info()
7418 /* parse raw info high-Byte0 */ in _update_bt_info()
7419 btinfo.val = bt->raw_info[BTC_BTINFO_H0]; in _update_bt_info()
7420 /* raw val is dBm unit, translate from -100~ 0dBm to 0~100%*/ in _update_bt_info()
7421 b->rssi = chip->ops->btc_get_bt_rssi(rtwdev, btinfo.hb0.rssi); in _update_bt_info()
7422 bt->rssi_level = _update_bt_rssi_level(rtwdev, b->rssi); in _update_bt_info()
7423 btc->dm.trx_info.bt_rssi = bt->rssi_level; in _update_bt_info()
7425 /* parse raw info high-Byte1 */ in _update_bt_info()
7426 btinfo.val = bt->raw_info[BTC_BTINFO_H1]; in _update_bt_info()
7427 b->status.map.ble_connect = btinfo.hb1.ble_connect; in _update_bt_info()
7429 hid->type |= (hid->exist ? BTC_HID_BLE : BTC_HID_RCU); in _update_bt_info()
7431 cx->cnt_bt[BTC_BCNT_REINIT] += !!(btinfo.hb1.reinit && !bt->reinit); in _update_bt_info()
7432 bt->reinit = btinfo.hb1.reinit; in _update_bt_info()
7433 cx->cnt_bt[BTC_BCNT_RELINK] += !!(btinfo.hb1.relink && !b->relink.now); in _update_bt_info()
7434 b->relink.now = btinfo.hb1.relink; in _update_bt_info()
7435 cx->cnt_bt[BTC_BCNT_IGNOWL] += !!(btinfo.hb1.igno_wl && !bt->igno_wl); in _update_bt_info()
7436 bt->igno_wl = btinfo.hb1.igno_wl; in _update_bt_info()
7438 if (bt->igno_wl && !cx->wl.status.map.rf_off) in _update_bt_info()
7441 hid->type |= (btinfo.hb1.voice ? BTC_HID_RCU_VOICE : 0); in _update_bt_info()
7442 bt->ble_scan_en = btinfo.hb1.ble_scan; in _update_bt_info()
7444 cx->cnt_bt[BTC_BCNT_ROLESW] += !!(btinfo.hb1.role_sw && !b->role_sw); in _update_bt_info()
7445 b->role_sw = btinfo.hb1.role_sw; in _update_bt_info()
7447 b->multi_link.now = btinfo.hb1.multi_link; in _update_bt_info()
7449 /* parse raw info high-Byte2 */ in _update_bt_info()
7450 btinfo.val = bt->raw_info[BTC_BTINFO_H2]; in _update_bt_info()
7451 pan->exist = btinfo.hb2.pan_active; in _update_bt_info()
7452 b->profile_cnt.now += (u8)pan->exist; in _update_bt_info()
7454 cx->cnt_bt[BTC_BCNT_AFH] += !!(btinfo.hb2.afh_update && !b->afh_update); in _update_bt_info()
7455 b->afh_update = btinfo.hb2.afh_update; in _update_bt_info()
7456 a2dp->active = btinfo.hb2.a2dp_active; in _update_bt_info()
7457 b->slave_role = btinfo.hb2.slave; in _update_bt_info()
7458 hid->slot_info = btinfo.hb2.hid_slot; in _update_bt_info()
7459 hid->pair_cnt = btinfo.hb2.hid_cnt; in _update_bt_info()
7460 hid->type |= (hid->slot_info == BTC_HID_218 ? in _update_bt_info()
7462 /* parse raw info high-Byte3 */ in _update_bt_info()
7463 btinfo.val = bt->raw_info[BTC_BTINFO_H3]; in _update_bt_info()
7464 a2dp->bitpool = btinfo.hb3.a2dp_bitpool; in _update_bt_info()
7466 if (b->tx_3m != (u32)btinfo.hb3.tx_3m) in _update_bt_info()
7467 cx->cnt_bt[BTC_BCNT_RATECHG]++; in _update_bt_info()
7468 b->tx_3m = (u32)btinfo.hb3.tx_3m; in _update_bt_info()
7470 a2dp->sink = btinfo.hb3.a2dp_sink; in _update_bt_info()
7472 if (!a2dp->exist_last && a2dp->exist) { in _update_bt_info()
7473 a2dp->vendor_id = 0; in _update_bt_info()
7474 a2dp->flush_time = 0; in _update_bt_info()
7475 a2dp->play_latency = 1; in _update_bt_info()
7476 ieee80211_queue_delayed_work(rtwdev->hw, in _update_bt_info()
7477 &rtwdev->coex_bt_devinfo_work, in _update_bt_info()
7488 rtwvif->chanctx_idx); in rtw89_btc_ntfy_role_info()
7491 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_role_info()
7492 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_ntfy_role_info()
7493 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_role_info()
7501 vif->type == NL80211_IFTYPE_STATION); in rtw89_btc_ntfy_role_info()
7502 rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC], port=%d\n", rtwvif->port); in rtw89_btc_ntfy_role_info()
7504 chan->band_type, chan->channel, chan->band_width); in rtw89_btc_ntfy_role_info()
7509 vif->bss_conf.beacon_int, vif->bss_conf.dtim_period); in rtw89_btc_ntfy_role_info()
7513 rtwsta->mac_id); in rtw89_btc_ntfy_role_info()
7517 sta->deflink.he_cap.has_he, in rtw89_btc_ntfy_role_info()
7518 sta->deflink.vht_cap.vht_supported, in rtw89_btc_ntfy_role_info()
7519 sta->deflink.ht_cap.ht_supported); in rtw89_btc_ntfy_role_info()
7520 if (sta->deflink.he_cap.has_he) in rtw89_btc_ntfy_role_info()
7522 if (sta->deflink.vht_cap.vht_supported) in rtw89_btc_ntfy_role_info()
7524 if (sta->deflink.ht_cap.ht_supported) in rtw89_btc_ntfy_role_info()
7530 if (rtwvif->wifi_role >= RTW89_WIFI_ROLE_MLME_MAX) in rtw89_btc_ntfy_role_info()
7534 "[BTC], wifi_role=%d\n", rtwvif->wifi_role); in rtw89_btc_ntfy_role_info()
7536 r.role = rtwvif->wifi_role; in rtw89_btc_ntfy_role_info()
7537 r.phy = rtwvif->phy_idx; in rtw89_btc_ntfy_role_info()
7538 r.pid = rtwvif->port; in rtw89_btc_ntfy_role_info()
7541 r.bcn_period = vif->bss_conf.beacon_int; in rtw89_btc_ntfy_role_info()
7542 r.dtim_period = vif->bss_conf.dtim_period; in rtw89_btc_ntfy_role_info()
7543 r.band = chan->band_type; in rtw89_btc_ntfy_role_info()
7544 r.ch = chan->channel; in rtw89_btc_ntfy_role_info()
7545 r.bw = chan->band_width; in rtw89_btc_ntfy_role_info()
7546 r.chdef.band = chan->band_type; in rtw89_btc_ntfy_role_info()
7547 r.chdef.center_ch = chan->channel; in rtw89_btc_ntfy_role_info()
7548 r.chdef.bw = chan->band_width; in rtw89_btc_ntfy_role_info()
7549 r.chdef.chan = chan->primary_channel; in rtw89_btc_ntfy_role_info()
7550 ether_addr_copy(r.mac_addr, rtwvif->mac_addr); in rtw89_btc_ntfy_role_info()
7552 if (rtwsta && vif->type == NL80211_IFTYPE_STATION) in rtw89_btc_ntfy_role_info()
7553 r.mac_id = rtwsta->mac_id; in rtw89_btc_ntfy_role_info()
7555 btc->dm.cnt_notify[BTC_NCNT_ROLE_INFO]++; in rtw89_btc_ntfy_role_info()
7557 wlinfo = &wl->link_info[r.pid]; in rtw89_btc_ntfy_role_info()
7560 if (ver->fwlrole == 0) { in rtw89_btc_ntfy_role_info()
7563 } else if (ver->fwlrole == 1) { in rtw89_btc_ntfy_role_info()
7566 } else if (ver->fwlrole == 2) { in rtw89_btc_ntfy_role_info()
7569 } else if (ver->fwlrole == 7) { in rtw89_btc_ntfy_role_info()
7572 } else if (ver->fwlrole == 8) { in rtw89_btc_ntfy_role_info()
7573 wlinfo = &wl->rlink_info[r.pid][rlink_id]; in rtw89_btc_ntfy_role_info()
7575 link_mode_ori = wl->role_info_v8.link_mode; in rtw89_btc_ntfy_role_info()
7576 pta_req_mac_ori = wl->pta_req_mac; in rtw89_btc_ntfy_role_info()
7579 if (wl->role_info_v8.link_mode != link_mode_ori) { in rtw89_btc_ntfy_role_info()
7580 wl->role_info_v8.link_mode_chg = 1; in rtw89_btc_ntfy_role_info()
7581 if (ver->fcxinit == 7) in rtw89_btc_ntfy_role_info()
7582 wa_type = btc->mdinfo.md_v7.wa_type; in rtw89_btc_ntfy_role_info()
7584 wa_type = btc->mdinfo.md.wa_type; in rtw89_btc_ntfy_role_info()
7590 if (wl->pta_req_mac != pta_req_mac_ori) in rtw89_btc_ntfy_role_info()
7591 wl->pta_reg_mac_chg = 1; in rtw89_btc_ntfy_role_info()
7594 if (wlinfo->role == RTW89_WIFI_ROLE_STATION && in rtw89_btc_ntfy_role_info()
7595 wlinfo->connected == MLME_NO_LINK) in rtw89_btc_ntfy_role_info()
7596 btc->dm.leak_ap = 0; in rtw89_btc_ntfy_role_info()
7599 wl->status.map.connecting = 1; in rtw89_btc_ntfy_role_info()
7601 wl->status.map.connecting = 0; in rtw89_btc_ntfy_role_info()
7604 wl->status.map._4way = false; in rtw89_btc_ntfy_role_info()
7611 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_radio_state()
7612 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_radio_state()
7613 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_radio_state()
7618 btc->dm.cnt_notify[BTC_NCNT_RADIO_STATE]++; in rtw89_btc_ntfy_radio_state()
7622 wl->status.map.rf_off = 1; in rtw89_btc_ntfy_radio_state()
7623 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_radio_state()
7624 wl->status.map.busy = 0; in rtw89_btc_ntfy_radio_state()
7627 wl->status.map.rf_off = 0; in rtw89_btc_ntfy_radio_state()
7628 wl->status.map.lps = BTC_LPS_RF_OFF; in rtw89_btc_ntfy_radio_state()
7629 wl->status.map.busy = 0; in rtw89_btc_ntfy_radio_state()
7631 case BTC_RFCTRL_LPS_WL_ON: /* LPS-Protocol (RFon) */ in rtw89_btc_ntfy_radio_state()
7632 wl->status.map.rf_off = 0; in rtw89_btc_ntfy_radio_state()
7633 wl->status.map.lps = BTC_LPS_RF_ON; in rtw89_btc_ntfy_radio_state()
7634 wl->status.map.busy = 0; in rtw89_btc_ntfy_radio_state()
7638 wl->status.map.rf_off = 0; in rtw89_btc_ntfy_radio_state()
7639 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_radio_state()
7648 chip->ops->btc_init_cfg(rtwdev); in rtw89_btc_ntfy_radio_state()
7659 wl->status.map.lps_pre != BTC_LPS_OFF) in rtw89_btc_ntfy_radio_state()
7663 btc->dm.cnt_dm[BTC_DCNT_BTCNT_HANG] = 0; in rtw89_btc_ntfy_radio_state()
7664 btc->dm.tdma_instant_excute = 1; in rtw89_btc_ntfy_radio_state()
7667 wl->status.map.rf_off_pre = wl->status.map.rf_off; in rtw89_btc_ntfy_radio_state()
7668 wl->status.map.lps_pre = wl->status.map.lps; in rtw89_btc_ntfy_radio_state()
7675 struct rtw89_btc *btc = &rtwdev->btc; in _ntfy_wl_rfk()
7676 struct rtw89_btc_cx *cx = &btc->cx; in _ntfy_wl_rfk()
7677 struct rtw89_btc_wl_info *wl = &cx->wl; in _ntfy_wl_rfk()
7680 wl->rfk_info.type = type; in _ntfy_wl_rfk()
7681 wl->rfk_info.path_map = FIELD_GET(BTC_RFK_PATH_MAP, phy_path); in _ntfy_wl_rfk()
7682 wl->rfk_info.phy_map = FIELD_GET(BTC_RFK_PHY_MAP, phy_path); in _ntfy_wl_rfk()
7683 wl->rfk_info.band = FIELD_GET(BTC_RFK_BAND_MAP, phy_path); in _ntfy_wl_rfk()
7687 __func__, wl->rfk_info.phy_map, wl->rfk_info.path_map, in _ntfy_wl_rfk()
7693 wl->rfk_info.state = result ? BTC_WRFK_START : BTC_WRFK_STOP; in _ntfy_wl_rfk()
7697 btc->dm.cnt_notify[BTC_NCNT_WL_RFK]++; in _ntfy_wl_rfk()
7701 if (wl->rfk_info.state == BTC_WRFK_STOP) { in _ntfy_wl_rfk()
7705 wl->rfk_info.state = state; in _ntfy_wl_rfk()
7710 wl->rfk_info.state = BTC_WRFK_STOP; in _ntfy_wl_rfk()
7713 cancel_delayed_work(&rtwdev->coex_rfk_chk_work); in _ntfy_wl_rfk()
7722 if (wl->rfk_info.state == BTC_WRFK_START || in _ntfy_wl_rfk()
7723 wl->rfk_info.state == BTC_WRFK_STOP) in _ntfy_wl_rfk()
7726 if (wl->rfk_info.state == BTC_WRFK_START) in _ntfy_wl_rfk()
7727 ieee80211_queue_delayed_work(rtwdev->hw, in _ntfy_wl_rfk()
7728 &rtwdev->coex_rfk_chk_work, in _ntfy_wl_rfk()
7734 __func__, btc->dm.cnt_notify[BTC_NCNT_WL_RFK], result); in _ntfy_wl_rfk()
7758 state == BTC_WRFK_ONESHOT_START ? "ONE-SHOT_START" : in rtw89_btc_ntfy_wl_rfk()
7759 "ONE-SHOT_STOP"); in rtw89_btc_ntfy_wl_rfk()
7761 if (state != BTC_WRFK_START || rtwdev->is_bt_iqk_timeout) { in rtw89_btc_ntfy_wl_rfk()
7770 rtwdev->is_bt_iqk_timeout = true; in rtw89_btc_ntfy_wl_rfk()
7788 struct rtw89_dev *rtwdev = iter_data->rtwdev; in rtw89_btc_ntfy_wl_sta_iter()
7789 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_wl_sta_iter()
7790 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_ntfy_wl_sta_iter()
7791 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_ntfy_wl_sta_iter()
7792 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_wl_sta_iter()
7794 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; in rtw89_btc_ntfy_wl_sta_iter()
7796 struct rtw89_vif *rtwvif = rtwsta->rtwvif; in rtw89_btc_ntfy_wl_sta_iter()
7797 struct rtw89_traffic_stats *stats = &rtwvif->stats; in rtw89_btc_ntfy_wl_sta_iter()
7798 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_wl_sta_iter()
7803 u8 port = rtwvif->port; in rtw89_btc_ntfy_wl_sta_iter()
7811 rssi = ewma_rssi_read(&rtwsta->avg_rssi) >> RSSI_FACTOR; in rtw89_btc_ntfy_wl_sta_iter()
7814 link_info = &wl->link_info[port]; in rtw89_btc_ntfy_wl_sta_iter()
7815 link_info->stat.traffic = rtwvif->stats; in rtw89_btc_ntfy_wl_sta_iter()
7816 link_info_t = &link_info->stat.traffic; in rtw89_btc_ntfy_wl_sta_iter()
7818 if (link_info->connected == MLME_NO_LINK) { in rtw89_btc_ntfy_wl_sta_iter()
7819 link_info->rx_rate_drop_cnt = 0; in rtw89_btc_ntfy_wl_sta_iter()
7823 link_info->stat.rssi = rssi; in rtw89_btc_ntfy_wl_sta_iter()
7825 link_info->rssi_state[i] = in rtw89_btc_ntfy_wl_sta_iter()
7827 link_info->rssi_state[i], in rtw89_btc_ntfy_wl_sta_iter()
7828 link_info->stat.rssi, in rtw89_btc_ntfy_wl_sta_iter()
7829 chip->wl_rssi_thres[i]); in rtw89_btc_ntfy_wl_sta_iter()
7830 if (BTC_RSSI_LOW(link_info->rssi_state[i])) in rtw89_btc_ntfy_wl_sta_iter()
7833 if (btc->ant_type == BTC_ANT_DEDICATED && in rtw89_btc_ntfy_wl_sta_iter()
7834 BTC_RSSI_CHANGE(link_info->rssi_state[i])) in rtw89_btc_ntfy_wl_sta_iter()
7837 iter_data->rssi_map_all |= rssi_map; in rtw89_btc_ntfy_wl_sta_iter()
7839 last_tx_rate = link_info_t->tx_rate; in rtw89_btc_ntfy_wl_sta_iter()
7840 last_rx_rate = link_info_t->rx_rate; in rtw89_btc_ntfy_wl_sta_iter()
7841 last_tx_lvl = (u16)link_info_t->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7842 last_rx_lvl = (u16)link_info_t->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7844 if (stats->tx_tfc_lv != RTW89_TFC_IDLE || in rtw89_btc_ntfy_wl_sta_iter()
7845 stats->rx_tfc_lv != RTW89_TFC_IDLE) in rtw89_btc_ntfy_wl_sta_iter()
7848 if (stats->tx_tfc_lv > stats->rx_tfc_lv) in rtw89_btc_ntfy_wl_sta_iter()
7853 link_info = &wl->link_info[port]; in rtw89_btc_ntfy_wl_sta_iter()
7854 if (link_info->busy != busy || link_info->dir != dir) { in rtw89_btc_ntfy_wl_sta_iter()
7856 link_info->busy = busy; in rtw89_btc_ntfy_wl_sta_iter()
7857 link_info->dir = dir; in rtw89_btc_ntfy_wl_sta_iter()
7860 iter_data->busy_all |= busy; in rtw89_btc_ntfy_wl_sta_iter()
7861 iter_data->dir_all |= BIT(dir); in rtw89_btc_ntfy_wl_sta_iter()
7863 if (rtwsta->rx_hw_rate <= RTW89_HW_RATE_CCK2 && in rtw89_btc_ntfy_wl_sta_iter()
7865 link_info_t->rx_tfc_lv > RTW89_TFC_IDLE) in rtw89_btc_ntfy_wl_sta_iter()
7866 link_info->rx_rate_drop_cnt++; in rtw89_btc_ntfy_wl_sta_iter()
7868 if (last_tx_rate != rtwsta->ra_report.hw_rate || in rtw89_btc_ntfy_wl_sta_iter()
7869 last_rx_rate != rtwsta->rx_hw_rate || in rtw89_btc_ntfy_wl_sta_iter()
7870 last_tx_lvl != link_info_t->tx_tfc_lv || in rtw89_btc_ntfy_wl_sta_iter()
7871 last_rx_lvl != link_info_t->rx_tfc_lv) in rtw89_btc_ntfy_wl_sta_iter()
7874 link_info_t->tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7875 link_info_t->rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7877 if (link_info->role == RTW89_WIFI_ROLE_STATION || in rtw89_btc_ntfy_wl_sta_iter()
7878 link_info->role == RTW89_WIFI_ROLE_P2P_CLIENT) { in rtw89_btc_ntfy_wl_sta_iter()
7879 dm->trx_info.tx_rate = link_info_t->tx_rate; in rtw89_btc_ntfy_wl_sta_iter()
7880 dm->trx_info.rx_rate = link_info_t->rx_rate; in rtw89_btc_ntfy_wl_sta_iter()
7883 if (ver->fwlrole == 0) { in rtw89_btc_ntfy_wl_sta_iter()
7884 r = &wl->role_info; in rtw89_btc_ntfy_wl_sta_iter()
7885 r->active_role[port].tx_lvl = stats->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7886 r->active_role[port].rx_lvl = stats->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7887 r->active_role[port].tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7888 r->active_role[port].rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7889 } else if (ver->fwlrole == 1) { in rtw89_btc_ntfy_wl_sta_iter()
7890 r1 = &wl->role_info_v1; in rtw89_btc_ntfy_wl_sta_iter()
7891 r1->active_role_v1[port].tx_lvl = stats->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7892 r1->active_role_v1[port].rx_lvl = stats->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7893 r1->active_role_v1[port].tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7894 r1->active_role_v1[port].rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7895 } else if (ver->fwlrole == 2) { in rtw89_btc_ntfy_wl_sta_iter()
7896 dm->trx_info.tx_lvl = stats->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7897 dm->trx_info.rx_lvl = stats->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
7898 dm->trx_info.tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7899 dm->trx_info.rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
7902 dm->trx_info.tx_tp = link_info_t->tx_throughput; in rtw89_btc_ntfy_wl_sta_iter()
7903 dm->trx_info.rx_tp = link_info_t->rx_throughput; in rtw89_btc_ntfy_wl_sta_iter()
7905 /* Trigger coex-run if 0x10980 reg-value is diff with coex setup */ in rtw89_btc_ntfy_wl_sta_iter()
7906 if ((dm->wl_btg_rx_rb != dm->wl_btg_rx && in rtw89_btc_ntfy_wl_sta_iter()
7907 dm->wl_btg_rx_rb != BTC_BTGCTRL_BB_GNT_NOTFOUND) || in rtw89_btc_ntfy_wl_sta_iter()
7908 (dm->wl_pre_agc_rb != dm->wl_pre_agc && in rtw89_btc_ntfy_wl_sta_iter()
7909 dm->wl_pre_agc_rb != BTC_PREAGC_NOTFOUND)) in rtw89_btc_ntfy_wl_sta_iter()
7910 iter_data->is_sta_change = true; in rtw89_btc_ntfy_wl_sta_iter()
7913 iter_data->is_sta_change = true; in rtw89_btc_ntfy_wl_sta_iter()
7916 iter_data->is_traffic_change = true; in rtw89_btc_ntfy_wl_sta_iter()
7923 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_wl_sta()
7924 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_ntfy_wl_sta()
7925 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_wl_sta()
7929 ieee80211_iterate_stations_atomic(rtwdev->hw, in rtw89_btc_ntfy_wl_sta()
7933 wl->rssi_level = 0; in rtw89_btc_ntfy_wl_sta()
7934 btc->dm.cnt_notify[BTC_NCNT_WL_STA]++; in rtw89_btc_ntfy_wl_sta()
7935 for (i = BTC_WL_RSSI_THMAX; i > 0; i--) { in rtw89_btc_ntfy_wl_sta()
7937 if (data.rssi_map_all & BIT(i - 1)) { in rtw89_btc_ntfy_wl_sta()
7938 wl->rssi_level = i; in rtw89_btc_ntfy_wl_sta()
7943 if (dm->trx_info.wl_rssi != wl->rssi_level) in rtw89_btc_ntfy_wl_sta()
7944 dm->trx_info.wl_rssi = wl->rssi_level; in rtw89_btc_ntfy_wl_sta()
7947 __func__, !!wl->status.map.busy); in rtw89_btc_ntfy_wl_sta()
7949 _write_scbd(rtwdev, BTC_WSCB_WLBUSY, (!!wl->status.map.busy)); in rtw89_btc_ntfy_wl_sta()
7954 wl->status.map.busy = data.busy_all; in rtw89_btc_ntfy_wl_sta()
7955 wl->status.map.traffic_dir = data.dir_all; in rtw89_btc_ntfy_wl_sta()
7957 } else if (btc->dm.cnt_notify[BTC_NCNT_WL_STA] >= in rtw89_btc_ntfy_wl_sta()
7958 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] + BTC_NHM_CHK_INTVL) { in rtw89_btc_ntfy_wl_sta()
7959 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] = in rtw89_btc_ntfy_wl_sta()
7960 btc->dm.cnt_notify[BTC_NCNT_WL_STA]; in rtw89_btc_ntfy_wl_sta()
7961 } else if (btc->dm.cnt_notify[BTC_NCNT_WL_STA] < in rtw89_btc_ntfy_wl_sta()
7962 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST]) { in rtw89_btc_ntfy_wl_sta()
7963 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] = in rtw89_btc_ntfy_wl_sta()
7964 btc->dm.cnt_notify[BTC_NCNT_WL_STA]; in rtw89_btc_ntfy_wl_sta()
7971 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_c2h_handle()
7972 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in rtw89_btc_c2h_handle()
7973 u8 *buf = &skb->data[RTW89_C2H_HEADER_LEN]; in rtw89_btc_c2h_handle()
7975 len -= RTW89_C2H_HEADER_LEN; in rtw89_btc_c2h_handle()
7987 pfwinfo->event[func]++; in rtw89_btc_c2h_handle()
7994 btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE]++; in rtw89_btc_c2h_handle()
8000 btc->cx.cnt_bt[BTC_BCNT_SCBDUPDATE]++; in rtw89_btc_c2h_handle()
8006 btc->dbg.rb_done = true; in rtw89_btc_c2h_handle()
8007 btc->dbg.rb_val = le32_to_cpu(*((__le32 *)buf)); in rtw89_btc_c2h_handle()
8011 btc->dbg.rb_done = true; in rtw89_btc_c2h_handle()
8012 btc->dbg.rb_val = buf[0]; in rtw89_btc_c2h_handle()
8015 btc->dm.cnt_dm[BTC_DCNT_CX_RUNINFO]++; in rtw89_btc_c2h_handle()
8024 union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo; in _show_cx_info()
8025 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_cx_info()
8026 const struct rtw89_btc_ver *ver = rtwdev->btc.ver; in _show_cx_info()
8027 struct rtw89_hal *hal = &rtwdev->hal; in _show_cx_info()
8028 struct rtw89_btc *btc = &rtwdev->btc; in _show_cx_info()
8029 struct rtw89_btc_dm *dm = &btc->dm; in _show_cx_info()
8030 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_cx_info()
8031 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_cx_info()
8035 if (!(dm->coex_info_map & BTC_COEX_INFO_CX)) in _show_cx_info()
8038 dm->cnt_notify[BTC_NCNT_SHOW_COEX_INFO]++; in _show_cx_info()
8041 chip->chip_id); in _show_cx_info()
8047 seq_printf(m, " %-15s : Coex:%d.%d.%d(branch:%d), ", in _show_cx_info()
8050 ver_main = FIELD_GET(GENMASK(31, 24), wl->ver_info.fw_coex); in _show_cx_info()
8051 ver_sub = FIELD_GET(GENMASK(23, 16), wl->ver_info.fw_coex); in _show_cx_info()
8052 ver_hotfix = FIELD_GET(GENMASK(15, 8), wl->ver_info.fw_coex); in _show_cx_info()
8053 id_branch = FIELD_GET(GENMASK(7, 0), wl->ver_info.fw_coex); in _show_cx_info()
8057 ver_main = FIELD_GET(GENMASK(31, 24), chip->wlcx_desired); in _show_cx_info()
8058 ver_sub = FIELD_GET(GENMASK(23, 16), chip->wlcx_desired); in _show_cx_info()
8059 ver_hotfix = FIELD_GET(GENMASK(15, 8), chip->wlcx_desired); in _show_cx_info()
8061 (wl->ver_info.fw_coex >= chip->wlcx_desired ? in _show_cx_info()
8065 bt->ver_info.fw_coex, in _show_cx_info()
8066 (bt->ver_info.fw_coex >= chip->btcx_desired ? in _show_cx_info()
8067 "Match" : "Mismatch"), chip->btcx_desired); in _show_cx_info()
8069 if (bt->enable.now && bt->ver_info.fw == 0) in _show_cx_info()
8074 ver_main = FIELD_GET(GENMASK(31, 24), wl->ver_info.fw); in _show_cx_info()
8075 ver_sub = FIELD_GET(GENMASK(23, 16), wl->ver_info.fw); in _show_cx_info()
8076 ver_hotfix = FIELD_GET(GENMASK(15, 8), wl->ver_info.fw); in _show_cx_info()
8077 id_branch = FIELD_GET(GENMASK(7, 0), wl->ver_info.fw); in _show_cx_info()
8078 seq_printf(m, " %-15s : WL_FW:%d.%d.%d.%d, BT_FW:0x%x(%s)\n", in _show_cx_info()
8081 bt->ver_info.fw, bt->run_patch_code ? "patch" : "ROM"); in _show_cx_info()
8083 if (ver->fcxinit == 7) { in _show_cx_info()
8084 cv = md->md_v7.kt_ver; in _show_cx_info()
8085 rfe = md->md_v7.rfe_type; in _show_cx_info()
8086 iso = md->md_v7.ant.isolation; in _show_cx_info()
8087 ant_num = md->md_v7.ant.num; in _show_cx_info()
8088 ant_single_pos = md->md_v7.ant.single_pos; in _show_cx_info()
8090 cv = md->md.cv; in _show_cx_info()
8091 rfe = md->md.rfe_type; in _show_cx_info()
8092 iso = md->md.ant.isolation; in _show_cx_info()
8093 ant_num = md->md.ant.num; in _show_cx_info()
8094 ant_single_pos = md->md.ant.single_pos; in _show_cx_info()
8097 seq_printf(m, " %-15s : cv:%x, rfe_type:0x%x, ant_iso:%d, ant_pg:%d, %s", in _show_cx_info()
8103 btc->cx.other.type, rtwdev->dbcc_en, hal->tx_nss, in _show_cx_info()
8104 hal->rx_nss); in _show_cx_info()
8109 struct rtw89_btc *btc = &rtwdev->btc; in _show_wl_role_info()
8111 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_wl_role_info()
8112 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _show_wl_role_info()
8116 if (rtwdev->dbcc_en) { in _show_wl_role_info()
8118 " %-15s : PHY0_band(op:%d/scan:%d/real:%d), ", in _show_wl_role_info()
8119 "[dbcc_info]", wl_dinfo->op_band[RTW89_PHY_0], in _show_wl_role_info()
8120 wl_dinfo->scan_band[RTW89_PHY_0], in _show_wl_role_info()
8121 wl_dinfo->real_band[RTW89_PHY_0]); in _show_wl_role_info()
8124 wl_dinfo->op_band[RTW89_PHY_1], in _show_wl_role_info()
8125 wl_dinfo->scan_band[RTW89_PHY_1], in _show_wl_role_info()
8126 wl_dinfo->real_band[RTW89_PHY_1]); in _show_wl_role_info()
8130 if (btc->ver->fwlrole == 8) in _show_wl_role_info()
8131 plink = &btc->cx.wl.rlink_info[i][0]; in _show_wl_role_info()
8133 plink = &btc->cx.wl.link_info[i]; in _show_wl_role_info()
8135 if (!plink->active) in _show_wl_role_info()
8139 … " [port_%d] : role=%d(phy-%d), connect=%d(client_cnt=%d), mode=%d, center_ch=%d, bw=%d", in _show_wl_role_info()
8140 plink->pid, (u32)plink->role, plink->phy, in _show_wl_role_info()
8141 (u32)plink->connected, plink->client_cnt - 1, in _show_wl_role_info()
8142 (u32)plink->mode, plink->ch, (u32)plink->bw); in _show_wl_role_info()
8144 if (plink->connected == MLME_NO_LINK) in _show_wl_role_info()
8149 plink->mac_id, plink->tx_time, plink->tx_retry); in _show_wl_role_info()
8152 " [port_%d] : rssi=-%ddBm(%d), busy=%d, dir=%s, ", in _show_wl_role_info()
8153 plink->pid, 110 - plink->stat.rssi, in _show_wl_role_info()
8154 plink->stat.rssi, plink->busy, in _show_wl_role_info()
8155 plink->dir == RTW89_TFC_UL ? "UL" : "DL"); in _show_wl_role_info()
8157 t = &plink->stat.traffic; in _show_wl_role_info()
8161 (u32)t->tx_rate, t->tx_tfc_lv); in _show_wl_role_info()
8164 (u32)t->rx_rate, in _show_wl_role_info()
8165 t->rx_tfc_lv, plink->rx_rate_drop_cnt); in _show_wl_role_info()
8171 struct rtw89_btc *btc = &rtwdev->btc; in _show_wl_info()
8172 const struct rtw89_btc_ver *ver = btc->ver; in _show_wl_info()
8173 struct rtw89_btc_cx *cx = &btc->cx; in _show_wl_info()
8174 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_wl_info()
8175 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _show_wl_info()
8176 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _show_wl_info()
8177 struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; in _show_wl_info()
8178 struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7; in _show_wl_info()
8179 struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; in _show_wl_info()
8182 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_WL)) in _show_wl_info()
8187 if (ver->fwlrole == 0) in _show_wl_info()
8188 mode = wl_rinfo->link_mode; in _show_wl_info()
8189 else if (ver->fwlrole == 1) in _show_wl_info()
8190 mode = wl_rinfo_v1->link_mode; in _show_wl_info()
8191 else if (ver->fwlrole == 2) in _show_wl_info()
8192 mode = wl_rinfo_v2->link_mode; in _show_wl_info()
8193 else if (ver->fwlrole == 7) in _show_wl_info()
8194 mode = wl_rinfo_v7->link_mode; in _show_wl_info()
8195 else if (ver->fwlrole == 8) in _show_wl_info()
8196 mode = wl_rinfo_v8->link_mode; in _show_wl_info()
8200 seq_printf(m, " %-15s : link_mode:%d, ", "[status]", mode); in _show_wl_info()
8204 wl->status.map.rf_off, wl->status.map.lps, in _show_wl_info()
8205 wl->status.map.scan ? "Y" : "N", in _show_wl_info()
8206 wl->scan_info.band[RTW89_PHY_0], wl->scan_info.phy_map); in _show_wl_info()
8210 wl->status.map.connecting ? "Y" : "N", in _show_wl_info()
8211 wl->status.map.roaming ? "Y" : "N", in _show_wl_info()
8212 wl->status.map._4way ? "Y" : "N", in _show_wl_info()
8213 wl->status.map.init_ok ? "Y" : "N"); in _show_wl_info()
8226 struct rtw89_btc *btc = &rtwdev->btc; in _show_bt_profile_info()
8227 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _show_bt_profile_info()
8228 struct rtw89_btc_bt_hfp_desc hfp = bt_linfo->hfp_desc; in _show_bt_profile_info()
8229 struct rtw89_btc_bt_hid_desc hid = bt_linfo->hid_desc; in _show_bt_profile_info()
8230 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _show_bt_profile_info()
8231 struct rtw89_btc_bt_pan_desc pan = bt_linfo->pan_desc; in _show_bt_profile_info()
8234 seq_printf(m, " %-15s : type:%s, sut_pwr:%d, golden-rx:%d", in _show_bt_profile_info()
8236 bt_linfo->sut_pwr_level[0], in _show_bt_profile_info()
8237 bt_linfo->golden_rx_shift[0]); in _show_bt_profile_info()
8242 "\n\r %-15s : type:%s%s%s%s%s pair-cnt:%d, sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
8248 hid.type & BTC_HID_RCU_VOICE ? "RCU-Voice," : "", in _show_bt_profile_info()
8249 hid.pair_cnt, bt_linfo->sut_pwr_level[1], in _show_bt_profile_info()
8250 bt_linfo->golden_rx_shift[1]); in _show_bt_profile_info()
8255 " %-15s : type:%s, bit-pool:%d, flush-time:%d, ", in _show_bt_profile_info()
8261 "vid:0x%x, Dev-name:0x%x, sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
8263 bt_linfo->sut_pwr_level[2], in _show_bt_profile_info()
8264 bt_linfo->golden_rx_shift[2]); in _show_bt_profile_info()
8268 seq_printf(m, " %-15s : sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
8270 bt_linfo->sut_pwr_level[3], in _show_bt_profile_info()
8271 bt_linfo->golden_rx_shift[3]); in _show_bt_profile_info()
8277 struct rtw89_btc *btc = &rtwdev->btc; in _show_bt_info()
8278 const struct rtw89_btc_ver *ver = btc->ver; in _show_bt_info()
8279 struct rtw89_btc_cx *cx = &btc->cx; in _show_bt_info()
8280 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_bt_info()
8281 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_bt_info()
8282 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _show_bt_info()
8283 union rtw89_btc_module_info *md = &btc->mdinfo; in _show_bt_info()
8284 u8 *afh = bt_linfo->afh_map; in _show_bt_info()
8285 u8 *afh_le = bt_linfo->afh_map_le; in _show_bt_info()
8288 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_BT)) in _show_bt_info()
8291 if (ver->fcxinit == 7) in _show_bt_info()
8292 bt_pos = md->md_v7.bt_pos; in _show_bt_info()
8294 bt_pos = md->md.bt_pos; in _show_bt_info()
8298 seq_printf(m, " %-15s : enable:%s, btg:%s%s, connect:%s, ", in _show_bt_info()
8299 "[status]", bt->enable.now ? "Y" : "N", in _show_bt_info()
8300 bt->btg_type ? "Y" : "N", in _show_bt_info()
8301 (bt->enable.now && (bt->btg_type != bt_pos) ? in _show_bt_info()
8302 "(efuse-mismatch!!)" : ""), in _show_bt_info()
8303 (bt_linfo->status.map.connect ? "Y" : "N")); in _show_bt_info()
8306 bt->igno_wl ? "Y" : "N", in _show_bt_info()
8307 bt->mbx_avl ? "Y" : "N", bt->rfk_info.val); in _show_bt_info()
8309 seq_printf(m, " %-15s : profile:%s%s%s%s%s ", in _show_bt_info()
8311 (bt_linfo->profile_cnt.now == 0) ? "None," : "", in _show_bt_info()
8312 bt_linfo->hfp_desc.exist ? "HFP," : "", in _show_bt_info()
8313 bt_linfo->hid_desc.exist ? "HID," : "", in _show_bt_info()
8314 bt_linfo->a2dp_desc.exist ? in _show_bt_info()
8315 (bt_linfo->a2dp_desc.sink ? "A2DP_sink," : "A2DP,") : "", in _show_bt_info()
8316 bt_linfo->pan_desc.exist ? "PAN," : ""); in _show_bt_info()
8319 "multi-link:%s, role:%s, ble-connect:%s, CQDDR:%s, A2DP_active:%s, PAN_active:%s\n", in _show_bt_info()
8320 bt_linfo->multi_link.now ? "Y" : "N", in _show_bt_info()
8321 bt_linfo->slave_role ? "Slave" : "Master", in _show_bt_info()
8322 bt_linfo->status.map.ble_connect ? "Y" : "N", in _show_bt_info()
8323 bt_linfo->cqddr ? "Y" : "N", in _show_bt_info()
8324 bt_linfo->a2dp_desc.active ? "Y" : "N", in _show_bt_info()
8325 bt_linfo->pan_desc.active ? "Y" : "N"); in _show_bt_info()
8328 " %-15s : rssi:%ddBm(lvl:%d), tx_rate:%dM, %s%s%s", in _show_bt_info()
8329 "[link]", bt_linfo->rssi - 100, in _show_bt_info()
8330 bt->rssi_level, in _show_bt_info()
8331 bt_linfo->tx_3m ? 3 : 2, in _show_bt_info()
8332 bt_linfo->status.map.inq_pag ? " inq-page!!" : "", in _show_bt_info()
8333 bt_linfo->status.map.acl_busy ? " acl_busy!!" : "", in _show_bt_info()
8334 bt_linfo->status.map.mesh_busy ? " mesh_busy!!" : ""); in _show_bt_info()
8338 bt_linfo->relink.now ? " ReLink!!" : "", in _show_bt_info()
8342 if (ver->fcxbtafh == 2 && bt_linfo->status.map.ble_connect) in _show_bt_info()
8348 seq_printf(m, "wl_ch_map[en:%d/ch:%d/bw:%d]\n", in _show_bt_info()
8349 wl->afh_info.en, wl->afh_info.ch, wl->afh_info.bw); in _show_bt_info()
8352 " %-15s : retry:%d, relink:%d, rate_chg:%d, reinit:%d, reenable:%d, ", in _show_bt_info()
8353 "[stat_cnt]", cx->cnt_bt[BTC_BCNT_RETRY], in _show_bt_info()
8354 cx->cnt_bt[BTC_BCNT_RELINK], cx->cnt_bt[BTC_BCNT_RATECHG], in _show_bt_info()
8355 cx->cnt_bt[BTC_BCNT_REINIT], cx->cnt_bt[BTC_BCNT_REENABLE]); in _show_bt_info()
8358 "role-switch:%d, afh:%d, inq_page:%d(inq:%d/page:%d), igno_wl:%d\n", in _show_bt_info()
8359 cx->cnt_bt[BTC_BCNT_ROLESW], cx->cnt_bt[BTC_BCNT_AFH], in _show_bt_info()
8360 cx->cnt_bt[BTC_BCNT_INQPAG], cx->cnt_bt[BTC_BCNT_INQ], in _show_bt_info()
8361 cx->cnt_bt[BTC_BCNT_PAGE], cx->cnt_bt[BTC_BCNT_IGNOWL]); in _show_bt_info()
8366 " %-15s : raw_data[%02x %02x %02x %02x %02x %02x] (type:%s/cnt:%d/same:%d)\n", in _show_bt_info()
8367 "[bt_info]", bt->raw_info[2], bt->raw_info[3], in _show_bt_info()
8368 bt->raw_info[4], bt->raw_info[5], bt->raw_info[6], in _show_bt_info()
8369 bt->raw_info[7], in _show_bt_info()
8370 bt->raw_info[0] == BTC_BTINFO_AUTO ? "auto" : "reply", in _show_bt_info()
8371 cx->cnt_bt[BTC_BCNT_INFOUPDATE], in _show_bt_info()
8372 cx->cnt_bt[BTC_BCNT_INFOSAME]); in _show_bt_info()
8375 " %-15s : Hi-rx = %d, Hi-tx = %d, Lo-rx = %d, Lo-tx = %d (bt_polut_wl_tx = %d)", in _show_bt_info()
8376 "[trx_req_cnt]", cx->cnt_bt[BTC_BCNT_HIPRI_RX], in _show_bt_info()
8377 cx->cnt_bt[BTC_BCNT_HIPRI_TX], cx->cnt_bt[BTC_BCNT_LOPRI_RX], in _show_bt_info()
8378 cx->cnt_bt[BTC_BCNT_LOPRI_TX], cx->cnt_bt[BTC_BCNT_POLUT]); in _show_bt_info()
8380 if (!bt->scan_info_update) { in _show_bt_info()
8385 if (ver->fcxbtscan == 1) { in _show_bt_info()
8387 "(INQ:%d-%d/PAGE:%d-%d/LE:%d-%d/INIT:%d-%d)", in _show_bt_info()
8388 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_INQ].win), in _show_bt_info()
8389 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_INQ].intvl), in _show_bt_info()
8390 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_PAGE].win), in _show_bt_info()
8391 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_PAGE].intvl), in _show_bt_info()
8392 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_BLE].win), in _show_bt_info()
8393 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_BLE].intvl), in _show_bt_info()
8394 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_INIT].win), in _show_bt_info()
8395 le16_to_cpu(bt->scan_info_v1[BTC_SCAN_INIT].intvl)); in _show_bt_info()
8396 } else if (ver->fcxbtscan == 2) { in _show_bt_info()
8398 "(BG:%d-%d/INIT:%d-%d/LE:%d-%d)", in _show_bt_info()
8399 le16_to_cpu(bt->scan_info_v2[CXSCAN_BG].win), in _show_bt_info()
8400 le16_to_cpu(bt->scan_info_v2[CXSCAN_BG].intvl), in _show_bt_info()
8401 le16_to_cpu(bt->scan_info_v2[CXSCAN_INIT].win), in _show_bt_info()
8402 le16_to_cpu(bt->scan_info_v2[CXSCAN_INIT].intvl), in _show_bt_info()
8403 le16_to_cpu(bt->scan_info_v2[CXSCAN_LE].win), in _show_bt_info()
8404 le16_to_cpu(bt->scan_info_v2[CXSCAN_LE].intvl)); in _show_bt_info()
8409 if (bt_linfo->profile_cnt.now || bt_linfo->status.map.ble_connect) in _show_bt_info()
8414 if (ver->fcxbtafh == 2 && bt_linfo->status.map.ble_connect) in _show_bt_info()
8419 if (bt_linfo->a2dp_desc.exist && in _show_bt_info()
8420 (bt_linfo->a2dp_desc.flush_time == 0 || in _show_bt_info()
8421 bt_linfo->a2dp_desc.vendor_id == 0 || in _show_bt_info()
8422 bt_linfo->a2dp_desc.play_latency == 1)) in _show_bt_info()
8727 seq_printf(m, " %-15s : ", prefix); in seq_print_segment()
8730 seq_printf(m, "-> %-20s", in seq_print_segment()
8733 seq_printf(m, "-> %-15s", in seq_print_segment()
8736 seq_printf(m, "-> %-13s", in seq_print_segment()
8738 if (i == (len - 1) || (i % seg_len) == (seg_len - 1)) in seq_print_segment()
8745 struct rtw89_btc *btc = &rtwdev->btc; in _show_dm_step()
8746 struct rtw89_btc_dm *dm = &btc->dm; in _show_dm_step()
8750 len = dm->dm_step.step_ov ? RTW89_BTC_DM_MAXSTEP : dm->dm_step.step_pos; in _show_dm_step()
8751 start_idx = dm->dm_step.step_ov ? dm->dm_step.step_pos : 0; in _show_dm_step()
8753 seq_print_segment(m, "[dm_steps]", dm->dm_step.step, len, 6, start_idx, in _show_dm_step()
8754 ARRAY_SIZE(dm->dm_step.step)); in _show_dm_step()
8759 struct rtw89_btc *btc = &rtwdev->btc; in _show_dm_info()
8760 const struct rtw89_btc_ver *ver = btc->ver; in _show_dm_info()
8761 struct rtw89_btc_dm *dm = &btc->dm; in _show_dm_info()
8762 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_dm_info()
8763 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_dm_info()
8766 if (!(dm->coex_info_map & BTC_COEX_INFO_DM)) in _show_dm_info()
8770 (btc->manual_ctrl ? "(Manual)" : "(Auto)")); in _show_dm_info()
8773 " %-15s : type:%s, reason:%s(), action:%s(), ant_path:%s, init_mode:%s, run_cnt:%d\n", in _show_dm_info()
8775 btc->ant_type == BTC_ANT_SHARED ? "shared" : "dedicated", in _show_dm_info()
8776 steps_to_str(dm->run_reason), in _show_dm_info()
8777 steps_to_str(dm->run_action | BTC_ACT_EXT_BIT), in _show_dm_info()
8778 id_to_ant(FIELD_GET(GENMASK(7, 0), dm->set_ant_path)), in _show_dm_info()
8779 id_to_mode(wl->coex_mode), in _show_dm_info()
8780 dm->cnt_dm[BTC_DCNT_RUN]); in _show_dm_info()
8784 if (ver->fcxctrl == 7) in _show_dm_info()
8785 igno_bt = btc->ctrl.ctrl_v7.igno_bt; in _show_dm_info()
8787 igno_bt = btc->ctrl.ctrl.igno_bt; in _show_dm_info()
8789 …seq_printf(m, " %-15s : wl_only:%d, bt_only:%d, igno_bt:%d, free_run:%d, wl_ps_ctrl:%d, wl_mimo_ps… in _show_dm_info()
8790 "[dm_flag]", dm->wl_only, dm->bt_only, igno_bt, in _show_dm_info()
8791 dm->freerun, btc->lps, dm->wl_mimo_ps); in _show_dm_info()
8793 seq_printf(m, "leak_ap:%d, fw_offload:%s%s\n", dm->leak_ap, in _show_dm_info()
8795 (dm->wl_fw_cx_offload == BTC_CX_FW_OFFLOAD ? in _show_dm_info()
8798 if (dm->rf_trx_para.wl_tx_power == 0xff) in _show_dm_info()
8800 " %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:orig, ", in _show_dm_info()
8801 "[trx_ctrl]", wl->rssi_level, dm->trx_para_level); in _show_dm_info()
8805 " %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:%d, ", in _show_dm_info()
8806 "[trx_ctrl]", wl->rssi_level, dm->trx_para_level, in _show_dm_info()
8807 dm->rf_trx_para.wl_tx_power); in _show_dm_info()
8810 "wl_rx_lvl:%d, bt_tx_pwr_dec:%d, bt_rx_lna:%d(%s-tbl), wl_btg_rx:%d\n", in _show_dm_info()
8811 dm->rf_trx_para.wl_rx_gain, dm->rf_trx_para.bt_tx_power, in _show_dm_info()
8812 dm->rf_trx_para.bt_rx_gain, in _show_dm_info()
8813 (bt->hi_lna_rx ? "Hi" : "Ori"), dm->wl_btg_rx); in _show_dm_info()
8816 … " %-15s : wl_tx_limit[en:%d/max_t:%dus/max_retry:%d], bt_slot_reg:%d-TU, bt_scan_rx_low_pri:%d\n", in _show_dm_info()
8817 "[dm_ctrl]", dm->wl_tx_limit.enable, dm->wl_tx_limit.tx_time, in _show_dm_info()
8818 dm->wl_tx_limit.tx_retry, btc->bt_req_len, bt->scan_rx_low_pri); in _show_dm_info()
8823 struct rtw89_btc *btc = &rtwdev->btc; in _show_error()
8824 const struct rtw89_btc_ver *ver = btc->ver; in _show_error()
8825 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_error()
8829 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo; in _show_error()
8830 if (ver->fcxcysta == 2) { in _show_error()
8831 pcysta->v2 = pfwinfo->rpt_fbtc_cysta.finfo.v2; in _show_error()
8832 except_cnt = le32_to_cpu(pcysta->v2.except_cnt); in _show_error()
8833 exception_map = le32_to_cpu(pcysta->v2.exception); in _show_error()
8834 } else if (ver->fcxcysta == 3) { in _show_error()
8835 pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3; in _show_error()
8836 except_cnt = le32_to_cpu(pcysta->v3.except_cnt); in _show_error()
8837 exception_map = le32_to_cpu(pcysta->v3.except_map); in _show_error()
8838 } else if (ver->fcxcysta == 4) { in _show_error()
8839 pcysta->v4 = pfwinfo->rpt_fbtc_cysta.finfo.v4; in _show_error()
8840 except_cnt = pcysta->v4.except_cnt; in _show_error()
8841 exception_map = le32_to_cpu(pcysta->v4.except_map); in _show_error()
8842 } else if (ver->fcxcysta == 5) { in _show_error()
8843 pcysta->v5 = pfwinfo->rpt_fbtc_cysta.finfo.v5; in _show_error()
8844 except_cnt = pcysta->v5.except_cnt; in _show_error()
8845 exception_map = le32_to_cpu(pcysta->v5.except_map); in _show_error()
8846 } else if (ver->fcxcysta == 7) { in _show_error()
8847 pcysta->v7 = pfwinfo->rpt_fbtc_cysta.finfo.v7; in _show_error()
8848 except_cnt = pcysta->v7.except_cnt; in _show_error()
8849 exception_map = le32_to_cpu(pcysta->v7.except_map); in _show_error()
8854 if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW] == 0 && except_cnt == 0 && in _show_error()
8855 !pfwinfo->len_mismch && !pfwinfo->fver_mismch) in _show_error()
8858 seq_printf(m, " %-15s : ", "[error]"); in _show_error()
8860 if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW]) { in _show_error()
8862 "overflow-cnt: %d, ", in _show_error()
8863 pfwinfo->event[BTF_EVNT_BUF_OVERFLOW]); in _show_error()
8866 if (pfwinfo->len_mismch) { in _show_error()
8868 "len-mismatch: 0x%x, ", in _show_error()
8869 pfwinfo->len_mismch); in _show_error()
8872 if (pfwinfo->fver_mismch) { in _show_error()
8874 "fver-mismatch: 0x%x, ", in _show_error()
8875 pfwinfo->fver_mismch); in _show_error()
8881 "exception-type: 0x%x, exception-cnt = %d", in _show_error()
8889 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_tdma()
8890 const struct rtw89_btc_ver *ver = btc->ver; in _show_fbtc_tdma()
8891 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_tdma()
8895 pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo; in _show_fbtc_tdma()
8896 if (!pcinfo->valid) in _show_fbtc_tdma()
8899 if (ver->fcxtdma == 1) in _show_fbtc_tdma()
8900 t = &pfwinfo->rpt_fbtc_tdma.finfo.v1; in _show_fbtc_tdma()
8902 t = &pfwinfo->rpt_fbtc_tdma.finfo.v3.tdma; in _show_fbtc_tdma()
8905 " %-15s : ", "[tdma_policy]"); in _show_fbtc_tdma()
8908 (u32)t->type, in _show_fbtc_tdma()
8909 t->rxflctrl, t->txpause); in _show_fbtc_tdma()
8913 t->wtgle_n, t->leak_n, t->ext_ctrl); in _show_fbtc_tdma()
8917 (u32)btc->policy_type); in _show_fbtc_tdma()
8924 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_slots()
8925 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_slots()
8931 if (btc->ver->fcxslots == 1) { in _show_fbtc_slots()
8932 dur = le16_to_cpu(dm->slot_now.v1[i].dur); in _show_fbtc_slots()
8933 tbl = le32_to_cpu(dm->slot_now.v1[i].cxtbl); in _show_fbtc_slots()
8934 cxtype = le16_to_cpu(dm->slot_now.v1[i].cxtype); in _show_fbtc_slots()
8935 } else if (btc->ver->fcxslots == 7) { in _show_fbtc_slots()
8936 dur = le16_to_cpu(dm->slot_now.v7[i].dur); in _show_fbtc_slots()
8937 tbl = le32_to_cpu(dm->slot_now.v7[i].cxtbl); in _show_fbtc_slots()
8938 cxtype = le16_to_cpu(dm->slot_now.v7[i].cxtype); in _show_fbtc_slots()
8945 " %-15s : %5s[%03d/0x%x/%d]", in _show_fbtc_slots()
8963 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta_v2()
8964 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta_v2()
8965 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta_v2()
8966 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta_v2()
8973 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v2()
8974 if (!pcinfo->valid) in _show_fbtc_cysta_v2()
8977 pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo.v2; in _show_fbtc_cysta_v2()
8979 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta_v2()
8981 le16_to_cpu(pcysta_le32->cycles), in _show_fbtc_cysta_v2()
8982 le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v2()
8983 le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v2()
8984 le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v2()
8985 le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v2()
8988 if (!le32_to_cpu(pcysta_le32->slot_cnt[i])) in _show_fbtc_cysta_v2()
8991 le32_to_cpu(pcysta_le32->slot_cnt[i])); in _show_fbtc_cysta_v2()
8994 if (dm->tdma_now.rxflctrl) { in _show_fbtc_cysta_v2()
8996 le32_to_cpu(pcysta_le32->leakrx_cnt)); in _show_fbtc_cysta_v2()
8999 if (le32_to_cpu(pcysta_le32->collision_cnt)) { in _show_fbtc_cysta_v2()
9001 le32_to_cpu(pcysta_le32->collision_cnt)); in _show_fbtc_cysta_v2()
9004 if (le32_to_cpu(pcysta_le32->skip_cnt)) { in _show_fbtc_cysta_v2()
9005 seq_printf(m, ", skip:%d", in _show_fbtc_cysta_v2()
9006 le32_to_cpu(pcysta_le32->skip_cnt)); in _show_fbtc_cysta_v2()
9010 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v2()
9012 le16_to_cpu(pcysta_le32->tavg_cycle[CXT_WL]), in _show_fbtc_cysta_v2()
9013 le16_to_cpu(pcysta_le32->tavg_cycle[CXT_BT]), in _show_fbtc_cysta_v2()
9014 le16_to_cpu(pcysta_le32->tavg_lk) / 1000, in _show_fbtc_cysta_v2()
9015 le16_to_cpu(pcysta_le32->tavg_lk) % 1000); in _show_fbtc_cysta_v2()
9017 le16_to_cpu(pcysta_le32->tmax_cycle[CXT_WL]), in _show_fbtc_cysta_v2()
9018 le16_to_cpu(pcysta_le32->tmax_cycle[CXT_BT]), in _show_fbtc_cysta_v2()
9019 le16_to_cpu(pcysta_le32->tmax_lk) / 1000, in _show_fbtc_cysta_v2()
9020 le16_to_cpu(pcysta_le32->tmax_lk) % 1000); in _show_fbtc_cysta_v2()
9022 le16_to_cpu(pcysta_le32->tmaxdiff_cycle[CXT_WL]), in _show_fbtc_cysta_v2()
9023 le16_to_cpu(pcysta_le32->tmaxdiff_cycle[CXT_BT])); in _show_fbtc_cysta_v2()
9025 if (le16_to_cpu(pcysta_le32->cycles) <= 1) in _show_fbtc_cysta_v2()
9028 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta_v2()
9031 if (le16_to_cpu(pcysta_le32->cycles) <= slot_pair) in _show_fbtc_cysta_v2()
9034 c_begin = le16_to_cpu(pcysta_le32->cycles) - slot_pair + 1; in _show_fbtc_cysta_v2()
9036 c_end = le16_to_cpu(pcysta_le32->cycles); in _show_fbtc_cysta_v2()
9040 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v2()
9044 " %-15s : ->b%02d->w%02d", "[cycle_step]", in _show_fbtc_cysta_v2()
9045 le16_to_cpu(pcysta_le32->tslot_cycle[store_index]), in _show_fbtc_cysta_v2()
9046 le16_to_cpu(pcysta_le32->tslot_cycle[store_index + 1])); in _show_fbtc_cysta_v2()
9049 "->b%02d->w%02d", in _show_fbtc_cysta_v2()
9050 le16_to_cpu(pcysta_le32->tslot_cycle[store_index]), in _show_fbtc_cysta_v2()
9051 le16_to_cpu(pcysta_le32->tslot_cycle[store_index + 1])); in _show_fbtc_cysta_v2()
9056 if (a2dp->exist) { in _show_fbtc_cysta_v2()
9058 " %-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta_v2()
9060 le16_to_cpu(pcysta_le32->a2dpept), in _show_fbtc_cysta_v2()
9061 le16_to_cpu(pcysta_le32->a2dpeptto)); in _show_fbtc_cysta_v2()
9065 le16_to_cpu(pcysta_le32->tavg_a2dpept), in _show_fbtc_cysta_v2()
9066 le16_to_cpu(pcysta_le32->tmax_a2dpept)); in _show_fbtc_cysta_v2()
9067 r.val = dm->tdma_now.rxflctrl; in _show_fbtc_cysta_v2()
9072 le16_to_cpu(pcysta_le32->cycles_a2dp[CXT_FLCTRL_ON]), in _show_fbtc_cysta_v2()
9073 le16_to_cpu(pcysta_le32->cycles_a2dp[CXT_FLCTRL_OFF])); in _show_fbtc_cysta_v2()
9077 le16_to_cpu(pcysta_le32->tavg_a2dp[CXT_FLCTRL_ON]), in _show_fbtc_cysta_v2()
9078 le16_to_cpu(pcysta_le32->tavg_a2dp[CXT_FLCTRL_OFF])); in _show_fbtc_cysta_v2()
9082 le16_to_cpu(pcysta_le32->tmax_a2dp[CXT_FLCTRL_ON]), in _show_fbtc_cysta_v2()
9083 le16_to_cpu(pcysta_le32->tmax_a2dp[CXT_FLCTRL_OFF])); in _show_fbtc_cysta_v2()
9091 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta_v3()
9092 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta_v3()
9093 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta_v3()
9094 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta_v3()
9101 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v3()
9102 if (!pcinfo->valid) in _show_fbtc_cysta_v3()
9105 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v3; in _show_fbtc_cysta_v3()
9107 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta_v3()
9109 le16_to_cpu(pcysta->cycles), in _show_fbtc_cysta_v3()
9110 le32_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v3()
9111 le32_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v3()
9112 le32_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v3()
9113 le32_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v3()
9116 if (!le32_to_cpu(pcysta->slot_cnt[i])) in _show_fbtc_cysta_v3()
9120 le32_to_cpu(pcysta->slot_cnt[i])); in _show_fbtc_cysta_v3()
9123 if (dm->tdma_now.rxflctrl) in _show_fbtc_cysta_v3()
9124 seq_printf(m, ", leak_rx:%d", le32_to_cpu(pcysta->leak_slot.cnt_rximr)); in _show_fbtc_cysta_v3()
9126 if (le32_to_cpu(pcysta->collision_cnt)) in _show_fbtc_cysta_v3()
9127 seq_printf(m, ", collision:%d", le32_to_cpu(pcysta->collision_cnt)); in _show_fbtc_cysta_v3()
9129 if (le32_to_cpu(pcysta->skip_cnt)) in _show_fbtc_cysta_v3()
9130 seq_printf(m, ", skip:%d", le32_to_cpu(pcysta->skip_cnt)); in _show_fbtc_cysta_v3()
9134 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v3()
9136 le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]), in _show_fbtc_cysta_v3()
9137 le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]), in _show_fbtc_cysta_v3()
9138 le16_to_cpu(pcysta->leak_slot.tavg) / 1000, in _show_fbtc_cysta_v3()
9139 le16_to_cpu(pcysta->leak_slot.tavg) % 1000); in _show_fbtc_cysta_v3()
9142 le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]), in _show_fbtc_cysta_v3()
9143 le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]), in _show_fbtc_cysta_v3()
9144 le16_to_cpu(pcysta->leak_slot.tmax) / 1000, in _show_fbtc_cysta_v3()
9145 le16_to_cpu(pcysta->leak_slot.tmax) % 1000); in _show_fbtc_cysta_v3()
9148 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_WL]), in _show_fbtc_cysta_v3()
9149 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_BT])); in _show_fbtc_cysta_v3()
9151 cycle = le16_to_cpu(pcysta->cycles); in _show_fbtc_cysta_v3()
9155 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta_v3()
9161 c_begin = cycle - slot_pair + 1; in _show_fbtc_cysta_v3()
9165 if (a2dp->exist) in _show_fbtc_cysta_v3()
9172 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v3()
9175 seq_printf(m, " %-15s : ", "[cycle_step]"); in _show_fbtc_cysta_v3()
9177 seq_printf(m, "->b%02d", in _show_fbtc_cysta_v3()
9178 le16_to_cpu(pcysta->slot_step_time[store_index])); in _show_fbtc_cysta_v3()
9179 if (a2dp->exist) { in _show_fbtc_cysta_v3()
9180 a2dp_trx = &pcysta->a2dp_trx[store_index]; in _show_fbtc_cysta_v3()
9182 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v3()
9183 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v3()
9184 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v3()
9185 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v3()
9186 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v3()
9187 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v3()
9189 seq_printf(m, "->w%02d", in _show_fbtc_cysta_v3()
9190 le16_to_cpu(pcysta->slot_step_time[store_index + 1])); in _show_fbtc_cysta_v3()
9191 if (a2dp->exist) { in _show_fbtc_cysta_v3()
9192 a2dp_trx = &pcysta->a2dp_trx[store_index + 1]; in _show_fbtc_cysta_v3()
9194 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v3()
9195 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v3()
9196 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v3()
9197 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v3()
9198 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v3()
9199 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v3()
9205 if (a2dp->exist) { in _show_fbtc_cysta_v3()
9206 seq_printf(m, " %-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta_v3()
9208 le16_to_cpu(pcysta->a2dp_ept.cnt), in _show_fbtc_cysta_v3()
9209 le16_to_cpu(pcysta->a2dp_ept.cnt_timeout)); in _show_fbtc_cysta_v3()
9212 le16_to_cpu(pcysta->a2dp_ept.tavg), in _show_fbtc_cysta_v3()
9213 le16_to_cpu(pcysta->a2dp_ept.tmax)); in _show_fbtc_cysta_v3()
9221 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta_v4()
9222 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta_v4()
9223 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta_v4()
9224 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta_v4()
9231 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v4()
9232 if (!pcinfo->valid) in _show_fbtc_cysta_v4()
9235 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v4; in _show_fbtc_cysta_v4()
9237 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta_v4()
9239 le16_to_cpu(pcysta->cycles), in _show_fbtc_cysta_v4()
9240 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v4()
9241 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v4()
9242 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v4()
9243 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v4()
9246 if (!le16_to_cpu(pcysta->slot_cnt[i])) in _show_fbtc_cysta_v4()
9250 le16_to_cpu(pcysta->slot_cnt[i])); in _show_fbtc_cysta_v4()
9253 if (dm->tdma_now.rxflctrl) in _show_fbtc_cysta_v4()
9255 le32_to_cpu(pcysta->leak_slot.cnt_rximr)); in _show_fbtc_cysta_v4()
9257 if (pcysta->collision_cnt) in _show_fbtc_cysta_v4()
9258 seq_printf(m, ", collision:%d", pcysta->collision_cnt); in _show_fbtc_cysta_v4()
9260 if (le16_to_cpu(pcysta->skip_cnt)) in _show_fbtc_cysta_v4()
9261 seq_printf(m, ", skip:%d", in _show_fbtc_cysta_v4()
9262 le16_to_cpu(pcysta->skip_cnt)); in _show_fbtc_cysta_v4()
9266 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v4()
9268 le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]), in _show_fbtc_cysta_v4()
9269 le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]), in _show_fbtc_cysta_v4()
9270 le16_to_cpu(pcysta->leak_slot.tavg) / 1000, in _show_fbtc_cysta_v4()
9271 le16_to_cpu(pcysta->leak_slot.tavg) % 1000); in _show_fbtc_cysta_v4()
9274 le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]), in _show_fbtc_cysta_v4()
9275 le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]), in _show_fbtc_cysta_v4()
9276 le16_to_cpu(pcysta->leak_slot.tmax) / 1000, in _show_fbtc_cysta_v4()
9277 le16_to_cpu(pcysta->leak_slot.tmax) % 1000); in _show_fbtc_cysta_v4()
9280 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_WL]), in _show_fbtc_cysta_v4()
9281 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_BT])); in _show_fbtc_cysta_v4()
9283 cycle = le16_to_cpu(pcysta->cycles); in _show_fbtc_cysta_v4()
9287 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta_v4()
9293 c_begin = cycle - slot_pair + 1; in _show_fbtc_cysta_v4()
9297 if (a2dp->exist) in _show_fbtc_cysta_v4()
9304 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v4()
9307 seq_printf(m, " %-15s : ", "[cycle_step]"); in _show_fbtc_cysta_v4()
9309 seq_printf(m, "->b%02d", in _show_fbtc_cysta_v4()
9310 le16_to_cpu(pcysta->slot_step_time[store_index])); in _show_fbtc_cysta_v4()
9311 if (a2dp->exist) { in _show_fbtc_cysta_v4()
9312 a2dp_trx = &pcysta->a2dp_trx[store_index]; in _show_fbtc_cysta_v4()
9314 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v4()
9315 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v4()
9316 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v4()
9317 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v4()
9318 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v4()
9319 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v4()
9321 seq_printf(m, "->w%02d", in _show_fbtc_cysta_v4()
9322 le16_to_cpu(pcysta->slot_step_time[store_index + 1])); in _show_fbtc_cysta_v4()
9323 if (a2dp->exist) { in _show_fbtc_cysta_v4()
9324 a2dp_trx = &pcysta->a2dp_trx[store_index + 1]; in _show_fbtc_cysta_v4()
9326 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v4()
9327 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v4()
9328 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v4()
9329 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v4()
9330 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v4()
9331 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v4()
9337 if (a2dp->exist) { in _show_fbtc_cysta_v4()
9338 seq_printf(m, " %-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta_v4()
9340 le16_to_cpu(pcysta->a2dp_ept.cnt), in _show_fbtc_cysta_v4()
9341 le16_to_cpu(pcysta->a2dp_ept.cnt_timeout)); in _show_fbtc_cysta_v4()
9344 le16_to_cpu(pcysta->a2dp_ept.tavg), in _show_fbtc_cysta_v4()
9345 le16_to_cpu(pcysta->a2dp_ept.tmax)); in _show_fbtc_cysta_v4()
9353 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta_v5()
9354 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta_v5()
9355 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta_v5()
9356 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta_v5()
9363 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v5()
9364 if (!pcinfo->valid) in _show_fbtc_cysta_v5()
9367 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v5; in _show_fbtc_cysta_v5()
9369 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta_v5()
9371 le16_to_cpu(pcysta->cycles), in _show_fbtc_cysta_v5()
9372 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v5()
9373 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v5()
9374 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v5()
9375 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v5()
9378 if (!le16_to_cpu(pcysta->slot_cnt[i])) in _show_fbtc_cysta_v5()
9382 le16_to_cpu(pcysta->slot_cnt[i])); in _show_fbtc_cysta_v5()
9385 if (dm->tdma_now.rxflctrl) in _show_fbtc_cysta_v5()
9387 le32_to_cpu(pcysta->leak_slot.cnt_rximr)); in _show_fbtc_cysta_v5()
9389 if (pcysta->collision_cnt) in _show_fbtc_cysta_v5()
9390 seq_printf(m, ", collision:%d", pcysta->collision_cnt); in _show_fbtc_cysta_v5()
9392 if (le16_to_cpu(pcysta->skip_cnt)) in _show_fbtc_cysta_v5()
9393 seq_printf(m, ", skip:%d", in _show_fbtc_cysta_v5()
9394 le16_to_cpu(pcysta->skip_cnt)); in _show_fbtc_cysta_v5()
9398 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v5()
9400 le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]), in _show_fbtc_cysta_v5()
9401 le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]), in _show_fbtc_cysta_v5()
9402 le16_to_cpu(pcysta->leak_slot.tavg) / 1000, in _show_fbtc_cysta_v5()
9403 le16_to_cpu(pcysta->leak_slot.tavg) % 1000); in _show_fbtc_cysta_v5()
9406 le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]), in _show_fbtc_cysta_v5()
9407 le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]), in _show_fbtc_cysta_v5()
9408 le16_to_cpu(pcysta->leak_slot.tmax) / 1000, in _show_fbtc_cysta_v5()
9409 le16_to_cpu(pcysta->leak_slot.tmax) % 1000); in _show_fbtc_cysta_v5()
9411 cycle = le16_to_cpu(pcysta->cycles); in _show_fbtc_cysta_v5()
9415 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta_v5()
9421 c_begin = cycle - slot_pair + 1; in _show_fbtc_cysta_v5()
9425 if (a2dp->exist) in _show_fbtc_cysta_v5()
9435 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v5()
9438 seq_printf(m, " %-15s : ", "[cycle_step]"); in _show_fbtc_cysta_v5()
9440 seq_printf(m, "->b%02d", in _show_fbtc_cysta_v5()
9441 le16_to_cpu(pcysta->slot_step_time[store_index])); in _show_fbtc_cysta_v5()
9442 if (a2dp->exist) { in _show_fbtc_cysta_v5()
9443 a2dp_trx = &pcysta->a2dp_trx[store_index]; in _show_fbtc_cysta_v5()
9445 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v5()
9446 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v5()
9447 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v5()
9448 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v5()
9449 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v5()
9450 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v5()
9452 seq_printf(m, "->w%02d", in _show_fbtc_cysta_v5()
9453 le16_to_cpu(pcysta->slot_step_time[store_index + 1])); in _show_fbtc_cysta_v5()
9454 if (a2dp->exist) { in _show_fbtc_cysta_v5()
9455 a2dp_trx = &pcysta->a2dp_trx[store_index + 1]; in _show_fbtc_cysta_v5()
9457 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v5()
9458 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v5()
9459 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v5()
9460 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v5()
9461 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v5()
9462 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v5()
9468 if (a2dp->exist) { in _show_fbtc_cysta_v5()
9469 seq_printf(m, " %-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta_v5()
9471 le16_to_cpu(pcysta->a2dp_ept.cnt), in _show_fbtc_cysta_v5()
9472 le16_to_cpu(pcysta->a2dp_ept.cnt_timeout)); in _show_fbtc_cysta_v5()
9475 le16_to_cpu(pcysta->a2dp_ept.tavg), in _show_fbtc_cysta_v5()
9476 le16_to_cpu(pcysta->a2dp_ept.tmax)); in _show_fbtc_cysta_v5()
9484 struct rtw89_btc_bt_info *bt = &rtwdev->btc.cx.bt; in _show_fbtc_cysta_v7()
9485 struct rtw89_btc_bt_a2dp_desc *a2dp = &bt->link_info.a2dp_desc; in _show_fbtc_cysta_v7()
9486 struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo; in _show_fbtc_cysta_v7()
9488 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in _show_fbtc_cysta_v7()
9494 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v7()
9495 if (!pcinfo->valid) in _show_fbtc_cysta_v7()
9498 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v7; in _show_fbtc_cysta_v7()
9499 seq_printf(m, "\n\r %-15s : cycle:%d", "[slot_stat]", in _show_fbtc_cysta_v7()
9500 le16_to_cpu(pcysta->cycles)); in _show_fbtc_cysta_v7()
9503 if (!le16_to_cpu(pcysta->slot_cnt[i])) in _show_fbtc_cysta_v7()
9506 id_to_slot(i), le16_to_cpu(pcysta->slot_cnt[i])); in _show_fbtc_cysta_v7()
9509 if (dm->tdma_now.rxflctrl) in _show_fbtc_cysta_v7()
9511 le32_to_cpu(pcysta->leak_slot.cnt_rximr)); in _show_fbtc_cysta_v7()
9513 if (pcysta->collision_cnt) in _show_fbtc_cysta_v7()
9514 seq_printf(m, ", collision:%d", pcysta->collision_cnt); in _show_fbtc_cysta_v7()
9516 if (pcysta->skip_cnt) in _show_fbtc_cysta_v7()
9517 seq_printf(m, ", skip:%d", le16_to_cpu(pcysta->skip_cnt)); in _show_fbtc_cysta_v7()
9519 seq_printf(m, "\n\r %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v7()
9521 le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]), in _show_fbtc_cysta_v7()
9522 le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]), in _show_fbtc_cysta_v7()
9523 le16_to_cpu(pcysta->leak_slot.tavg) / 1000, in _show_fbtc_cysta_v7()
9524 le16_to_cpu(pcysta->leak_slot.tavg) % 1000); in _show_fbtc_cysta_v7()
9526 le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]), in _show_fbtc_cysta_v7()
9527 le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]), in _show_fbtc_cysta_v7()
9528 dm->bt_slot_flood, dm->cnt_dm[BTC_DCNT_BT_SLOT_FLOOD], in _show_fbtc_cysta_v7()
9529 le16_to_cpu(pcysta->leak_slot.tamx) / 1000, in _show_fbtc_cysta_v7()
9530 le16_to_cpu(pcysta->leak_slot.tamx) % 1000); in _show_fbtc_cysta_v7()
9532 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v7()
9533 le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v7()
9534 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v7()
9535 le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v7()
9537 if (a2dp->exist) { in _show_fbtc_cysta_v7()
9539 "\n\r %-15s : a2dp_ept:%d, a2dp_late:%d(streak 2S:%d/max:%d)", in _show_fbtc_cysta_v7()
9541 le16_to_cpu(pcysta->a2dp_ept.cnt), in _show_fbtc_cysta_v7()
9542 le16_to_cpu(pcysta->a2dp_ept.cnt_timeout), in _show_fbtc_cysta_v7()
9543 a2dp->no_empty_streak_2s, a2dp->no_empty_streak_max); in _show_fbtc_cysta_v7()
9546 le16_to_cpu(pcysta->a2dp_ept.tavg), in _show_fbtc_cysta_v7()
9547 le16_to_cpu(pcysta->a2dp_ept.tmax)); in _show_fbtc_cysta_v7()
9550 if (le16_to_cpu(pcysta->cycles) <= 1) in _show_fbtc_cysta_v7()
9553 /* 1 cycle = 1 wl-slot + 1 bt-slot */ in _show_fbtc_cysta_v7()
9556 if (le16_to_cpu(pcysta->cycles) <= slot_pair) in _show_fbtc_cysta_v7()
9559 c_begin = le16_to_cpu(pcysta->cycles) - slot_pair + 1; in _show_fbtc_cysta_v7()
9561 c_end = le16_to_cpu(pcysta->cycles); in _show_fbtc_cysta_v7()
9563 if (a2dp->exist) in _show_fbtc_cysta_v7()
9573 s_id = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v7()
9576 if (a2dp->exist) in _show_fbtc_cysta_v7()
9577 seq_printf(m, "\n\r %-15s : ", "[slotT_wermtan]"); in _show_fbtc_cysta_v7()
9579 seq_printf(m, "\n\r %-15s : ", "[slotT_rxerr]"); in _show_fbtc_cysta_v7()
9582 seq_printf(m, "->b%d", le16_to_cpu(pcysta->slot_step_time[s_id])); in _show_fbtc_cysta_v7()
9584 if (a2dp->exist) in _show_fbtc_cysta_v7()
9586 pcysta->wl_rx_err_ratio[s_id], in _show_fbtc_cysta_v7()
9587 pcysta->a2dp_trx[s_id].empty_cnt, in _show_fbtc_cysta_v7()
9588 pcysta->a2dp_trx[s_id].retry_cnt, in _show_fbtc_cysta_v7()
9589 (pcysta->a2dp_trx[s_id].tx_rate ? 3 : 2), in _show_fbtc_cysta_v7()
9590 pcysta->a2dp_trx[s_id].tx_cnt, in _show_fbtc_cysta_v7()
9591 pcysta->a2dp_trx[s_id].ack_cnt, in _show_fbtc_cysta_v7()
9592 pcysta->a2dp_trx[s_id].nack_cnt); in _show_fbtc_cysta_v7()
9594 seq_printf(m, "(%d)", pcysta->wl_rx_err_ratio[s_id]); in _show_fbtc_cysta_v7()
9596 seq_printf(m, "->w%d", le16_to_cpu(pcysta->slot_step_time[s_id + 1])); in _show_fbtc_cysta_v7()
9598 if (a2dp->exist) in _show_fbtc_cysta_v7()
9600 pcysta->wl_rx_err_ratio[s_id + 1], in _show_fbtc_cysta_v7()
9601 pcysta->a2dp_trx[s_id + 1].empty_cnt, in _show_fbtc_cysta_v7()
9602 pcysta->a2dp_trx[s_id + 1].retry_cnt, in _show_fbtc_cysta_v7()
9603 (pcysta->a2dp_trx[s_id + 1].tx_rate ? 3 : 2), in _show_fbtc_cysta_v7()
9604 pcysta->a2dp_trx[s_id + 1].tx_cnt, in _show_fbtc_cysta_v7()
9605 pcysta->a2dp_trx[s_id + 1].ack_cnt, in _show_fbtc_cysta_v7()
9606 pcysta->a2dp_trx[s_id + 1].nack_cnt); in _show_fbtc_cysta_v7()
9608 seq_printf(m, "(%d)", pcysta->wl_rx_err_ratio[s_id + 1]); in _show_fbtc_cysta_v7()
9614 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_nullsta()
9615 const struct rtw89_btc_ver *ver = btc->ver; in _show_fbtc_nullsta()
9616 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_nullsta()
9621 if (!btc->dm.tdma_now.rxflctrl) in _show_fbtc_nullsta()
9624 pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo; in _show_fbtc_nullsta()
9625 if (!pcinfo->valid) in _show_fbtc_nullsta()
9628 ns = &pfwinfo->rpt_fbtc_nullsta.finfo; in _show_fbtc_nullsta()
9629 if (ver->fcxnullsta == 1) { in _show_fbtc_nullsta()
9631 seq_printf(m, " %-15s : ", "[NULL-STA]"); in _show_fbtc_nullsta()
9632 seq_printf(m, "null-%d", i); in _show_fbtc_nullsta()
9634 le32_to_cpu(ns->v1.result[i][1])); in _show_fbtc_nullsta()
9636 le32_to_cpu(ns->v1.result[i][0])); in _show_fbtc_nullsta()
9638 le32_to_cpu(ns->v1.result[i][2])); in _show_fbtc_nullsta()
9640 le32_to_cpu(ns->v1.result[i][3])); in _show_fbtc_nullsta()
9642 le32_to_cpu(ns->v1.avg_t[i]) / 1000, in _show_fbtc_nullsta()
9643 le32_to_cpu(ns->v1.avg_t[i]) % 1000); in _show_fbtc_nullsta()
9645 le32_to_cpu(ns->v1.max_t[i]) / 1000, in _show_fbtc_nullsta()
9646 le32_to_cpu(ns->v1.max_t[i]) % 1000); in _show_fbtc_nullsta()
9648 } else if (ver->fcxnullsta == 7) { in _show_fbtc_nullsta()
9650 seq_printf(m, " %-15s : ", "[NULL-STA]"); in _show_fbtc_nullsta()
9651 seq_printf(m, "null-%d", i); in _show_fbtc_nullsta()
9653 le32_to_cpu(ns->v7.result[i][4])); in _show_fbtc_nullsta()
9655 le32_to_cpu(ns->v7.result[i][1])); in _show_fbtc_nullsta()
9657 le32_to_cpu(ns->v7.result[i][0])); in _show_fbtc_nullsta()
9659 le32_to_cpu(ns->v7.result[i][2])); in _show_fbtc_nullsta()
9661 le32_to_cpu(ns->v7.result[i][3])); in _show_fbtc_nullsta()
9663 le32_to_cpu(ns->v7.tavg[i]) / 1000, in _show_fbtc_nullsta()
9664 le32_to_cpu(ns->v7.tavg[i]) % 1000); in _show_fbtc_nullsta()
9666 le32_to_cpu(ns->v7.tmax[i]) / 1000, in _show_fbtc_nullsta()
9667 le32_to_cpu(ns->v7.tmax[i]) % 1000); in _show_fbtc_nullsta()
9671 seq_printf(m, " %-15s : ", "[NULL-STA]"); in _show_fbtc_nullsta()
9672 seq_printf(m, "null-%d", i); in _show_fbtc_nullsta()
9674 le32_to_cpu(ns->v2.result[i][4])); in _show_fbtc_nullsta()
9676 le32_to_cpu(ns->v2.result[i][1])); in _show_fbtc_nullsta()
9678 le32_to_cpu(ns->v2.result[i][0])); in _show_fbtc_nullsta()
9680 le32_to_cpu(ns->v2.result[i][2])); in _show_fbtc_nullsta()
9682 le32_to_cpu(ns->v2.result[i][3])); in _show_fbtc_nullsta()
9684 le32_to_cpu(ns->v2.avg_t[i]) / 1000, in _show_fbtc_nullsta()
9685 le32_to_cpu(ns->v2.avg_t[i]) % 1000); in _show_fbtc_nullsta()
9687 le32_to_cpu(ns->v2.max_t[i]) / 1000, in _show_fbtc_nullsta()
9688 le32_to_cpu(ns->v2.max_t[i]) % 1000); in _show_fbtc_nullsta()
9695 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_step_v2()
9696 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_step_v2()
9699 const struct rtw89_btc_ver *ver = btc->ver; in _show_fbtc_step_v2()
9705 pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; in _show_fbtc_step_v2()
9706 if (!pcinfo->valid) in _show_fbtc_step_v2()
9709 pstep = &pfwinfo->rpt_fbtc_step.finfo.v2; in _show_fbtc_step_v2()
9710 pos_old = le16_to_cpu(pstep->pos_old); in _show_fbtc_step_v2()
9711 pos_new = le16_to_cpu(pstep->pos_new); in _show_fbtc_step_v2()
9713 if (pcinfo->req_fver != pstep->fver) in _show_fbtc_step_v2()
9720 if (ver->fcxctrl == 7 || ver->fcxctrl == 1) in _show_fbtc_step_v2()
9723 trace_step = btc->ctrl.ctrl.trace_step; in _show_fbtc_step_v2()
9729 n_stop = trace_step - 1; in _show_fbtc_step_v2()
9735 type = pstep->step[i].type; in _show_fbtc_step_v2()
9736 val = pstep->step[i].val; in _show_fbtc_step_v2()
9737 diff_t = le16_to_cpu(pstep->step[i].difft); in _show_fbtc_step_v2()
9743 seq_printf(m, " %-15s : ", "[steps]"); in _show_fbtc_step_v2()
9745 seq_printf(m, "-> %s(%02d)(%02d)", in _show_fbtc_step_v2()
9770 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_step_v3()
9771 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_step_v3()
9778 if ((pfwinfo->rpt_en_map & in _show_fbtc_step_v3()
9782 pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; in _show_fbtc_step_v3()
9783 if (!pcinfo->valid) in _show_fbtc_step_v3()
9786 pstep = &pfwinfo->rpt_fbtc_step.finfo.v3; in _show_fbtc_step_v3()
9787 if (pcinfo->req_fver != pstep->fver) in _show_fbtc_step_v3()
9790 if (le32_to_cpu(pstep->cnt) <= FCXDEF_STEP) in _show_fbtc_step_v3()
9793 n_begin = le32_to_cpu(pstep->cnt) - FCXDEF_STEP + 1; in _show_fbtc_step_v3()
9795 n_end = le32_to_cpu(pstep->cnt); in _show_fbtc_step_v3()
9802 array_idx = (i - 1) % FCXDEF_STEP; in _show_fbtc_step_v3()
9803 type = pstep->step[array_idx].type; in _show_fbtc_step_v3()
9804 val = pstep->step[array_idx].val; in _show_fbtc_step_v3()
9805 diff_t = le16_to_cpu(pstep->step[array_idx].difft); in _show_fbtc_step_v3()
9811 seq_printf(m, " %-15s : ", "[steps]"); in _show_fbtc_step_v3()
9813 seq_printf(m, "-> %s(%02d)", in _show_fbtc_step_v3()
9827 struct rtw89_btc *btc = &rtwdev->btc; in _show_fw_dm_msg()
9828 const struct rtw89_btc_ver *ver = btc->ver; in _show_fw_dm_msg()
9830 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_DM)) in _show_fw_dm_msg()
9837 if (ver->fcxcysta == 2) in _show_fw_dm_msg()
9839 else if (ver->fcxcysta == 3) in _show_fw_dm_msg()
9841 else if (ver->fcxcysta == 4) in _show_fw_dm_msg()
9843 else if (ver->fcxcysta == 5) in _show_fw_dm_msg()
9845 else if (ver->fcxcysta == 7) in _show_fw_dm_msg()
9850 if (ver->fcxstep == 2) in _show_fw_dm_msg()
9852 else if (ver->fcxstep == 3) in _show_fw_dm_msg()
9859 const struct rtw89_chip_info *chip = rtwdev->chip; in _get_gnt()
9863 if (chip->chip_id == RTL8852A || chip->chip_id == RTL8852B || in _get_gnt()
9864 chip->chip_id == RTL8851B || chip->chip_id == RTL8852BT) { in _get_gnt()
9868 gnt = &gnt_cfg->band[0]; in _get_gnt()
9869 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S0_SW_CTRL); in _get_gnt()
9870 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S0_STA); in _get_gnt()
9871 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S0_SW_CTRL); in _get_gnt()
9872 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S0_STA); in _get_gnt()
9874 gnt = &gnt_cfg->band[1]; in _get_gnt()
9875 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S1_SW_CTRL); in _get_gnt()
9876 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S1_STA); in _get_gnt()
9877 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S1_SW_CTRL); in _get_gnt()
9878 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S1_STA); in _get_gnt()
9879 } else if (chip->chip_id == RTL8852C) { in _get_gnt()
9883 gnt = &gnt_cfg->band[0]; in _get_gnt()
9884 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S0_SWCTRL); in _get_gnt()
9885 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S0); in _get_gnt()
9886 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S0_SWCTRL); in _get_gnt()
9887 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S0); in _get_gnt()
9889 gnt = &gnt_cfg->band[1]; in _get_gnt()
9890 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S1_SWCTRL); in _get_gnt()
9891 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S1); in _get_gnt()
9892 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S1_SWCTRL); in _get_gnt()
9893 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S1); in _get_gnt()
9901 struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo; in _show_gpio_dbg()
9902 const struct rtw89_btc_ver *ver = rtwdev->btc.ver; in _show_gpio_dbg()
9908 pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo; in _show_gpio_dbg()
9909 gdbg = &rtwdev->btc.fwinfo.rpt_fbtc_gpio_dbg.finfo; in _show_gpio_dbg()
9910 if (!pcinfo->valid) { in _show_gpio_dbg()
9918 if (ver->fcxgpiodbg == 7) { in _show_gpio_dbg()
9919 en_map = le32_to_cpu(gdbg->v7.en_map); in _show_gpio_dbg()
9920 gpio_map = gdbg->v7.gpio_map; in _show_gpio_dbg()
9922 en_map = le32_to_cpu(gdbg->v1.en_map); in _show_gpio_dbg()
9923 gpio_map = gdbg->v1.gpio_map; in _show_gpio_dbg()
9929 seq_printf(m, " %-15s : enable_map:0x%08x", in _show_gpio_dbg()
9935 seq_printf(m, ", %s->GPIO%d", id_to_gdbg(i), gpio_map[i]); in _show_gpio_dbg()
9942 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_mreg_v1()
9943 struct rtw89_btc *btc = &rtwdev->btc; in _show_mreg_v1()
9944 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_mreg_v1()
9947 struct rtw89_btc_cx *cx = &btc->cx; in _show_mreg_v1()
9948 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_mreg_v1()
9949 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_mreg_v1()
9955 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_MREG)) in _show_mreg_v1()
9961 " %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n", in _show_mreg_v1()
9962 "[scoreboard]", wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE], in _show_mreg_v1()
9963 bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD], in _show_mreg_v1()
9964 cx->cnt_bt[BTC_BCNT_SCBDUPDATE]); in _show_mreg_v1()
9966 btc->dm.pta_owner = rtw89_mac_get_ctrl_path(rtwdev); in _show_mreg_v1()
9971 " %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], ", in _show_mreg_v1()
9973 chip->chip_id == RTL8852C ? "HW" : in _show_mreg_v1()
9974 btc->dm.pta_owner == BTC_CTRL_BY_WL ? "WL" : "BT", in _show_mreg_v1()
9979 seq_printf(m, "phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n", in _show_mreg_v1()
9985 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _show_mreg_v1()
9986 if (!pcinfo->valid) { in _show_mreg_v1()
9993 pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v1; in _show_mreg_v1()
9996 __func__, pmreg->reg_num); in _show_mreg_v1()
9998 for (i = 0; i < pmreg->reg_num; i++) { in _show_mreg_v1()
9999 type = (u8)le16_to_cpu(chip->mon_reg[i].type); in _show_mreg_v1()
10000 offset = le32_to_cpu(chip->mon_reg[i].offset); in _show_mreg_v1()
10001 val = le32_to_cpu(pmreg->mreg_val[i]); in _show_mreg_v1()
10004 seq_printf(m, " %-15s : %d_0x%04x=0x%08x", in _show_mreg_v1()
10013 if (i >= pmreg->reg_num) in _show_mreg_v1()
10020 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_mreg_v2()
10021 struct rtw89_btc *btc = &rtwdev->btc; in _show_mreg_v2()
10022 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_mreg_v2()
10025 struct rtw89_btc_cx *cx = &btc->cx; in _show_mreg_v2()
10026 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_mreg_v2()
10027 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_mreg_v2()
10033 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_MREG)) in _show_mreg_v2()
10039 " %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n", in _show_mreg_v2()
10040 "[scoreboard]", wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE], in _show_mreg_v2()
10041 bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD], in _show_mreg_v2()
10042 cx->cnt_bt[BTC_BCNT_SCBDUPDATE]); in _show_mreg_v2()
10044 btc->dm.pta_owner = rtw89_mac_get_ctrl_path(rtwdev); in _show_mreg_v2()
10049 " %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], polut_type:%s", in _show_mreg_v2()
10051 chip->chip_id == RTL8852C ? "HW" : in _show_mreg_v2()
10052 btc->dm.pta_owner == BTC_CTRL_BY_WL ? "WL" : "BT", in _show_mreg_v2()
10055 id_to_polut(wl->bt_polut_type[wl->pta_req_mac])); in _show_mreg_v2()
10058 seq_printf(m, "phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n", in _show_mreg_v2()
10064 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _show_mreg_v2()
10065 if (!pcinfo->valid) { in _show_mreg_v2()
10072 pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v2; in _show_mreg_v2()
10075 __func__, pmreg->reg_num); in _show_mreg_v2()
10077 for (i = 0; i < pmreg->reg_num; i++) { in _show_mreg_v2()
10078 type = (u8)le16_to_cpu(chip->mon_reg[i].type); in _show_mreg_v2()
10079 offset = le32_to_cpu(chip->mon_reg[i].offset); in _show_mreg_v2()
10080 val = le32_to_cpu(pmreg->mreg_val[i]); in _show_mreg_v2()
10083 seq_printf(m, " %-15s : %d_0x%04x=0x%08x", in _show_mreg_v2()
10092 if (i >= pmreg->reg_num) in _show_mreg_v2()
10099 struct rtw89_btc *btc = &rtwdev->btc; in _show_mreg_v7()
10100 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_mreg_v7()
10103 struct rtw89_btc_cx *cx = &btc->cx; in _show_mreg_v7()
10104 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_mreg_v7()
10105 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_mreg_v7()
10107 struct rtw89_btc_dm *dm = &btc->dm; in _show_mreg_v7()
10111 if (!(dm->coex_info_map & BTC_COEX_INFO_MREG)) in _show_mreg_v7()
10117 "\n\r %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)", in _show_mreg_v7()
10118 "[scoreboard]", wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE], in _show_mreg_v7()
10119 bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD], in _show_mreg_v7()
10120 cx->cnt_bt[BTC_BCNT_SCBDUPDATE]); in _show_mreg_v7()
10122 /* To avoid I/O if WL LPS or power-off */ in _show_mreg_v7()
10123 dm->pta_owner = rtw89_mac_get_ctrl_path(rtwdev); in _show_mreg_v7()
10126 "\n\r %-15s : pta_owner:%s, pta_req_mac:MAC%d, rf_gnt_source: polut_type:%s", in _show_mreg_v7()
10128 rtwdev->chip->para_ver & BTC_FEAT_PTA_ONOFF_CTRL ? "HW" : in _show_mreg_v7()
10129 dm->pta_owner == BTC_CTRL_BY_WL ? "WL" : "BT", in _show_mreg_v7()
10130 wl->pta_req_mac, id_to_polut(wl->bt_polut_type[wl->pta_req_mac])); in _show_mreg_v7()
10132 gnt = &dm->gnt.band[RTW89_PHY_0]; in _show_mreg_v7()
10134 seq_printf(m, ", phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d]", in _show_mreg_v7()
10135 gnt->gnt_wl_sw_en ? "SW" : "HW", gnt->gnt_wl, in _show_mreg_v7()
10136 gnt->gnt_bt_sw_en ? "SW" : "HW", gnt->gnt_bt); in _show_mreg_v7()
10138 if (rtwdev->dbcc_en) { in _show_mreg_v7()
10139 gnt = &dm->gnt.band[RTW89_PHY_1]; in _show_mreg_v7()
10140 seq_printf(m, ", phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]", in _show_mreg_v7()
10141 gnt->gnt_wl_sw_en ? "SW" : "HW", gnt->gnt_wl, in _show_mreg_v7()
10142 gnt->gnt_bt_sw_en ? "SW" : "HW", gnt->gnt_bt); in _show_mreg_v7()
10145 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _show_mreg_v7()
10146 if (!pcinfo->valid) in _show_mreg_v7()
10149 pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v7; in _show_mreg_v7()
10151 for (i = 0; i < pmreg->reg_num; i++) { in _show_mreg_v7()
10152 type = (u8)le16_to_cpu(rtwdev->chip->mon_reg[i].type); in _show_mreg_v7()
10153 offset = le32_to_cpu(rtwdev->chip->mon_reg[i].offset); in _show_mreg_v7()
10154 val = le32_to_cpu(pmreg->mreg_val[i]); in _show_mreg_v7()
10157 seq_printf(m, "\n\r %-15s : %s_0x%x=0x%x", "[reg]", in _show_mreg_v7()
10169 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary_v1()
10170 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary_v1()
10173 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary_v1()
10174 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary_v1()
10175 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v1()
10176 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_summary_v1()
10177 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary_v1()
10180 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v1()
10185 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v1()
10186 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary_v1()
10187 prptctrl = &pfwinfo->rpt_ctrl.finfo.v1; in _show_summary_v1()
10190 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ", in _show_summary_v1()
10191 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v1()
10192 pfwinfo->cnt_h2c_fail, prptctrl->h2c_cnt, in _show_summary_v1()
10193 pfwinfo->cnt_c2h, prptctrl->c2h_cnt); in _show_summary_v1()
10197 pfwinfo->event[BTF_EVNT_RPT], prptctrl->rpt_cnt, in _show_summary_v1()
10198 prptctrl->rpt_enable, dm->error.val); in _show_summary_v1()
10200 if (dm->error.map.wl_fw_hang) in _show_summary_v1()
10204 " %-15s : send_ok:%d, send_fail:%d, recv:%d", in _show_summary_v1()
10205 "[mailbox]", prptctrl->mb_send_ok_cnt, in _show_summary_v1()
10206 prptctrl->mb_send_fail_cnt, prptctrl->mb_recv_cnt); in _show_summary_v1()
10210 prptctrl->mb_a2dp_empty_cnt, in _show_summary_v1()
10211 prptctrl->mb_a2dp_flct_cnt, in _show_summary_v1()
10212 prptctrl->mb_a2dp_full_cnt); in _show_summary_v1()
10215 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]", in _show_summary_v1()
10216 "[RFK]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v1()
10217 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v1()
10218 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v1()
10219 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary_v1()
10223 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REQ], in _show_summary_v1()
10224 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_GO], in _show_summary_v1()
10225 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REJECT], in _show_summary_v1()
10226 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT], in _show_summary_v1()
10227 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_FAIL]); in _show_summary_v1()
10229 if (prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT] > 0) in _show_summary_v1()
10230 bt->rfk_info.map.timeout = 1; in _show_summary_v1()
10232 bt->rfk_info.map.timeout = 0; in _show_summary_v1()
10234 dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; in _show_summary_v1()
10237 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x", in _show_summary_v1()
10238 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v1()
10239 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, in _show_summary_v1()
10240 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v1()
10241 btc->fwinfo.rpt_en_map); in _show_summary_v1()
10246 cnt_sum += dm->cnt_notify[i]; in _show_summary_v1()
10249 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v1()
10260 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary_v1()
10273 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary_v4()
10274 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary_v4()
10277 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary_v4()
10278 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary_v4()
10279 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v4()
10280 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_summary_v4()
10281 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary_v4()
10284 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v4()
10289 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v4()
10290 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary_v4()
10291 prptctrl = &pfwinfo->rpt_ctrl.finfo.v4; in _show_summary_v4()
10294 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ", in _show_summary_v4()
10295 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v4()
10296 pfwinfo->cnt_h2c_fail, in _show_summary_v4()
10297 le32_to_cpu(prptctrl->rpt_info.cnt_h2c), in _show_summary_v4()
10298 pfwinfo->cnt_c2h, in _show_summary_v4()
10299 le32_to_cpu(prptctrl->rpt_info.cnt_c2h)); in _show_summary_v4()
10303 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v4()
10304 le32_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v4()
10305 le32_to_cpu(prptctrl->rpt_info.en), in _show_summary_v4()
10306 dm->error.val); in _show_summary_v4()
10308 if (dm->error.map.wl_fw_hang) in _show_summary_v4()
10312 " %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v4()
10314 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v4()
10315 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v4()
10316 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v4()
10320 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v4()
10321 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v4()
10322 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v4()
10323 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v4()
10324 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v4()
10327 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]", in _show_summary_v4()
10328 "[RFK]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v4()
10329 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v4()
10330 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v4()
10331 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary_v4()
10335 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ]), in _show_summary_v4()
10336 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_GO]), in _show_summary_v4()
10337 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REJECT]), in _show_summary_v4()
10338 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT]), in _show_summary_v4()
10339 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_FAIL])); in _show_summary_v4()
10341 if (le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0) in _show_summary_v4()
10342 bt->rfk_info.map.timeout = 1; in _show_summary_v4()
10344 bt->rfk_info.map.timeout = 0; in _show_summary_v4()
10346 dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; in _show_summary_v4()
10349 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x", in _show_summary_v4()
10350 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v4()
10351 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, in _show_summary_v4()
10352 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v4()
10353 btc->fwinfo.rpt_en_map); in _show_summary_v4()
10358 cnt_sum += dm->cnt_notify[i]; in _show_summary_v4()
10361 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v4()
10372 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary_v4()
10385 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary_v5()
10386 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary_v5()
10389 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary_v5()
10390 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary_v5()
10391 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v5()
10392 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary_v5()
10395 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v5()
10400 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v5()
10401 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary_v5()
10402 prptctrl = &pfwinfo->rpt_ctrl.finfo.v5; in _show_summary_v5()
10405 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d, len:%d), ", in _show_summary_v5()
10406 "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v5()
10407 le16_to_cpu(prptctrl->rpt_info.cnt_h2c), in _show_summary_v5()
10408 pfwinfo->cnt_c2h, in _show_summary_v5()
10409 le16_to_cpu(prptctrl->rpt_info.cnt_c2h), in _show_summary_v5()
10410 le16_to_cpu(prptctrl->rpt_info.len_c2h)); in _show_summary_v5()
10414 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v5()
10415 le16_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v5()
10416 le32_to_cpu(prptctrl->rpt_info.en)); in _show_summary_v5()
10418 if (dm->error.map.wl_fw_hang) in _show_summary_v5()
10422 " %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v5()
10424 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v5()
10425 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v5()
10426 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v5()
10430 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v5()
10431 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v5()
10432 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v5()
10433 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v5()
10434 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v5()
10437 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d]", in _show_summary_v5()
10438 "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v5()
10439 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v5()
10440 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v5()
10441 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary_v5()
10445 le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ])); in _show_summary_v5()
10449 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on), in _show_summary_v5()
10450 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off)); in _show_summary_v5()
10453 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d", in _show_summary_v5()
10454 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v5()
10455 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h); in _show_summary_v5()
10458 if (!pcinfo->valid || pfwinfo->len_mismch || pfwinfo->fver_mismch || in _show_summary_v5()
10459 pfwinfo->err[BTFRE_EXCEPTION]) { in _show_summary_v5()
10462 " %-15s : WL FW rpt error!![rpt_ctrl_valid:%d/len:" in _show_summary_v5()
10464 "[ERROR]", pcinfo->valid, pfwinfo->len_mismch, in _show_summary_v5()
10465 pfwinfo->fver_mismch, pfwinfo->err[BTFRE_EXCEPTION], in _show_summary_v5()
10466 wl->status.map.lps, wl->status.map.rf_off); in _show_summary_v5()
10470 cnt_sum += dm->cnt_notify[i]; in _show_summary_v5()
10474 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v5()
10487 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary_v5()
10500 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary_v105()
10501 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary_v105()
10504 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary_v105()
10505 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary_v105()
10506 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v105()
10507 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary_v105()
10510 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v105()
10515 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v105()
10516 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary_v105()
10517 prptctrl = &pfwinfo->rpt_ctrl.finfo.v105; in _show_summary_v105()
10520 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d, len:%d), ", in _show_summary_v105()
10521 "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v105()
10522 le16_to_cpu(prptctrl->rpt_info.cnt_h2c), in _show_summary_v105()
10523 pfwinfo->cnt_c2h, in _show_summary_v105()
10524 le16_to_cpu(prptctrl->rpt_info.cnt_c2h), in _show_summary_v105()
10525 le16_to_cpu(prptctrl->rpt_info.len_c2h)); in _show_summary_v105()
10529 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v105()
10530 le16_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v105()
10531 le32_to_cpu(prptctrl->rpt_info.en)); in _show_summary_v105()
10533 if (dm->error.map.wl_fw_hang) in _show_summary_v105()
10537 " %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v105()
10539 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v105()
10540 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v105()
10541 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v105()
10545 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v105()
10546 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v105()
10547 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v105()
10548 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v105()
10549 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v105()
10552 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d]", in _show_summary_v105()
10553 "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v105()
10554 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v105()
10555 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v105()
10556 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary_v105()
10560 le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ])); in _show_summary_v105()
10564 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on), in _show_summary_v105()
10565 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off)); in _show_summary_v105()
10568 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d", in _show_summary_v105()
10569 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v105()
10570 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h); in _show_summary_v105()
10573 if (!pcinfo->valid || pfwinfo->len_mismch || pfwinfo->fver_mismch || in _show_summary_v105()
10574 pfwinfo->err[BTFRE_EXCEPTION]) { in _show_summary_v105()
10577 " %-15s : WL FW rpt error!![rpt_ctrl_valid:%d/len:" in _show_summary_v105()
10579 "[ERROR]", pcinfo->valid, pfwinfo->len_mismch, in _show_summary_v105()
10580 pfwinfo->fver_mismch, pfwinfo->err[BTFRE_EXCEPTION], in _show_summary_v105()
10581 wl->status.map.lps, wl->status.map.rf_off); in _show_summary_v105()
10585 cnt_sum += dm->cnt_notify[i]; in _show_summary_v105()
10589 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v105()
10602 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary_v105()
10615 struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo; in _show_summary_v7()
10618 struct rtw89_btc_cx *cx = &rtwdev->btc.cx; in _show_summary_v7()
10619 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in _show_summary_v7()
10620 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v7()
10621 u32 *cnt = rtwdev->btc.dm.cnt_notify; in _show_summary_v7()
10625 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v7()
10630 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v7()
10631 if (pcinfo->valid && wl->status.map.lps != BTC_LPS_RF_OFF && in _show_summary_v7()
10632 !wl->status.map.rf_off) { in _show_summary_v7()
10633 prptctrl = &pfwinfo->rpt_ctrl.finfo.v7; in _show_summary_v7()
10636 "\n\r %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d)," in _show_summary_v7()
10638 "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v7()
10639 le16_to_cpu(prptctrl->rpt_info.cnt_h2c), pfwinfo->cnt_c2h, in _show_summary_v7()
10640 le16_to_cpu(prptctrl->rpt_info.cnt_c2h), in _show_summary_v7()
10641 le16_to_cpu(prptctrl->rpt_info.len_c2h), in _show_summary_v7()
10642 rtwdev->btc.ver->info_buf); in _show_summary_v7()
10645 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v7()
10646 le16_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v7()
10647 le32_to_cpu(prptctrl->rpt_info.en)); in _show_summary_v7()
10649 if (dm->error.map.wl_fw_hang) in _show_summary_v7()
10652 seq_printf(m, "\n\r %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v7()
10653 "[mailbox]", le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v7()
10654 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v7()
10655 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v7()
10658 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v7()
10659 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v7()
10660 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v7()
10661 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v7()
10662 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v7()
10665 "\n\r %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d/time:%dms]", in _show_summary_v7()
10666 "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v7()
10667 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v7()
10668 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v7()
10669 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT], in _show_summary_v7()
10670 wl->rfk_info.proc_time); in _show_summary_v7()
10673 le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ])); in _show_summary_v7()
10676 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on), in _show_summary_v7()
10677 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off)); in _show_summary_v7()
10680 "\n\r %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d (lps=%d/rf_off=%d)", in _show_summary_v7()
10682 pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v7()
10683 pfwinfo->cnt_c2h, in _show_summary_v7()
10684 wl->status.map.lps, wl->status.map.rf_off); in _show_summary_v7()
10688 cnt_sum += dm->cnt_notify[i]; in _show_summary_v7()
10691 "\n\r %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v7()
10703 "\n\r %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, switch_chbw=%d, special_pkt=%d, ", in _show_summary_v7()
10711 rtwdev->btc.hubmsg_cnt, cnt[BTC_NCNT_RESUME_DL_FW], in _show_summary_v7()
10717 struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo; in _show_summary_v8()
10720 struct rtw89_btc_cx *cx = &rtwdev->btc.cx; in _show_summary_v8()
10721 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in _show_summary_v8()
10722 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v8()
10723 u32 *cnt = rtwdev->btc.dm.cnt_notify; in _show_summary_v8()
10727 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v8()
10732 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v8()
10733 if (pcinfo->valid && wl->status.map.lps != BTC_LPS_RF_OFF && in _show_summary_v8()
10734 !wl->status.map.rf_off) { in _show_summary_v8()
10735 prptctrl = &pfwinfo->rpt_ctrl.finfo.v8; in _show_summary_v8()
10738 …"\n\r %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d, len:%d, max:fw-%d/drv-%d), ", in _show_summary_v8()
10739 "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v8()
10740 le16_to_cpu(prptctrl->rpt_info.cnt_h2c), pfwinfo->cnt_c2h, in _show_summary_v8()
10741 le16_to_cpu(prptctrl->rpt_info.cnt_c2h), in _show_summary_v8()
10742 le16_to_cpu(prptctrl->rpt_info.len_c2h), in _show_summary_v8()
10743 (prptctrl->rpt_len_max_h << 8) + prptctrl->rpt_len_max_l, in _show_summary_v8()
10744 rtwdev->btc.ver->info_buf); in _show_summary_v8()
10747 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v8()
10748 le16_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v8()
10749 le32_to_cpu(prptctrl->rpt_info.en)); in _show_summary_v8()
10751 if (dm->error.map.wl_fw_hang) in _show_summary_v8()
10754 seq_printf(m, "\n\r %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v8()
10755 "[mailbox]", le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v8()
10756 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v8()
10757 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v8()
10760 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v8()
10761 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v8()
10762 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v8()
10763 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v8()
10764 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v8()
10767 "\n\r %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d/time:%dms]", in _show_summary_v8()
10768 "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v8()
10769 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v8()
10770 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v8()
10771 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT], in _show_summary_v8()
10772 wl->rfk_info.proc_time); in _show_summary_v8()
10775 le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ])); in _show_summary_v8()
10778 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on), in _show_summary_v8()
10779 le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off)); in _show_summary_v8()
10782 "\n\r %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d (lps=%d/rf_off=%d)", in _show_summary_v8()
10784 pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail, in _show_summary_v8()
10785 pfwinfo->cnt_c2h, in _show_summary_v8()
10786 wl->status.map.lps, wl->status.map.rf_off); in _show_summary_v8()
10790 cnt_sum += dm->cnt_notify[i]; in _show_summary_v8()
10793 "\n\r %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v8()
10805 "\n\r %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, switch_chbw=%d, special_pkt=%d, ", in _show_summary_v8()
10813 rtwdev->btc.hubmsg_cnt, cnt[BTC_NCNT_RESUME_DL_FW], in _show_summary_v8()
10819 struct rtw89_fw_suit *fw_suit = &rtwdev->fw.normal; in rtw89_btc_dump_info()
10820 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_dump_info()
10821 const struct rtw89_btc_ver *ver = btc->ver; in rtw89_btc_dump_info()
10822 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_btc_dump_info()
10823 struct rtw89_btc_bt_info *bt = &cx->bt; in rtw89_btc_dump_info()
10827 fw_suit->major_ver, fw_suit->minor_ver, in rtw89_btc_dump_info()
10828 fw_suit->sub_ver, fw_suit->sub_idex); in rtw89_btc_dump_info()
10829 seq_printf(m, "manual %d\n", btc->manual_ctrl); in rtw89_btc_dump_info()
10833 seq_printf(m, "\n\r %-15s : raw_data[%02x %02x %02x %02x %02x %02x] (type:%s/cnt:%d/same:%d)", in rtw89_btc_dump_info()
10835 bt->raw_info[2], bt->raw_info[3], in rtw89_btc_dump_info()
10836 bt->raw_info[4], bt->raw_info[5], in rtw89_btc_dump_info()
10837 bt->raw_info[6], bt->raw_info[7], in rtw89_btc_dump_info()
10838 bt->raw_info[0] == BTC_BTINFO_AUTO ? "auto" : "reply", in rtw89_btc_dump_info()
10839 cx->cnt_bt[BTC_BCNT_INFOUPDATE], in rtw89_btc_dump_info()
10840 cx->cnt_bt[BTC_BCNT_INFOSAME]); in rtw89_btc_dump_info()
10850 if (ver->fcxmreg == 1) in rtw89_btc_dump_info()
10852 else if (ver->fcxmreg == 2) in rtw89_btc_dump_info()
10854 else if (ver->fcxmreg == 7) in rtw89_btc_dump_info()
10859 if (ver->fcxbtcrpt == 1) in rtw89_btc_dump_info()
10861 else if (ver->fcxbtcrpt == 4) in rtw89_btc_dump_info()
10863 else if (ver->fcxbtcrpt == 5) in rtw89_btc_dump_info()
10865 else if (ver->fcxbtcrpt == 105) in rtw89_btc_dump_info()
10867 else if (ver->fcxbtcrpt == 7) in rtw89_btc_dump_info()
10869 else if (ver->fcxbtcrpt == 8) in rtw89_btc_dump_info()
10875 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_coex_recognize_ver()
10876 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_recognize_ver()
10888 if (chip->chip_id != btc_ver_def->chip_id) in rtw89_coex_recognize_ver()
10891 if (suit_ver_code >= btc_ver_def->fw_ver_code) { in rtw89_coex_recognize_ver()
10892 btc->ver = btc_ver_def; in rtw89_coex_recognize_ver()
10897 btc->ver = &rtw89_btc_ver_defs[RTW89_DEFAULT_BTC_VER_IDX]; in rtw89_coex_recognize_ver()
10901 (int)(btc->ver - rtw89_btc_ver_defs), btc->ver->fw_ver_code); in rtw89_coex_recognize_ver()