Lines Matching +full:lo +full:- +full:x2 +full:- +full:en
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2019-2020 Realtek Corporation
31 CXTDMA_AUTO = 0x2,
39 CXFLC_QOSNULL = 0x2,
166 CXPOLICY_TYPE = 0x2,
262 /* TDMA off + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo */
265 /* TDMA off + pri: WL_Hi-Tx > BT, BT_Hi > other-WL > BT_Lo */
268 /* TDMA off + pri: WL_Hi-Tx = BT */
271 /* TDMA off+Bcn-Protect + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo*/
274 /* TDMA off + Ext-Ctrl + pri: default */
277 /* TDMA off + Ext-Ctrl + pri: E2G-slot block all BT */
280 /* TDMA off + Ext-Ctrl + pri: default */
283 /* TDMA off + Ext-Ctrl + pri: E2G-slot block all BT */
286 /* TDMA off + Ext-Ctrl + pri: E2G-slot WL > BT */
289 /* TDMA off + Ext-Ctrl + pri: E2G/EBT-slot WL > BT */
292 /* TDMA off + Ext-Ctrl + pri: default */
295 /* TDMA Fix slot-0: W1:B1 = 30:30 */
298 /* TDMA Fix slot-1: W1:B1 = 50:50 */
301 /* TDMA Fix slot-2: W1:B1 = 20:30 */
304 /* TDMA Fix slot-3: W1:B1 = 40:10 */
307 /* TDMA Fix slot-4: W1:B1 = 70:10 */
310 /* TDMA Fix slot-5: W1:B1 = 20:60 */
313 /* TDMA Fix slot-6: W1:B1 = 30:60 */
316 /* TDMA Fix slot-7: W1:B1 = 20:80 */
319 /* TDMA Fix slot-8: W1:B1 = user-define */
322 /* TDMA Fix slot-9: W1:B1 = 40:20 */
325 /* TDMA Fix slot-9: W1:B1 = 40:10 */
328 /* PS-TDMA Fix slot-0: W1:B1 = 30:30 */
331 /* PS-TDMA Fix slot-1: W1:B1 = 50:50 */
334 /* PS-TDMA Fix slot-2: W1:B1 = 20:30 */
337 /* PS-TDMA Fix slot-3: W1:B1 = 20:60 */
340 /* PS-TDMA Fix slot-4: W1:B1 = 30:70 */
343 /* PS-TDMA Fix slot-5: W1:B1 = 20:80 */
346 /* PS-TDMA Fix slot-6: W1:B1 = user-define */
349 /* TDMA Auto slot-0: W1:B1 = 50:200 */
352 /* TDMA Auto slot-1: W1:B1 = 60:200 */
355 /* TDMA Auto slot-2: W1:B1 = 20:200 */
358 /* TDMA Auto slot-3: W1:B1 = user-define */
361 /* PS-TDMA Auto slot-0: W1:B1 = 50:200 */
364 /* PS-TDMA Auto slot-1: W1:B1 = 60:200 */
367 /* PS-TDMA Auto slot-2: W1:B1 = 20:200 */
370 /* PS-TDMA Auto slot-3: W1:B1 = user-define */
373 /* TDMA Auto slot2-0: W1:B4 = 30:50 */
376 /* TDMA Auto slot2-1: W1:B4 = 30:70 */
379 /* TDMA Auto slot2-2: W1:B4 = 50:50 */
382 /* TDMA Auto slot2-3: W1:B4 = 60:60 */
385 /* TDMA Auto slot2-4: W1:B4 = 20:80 */
388 /* TDMA Auto slot2-5: W1:B4 = user-define */
391 /* PS-TDMA Auto slot2-0: W1:B4 = 30:50 */
394 /* PS-TDMA Auto slot2-1: W1:B4 = 30:70 */
397 /* PS-TDMA Auto slot2-2: W1:B4 = 50:50 */
400 /* PS-TDMA Auto slot2-3: W1:B4 = 60:60 */
403 /* PS-TDMA Auto slot2-4: W1:B4 = 20:80 */
406 /* PS-TDMA Auto slot2-5: W1:B4 = user-define */
566 BTC_ACT_NUM = BTC_ACT_LAST - BTC_ACT_NONE,
584 struct rtw89_btc *btc = &rtwdev->btc; in _send_fw_cmd()
585 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _send_fw_cmd()
586 struct rtw89_btc_cx *cx = &btc->cx; in _send_fw_cmd()
587 struct rtw89_btc_wl_info *wl = &cx->wl; in _send_fw_cmd()
590 if (!wl->status.map.init_ok) { in _send_fw_cmd()
593 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
595 } else if ((wl->status.map.rf_off_pre == BTC_LPS_RF_OFF && in _send_fw_cmd()
596 wl->status.map.rf_off == BTC_LPS_RF_OFF) || in _send_fw_cmd()
597 (wl->status.map.lps_pre == BTC_LPS_RF_OFF && in _send_fw_cmd()
598 wl->status.map.lps == BTC_LPS_RF_OFF)) { in _send_fw_cmd()
601 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
605 pfwinfo->cnt_h2c++; in _send_fw_cmd()
610 pfwinfo->cnt_h2c_fail++; in _send_fw_cmd()
615 struct rtw89_btc *btc = &rtwdev->btc; in _reset_btc_var()
616 struct rtw89_btc_cx *cx = &btc->cx; in _reset_btc_var()
617 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _reset_btc_var()
618 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _reset_btc_var()
619 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _reset_btc_var()
620 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _reset_btc_var()
631 memset(&btc->ctrl, 0, sizeof(btc->ctrl)); in _reset_btc_var()
632 btc->ctrl.trace_step = FCXDEF_STEP; in _reset_btc_var()
637 memset(&btc->dm, 0, sizeof(btc->dm)); in _reset_btc_var()
638 memset(bt_linfo->rssi_state, 0, sizeof(bt_linfo->rssi_state)); in _reset_btc_var()
645 btc->dm.tdma_now = t_def[CXTD_OFF]; in _reset_btc_var()
646 btc->dm.tdma = t_def[CXTD_OFF]; in _reset_btc_var()
647 memcpy(&btc->dm.slot_now, s_def, sizeof(btc->dm.slot_now)); in _reset_btc_var()
648 memcpy(&btc->dm.slot, s_def, sizeof(btc->dm.slot)); in _reset_btc_var()
650 btc->policy_len = 0; in _reset_btc_var()
651 btc->bt_req_len = 0; in _reset_btc_var()
653 btc->dm.coex_info_map = BTC_COEX_INFO_ALL; in _reset_btc_var()
654 btc->dm.wl_tx_limit.tx_time = BTC_MAX_TX_TIME_DEF; in _reset_btc_var()
655 btc->dm.wl_tx_limit.tx_retry = BTC_MAX_TX_RETRY_DEF; in _reset_btc_var()
659 memset(&btc->mdinfo, 0, sizeof(btc->mdinfo)); in _reset_btc_var()
668 struct rtw89_btc *btc = &rtwdev->btc; in _chk_btc_err()
669 struct rtw89_btc_cx *cx = &btc->cx; in _chk_btc_err()
670 struct rtw89_btc_dm *dm = &btc->dm; in _chk_btc_err()
671 struct rtw89_btc_bt_info *bt = &cx->bt; in _chk_btc_err()
679 if (dm->cnt_dm[BTC_DCNT_RPT] == cnt && btc->fwinfo.rpt_en_map) in _chk_btc_err()
680 dm->cnt_dm[BTC_DCNT_RPT_FREEZE]++; in _chk_btc_err()
682 dm->cnt_dm[BTC_DCNT_RPT_FREEZE] = 0; in _chk_btc_err()
684 if (dm->cnt_dm[BTC_DCNT_RPT_FREEZE] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
685 dm->error.map.wl_fw_hang = true; in _chk_btc_err()
687 dm->error.map.wl_fw_hang = false; in _chk_btc_err()
689 dm->cnt_dm[BTC_DCNT_RPT] = cnt; in _chk_btc_err()
692 if (dm->cnt_dm[BTC_DCNT_CYCLE] == cnt && in _chk_btc_err()
693 (dm->tdma_now.type != CXTDMA_OFF || in _chk_btc_err()
694 dm->tdma_now.ext_ctrl == CXECTL_EXT)) in _chk_btc_err()
695 dm->cnt_dm[BTC_DCNT_CYCLE_FREEZE]++; in _chk_btc_err()
697 dm->cnt_dm[BTC_DCNT_CYCLE_FREEZE] = 0; in _chk_btc_err()
699 if (dm->cnt_dm[BTC_DCNT_CYCLE_FREEZE] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
700 dm->error.map.cycle_hang = true; in _chk_btc_err()
702 dm->error.map.cycle_hang = false; in _chk_btc_err()
704 dm->cnt_dm[BTC_DCNT_CYCLE] = cnt; in _chk_btc_err()
707 if (dm->cnt_dm[BTC_DCNT_W1] == cnt && in _chk_btc_err()
708 dm->tdma_now.type != CXTDMA_OFF) in _chk_btc_err()
709 dm->cnt_dm[BTC_DCNT_W1_FREEZE]++; in _chk_btc_err()
711 dm->cnt_dm[BTC_DCNT_W1_FREEZE] = 0; in _chk_btc_err()
713 if (dm->cnt_dm[BTC_DCNT_W1_FREEZE] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
714 dm->error.map.w1_hang = true; in _chk_btc_err()
716 dm->error.map.w1_hang = false; in _chk_btc_err()
718 dm->cnt_dm[BTC_DCNT_W1] = cnt; in _chk_btc_err()
721 if (dm->cnt_dm[BTC_DCNT_B1] == cnt && in _chk_btc_err()
722 dm->tdma_now.type != CXTDMA_OFF) in _chk_btc_err()
723 dm->cnt_dm[BTC_DCNT_B1_FREEZE]++; in _chk_btc_err()
725 dm->cnt_dm[BTC_DCNT_B1_FREEZE] = 0; in _chk_btc_err()
727 if (dm->cnt_dm[BTC_DCNT_B1_FREEZE] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
728 dm->error.map.b1_hang = true; in _chk_btc_err()
730 dm->error.map.b1_hang = false; in _chk_btc_err()
732 dm->cnt_dm[BTC_DCNT_B1] = cnt; in _chk_btc_err()
736 dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC]++; in _chk_btc_err()
738 dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC] = 0; in _chk_btc_err()
740 if (dm->cnt_dm[BTC_DCNT_TDMA_NONSYNC] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
741 dm->error.map.tdma_no_sync = true; in _chk_btc_err()
743 dm->error.map.tdma_no_sync = false; in _chk_btc_err()
747 dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC]++; in _chk_btc_err()
749 dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC] = 0; in _chk_btc_err()
751 if (dm->cnt_dm[BTC_DCNT_SLOT_NONSYNC] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
752 dm->error.map.tdma_no_sync = true; in _chk_btc_err()
754 dm->error.map.tdma_no_sync = false; in _chk_btc_err()
757 cnt = cx->cnt_bt[BTC_BCNT_HIPRI_RX] + in _chk_btc_err()
758 cx->cnt_bt[BTC_BCNT_HIPRI_TX] + in _chk_btc_err()
759 cx->cnt_bt[BTC_BCNT_LOPRI_RX] + in _chk_btc_err()
760 cx->cnt_bt[BTC_BCNT_LOPRI_TX]; in _chk_btc_err()
763 dm->cnt_dm[BTC_DCNT_BTCNT_FREEZE]++; in _chk_btc_err()
765 dm->cnt_dm[BTC_DCNT_BTCNT_FREEZE] = 0; in _chk_btc_err()
767 if ((dm->cnt_dm[BTC_DCNT_BTCNT_FREEZE] >= BTC_CHK_HANG_MAX && in _chk_btc_err()
768 bt->enable.now) || (!dm->cnt_dm[BTC_DCNT_BTCNT_FREEZE] && in _chk_btc_err()
769 !bt->enable.now)) in _chk_btc_err()
774 dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT]++; in _chk_btc_err()
776 dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT] = 0; in _chk_btc_err()
778 if (dm->cnt_dm[BTC_DCNT_WL_SLOT_DRIFT] >= BTC_CHK_HANG_MAX) in _chk_btc_err()
779 dm->error.map.wl_slot_drift = true; in _chk_btc_err()
781 dm->error.map.wl_slot_drift = false; in _chk_btc_err()
788 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_report()
789 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _update_bt_report()
790 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _update_bt_report()
791 struct rtw89_btc_bt_a2dp_desc *a2dp = &bt_linfo->a2dp_desc; in _update_bt_report()
808 bt->ver_info.fw = le32_to_cpu(pver->fw_ver); in _update_bt_report()
809 bt->ver_info.fw_coex = le32_get_bits(pver->coex_ver, GENMASK(7, 0)); in _update_bt_report()
810 bt->feature = le32_to_cpu(pver->feature); in _update_bt_report()
813 memcpy(bt->scan_info, pscan->scan, BTC_SCAN_MAX1); in _update_bt_report()
816 memcpy(&bt_linfo->afh_map[0], pafh->afh_l, 4); in _update_bt_report()
817 memcpy(&bt_linfo->afh_map[4], pafh->afh_m, 4); in _update_bt_report()
818 memcpy(&bt_linfo->afh_map[8], pafh->afh_h, 2); in _update_bt_report()
821 a2dp->device_name = le32_to_cpu(pdev->dev_name); in _update_bt_report()
822 a2dp->vendor_id = le16_to_cpu(pdev->vendor_id); in _update_bt_report()
823 a2dp->flush_time = le32_to_cpu(pdev->flush_time); in _update_bt_report()
861 #define __CPY_U8(_x) ({dst->_x = src->_x; }) in rtw89_btc_fbtc_cysta_to_cpu()
862 #define __CPY_LE16(_x) ({dst->_x = le16_to_cpu(src->_x); }) in rtw89_btc_fbtc_cysta_to_cpu()
863 #define __CPY_LE16S(_x) ({int _i; for (_i = 0; _i < ARRAY_SIZE(dst->_x); _i++) \ in rtw89_btc_fbtc_cysta_to_cpu()
864 dst->_x[_i] = le16_to_cpu(src->_x[_i]); }) in rtw89_btc_fbtc_cysta_to_cpu()
865 #define __CPY_LE32(_x) ({dst->_x = le32_to_cpu(src->_x); }) in rtw89_btc_fbtc_cysta_to_cpu()
866 #define __CPY_LE32S(_x) ({int _i; for (_i = 0; _i < ARRAY_SIZE(dst->_x); _i++) \ in rtw89_btc_fbtc_cysta_to_cpu()
867 dst->_x[_i] = le32_to_cpu(src->_x[_i]); }) in rtw89_btc_fbtc_cysta_to_cpu()
913 const struct rtw89_chip_info *chip = rtwdev->chip; in _chk_btc_report()
914 struct rtw89_btc *btc = &rtwdev->btc; in _chk_btc_report()
915 struct rtw89_btc_dm *dm = &btc->dm; in _chk_btc_report()
917 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _chk_btc_report()
918 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _chk_btc_report()
929 u32 trace_step = btc->ctrl.trace_step, rpt_len = 0, diff_t; in _chk_btc_report()
938 pfwinfo->err[BTFRE_INVALID_INPUT]++; in _chk_btc_report()
943 rpt_type = btc_prpt->type; in _chk_btc_report()
944 rpt_len = le16_to_cpu(btc_prpt->len); in _chk_btc_report()
945 rpt_content = btc_prpt->content; in _chk_btc_report()
953 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _chk_btc_report()
954 if (chip->chip_id == RTL8852A) { in _chk_btc_report()
955 pfinfo = &pfwinfo->rpt_ctrl.finfo; in _chk_btc_report()
956 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo); in _chk_btc_report()
958 pfinfo = &pfwinfo->rpt_ctrl.finfo_v1; in _chk_btc_report()
959 pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo_v1); in _chk_btc_report()
961 pcinfo->req_fver = chip->fcxbtcrpt_ver; in _chk_btc_report()
962 pcinfo->rx_len = rpt_len; in _chk_btc_report()
963 pcinfo->rx_cnt++; in _chk_btc_report()
966 pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo; in _chk_btc_report()
967 if (chip->chip_id == RTL8852A) { in _chk_btc_report()
968 pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo; in _chk_btc_report()
969 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo); in _chk_btc_report()
971 pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo_v1; in _chk_btc_report()
972 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo_v1); in _chk_btc_report()
974 pcinfo->req_fver = chip->fcxtdma_ver; in _chk_btc_report()
975 pcinfo->rx_len = rpt_len; in _chk_btc_report()
976 pcinfo->rx_cnt++; in _chk_btc_report()
979 pcinfo = &pfwinfo->rpt_fbtc_slots.cinfo; in _chk_btc_report()
980 pfinfo = &pfwinfo->rpt_fbtc_slots.finfo; in _chk_btc_report()
981 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_slots.finfo); in _chk_btc_report()
982 pcinfo->req_fver = chip->fcxslots_ver; in _chk_btc_report()
983 pcinfo->rx_len = rpt_len; in _chk_btc_report()
984 pcinfo->rx_cnt++; in _chk_btc_report()
987 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _chk_btc_report()
988 if (chip->chip_id == RTL8852A) { in _chk_btc_report()
989 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo; in _chk_btc_report()
990 pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo; in _chk_btc_report()
992 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo); in _chk_btc_report()
994 pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo_v1; in _chk_btc_report()
995 pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1; in _chk_btc_report()
996 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo_v1); in _chk_btc_report()
998 pcinfo->req_fver = chip->fcxcysta_ver; in _chk_btc_report()
999 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1000 pcinfo->rx_cnt++; in _chk_btc_report()
1003 pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; in _chk_btc_report()
1004 if (chip->chip_id == RTL8852A) { in _chk_btc_report()
1005 pfinfo = &pfwinfo->rpt_fbtc_step.finfo; in _chk_btc_report()
1006 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_step.finfo.step[0]) * in _chk_btc_report()
1010 pfinfo = &pfwinfo->rpt_fbtc_step.finfo_v1; in _chk_btc_report()
1011 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_step.finfo_v1.step[0]) * in _chk_btc_report()
1015 pcinfo->req_fver = chip->fcxstep_ver; in _chk_btc_report()
1016 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1017 pcinfo->rx_cnt++; in _chk_btc_report()
1020 pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo; in _chk_btc_report()
1021 if (chip->chip_id == RTL8852A) { in _chk_btc_report()
1022 pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo; in _chk_btc_report()
1023 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo); in _chk_btc_report()
1025 pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo_v1; in _chk_btc_report()
1026 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo_v1); in _chk_btc_report()
1028 pcinfo->req_fver = chip->fcxnullsta_ver; in _chk_btc_report()
1029 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1030 pcinfo->rx_cnt++; in _chk_btc_report()
1033 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _chk_btc_report()
1034 pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo; in _chk_btc_report()
1035 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo); in _chk_btc_report()
1036 pcinfo->req_fver = chip->fcxmreg_ver; in _chk_btc_report()
1037 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1038 pcinfo->rx_cnt++; in _chk_btc_report()
1041 pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo; in _chk_btc_report()
1042 pfinfo = &pfwinfo->rpt_fbtc_gpio_dbg.finfo; in _chk_btc_report()
1043 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_gpio_dbg.finfo); in _chk_btc_report()
1044 pcinfo->req_fver = chip->fcxgpiodbg_ver; in _chk_btc_report()
1045 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1046 pcinfo->rx_cnt++; in _chk_btc_report()
1049 pcinfo = &pfwinfo->rpt_fbtc_btver.cinfo; in _chk_btc_report()
1050 pfinfo = &pfwinfo->rpt_fbtc_btver.finfo; in _chk_btc_report()
1051 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo); in _chk_btc_report()
1052 pcinfo->req_fver = chip->fcxbtver_ver; in _chk_btc_report()
1053 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1054 pcinfo->rx_cnt++; in _chk_btc_report()
1057 pcinfo = &pfwinfo->rpt_fbtc_btscan.cinfo; in _chk_btc_report()
1058 pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo; in _chk_btc_report()
1059 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo); in _chk_btc_report()
1060 pcinfo->req_fver = chip->fcxbtscan_ver; in _chk_btc_report()
1061 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1062 pcinfo->rx_cnt++; in _chk_btc_report()
1065 pcinfo = &pfwinfo->rpt_fbtc_btafh.cinfo; in _chk_btc_report()
1066 pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo; in _chk_btc_report()
1067 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo); in _chk_btc_report()
1068 pcinfo->req_fver = chip->fcxbtafh_ver; in _chk_btc_report()
1069 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1070 pcinfo->rx_cnt++; in _chk_btc_report()
1073 pcinfo = &pfwinfo->rpt_fbtc_btdev.cinfo; in _chk_btc_report()
1074 pfinfo = &pfwinfo->rpt_fbtc_btdev.finfo; in _chk_btc_report()
1075 pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btdev.finfo); in _chk_btc_report()
1076 pcinfo->req_fver = chip->fcxbtdevinfo_ver; in _chk_btc_report()
1077 pcinfo->rx_len = rpt_len; in _chk_btc_report()
1078 pcinfo->rx_cnt++; in _chk_btc_report()
1081 pfwinfo->err[BTFRE_UNDEF_TYPE]++; in _chk_btc_report()
1085 if (rpt_len != pcinfo->req_len) { in _chk_btc_report()
1087 pfwinfo->len_mismch |= (0x1 << rpt_type); in _chk_btc_report()
1089 pfwinfo->len_mismch |= BIT(31); in _chk_btc_report()
1092 __func__, rpt_type, rpt_len, pcinfo->req_len); in _chk_btc_report()
1094 pcinfo->valid = 0; in _chk_btc_report()
1096 } else if (!pfinfo || !rpt_content || !pcinfo->req_len) { in _chk_btc_report()
1097 pfwinfo->err[BTFRE_EXCEPTION]++; in _chk_btc_report()
1098 pcinfo->valid = 0; in _chk_btc_report()
1102 memcpy(pfinfo, rpt_content, pcinfo->req_len); in _chk_btc_report()
1103 pcinfo->valid = 1; in _chk_btc_report()
1105 if (rpt_type == BTC_RPT_TYPE_TDMA && chip->chip_id == RTL8852A) { in _chk_btc_report()
1108 BTC_DCNT_TDMA_NONSYNC, sizeof(dm->tdma_now)); in _chk_btc_report()
1110 if (memcmp(&dm->tdma_now, &pfwinfo->rpt_fbtc_tdma.finfo, in _chk_btc_report()
1111 sizeof(dm->tdma_now)) != 0) { in _chk_btc_report()
1115 dm->tdma_now.type, dm->tdma_now.rxflctrl, in _chk_btc_report()
1116 dm->tdma_now.txpause, dm->tdma_now.wtgle_n, in _chk_btc_report()
1117 dm->tdma_now.leak_n, dm->tdma_now.ext_ctrl, in _chk_btc_report()
1118 dm->tdma_now.rxflctrl_role, in _chk_btc_report()
1119 dm->tdma_now.option_ctrl); in _chk_btc_report()
1124 pfwinfo->rpt_fbtc_tdma.finfo.type, in _chk_btc_report()
1125 pfwinfo->rpt_fbtc_tdma.finfo.rxflctrl, in _chk_btc_report()
1126 pfwinfo->rpt_fbtc_tdma.finfo.txpause, in _chk_btc_report()
1127 pfwinfo->rpt_fbtc_tdma.finfo.wtgle_n, in _chk_btc_report()
1128 pfwinfo->rpt_fbtc_tdma.finfo.leak_n, in _chk_btc_report()
1129 pfwinfo->rpt_fbtc_tdma.finfo.ext_ctrl, in _chk_btc_report()
1130 pfwinfo->rpt_fbtc_tdma.finfo.rxflctrl_role, in _chk_btc_report()
1131 pfwinfo->rpt_fbtc_tdma.finfo.option_ctrl); in _chk_btc_report()
1135 memcmp(&dm->tdma_now, in _chk_btc_report()
1136 &pfwinfo->rpt_fbtc_tdma.finfo, in _chk_btc_report()
1137 sizeof(dm->tdma_now))); in _chk_btc_report()
1141 BTC_DCNT_TDMA_NONSYNC, sizeof(dm->tdma_now)); in _chk_btc_report()
1143 if (memcmp(&dm->tdma_now, &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma, in _chk_btc_report()
1144 sizeof(dm->tdma_now)) != 0) { in _chk_btc_report()
1148 dm->tdma_now.type, dm->tdma_now.rxflctrl, in _chk_btc_report()
1149 dm->tdma_now.txpause, dm->tdma_now.wtgle_n, in _chk_btc_report()
1150 dm->tdma_now.leak_n, dm->tdma_now.ext_ctrl, in _chk_btc_report()
1151 dm->tdma_now.rxflctrl_role, in _chk_btc_report()
1152 dm->tdma_now.option_ctrl); in _chk_btc_report()
1156 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.type, in _chk_btc_report()
1157 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.rxflctrl, in _chk_btc_report()
1158 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.txpause, in _chk_btc_report()
1159 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.wtgle_n, in _chk_btc_report()
1160 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.leak_n, in _chk_btc_report()
1161 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.ext_ctrl, in _chk_btc_report()
1162 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.rxflctrl_role, in _chk_btc_report()
1163 pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.option_ctrl); in _chk_btc_report()
1167 memcmp(&dm->tdma_now, in _chk_btc_report()
1168 &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma, in _chk_btc_report()
1169 sizeof(dm->tdma_now))); in _chk_btc_report()
1176 sizeof(dm->slot_now)); in _chk_btc_report()
1178 if (memcmp(dm->slot_now, pfwinfo->rpt_fbtc_slots.finfo.slot, in _chk_btc_report()
1179 sizeof(dm->slot_now)) != 0) { in _chk_btc_report()
1182 &pfwinfo->rpt_fbtc_slots.finfo.slot[i]; in _chk_btc_report()
1183 if (memcmp(&dm->slot_now[i], rtp_slot, in _chk_btc_report()
1184 sizeof(dm->slot_now[i])) != 0) { in _chk_btc_report()
1189 dm->slot_now[i].dur, in _chk_btc_report()
1190 dm->slot_now[i].cxtbl, in _chk_btc_report()
1191 dm->slot_now[i].cxtype); in _chk_btc_report()
1197 rtp_slot->dur, in _chk_btc_report()
1198 rtp_slot->cxtbl, in _chk_btc_report()
1199 rtp_slot->cxtype); in _chk_btc_report()
1204 memcmp(dm->slot_now, in _chk_btc_report()
1205 pfwinfo->rpt_fbtc_slots.finfo.slot, in _chk_btc_report()
1206 sizeof(dm->slot_now))); in _chk_btc_report()
1209 if (rpt_type == BTC_RPT_TYPE_CYSTA && chip->chip_id == RTL8852A && in _chk_btc_report()
1210 pcysta->cycles >= BTC_CYSTA_CHK_PERIOD) { in _chk_btc_report()
1211 /* Check Leak-AP */ in _chk_btc_report()
1212 if (pcysta->slot_cnt[CXST_LK] != 0 && in _chk_btc_report()
1213 pcysta->leakrx_cnt != 0 && dm->tdma_now.rxflctrl) { in _chk_btc_report()
1214 if (pcysta->slot_cnt[CXST_LK] < in _chk_btc_report()
1215 BTC_LEAK_AP_TH * pcysta->leakrx_cnt) in _chk_btc_report()
1216 dm->leak_ap = 1; in _chk_btc_report()
1220 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1221 dm->tdma_now.ext_ctrl == CXECTL_EXT) in _chk_btc_report()
1222 wl_slot_set = le16_to_cpu(dm->slot_now[CXST_E2G].dur); in _chk_btc_report()
1224 wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur); in _chk_btc_report()
1226 if (pcysta->tavg_cycle[CXT_WL] > wl_slot_set) { in _chk_btc_report()
1227 diff_t = pcysta->tavg_cycle[CXT_WL] - wl_slot_set; in _chk_btc_report()
1231 _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_W1]); in _chk_btc_report()
1232 _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_B1]); in _chk_btc_report()
1233 _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE, (u32)pcysta->cycles); in _chk_btc_report()
1235 le16_to_cpu(pcysta_v1->cycles) >= BTC_CYSTA_CHK_PERIOD) { in _chk_btc_report()
1236 cnt_leak_slot = le32_to_cpu(pcysta_v1->slot_cnt[CXST_LK]); in _chk_btc_report()
1237 cnt_rx_imr = le32_to_cpu(pcysta_v1->leak_slot.cnt_rximr); in _chk_btc_report()
1238 /* Check Leak-AP */ in _chk_btc_report()
1240 dm->tdma_now.rxflctrl) { in _chk_btc_report()
1242 dm->leak_ap = 1; in _chk_btc_report()
1246 if (dm->tdma_now.type == CXTDMA_OFF) { in _chk_btc_report()
1247 wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur); in _chk_btc_report()
1248 wl_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_WL]); in _chk_btc_report()
1250 diff_t = wl_slot_real - wl_slot_set; in _chk_btc_report()
1256 if (dm->tdma_now.type == CXTDMA_OFF && in _chk_btc_report()
1257 dm->tdma_now.ext_ctrl == CXECTL_EXT && in _chk_btc_report()
1258 btc->bt_req_len != 0) { in _chk_btc_report()
1259 bt_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_BT]); in _chk_btc_report()
1261 if (btc->bt_req_len > bt_slot_real) { in _chk_btc_report()
1262 diff_t = btc->bt_req_len - bt_slot_real; in _chk_btc_report()
1268 le32_to_cpu(pcysta_v1->slot_cnt[CXST_W1])); in _chk_btc_report()
1270 le32_to_cpu(pcysta_v1->slot_cnt[CXST_B1])); in _chk_btc_report()
1272 (u32)le16_to_cpu(pcysta_v1->cycles)); in _chk_btc_report()
1275 if (rpt_type == BTC_RPT_TYPE_CTRL && chip->chip_id == RTL8852A) { in _chk_btc_report()
1276 prpt = &pfwinfo->rpt_ctrl.finfo; in _chk_btc_report()
1277 btc->fwinfo.rpt_en_map = prpt->rpt_enable; in _chk_btc_report()
1278 wl->ver_info.fw_coex = prpt->wl_fw_coex_ver; in _chk_btc_report()
1279 wl->ver_info.fw = prpt->wl_fw_ver; in _chk_btc_report()
1280 dm->wl_fw_cx_offload = !!prpt->wl_fw_cx_offload; in _chk_btc_report()
1283 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1285 /* To avoid I/O if WL LPS or power-off */ in _chk_btc_report()
1286 if (wl->status.map.lps != BTC_LPS_RF_OFF && !wl->status.map.rf_off) { in _chk_btc_report()
1287 rtwdev->chip->ops->btc_update_bt_cnt(rtwdev); in _chk_btc_report()
1290 btc->cx.cnt_bt[BTC_BCNT_POLUT] = in _chk_btc_report()
1294 prpt_v1 = &pfwinfo->rpt_ctrl.finfo_v1; in _chk_btc_report()
1295 btc->fwinfo.rpt_en_map = le32_to_cpu(prpt_v1->rpt_info.en); in _chk_btc_report()
1296 wl->ver_info.fw_coex = le32_to_cpu(prpt_v1->wl_fw_info.cx_ver); in _chk_btc_report()
1297 wl->ver_info.fw = le32_to_cpu(prpt_v1->wl_fw_info.fw_ver); in _chk_btc_report()
1298 dm->wl_fw_cx_offload = !!le32_to_cpu(prpt_v1->wl_fw_info.cx_offload); in _chk_btc_report()
1301 memcpy(&dm->gnt.band[i], &prpt_v1->gnt_val[i], in _chk_btc_report()
1302 sizeof(dm->gnt.band[i])); in _chk_btc_report()
1304 btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_TX]); in _chk_btc_report()
1305 btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_RX]); in _chk_btc_report()
1306 btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_TX]); in _chk_btc_report()
1307 btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_RX]); in _chk_btc_report()
1308 btc->cx.cnt_bt[BTC_BCNT_POLUT] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_POLLUTED]); in _chk_btc_report()
1312 pfwinfo->event[BTF_EVNT_RPT]); in _chk_btc_report()
1314 if (le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0) in _chk_btc_report()
1315 bt->rfk_info.map.timeout = 1; in _chk_btc_report()
1317 bt->rfk_info.map.timeout = 0; in _chk_btc_report()
1319 dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout; in _chk_btc_report()
1333 const struct rtw89_chip_info *chip = rtwdev->chip; in _parse_btc_report()
1343 if (index + 2 >= chip->btc_fwinfo_buf) in _parse_btc_report()
1346 rpt_len = le16_to_cpu(btc_prpt->len); in _parse_btc_report()
1361 const struct rtw89_chip_info *chip = rtwdev->chip; in _append_tdma()
1362 struct rtw89_btc *btc = &rtwdev->btc; in _append_tdma()
1363 struct rtw89_btc_dm *dm = &btc->dm; in _append_tdma()
1367 u16 len = btc->policy_len; in _append_tdma()
1369 if (!btc->update_policy_force && in _append_tdma()
1370 !memcmp(&dm->tdma, &dm->tdma_now, sizeof(dm->tdma))) { in _append_tdma()
1377 tlv = (struct rtw89_btc_btf_tlv *)&btc->policy[len]; in _append_tdma()
1378 tlv->type = CXPOLICY_TDMA; in _append_tdma()
1379 if (chip->chip_id == RTL8852A) { in _append_tdma()
1380 v = (struct rtw89_btc_fbtc_tdma *)&tlv->val[0]; in _append_tdma()
1381 tlv->len = sizeof(*v); in _append_tdma()
1382 memcpy(v, &dm->tdma, sizeof(*v)); in _append_tdma()
1383 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v); in _append_tdma()
1385 tlv->len = sizeof(*v1); in _append_tdma()
1386 v1 = (struct rtw89_btc_fbtc_tdma_v1 *)&tlv->val[0]; in _append_tdma()
1387 v1->fver = chip->fcxtdma_ver; in _append_tdma()
1388 v1->tdma = dm->tdma; in _append_tdma()
1389 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v1); in _append_tdma()
1394 __func__, dm->tdma.type, dm->tdma.rxflctrl, in _append_tdma()
1395 dm->tdma.txpause, dm->tdma.wtgle_n, dm->tdma.leak_n, in _append_tdma()
1396 dm->tdma.ext_ctrl); in _append_tdma()
1401 struct rtw89_btc *btc = &rtwdev->btc; in _append_slot()
1402 struct rtw89_btc_dm *dm = &btc->dm; in _append_slot()
1409 "[BTC], %s(): A:btc->policy_len = %d\n", in _append_slot()
1410 __func__, btc->policy_len); in _append_slot()
1413 if (!btc->update_policy_force && in _append_slot()
1414 !memcmp(&dm->slot[i], &dm->slot_now[i], in _append_slot()
1415 sizeof(dm->slot[i]))) in _append_slot()
1418 len = btc->policy_len; in _append_slot()
1420 tlv = (struct rtw89_btc_btf_tlv *)&btc->policy[len]; in _append_slot()
1421 v = (struct btc_fbtc_1slot *)&tlv->val[0]; in _append_slot()
1422 tlv->type = CXPOLICY_SLOT; in _append_slot()
1423 tlv->len = sizeof(*v); in _append_slot()
1425 v->fver = FCXONESLOT_VER; in _append_slot()
1426 v->sid = i; in _append_slot()
1427 v->slot = dm->slot[i]; in _append_slot()
1430 "[BTC], %s(): slot-%d: dur=%d, table=0x%08x, type=%d\n", in _append_slot()
1431 __func__, i, dm->slot[i].dur, dm->slot[i].cxtbl, in _append_slot()
1432 dm->slot[i].cxtype); in _append_slot()
1435 btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v); in _append_slot()
1447 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_fw_en_rpt()
1448 struct rtw89_btc_btf_fwinfo *fwinfo = &btc->fwinfo; in rtw89_btc_fw_en_rpt()
1457 val = fwinfo->rpt_en_map | rpt_map; in rtw89_btc_fw_en_rpt()
1459 val = fwinfo->rpt_en_map & ~rpt_map; in rtw89_btc_fw_en_rpt()
1461 if (val == fwinfo->rpt_en_map) in rtw89_btc_fw_en_rpt()
1464 fwinfo->rpt_en_map = val; in rtw89_btc_fw_en_rpt()
1485 tbl->fver = BTF_SET_SLOT_TABLE_VER; in rtw89_btc_fw_set_slots()
1486 tbl->tbl_num = num; in rtw89_btc_fw_set_slots()
1487 ptr = &tbl->buf[0]; in rtw89_btc_fw_set_slots()
1497 const struct rtw89_chip_info *chip = rtwdev->chip; in btc_fw_set_monreg()
1502 n = chip->mon_reg_num; in btc_fw_set_monreg()
1519 monreg->fver = BTF_SET_MON_REG_VER; in btc_fw_set_monreg()
1520 monreg->reg_num = n; in btc_fw_set_monreg()
1521 ptr = &monreg->buf[0]; in btc_fw_set_monreg()
1522 memcpy(ptr, chip->mon_reg, n * ulen); in btc_fw_set_monreg()
1535 struct rtw89_btc *btc = &rtwdev->btc; in _update_dm_step()
1536 struct rtw89_btc_dm *dm = &btc->dm; in _update_dm_step()
1538 /* use ring-structure to store dm step */ in _update_dm_step()
1539 dm->dm_step.step[dm->dm_step.step_pos] = reason_or_action; in _update_dm_step()
1540 dm->dm_step.step_pos++; in _update_dm_step()
1542 if (dm->dm_step.step_pos >= ARRAY_SIZE(dm->dm_step.step)) { in _update_dm_step()
1543 dm->dm_step.step_pos = 0; in _update_dm_step()
1544 dm->dm_step.step_ov = true; in _update_dm_step()
1551 struct rtw89_btc *btc = &rtwdev->btc; in _fw_set_policy()
1552 struct rtw89_btc_dm *dm = &btc->dm; in _fw_set_policy()
1554 dm->run_action = action; in _fw_set_policy()
1559 btc->policy_len = 0; in _fw_set_policy()
1560 btc->policy_type = policy_type; in _fw_set_policy()
1565 if (btc->policy_len == 0 || btc->policy_len > RTW89_BTC_POLICY_MAXLEN) in _fw_set_policy()
1569 "[BTC], %s(): action = %d -> policy type/len: 0x%04x/%d\n", in _fw_set_policy()
1570 __func__, action, policy_type, btc->policy_len); in _fw_set_policy()
1572 if (dm->tdma.rxflctrl == CXFLC_NULLP || in _fw_set_policy()
1573 dm->tdma.rxflctrl == CXFLC_QOSNULL) in _fw_set_policy()
1574 btc->lps = 1; in _fw_set_policy()
1576 btc->lps = 0; in _fw_set_policy()
1578 if (btc->lps == 1) in _fw_set_policy()
1579 rtw89_set_coex_ctrl_lps(rtwdev, btc->lps); in _fw_set_policy()
1582 btc->policy, btc->policy_len); in _fw_set_policy()
1584 memcpy(&dm->tdma_now, &dm->tdma, sizeof(dm->tdma_now)); in _fw_set_policy()
1585 memcpy(&dm->slot_now, &dm->slot, sizeof(dm->slot_now)); in _fw_set_policy()
1587 if (btc->update_policy_force) in _fw_set_policy()
1588 btc->update_policy_force = false; in _fw_set_policy()
1590 if (btc->lps == 0) in _fw_set_policy()
1591 rtw89_set_coex_ctrl_lps(rtwdev, btc->lps); in _fw_set_policy()
1596 const struct rtw89_chip_info *chip = rtwdev->chip; in _fw_set_drv_info()
1603 if (chip->chip_id == RTL8852A) in _fw_set_drv_info()
1622 struct rtw89_btc *btc = &rtwdev->btc; in btc_fw_event()
1623 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in btc_fw_event()
1643 struct rtw89_btc *btc = &rtwdev->btc; in _set_gnt()
1644 struct rtw89_btc_dm *dm = &btc->dm; in _set_gnt()
1645 struct rtw89_mac_ax_gnt *g = dm->gnt.band; in _set_gnt()
1686 rtw89_chip_mac_cfg_gnt(rtwdev, &dm->gnt); in _set_gnt()
1710 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_tx_power()
1711 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_tx_power()
1712 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_wl_tx_power()
1715 if (wl->rf_para.tx_pwr_freerun == level) in _set_wl_tx_power()
1718 wl->rf_para.tx_pwr_freerun = level; in _set_wl_tx_power()
1719 btc->dm.rf_trx_para.wl_tx_power = level; in _set_wl_tx_power()
1737 chip->ops->btc_set_wl_txpwr_ctrl(rtwdev, pwr_val); in _set_wl_tx_power()
1742 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_rx_gain()
1743 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_rx_gain()
1744 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_wl_rx_gain()
1746 if (wl->rf_para.rx_gain_freerun == level) in _set_wl_rx_gain()
1749 wl->rf_para.rx_gain_freerun = level; in _set_wl_rx_gain()
1750 btc->dm.rf_trx_para.wl_rx_gain = level; in _set_wl_rx_gain()
1756 chip->ops->btc_set_wl_rx_gain(rtwdev, level); in _set_wl_rx_gain()
1761 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_tx_power()
1762 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_tx_power()
1765 if (bt->rf_para.tx_pwr_freerun == level) in _set_bt_tx_power()
1768 bt->rf_para.tx_pwr_freerun = level; in _set_bt_tx_power()
1769 btc->dm.rf_trx_para.bt_tx_power = level; in _set_bt_tx_power()
1775 buf = (s8)(-level); in _set_bt_tx_power()
1783 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_gain()
1784 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_gain()
1786 if (bt->rf_para.rx_gain_freerun == level || in _set_bt_rx_gain()
1790 bt->rf_para.rx_gain_freerun = level; in _set_bt_rx_gain()
1791 btc->dm.rf_trx_para.bt_rx_gain = level; in _set_bt_rx_gain()
1807 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_rf_trx_para()
1808 struct rtw89_btc *btc = &rtwdev->btc; in _set_rf_trx_para()
1809 struct rtw89_btc_dm *dm = &btc->dm; in _set_rf_trx_para()
1810 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_rf_trx_para()
1811 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_rf_trx_para()
1816 if (!dm->freerun) { in _set_rf_trx_para()
1817 dm->trx_para_level = 0; in _set_rf_trx_para()
1818 chip->ops->btc_bt_aci_imp(rtwdev); in _set_rf_trx_para()
1821 level_id = (u8)dm->trx_para_level; in _set_rf_trx_para()
1823 if (level_id >= chip->rf_para_dlink_num || in _set_rf_trx_para()
1824 level_id >= chip->rf_para_ulink_num) { in _set_rf_trx_para()
1831 if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) in _set_rf_trx_para()
1832 para = chip->rf_para_ulink[level_id]; in _set_rf_trx_para()
1834 para = chip->rf_para_dlink[level_id]; in _set_rf_trx_para()
1845 if (bt->enable.now == 0 || wl->status.map.rf_off == 1 || in _set_rf_trx_para()
1846 wl->status.map.lps == BTC_LPS_RF_OFF) in _set_rf_trx_para()
1851 if (wl_stb_chg != dm->wl_stb_chg) { in _set_rf_trx_para()
1855 dm->wl_stb_chg = wl_stb_chg; in _set_rf_trx_para()
1856 chip->ops->btc_wl_s1_standby(rtwdev, dm->wl_stb_chg); in _set_rf_trx_para()
1862 struct rtw89_btc *btc = &rtwdev->btc; in _update_btc_state_map()
1863 struct rtw89_btc_cx *cx = &btc->cx; in _update_btc_state_map()
1864 struct rtw89_btc_wl_info *wl = &cx->wl; in _update_btc_state_map()
1865 struct rtw89_btc_bt_info *bt = &cx->bt; in _update_btc_state_map()
1866 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _update_btc_state_map()
1868 if (wl->status.map.connecting || wl->status.map._4way || in _update_btc_state_map()
1869 wl->status.map.roaming) { in _update_btc_state_map()
1870 cx->state_map = BTC_WLINKING; in _update_btc_state_map()
1871 } else if (wl->status.map.scan) { /* wl scan */ in _update_btc_state_map()
1872 if (bt_linfo->status.map.inq_pag) in _update_btc_state_map()
1873 cx->state_map = BTC_WSCAN_BSCAN; in _update_btc_state_map()
1875 cx->state_map = BTC_WSCAN_BNOSCAN; in _update_btc_state_map()
1876 } else if (wl->status.map.busy) { /* only busy */ in _update_btc_state_map()
1877 if (bt_linfo->status.map.inq_pag) in _update_btc_state_map()
1878 cx->state_map = BTC_WBUSY_BSCAN; in _update_btc_state_map()
1880 cx->state_map = BTC_WBUSY_BNOSCAN; in _update_btc_state_map()
1882 cx->state_map = BTC_WIDLE; in _update_btc_state_map()
1888 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_bt_afh_info()
1889 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_afh_info()
1890 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_bt_afh_info()
1891 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_afh_info()
1892 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _set_bt_afh_info()
1893 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_bt_afh_info()
1894 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_bt_afh_info()
1897 u8 en = 0, i, ch = 0, bw = 0; in _set_bt_afh_info() local
1900 if (btc->ctrl.manual || wl->status.map.scan) in _set_bt_afh_info()
1903 if (chip->chip_id == RTL8852A) { in _set_bt_afh_info()
1904 mode = wl_rinfo->link_mode; in _set_bt_afh_info()
1905 connect_cnt = wl_rinfo->connect_cnt; in _set_bt_afh_info()
1907 mode = wl_rinfo_v1->link_mode; in _set_bt_afh_info()
1908 connect_cnt = wl_rinfo_v1->connect_cnt; in _set_bt_afh_info()
1911 if (wl->status.map.rf_off || bt->whql_test || in _set_bt_afh_info()
1914 en = false; in _set_bt_afh_info()
1916 en = true; in _set_bt_afh_info()
1919 r = &wl_rinfo->active_role[i]; in _set_bt_afh_info()
1920 r1 = &wl_rinfo_v1->active_role_v1[i]; in _set_bt_afh_info()
1922 if (chip->chip_id == RTL8852A && in _set_bt_afh_info()
1923 (r->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
1924 r->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
1925 ch = r->ch; in _set_bt_afh_info()
1926 bw = r->bw; in _set_bt_afh_info()
1928 } else if (chip->chip_id != RTL8852A && in _set_bt_afh_info()
1929 (r1->role == RTW89_WIFI_ROLE_P2P_GO || in _set_bt_afh_info()
1930 r1->role == RTW89_WIFI_ROLE_P2P_CLIENT)) { in _set_bt_afh_info()
1931 ch = r1->ch; in _set_bt_afh_info()
1932 bw = r1->bw; in _set_bt_afh_info()
1937 en = true; in _set_bt_afh_info()
1940 r = &wl_rinfo->active_role[i]; in _set_bt_afh_info()
1941 r1 = &wl_rinfo_v1->active_role_v1[i]; in _set_bt_afh_info()
1943 if (chip->chip_id == RTL8852A && in _set_bt_afh_info()
1944 r->connected && r->band == RTW89_BAND_2G) { in _set_bt_afh_info()
1945 ch = r->ch; in _set_bt_afh_info()
1946 bw = r->bw; in _set_bt_afh_info()
1948 } else if (chip->chip_id != RTL8852A && in _set_bt_afh_info()
1949 r1->connected && r1->band == RTW89_BAND_2G) { in _set_bt_afh_info()
1950 ch = r1->ch; in _set_bt_afh_info()
1951 bw = r1->bw; in _set_bt_afh_info()
1959 bw = 20 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
1962 bw = 40 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
1965 bw = 5 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
1968 bw = 10 + chip->afh_guard_ch * 2; in _set_bt_afh_info()
1972 en = false; /* turn off AFH info if BW > 40 */ in _set_bt_afh_info()
1976 if (wl->afh_info.en == en && in _set_bt_afh_info()
1977 wl->afh_info.ch == ch && in _set_bt_afh_info()
1978 wl->afh_info.bw == bw && in _set_bt_afh_info()
1979 b->profile_cnt.last == b->profile_cnt.now) { in _set_bt_afh_info()
1986 wl->afh_info.en = en; in _set_bt_afh_info()
1987 wl->afh_info.ch = ch; in _set_bt_afh_info()
1988 wl->afh_info.bw = bw; in _set_bt_afh_info()
1990 _send_fw_cmd(rtwdev, BTFC_SET, SET_BT_WL_CH_INFO, &wl->afh_info, 3); in _set_bt_afh_info()
1993 "[BTC], %s(): en=%d, ch=%d, bw=%d\n", in _set_bt_afh_info()
1994 __func__, en, ch, bw); in _set_bt_afh_info()
1995 btc->cx.cnt_wl[BTC_WCNT_CH_UPDATE]++; in _set_bt_afh_info()
2000 struct rtw89_btc *btc = &rtwdev->btc; in _check_freerun()
2001 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _check_freerun()
2002 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _check_freerun()
2003 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _check_freerun()
2004 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _check_freerun()
2005 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _check_freerun()
2006 struct rtw89_btc_bt_hid_desc *hid = &bt_linfo->hid_desc; in _check_freerun()
2008 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in _check_freerun()
2009 btc->dm.trx_para_level = 0; in _check_freerun()
2014 if (wl_rinfo->connect_cnt > BTC_TDMA_WLROLE_MAX || in _check_freerun()
2015 wl_rinfo_v1->connect_cnt > BTC_TDMA_WLROLE_MAX) { in _check_freerun()
2016 btc->dm.trx_para_level = 5; in _check_freerun()
2020 if (bt_linfo->profile_cnt.now == 0) { in _check_freerun()
2021 btc->dm.trx_para_level = 5; in _check_freerun()
2025 if (hid->pair_cnt > BTC_TDMA_BTHID_MAX) { in _check_freerun()
2026 btc->dm.trx_para_level = 5; in _check_freerun()
2031 if (btc->mdinfo.ant.isolation >= BTC_FREERUN_ANTISO_MIN) { in _check_freerun()
2032 btc->dm.trx_para_level = 5; in _check_freerun()
2036 if (!wl->status.map.busy) {/* wl idle -> freerun */ in _check_freerun()
2037 btc->dm.trx_para_level = 5; in _check_freerun()
2039 } else if (wl->rssi_level > 1) {/* WL rssi < 50% (-60dBm) */ in _check_freerun()
2040 btc->dm.trx_para_level = 0; in _check_freerun()
2042 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _check_freerun()
2043 if (wl->rssi_level == 0 && bt_linfo->rssi > 31) { in _check_freerun()
2044 btc->dm.trx_para_level = 6; in _check_freerun()
2046 } else if (wl->rssi_level == 1 && bt_linfo->rssi > 36) { in _check_freerun()
2047 btc->dm.trx_para_level = 7; in _check_freerun()
2050 btc->dm.trx_para_level = 0; in _check_freerun()
2052 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_DL)) { in _check_freerun()
2053 if (bt_linfo->rssi > 28) { in _check_freerun()
2054 btc->dm.trx_para_level = 6; in _check_freerun()
2059 btc->dm.trx_para_level = 0; in _check_freerun()
2063 #define _tdma_set_flctrl(btc, flc) ({(btc)->dm.tdma.rxflctrl = flc; })
2064 #define _tdma_set_flctrl_role(btc, role) ({(btc)->dm.tdma.rxflctrl_role = role; })
2065 #define _tdma_set_tog(btc, wtg) ({(btc)->dm.tdma.wtgle_n = wtg; })
2066 #define _tdma_set_lek(btc, lek) ({(btc)->dm.tdma.leak_n = lek; })
2072 _btc->dm.slot[_sid].dur = cpu_to_le16(dura);\
2073 _btc->dm.slot[_sid].cxtbl = cpu_to_le32(tbl); \
2074 _btc->dm.slot[_sid].cxtype = cpu_to_le16(type); \
2077 #define _slot_set_dur(btc, sid, dura) (btc)->dm.slot[sid].dur = cpu_to_le16(dura)
2078 #define _slot_set_tbl(btc, sid, tbl) (btc)->dm.slot[sid].cxtbl = cpu_to_le32(tbl)
2079 #define _slot_set_type(btc, sid, type) (btc)->dm.slot[sid].cxtype = cpu_to_le16(type)
2143 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_policy()
2145 chip->ops->btc_set_policy(rtwdev, policy_type); in _set_policy()
2152 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_set_policy()
2153 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_set_policy()
2154 struct rtw89_btc_fbtc_tdma *t = &dm->tdma; in rtw89_btc_set_policy()
2155 struct rtw89_btc_fbtc_slot *s = dm->slot; in rtw89_btc_set_policy()
2159 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in rtw89_btc_set_policy()
2160 if (btc->cx.wl.status.map._4way) in rtw89_btc_set_policy()
2173 btc->bt_req_en = false; in rtw89_btc_set_policy()
2180 btc->update_policy_force = true; in rtw89_btc_set_policy()
2228 btc->bt_req_en = true; in rtw89_btc_set_policy()
2246 case BTC_CXP_FIX: /* TDMA Fix-Slot */ in rtw89_btc_set_policy()
2286 case BTC_CXP_FIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
2287 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
2289 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
2294 case BTC_CXP_PFIX: /* PS-TDMA Fix-Slot */ in rtw89_btc_set_policy()
2297 if (btc->cx.wl.role_info.role_map.role.ap) in rtw89_btc_set_policy()
2327 case BTC_CXP_AUTO: /* TDMA Auto-Slot */ in rtw89_btc_set_policy()
2343 case BTC_CXP_AUTO_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
2344 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
2346 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
2351 case BTC_CXP_PAUTO: /* PS-TDMA Auto-Slot */ in rtw89_btc_set_policy()
2368 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
2370 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy()
2375 case BTC_CXP_AUTO2: /* TDMA Auto-Slot2 */ in rtw89_btc_set_policy()
2404 case BTC_CXP_AUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
2405 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
2407 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy()
2412 case BTC_CXP_PAUTO2: /* PS-TDMA Auto-Slot2 */ in rtw89_btc_set_policy()
2441 case BTC_CXP_PAUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy()
2442 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy()
2444 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy()
2455 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_set_policy_v1()
2456 struct rtw89_btc_dm *dm = &btc->dm; in rtw89_btc_set_policy_v1()
2457 struct rtw89_btc_fbtc_tdma *t = &dm->tdma; in rtw89_btc_set_policy_v1()
2458 struct rtw89_btc_fbtc_slot *s = dm->slot; in rtw89_btc_set_policy_v1()
2459 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &btc->cx.wl.role_info_v1; in rtw89_btc_set_policy_v1()
2460 struct rtw89_btc_bt_hid_desc *hid = &btc->cx.bt.link_info.hid_desc; in rtw89_btc_set_policy_v1()
2461 struct rtw89_btc_bt_hfp_desc *hfp = &btc->cx.bt.link_info.hfp_desc; in rtw89_btc_set_policy_v1()
2467 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in rtw89_btc_set_policy_v1()
2468 if (btc->cx.wl.status.map._4way) in rtw89_btc_set_policy_v1()
2470 else if (hid->exist && hid->type == BTC_HID_218) in rtw89_btc_set_policy_v1()
2471 tbl_w1 = cxtbl[7]; /* Ack/BA no break bt Hi-Pri-rx */ in rtw89_btc_set_policy_v1()
2475 if (dm->leak_ap && in rtw89_btc_set_policy_v1()
2479 } else if (hid->exist && hid->type == BTC_HID_218) { in rtw89_btc_set_policy_v1()
2480 tbl_b1 = cxtbl[4]; /* Ack/BA no break bt Hi-Pri-rx */ in rtw89_btc_set_policy_v1()
2492 btc->bt_req_en = false; in rtw89_btc_set_policy_v1()
2496 btc->update_policy_force = true; in rtw89_btc_set_policy_v1()
2555 btc->bt_req_en = true; in rtw89_btc_set_policy_v1()
2559 /* To avoid wl-s0 tx break by hid/hfp tx */ in rtw89_btc_set_policy_v1()
2560 if (hid->exist || hfp->exist) in rtw89_btc_set_policy_v1()
2580 case BTC_CXP_FIX: /* TDMA Fix-Slot */ in rtw89_btc_set_policy_v1()
2621 case BTC_CXP_FIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
2622 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2624 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2631 case BTC_CXP_PFIX: /* PS-TDMA Fix-Slot */ in rtw89_btc_set_policy_v1()
2660 case BTC_CXP_PFIX_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
2661 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2663 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2670 case BTC_CXP_AUTO: /* TDMA Auto-Slot */ in rtw89_btc_set_policy_v1()
2687 case BTC_CXP_AUTO_TDW1B1: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
2688 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2690 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2697 case BTC_CXP_PAUTO: /* PS-TDMA Auto-Slot */ in rtw89_btc_set_policy_v1()
2715 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2717 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2724 case BTC_CXP_AUTO2: /* TDMA Auto-Slot2 */ in rtw89_btc_set_policy_v1()
2754 case BTC_CXP_AUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
2755 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2757 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2759 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy_v1()
2766 case BTC_CXP_PAUTO2: /* PS-TDMA Auto-Slot2 */ in rtw89_btc_set_policy_v1()
2796 case BTC_CXP_PAUTO2_TDW1B4: /* W1:B1 = user-define */ in rtw89_btc_set_policy_v1()
2797 _slot_set(btc, CXST_W1, dm->slot_dur[CXST_W1], in rtw89_btc_set_policy_v1()
2799 _slot_set(btc, CXST_B1, dm->slot_dur[CXST_B1], in rtw89_btc_set_policy_v1()
2801 _slot_set(btc, CXST_B4, dm->slot_dur[CXST_B4], in rtw89_btc_set_policy_v1()
2810 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC && dm->tdma.rxflctrl) { in rtw89_btc_set_policy_v1()
2811 null_role = FIELD_PREP(0x0f, dm->wl_scc.null_role1) | in rtw89_btc_set_policy_v1()
2812 FIELD_PREP(0xf0, dm->wl_scc.null_role2); in rtw89_btc_set_policy_v1()
2816 /* enter leak_slot after each null-1 */ in rtw89_btc_set_policy_v1()
2817 if (dm->leak_ap && dm->tdma.leak_n > 1) in rtw89_btc_set_policy_v1()
2820 if (dm->tdma_instant_excute) { in rtw89_btc_set_policy_v1()
2821 btc->dm.tdma.option_ctrl |= BIT(0); in rtw89_btc_set_policy_v1()
2822 btc->update_policy_force = true; in rtw89_btc_set_policy_v1()
2839 if (!rtwdev->dbcc_en) in _set_bt_plut()
2850 struct rtw89_btc *btc = &rtwdev->btc; in _set_ant()
2851 struct rtw89_btc_dm *dm = &btc->dm; in _set_ant()
2852 struct rtw89_btc_cx *cx = &btc->cx; in _set_ant()
2853 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_ant()
2854 struct rtw89_btc_bt_info *bt = &cx->bt; in _set_ant()
2855 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _set_ant()
2861 if (btc->dm.run_reason == BTC_RSN_NTFY_POWEROFF || in _set_ant()
2862 btc->dm.run_reason == BTC_RSN_NTFY_RADIO_STATE || in _set_ant()
2863 btc->dm.run_reason == BTC_RSN_CMD_SET_COEX) in _set_ant()
2866 if (!force_exec && ant_path_type == dm->set_ant_path) { in _set_ant()
2871 } else if (bt->rfk_info.map.run) { in _set_ant()
2875 } else if (btc->dm.run_reason != BTC_RSN_NTFY_WL_RFK && in _set_ant()
2876 wl->rfk_info.state != BTC_WRFK_STOP) { in _set_ant()
2882 dm->set_ant_path = ant_path_type; in _set_ant()
2887 __func__, phy_map, dm->set_ant_path & 0xff); in _set_ant()
2894 if (bt->enable.now) in _set_ant()
2913 if (rtwdev->dbcc_en) { in _set_ant()
2915 b2g = (wl_dinfo->real_band[i] == RTW89_BAND_2G); in _set_ant()
2921 wl_dinfo->real_band[0] == RTW89_BAND_2G && in _set_ant()
2922 wl_dinfo->real_band[1] == RTW89_BAND_5G) in _set_ant()
2982 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_off()
2983 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_off()
2987 if (wl->status.map.rf_off || btc->dm.bt_only) in _action_wl_off()
2995 struct rtw89_btc *btc = &rtwdev->btc; in _action_freerun()
3002 btc->dm.freerun = true; in _action_freerun()
3023 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_idle()
3024 struct rtw89_btc_bt_link_info *b = &btc->cx.bt.link_info; in _action_bt_idle()
3028 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_bt_idle()
3029 switch (btc->cx.state_map) { in _action_bt_idle()
3030 case BTC_WBUSY_BNOSCAN: /*wl-busy + bt idle*/ in _action_bt_idle()
3031 if (b->profile_cnt.now > 0) in _action_bt_idle()
3038 case BTC_WBUSY_BSCAN: /*wl-busy + bt-inq */ in _action_bt_idle()
3042 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-idle */ in _action_bt_idle()
3043 if (b->profile_cnt.now > 0) in _action_bt_idle()
3050 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq */ in _action_bt_idle()
3054 case BTC_WLINKING: /* wl-connecting + bt-inq or bt-idle */ in _action_bt_idle()
3058 case BTC_WIDLE: /* wl-idle + bt-idle */ in _action_bt_idle()
3062 } else { /* dedicated-antenna */ in _action_bt_idle()
3069 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_hfp()
3070 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_bt_hfp()
3074 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in _action_bt_hfp()
3075 if (btc->cx.wl.status.map._4way) { in _action_bt_hfp()
3077 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _action_bt_hfp()
3078 btc->cx.bt.scan_rx_low_pri = true; in _action_bt_hfp()
3090 const struct rtw89_chip_info *chip = rtwdev->chip; in _action_bt_hid()
3091 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_hid()
3092 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_bt_hid()
3093 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_bt_hid()
3094 struct rtw89_btc_bt_hid_desc *hid = &bt->link_info.hid_desc; in _action_bt_hid()
3099 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_bt_hid()
3100 if (wl->status.map._4way) { in _action_bt_hid()
3102 } else if (wl->status.map.traffic_dir & BIT(RTW89_TFC_UL)) { in _action_bt_hid()
3103 btc->cx.bt.scan_rx_low_pri = true; in _action_bt_hid()
3104 if (hid->type & BTC_HID_BLE) in _action_bt_hid()
3108 } else if (hid->type == BTC_HID_218) { in _action_bt_hid()
3109 bt->scan_rx_low_pri = true; in _action_bt_hid()
3111 } else if (chip->para_ver == 0x1) { in _action_bt_hid()
3116 } else { /* dedicated-antenna */ in _action_bt_hid()
3125 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp()
3126 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _action_bt_a2dp()
3127 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_bt_a2dp()
3128 struct rtw89_btc_dm *dm = &btc->dm; in _action_bt_a2dp()
3132 switch (btc->cx.state_map) { in _action_bt_a2dp()
3133 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP */ in _action_bt_a2dp()
3134 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp()
3135 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp()
3136 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp()
3144 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP */ in _action_bt_a2dp()
3147 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP */ in _action_bt_a2dp()
3150 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP */ in _action_bt_a2dp()
3151 case BTC_WLINKING: /* wl-connecting + bt-A2DP */ in _action_bt_a2dp()
3152 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp()
3153 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp()
3154 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp()
3162 case BTC_WIDLE: /* wl-idle + bt-A2DP */ in _action_bt_a2dp()
3170 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dpsink()
3174 switch (btc->cx.state_map) { in _action_bt_a2dpsink()
3175 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3178 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3181 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3184 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3187 case BTC_WLINKING: /* wl-connecting + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3190 case BTC_WIDLE: /* wl-idle + bt-A2dp_Sink */ in _action_bt_a2dpsink()
3198 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_pan()
3202 switch (btc->cx.state_map) { in _action_bt_pan()
3203 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-PAN */ in _action_bt_pan()
3206 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-PAN */ in _action_bt_pan()
3209 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-PAN */ in _action_bt_pan()
3212 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-PAN */ in _action_bt_pan()
3215 case BTC_WLINKING: /* wl-connecting + bt-PAN */ in _action_bt_pan()
3218 case BTC_WIDLE: /* wl-idle + bt-pan */ in _action_bt_pan()
3226 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_hid()
3227 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _action_bt_a2dp_hid()
3228 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_bt_a2dp_hid()
3229 struct rtw89_btc_dm *dm = &btc->dm; in _action_bt_a2dp_hid()
3233 switch (btc->cx.state_map) { in _action_bt_a2dp_hid()
3234 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+HID */ in _action_bt_a2dp_hid()
3235 case BTC_WIDLE: /* wl-idle + bt-A2DP */ in _action_bt_a2dp_hid()
3236 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp_hid()
3237 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp_hid()
3238 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp_hid()
3246 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+HID */ in _action_bt_a2dp_hid()
3250 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+HID */ in _action_bt_a2dp_hid()
3253 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+HID */ in _action_bt_a2dp_hid()
3254 case BTC_WLINKING: /* wl-connecting + bt-A2DP+HID */ in _action_bt_a2dp_hid()
3255 if (a2dp.vendor_id == 0x4c || dm->leak_ap) { in _action_bt_a2dp_hid()
3256 dm->slot_dur[CXST_W1] = 40; in _action_bt_a2dp_hid()
3257 dm->slot_dur[CXST_B1] = 200; in _action_bt_a2dp_hid()
3270 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_pan()
3274 switch (btc->cx.state_map) { in _action_bt_a2dp_pan()
3275 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3278 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3281 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3284 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3287 case BTC_WLINKING: /* wl-connecting + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3290 case BTC_WIDLE: /* wl-idle + bt-A2DP+PAN */ in _action_bt_a2dp_pan()
3298 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_pan_hid()
3302 switch (btc->cx.state_map) { in _action_bt_pan_hid()
3303 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-PAN+HID */ in _action_bt_pan_hid()
3306 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-PAN+HID */ in _action_bt_pan_hid()
3309 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-PAN+HID */ in _action_bt_pan_hid()
3312 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-PAN+HID */ in _action_bt_pan_hid()
3315 case BTC_WLINKING: /* wl-connecting + bt-PAN+HID */ in _action_bt_pan_hid()
3318 case BTC_WIDLE: /* wl-idle + bt-PAN+HID */ in _action_bt_pan_hid()
3326 struct rtw89_btc *btc = &rtwdev->btc; in _action_bt_a2dp_pan_hid()
3330 switch (btc->cx.state_map) { in _action_bt_a2dp_pan_hid()
3331 case BTC_WBUSY_BNOSCAN: /* wl-busy + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3335 case BTC_WBUSY_BSCAN: /* wl-busy + bt-inq + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3339 case BTC_WSCAN_BSCAN: /* wl-scan + bt-inq + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3343 case BTC_WSCAN_BNOSCAN: /* wl-scan + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3344 case BTC_WLINKING: /* wl-connecting + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3348 case BTC_WIDLE: /* wl-idle + bt-A2DP+PAN+HID */ in _action_bt_a2dp_pan_hid()
3363 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_other()
3367 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) in _action_wl_other()
3381 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_rfk()
3382 struct rtw89_btc_wl_rfk_info rfk = btc->cx.wl.rfk_info; in _action_wl_rfk()
3396 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_btg_ctrl()
3397 struct rtw89_btc *btc = &rtwdev->btc; in _set_btg_ctrl()
3398 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_btg_ctrl()
3399 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_btg_ctrl()
3400 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_btg_ctrl()
3401 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _set_btg_ctrl()
3405 if (btc->ctrl.manual) in _set_btg_ctrl()
3408 if (chip->chip_id == RTL8852A) in _set_btg_ctrl()
3409 mode = wl_rinfo->link_mode; in _set_btg_ctrl()
3411 mode = wl_rinfo_v1->link_mode; in _set_btg_ctrl()
3413 /* notify halbb ignore GNT_BT or not for WL BB Rx-AGC control */ in _set_btg_ctrl()
3417 wl_dinfo->real_band[RTW89_PHY_1] != RTW89_BAND_2G) in _set_btg_ctrl()
3422 if (btc->dm.run_reason != BTC_RSN_NTFY_INIT && in _set_btg_ctrl()
3423 is_btg == btc->dm.wl_btg_rx) in _set_btg_ctrl()
3426 btc->dm.wl_btg_rx = is_btg; in _set_btg_ctrl()
3445 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; in rtw89_tx_time_iter()
3448 struct rtw89_dev *rtwdev = iter_data->rtwdev; in rtw89_tx_time_iter()
3449 struct rtw89_vif *rtwvif = rtwsta->rtwvif; in rtw89_tx_time_iter()
3450 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_tx_time_iter()
3451 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_tx_time_iter()
3452 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_tx_time_iter()
3454 u8 port = rtwvif->port; in rtw89_tx_time_iter()
3455 u32 tx_time = iter_data->tx_time; in rtw89_tx_time_iter()
3456 u8 tx_retry = iter_data->tx_retry; in rtw89_tx_time_iter()
3457 u16 enable = iter_data->enable; in rtw89_tx_time_iter()
3458 bool reenable = iter_data->reenable; in rtw89_tx_time_iter()
3460 plink = &wl->link_info[port]; in rtw89_tx_time_iter()
3465 if (!plink->connected) { in rtw89_tx_time_iter()
3468 __func__, plink->connected); in rtw89_tx_time_iter()
3472 /* backup the original tx time before tx-limit on */ in rtw89_tx_time_iter()
3474 rtw89_mac_get_tx_time(rtwdev, rtwsta, &plink->tx_time); in rtw89_tx_time_iter()
3475 rtw89_mac_get_tx_retry_limit(rtwdev, rtwsta, &plink->tx_retry); in rtw89_tx_time_iter()
3478 __func__, plink->tx_time, plink->tx_retry); in rtw89_tx_time_iter()
3481 /* restore the original tx time if no tx-limit */ in rtw89_tx_time_iter()
3483 rtw89_mac_set_tx_time(rtwdev, rtwsta, true, plink->tx_time); in rtw89_tx_time_iter()
3485 plink->tx_retry); in rtw89_tx_time_iter()
3488 __func__, plink->tx_time, plink->tx_retry); in rtw89_tx_time_iter()
3501 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_wl_tx_limit()
3502 struct rtw89_btc *btc = &rtwdev->btc; in _set_wl_tx_limit()
3503 struct rtw89_btc_cx *cx = &btc->cx; in _set_wl_tx_limit()
3504 struct rtw89_btc_dm *dm = &btc->dm; in _set_wl_tx_limit()
3505 struct rtw89_btc_wl_info *wl = &cx->wl; in _set_wl_tx_limit()
3506 struct rtw89_btc_bt_info *bt = &cx->bt; in _set_wl_tx_limit()
3507 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _set_wl_tx_limit()
3508 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in _set_wl_tx_limit()
3509 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in _set_wl_tx_limit()
3510 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_wl_tx_limit()
3511 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_wl_tx_limit()
3519 if (btc->ctrl.manual) in _set_wl_tx_limit()
3522 if (chip->chip_id == RTL8852A) in _set_wl_tx_limit()
3523 mode = wl_rinfo->link_mode; in _set_wl_tx_limit()
3525 mode = wl_rinfo_v1->link_mode; in _set_wl_tx_limit()
3527 if (btc->dm.freerun || btc->ctrl.igno_bt || b->profile_cnt.now == 0 || in _set_wl_tx_limit()
3532 } else if ((hfp->exist && hid->exist) || hid->pair_cnt > 1) { in _set_wl_tx_limit()
3536 } else if (hfp->exist || hid->exist) { in _set_wl_tx_limit()
3546 if (dm->wl_tx_limit.enable == enable && in _set_wl_tx_limit()
3547 dm->wl_tx_limit.tx_time == tx_time && in _set_wl_tx_limit()
3548 dm->wl_tx_limit.tx_retry == tx_retry) in _set_wl_tx_limit()
3551 if (!dm->wl_tx_limit.enable && enable) in _set_wl_tx_limit()
3554 dm->wl_tx_limit.enable = enable; in _set_wl_tx_limit()
3555 dm->wl_tx_limit.tx_time = tx_time; in _set_wl_tx_limit()
3556 dm->wl_tx_limit.tx_retry = tx_retry; in _set_wl_tx_limit()
3563 ieee80211_iterate_stations_atomic(rtwdev->hw, in _set_wl_tx_limit()
3570 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_bt_rx_agc()
3571 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_agc()
3572 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_bt_rx_agc()
3573 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _set_bt_rx_agc()
3574 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _set_bt_rx_agc()
3575 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_agc()
3579 if (chip->chip_id == RTL8852A) in _set_bt_rx_agc()
3580 mode = wl_rinfo->link_mode; in _set_bt_rx_agc()
3582 mode = wl_rinfo_v1->link_mode; in _set_bt_rx_agc()
3584 if (mode != BTC_WLINK_NOLINK && btc->dm.wl_btg_rx) in _set_bt_rx_agc()
3587 if (bt_hi_lna_rx == bt->hi_lna_rx) in _set_bt_rx_agc()
3595 struct rtw89_btc *btc = &rtwdev->btc; in _set_bt_rx_scan_pri()
3596 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _set_bt_rx_scan_pri()
3598 _write_scbd(rtwdev, BTC_WSCB_RXSCAN_PRI, (bool)(!!bt->scan_rx_low_pri)); in _set_bt_rx_scan_pri()
3604 struct rtw89_btc *btc = &rtwdev->btc; in _action_common()
3605 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_common()
3614 if (wl->scbd_change) { in _action_common()
3615 rtw89_mac_cfg_sb(rtwdev, wl->scbd); in _action_common()
3617 wl->scbd); in _action_common()
3618 wl->scbd_change = false; in _action_common()
3619 btc->cx.cnt_wl[BTC_WCNT_SCBDUPDATE]++; in _action_common()
3625 struct rtw89_btc *btc = &rtwdev->btc; in _action_by_bt()
3626 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_by_bt()
3627 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _action_by_bt()
3628 struct rtw89_btc_bt_hid_desc hid = bt_linfo->hid_desc; in _action_by_bt()
3629 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _action_by_bt()
3630 struct rtw89_btc_bt_pan_desc pan = bt_linfo->pan_desc; in _action_by_bt()
3633 if (bt_linfo->hfp_desc.exist) in _action_by_bt()
3636 if (bt_linfo->hid_desc.exist) in _action_by_bt()
3639 if (bt_linfo->a2dp_desc.exist) in _action_by_bt()
3642 if (bt_linfo->pan_desc.exist) in _action_by_bt()
3672 else if (bt_linfo->multi_link.now && !hid.pair_cnt) in _action_by_bt()
3711 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_scan()
3712 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_scan()
3713 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _action_wl_scan()
3715 if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) { in _action_wl_scan()
3717 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) in _action_wl_scan()
3725 } else if (rtwdev->dbcc_en) { in _action_wl_scan()
3726 if (wl_dinfo->real_band[RTW89_PHY_0] != RTW89_BAND_2G && in _action_wl_scan()
3727 wl_dinfo->real_band[RTW89_PHY_1] != RTW89_BAND_2G) in _action_wl_scan()
3732 if (wl->scan_info.band[RTW89_PHY_0] != RTW89_BAND_2G) in _action_wl_scan()
3741 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_25g_mcc()
3745 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in _action_wl_25g_mcc()
3746 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_25g_mcc()
3752 } else { /* dedicated-antenna */ in _action_wl_25g_mcc()
3758 { struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_mcc()
3762 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_mcc()
3763 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_mcc()
3769 } else { /* dedicated-antenna */ in _action_wl_2g_mcc()
3776 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc()
3780 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_scc()
3781 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_scc()
3787 } else { /* dedicated-antenna */ in _action_wl_2g_scc()
3794 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_scc_v1()
3795 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _action_wl_2g_scc_v1()
3796 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _action_wl_2g_scc_v1()
3797 struct rtw89_btc_dm *dm = &btc->dm; in _action_wl_2g_scc_v1()
3798 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &wl->role_info_v1; in _action_wl_2g_scc_v1()
3802 if (btc->mdinfo.ant.type == BTC_ANT_DEDICATED) { in _action_wl_2g_scc_v1()
3805 /* shared-antenna */ in _action_wl_2g_scc_v1()
3806 switch (wl_rinfo->mrole_type) { in _action_wl_2g_scc_v1()
3808 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
3809 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_P2P_CLIENT; in _action_wl_2g_scc_v1()
3810 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v1()
3814 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
3815 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
3816 dm->wl_scc.ebt_null = 0; /* no ext-slot-control */ in _action_wl_2g_scc_v1()
3822 dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION; in _action_wl_2g_scc_v1()
3823 dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_NONE; in _action_wl_2g_scc_v1()
3824 dur = wl_rinfo->mrole_noa_duration; in _action_wl_2g_scc_v1()
3826 if (wl->status.map._4way) { in _action_wl_2g_scc_v1()
3827 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
3829 } else if (bt->link_info.status.map.connect == 0) { in _action_wl_2g_scc_v1()
3830 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
3832 } else if (bt->link_info.a2dp_desc.exist && in _action_wl_2g_scc_v1()
3833 dur < btc->bt_req_len) { in _action_wl_2g_scc_v1()
3834 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v1()
3836 } else if (bt->link_info.a2dp_desc.exist || in _action_wl_2g_scc_v1()
3837 bt->link_info.pan_desc.exist) { in _action_wl_2g_scc_v1()
3838 dm->wl_scc.ebt_null = 1; /* tx null at EBT */ in _action_wl_2g_scc_v1()
3841 dm->wl_scc.ebt_null = 0; in _action_wl_2g_scc_v1()
3856 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_ap()
3860 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { in _action_wl_2g_ap()
3861 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_ap()
3866 } else {/* dedicated-antenna */ in _action_wl_2g_ap()
3873 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_go()
3877 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_go()
3878 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_go()
3884 } else { /* dedicated-antenna */ in _action_wl_2g_go()
3891 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_gc()
3895 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_gc()
3897 } else {/* dedicated-antenna */ in _action_wl_2g_gc()
3904 struct rtw89_btc *btc = &rtwdev->btc; in _action_wl_2g_nan()
3908 if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ in _action_wl_2g_nan()
3909 if (btc->cx.bt.link_info.profile_cnt.now == 0) in _action_wl_2g_nan()
3915 } else { /* dedicated-antenna */ in _action_wl_2g_nan()
3922 const struct rtw89_chip_info *chip = rtwdev->chip; in _read_scbd()
3923 struct rtw89_btc *btc = &rtwdev->btc; in _read_scbd()
3926 if (!chip->scbd) in _read_scbd()
3933 btc->cx.cnt_bt[BTC_BCNT_SCBDREAD]++; in _read_scbd()
3939 const struct rtw89_chip_info *chip = rtwdev->chip; in _write_scbd()
3940 struct rtw89_btc *btc = &rtwdev->btc; in _write_scbd()
3941 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _write_scbd()
3945 if (!chip->scbd) in _write_scbd()
3948 scbd_val = state ? wl->scbd | val : wl->scbd & ~val; in _write_scbd()
3953 if (scbd_val != wl->scbd || force_exec) { in _write_scbd()
3954 wl->scbd = scbd_val; in _write_scbd()
3955 wl->scbd_change = true; in _write_scbd()
3962 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_rssi_state()
3963 u8 next_state, tol = chip->rssi_tol; in _update_rssi_state()
3984 struct rtw89_btc *btc = &rtwdev->btc; in _update_dbcc_band()
3986 btc->cx.wl.dbcc_info.real_band[phy_idx] = in _update_dbcc_band()
3987 btc->cx.wl.scan_info.phy_map & BIT(phy_idx) ? in _update_dbcc_band()
3988 btc->cx.wl.dbcc_info.scan_band[phy_idx] : in _update_dbcc_band()
3989 btc->cx.wl.dbcc_info.op_band[phy_idx]; in _update_dbcc_band()
3994 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info()
3995 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info()
3996 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info()
3997 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _update_wl_info()
3998 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info()
4012 wl_rinfo->active_role[cnt_active - 1].role = wl_linfo[i].role; in _update_wl_info()
4013 wl_rinfo->active_role[cnt_active - 1].pid = wl_linfo[i].pid; in _update_wl_info()
4014 wl_rinfo->active_role[cnt_active - 1].phy = wl_linfo[i].phy; in _update_wl_info()
4015 wl_rinfo->active_role[cnt_active - 1].band = wl_linfo[i].band; in _update_wl_info()
4016 wl_rinfo->active_role[cnt_active - 1].noa = (u8)wl_linfo[i].noa; in _update_wl_info()
4017 wl_rinfo->active_role[cnt_active - 1].connected = 0; in _update_wl_info()
4019 wl->port_id[wl_linfo[i].role] = wl_linfo[i].pid; in _update_wl_info()
4024 if (rtwdev->dbcc_en && phy < RTW89_PHY_MAX) { in _update_wl_info()
4025 wl_dinfo->role[phy] = wl_linfo[i].role; in _update_wl_info()
4026 wl_dinfo->op_band[phy] = wl_linfo[i].band; in _update_wl_info()
4043 wl_rinfo->role_map.val |= BIT(wl_linfo[i].role); in _update_wl_info()
4044 wl_rinfo->active_role[cnt_active - 1].ch = wl_linfo[i].ch; in _update_wl_info()
4045 wl_rinfo->active_role[cnt_active - 1].bw = wl_linfo[i].bw; in _update_wl_info()
4046 wl_rinfo->active_role[cnt_active - 1].connected = 1; in _update_wl_info()
4050 if (cnt_5g <= ARRAY_SIZE(wl_5g_ch) - 1) in _update_wl_info()
4055 if (cnt_2g <= ARRAY_SIZE(wl_2g_ch) - 1) in _update_wl_info()
4062 wl_rinfo->connect_cnt = cnt_connect; in _update_wl_info()
4066 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info()
4067 wl_rinfo->role_map.role.none = 1; in _update_wl_info()
4069 wl_rinfo->link_mode = BTC_WLINK_5G; in _update_wl_info()
4070 } else if (wl_rinfo->role_map.role.nan) { in _update_wl_info()
4071 wl_rinfo->link_mode = BTC_WLINK_2G_NAN; in _update_wl_info()
4073 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
4075 if (rtwdev->dbcc_en) { in _update_wl_info()
4076 switch (wl_dinfo->role[RTW89_PHY_0]) { in _update_wl_info()
4078 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
4081 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info()
4084 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info()
4087 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info()
4090 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
4094 wl_rinfo->link_mode = BTC_WLINK_25G_MCC; in _update_wl_info()
4097 if (wl_rinfo->role_map.role.station && in _update_wl_info()
4098 (wl_rinfo->role_map.role.p2p_go || in _update_wl_info()
4099 wl_rinfo->role_map.role.p2p_gc || in _update_wl_info()
4100 wl_rinfo->role_map.role.ap)) { in _update_wl_info()
4102 wl_rinfo->link_mode = BTC_WLINK_2G_SCC; in _update_wl_info()
4104 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info()
4106 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info()
4109 if (wl_rinfo->role_map.role.station) in _update_wl_info()
4110 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
4111 else if (wl_rinfo->role_map.role.ap) in _update_wl_info()
4112 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info()
4113 else if (wl_rinfo->role_map.role.p2p_go) in _update_wl_info()
4114 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info()
4115 else if (wl_rinfo->role_map.role.p2p_gc) in _update_wl_info()
4116 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info()
4118 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info()
4121 /* if no client_joined, don't care P2P-GO/AP role */ in _update_wl_info()
4122 if (wl_rinfo->role_map.role.p2p_go || wl_rinfo->role_map.role.ap) { in _update_wl_info()
4124 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC || in _update_wl_info()
4125 wl_rinfo->link_mode == BTC_WLINK_2G_MCC) { in _update_wl_info()
4126 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info()
4127 wl_rinfo->connect_cnt = 1; in _update_wl_info()
4128 } else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO || in _update_wl_info()
4129 wl_rinfo->link_mode == BTC_WLINK_2G_AP) { in _update_wl_info()
4130 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info()
4131 wl_rinfo->connect_cnt = 0; in _update_wl_info()
4138 cnt_connect, cnt_connecting, wl_rinfo->link_mode); in _update_wl_info()
4145 struct rtw89_btc *btc = &rtwdev->btc; in _update_wl_info_v1()
4146 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _update_wl_info_v1()
4147 struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info; in _update_wl_info_v1()
4148 struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &wl->role_info_v1; in _update_wl_info_v1()
4149 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _update_wl_info_v1()
4163 wl_rinfo->active_role_v1[cnt_active - 1].role = wl_linfo[i].role; in _update_wl_info_v1()
4164 wl_rinfo->active_role_v1[cnt_active - 1].pid = wl_linfo[i].pid; in _update_wl_info_v1()
4165 wl_rinfo->active_role_v1[cnt_active - 1].phy = wl_linfo[i].phy; in _update_wl_info_v1()
4166 wl_rinfo->active_role_v1[cnt_active - 1].band = wl_linfo[i].band; in _update_wl_info_v1()
4167 wl_rinfo->active_role_v1[cnt_active - 1].noa = (u8)wl_linfo[i].noa; in _update_wl_info_v1()
4168 wl_rinfo->active_role_v1[cnt_active - 1].connected = 0; in _update_wl_info_v1()
4170 wl->port_id[wl_linfo[i].role] = wl_linfo[i].pid; in _update_wl_info_v1()
4174 if (rtwdev->dbcc_en && phy < RTW89_PHY_MAX) { in _update_wl_info_v1()
4175 wl_dinfo->role[phy] = wl_linfo[i].role; in _update_wl_info_v1()
4176 wl_dinfo->op_band[phy] = wl_linfo[i].band; in _update_wl_info_v1()
4193 wl_rinfo->role_map.val |= BIT(wl_linfo[i].role); in _update_wl_info_v1()
4194 wl_rinfo->active_role_v1[cnt_active - 1].ch = wl_linfo[i].ch; in _update_wl_info_v1()
4195 wl_rinfo->active_role_v1[cnt_active - 1].bw = wl_linfo[i].bw; in _update_wl_info_v1()
4196 wl_rinfo->active_role_v1[cnt_active - 1].connected = 1; in _update_wl_info_v1()
4200 if (cnt_5g <= ARRAY_SIZE(wl_5g_ch) - 1) in _update_wl_info_v1()
4205 if (cnt_2g <= ARRAY_SIZE(wl_2g_ch) - 1) in _update_wl_info_v1()
4212 wl_rinfo->connect_cnt = cnt_connect; in _update_wl_info_v1()
4216 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v1()
4217 wl_rinfo->role_map.role.none = 1; in _update_wl_info_v1()
4219 wl_rinfo->link_mode = BTC_WLINK_5G; in _update_wl_info_v1()
4220 } else if (wl_rinfo->role_map.role.nan) { in _update_wl_info_v1()
4221 wl_rinfo->link_mode = BTC_WLINK_2G_NAN; in _update_wl_info_v1()
4223 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
4225 if (rtwdev->dbcc_en) { in _update_wl_info_v1()
4226 switch (wl_dinfo->role[RTW89_PHY_0]) { in _update_wl_info_v1()
4228 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
4231 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v1()
4234 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v1()
4237 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v1()
4240 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
4244 wl_rinfo->link_mode = BTC_WLINK_25G_MCC; in _update_wl_info_v1()
4247 if (wl_rinfo->role_map.role.station && in _update_wl_info_v1()
4248 (wl_rinfo->role_map.role.p2p_go || in _update_wl_info_v1()
4249 wl_rinfo->role_map.role.p2p_gc || in _update_wl_info_v1()
4250 wl_rinfo->role_map.role.ap)) { in _update_wl_info_v1()
4252 wl_rinfo->link_mode = BTC_WLINK_2G_SCC; in _update_wl_info_v1()
4254 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v1()
4256 wl_rinfo->link_mode = BTC_WLINK_2G_MCC; in _update_wl_info_v1()
4259 if (wl_rinfo->role_map.role.station) in _update_wl_info_v1()
4260 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
4261 else if (wl_rinfo->role_map.role.ap) in _update_wl_info_v1()
4262 wl_rinfo->link_mode = BTC_WLINK_2G_AP; in _update_wl_info_v1()
4263 else if (wl_rinfo->role_map.role.p2p_go) in _update_wl_info_v1()
4264 wl_rinfo->link_mode = BTC_WLINK_2G_GO; in _update_wl_info_v1()
4265 else if (wl_rinfo->role_map.role.p2p_gc) in _update_wl_info_v1()
4266 wl_rinfo->link_mode = BTC_WLINK_2G_GC; in _update_wl_info_v1()
4268 wl_rinfo->link_mode = BTC_WLINK_OTHER; in _update_wl_info_v1()
4271 /* if no client_joined, don't care P2P-GO/AP role */ in _update_wl_info_v1()
4272 if (wl_rinfo->role_map.role.p2p_go || wl_rinfo->role_map.role.ap) { in _update_wl_info_v1()
4274 if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC || in _update_wl_info_v1()
4275 wl_rinfo->link_mode == BTC_WLINK_2G_MCC) { in _update_wl_info_v1()
4276 wl_rinfo->link_mode = BTC_WLINK_2G_STA; in _update_wl_info_v1()
4277 wl_rinfo->connect_cnt = 1; in _update_wl_info_v1()
4278 } else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO || in _update_wl_info_v1()
4279 wl_rinfo->link_mode == BTC_WLINK_2G_AP) { in _update_wl_info_v1()
4280 wl_rinfo->link_mode = BTC_WLINK_NOLINK; in _update_wl_info_v1()
4281 wl_rinfo->connect_cnt = 0; in _update_wl_info_v1()
4288 cnt_connect, cnt_connecting, wl_rinfo->link_mode); in _update_wl_info_v1()
4300 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_act1_work()
4301 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_act1_work()
4302 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_coex_act1_work()
4303 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_coex_act1_work()
4305 mutex_lock(&rtwdev->mutex); in rtw89_coex_act1_work()
4307 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_act1_work()
4308 if (wl->status.map._4way) in rtw89_coex_act1_work()
4309 wl->status.map._4way = false; in rtw89_coex_act1_work()
4310 if (wl->status.map.connecting) in rtw89_coex_act1_work()
4311 wl->status.map.connecting = false; in rtw89_coex_act1_work()
4314 mutex_unlock(&rtwdev->mutex); in rtw89_coex_act1_work()
4321 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_bt_devinfo_work()
4322 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_bt_devinfo_work()
4323 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in rtw89_coex_bt_devinfo_work()
4325 mutex_lock(&rtwdev->mutex); in rtw89_coex_bt_devinfo_work()
4327 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_bt_devinfo_work()
4328 a2dp->play_latency = 0; in rtw89_coex_bt_devinfo_work()
4330 mutex_unlock(&rtwdev->mutex); in rtw89_coex_bt_devinfo_work()
4337 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_coex_rfk_chk_work()
4338 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_coex_rfk_chk_work()
4339 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_coex_rfk_chk_work()
4340 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_coex_rfk_chk_work()
4342 mutex_lock(&rtwdev->mutex); in rtw89_coex_rfk_chk_work()
4344 dm->cnt_notify[BTC_NCNT_TIMER]++; in rtw89_coex_rfk_chk_work()
4345 if (wl->rfk_info.state != BTC_WRFK_STOP) { in rtw89_coex_rfk_chk_work()
4348 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]++; in rtw89_coex_rfk_chk_work()
4349 dm->error.map.wl_rfk_timeout = true; in rtw89_coex_rfk_chk_work()
4350 wl->rfk_info.state = BTC_WRFK_STOP; in rtw89_coex_rfk_chk_work()
4354 mutex_unlock(&rtwdev->mutex); in rtw89_coex_rfk_chk_work()
4359 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_bt_scbd()
4360 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_scbd()
4361 struct rtw89_btc_cx *cx = &btc->cx; in _update_bt_scbd()
4362 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _update_bt_scbd()
4366 if (!chip->scbd) in _update_bt_scbd()
4380 btc->dm.cnt_dm[BTC_DCNT_BTCNT_FREEZE] >= BTC_CHK_HANG_MAX) in _update_bt_scbd()
4381 bt->enable.now = 0; in _update_bt_scbd()
4383 bt->enable.now = 1; in _update_bt_scbd()
4385 if (bt->enable.now != bt->enable.last) in _update_bt_scbd()
4388 /* reset bt info if bt re-enable */ in _update_bt_scbd()
4389 if (bt->enable.now && !bt->enable.last) { in _update_bt_scbd()
4391 cx->cnt_bt[BTC_BCNT_REENABLE]++; in _update_bt_scbd()
4392 bt->enable.now = 1; in _update_bt_scbd()
4395 bt->enable.last = bt->enable.now; in _update_bt_scbd()
4396 bt->scbd = val; in _update_bt_scbd()
4397 bt->mbx_avl = !!(val & BTC_BSCB_ACT); in _update_bt_scbd()
4399 if (bt->whql_test != !!(val & BTC_BSCB_WHQL)) in _update_bt_scbd()
4402 bt->whql_test = !!(val & BTC_BSCB_WHQL); in _update_bt_scbd()
4403 bt->btg_type = val & BTC_BSCB_BT_S1 ? BTC_BT_BTG : BTC_BT_ALONE; in _update_bt_scbd()
4404 bt->link_info.a2dp_desc.active = !!(val & BTC_BSCB_A2DP_ACT); in _update_bt_scbd()
4406 /* if rfk run 1->0 */ in _update_bt_scbd()
4407 if (bt->rfk_info.map.run && !(val & BTC_BSCB_RFK_RUN)) in _update_bt_scbd()
4410 bt->rfk_info.map.run = !!(val & BTC_BSCB_RFK_RUN); in _update_bt_scbd()
4411 bt->rfk_info.map.req = !!(val & BTC_BSCB_RFK_REQ); in _update_bt_scbd()
4412 bt->hi_lna_rx = !!(val & BTC_BSCB_BT_HILNA); in _update_bt_scbd()
4413 bt->link_info.status.map.connect = !!(val & BTC_BSCB_BT_CONNECT); in _update_bt_scbd()
4414 bt->run_patch_code = !!(val & BTC_BSCB_PATCH_CODE); in _update_bt_scbd()
4422 struct rtw89_btc *btc = &rtwdev->btc; in _chk_wl_rfk_request()
4423 struct rtw89_btc_cx *cx = &btc->cx; in _chk_wl_rfk_request()
4424 struct rtw89_btc_bt_info *bt = &cx->bt; in _chk_wl_rfk_request()
4428 cx->cnt_wl[BTC_WCNT_RFK_REQ]++; in _chk_wl_rfk_request()
4430 if ((bt->rfk_info.map.run || bt->rfk_info.map.req) && in _chk_wl_rfk_request()
4431 !bt->rfk_info.map.timeout) { in _chk_wl_rfk_request()
4432 cx->cnt_wl[BTC_WCNT_RFK_REJECT]++; in _chk_wl_rfk_request()
4434 cx->cnt_wl[BTC_WCNT_RFK_GO]++; in _chk_wl_rfk_request()
4443 const struct rtw89_chip_info *chip = rtwdev->chip; in _run_coex()
4444 struct rtw89_btc *btc = &rtwdev->btc; in _run_coex()
4445 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in _run_coex()
4446 struct rtw89_btc_cx *cx = &btc->cx; in _run_coex()
4447 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _run_coex()
4448 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _run_coex()
4449 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _run_coex()
4450 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _run_coex()
4453 lockdep_assert_held(&rtwdev->mutex); in _run_coex()
4455 dm->run_reason = reason; in _run_coex()
4459 if (chip->chip_id == RTL8852A) in _run_coex()
4460 mode = wl_rinfo->link_mode; in _run_coex()
4462 mode = wl_rinfo_v1->link_mode; in _run_coex()
4467 __func__, dm->wl_only, dm->bt_only); in _run_coex()
4470 if (btc->ctrl.manual) { in _run_coex()
4477 if (btc->ctrl.igno_bt && in _run_coex()
4486 if (!wl->status.map.init_ok) { in _run_coex()
4493 if (wl->status.map.rf_off_pre == wl->status.map.rf_off && in _run_coex()
4494 wl->status.map.lps_pre == wl->status.map.lps && in _run_coex()
4503 dm->cnt_dm[BTC_DCNT_RUN]++; in _run_coex()
4505 if (btc->ctrl.always_freerun) { in _run_coex()
4507 btc->ctrl.igno_bt = true; in _run_coex()
4511 if (dm->wl_only) { in _run_coex()
4513 btc->ctrl.igno_bt = true; in _run_coex()
4517 if (wl->status.map.rf_off || wl->status.map.lps || dm->bt_only) { in _run_coex()
4519 btc->ctrl.igno_bt = true; in _run_coex()
4523 btc->ctrl.igno_bt = false; in _run_coex()
4524 dm->freerun = false; in _run_coex()
4525 bt->scan_rx_low_pri = false; in _run_coex()
4532 if (!cx->bt.enable.now && !cx->other.type) { in _run_coex()
4537 if (cx->bt.whql_test) { in _run_coex()
4542 if (wl->rfk_info.state != BTC_WRFK_STOP) { in _run_coex()
4547 if (cx->state_map == BTC_WLINKING) { in _run_coex()
4555 if (wl->status.map.scan) { in _run_coex()
4568 bt->scan_rx_low_pri = true; in _run_coex()
4572 bt->scan_rx_low_pri = true; in _run_coex()
4576 bt->scan_rx_low_pri = true; in _run_coex()
4580 bt->scan_rx_low_pri = true; in _run_coex()
4581 if (chip->chip_id == RTL8852A) in _run_coex()
4583 else if (chip->chip_id == RTL8852C) in _run_coex()
4587 bt->scan_rx_low_pri = true; in _run_coex()
4591 bt->scan_rx_low_pri = true; in _run_coex()
4612 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_poweron()
4615 btc->dm.cnt_notify[BTC_NCNT_POWER_ON]++; in rtw89_btc_ntfy_poweron()
4620 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_poweroff()
4621 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_poweroff()
4624 btc->dm.cnt_notify[BTC_NCNT_POWER_OFF]++; in rtw89_btc_ntfy_poweroff()
4626 btc->cx.wl.status.map.rf_off = 1; in rtw89_btc_ntfy_poweroff()
4627 btc->cx.wl.status.map.busy = 0; in rtw89_btc_ntfy_poweroff()
4628 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_poweroff()
4635 btc->cx.wl.status.map.rf_off_pre = btc->cx.wl.status.map.rf_off; in rtw89_btc_ntfy_poweroff()
4640 const struct rtw89_chip_info *chip = rtwdev->chip; in _set_init_info()
4641 struct rtw89_btc *btc = &rtwdev->btc; in _set_init_info()
4642 struct rtw89_btc_dm *dm = &btc->dm; in _set_init_info()
4643 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _set_init_info()
4645 dm->init_info.wl_only = (u8)dm->wl_only; in _set_init_info()
4646 dm->init_info.bt_only = (u8)dm->bt_only; in _set_init_info()
4647 dm->init_info.wl_init_ok = (u8)wl->status.map.init_ok; in _set_init_info()
4648 dm->init_info.dbcc_en = rtwdev->dbcc_en; in _set_init_info()
4649 dm->init_info.cx_other = btc->cx.other.type; in _set_init_info()
4650 dm->init_info.wl_guard_ch = chip->afh_guard_ch; in _set_init_info()
4651 dm->init_info.module = btc->mdinfo; in _set_init_info()
4656 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_init()
4657 struct rtw89_btc_dm *dm = &rtwdev->btc.dm; in rtw89_btc_ntfy_init()
4658 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_init()
4659 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_init()
4662 btc->dm.run_reason = BTC_RSN_NONE; in rtw89_btc_ntfy_init()
4663 btc->dm.run_action = BTC_ACT_NONE; in rtw89_btc_ntfy_init()
4664 btc->ctrl.igno_bt = true; in rtw89_btc_ntfy_init()
4669 dm->cnt_notify[BTC_NCNT_INIT_COEX]++; in rtw89_btc_ntfy_init()
4670 dm->wl_only = mode == BTC_MODE_WL ? 1 : 0; in rtw89_btc_ntfy_init()
4671 dm->bt_only = mode == BTC_MODE_BT ? 1 : 0; in rtw89_btc_ntfy_init()
4672 wl->status.map.rf_off = mode == BTC_MODE_WLOFF ? 1 : 0; in rtw89_btc_ntfy_init()
4674 chip->ops->btc_set_rfe(rtwdev); in rtw89_btc_ntfy_init()
4675 chip->ops->btc_init_cfg(rtwdev); in rtw89_btc_ntfy_init()
4677 if (!wl->status.map.init_ok) { in rtw89_btc_ntfy_init()
4681 dm->error.map.init = true; in rtw89_btc_ntfy_init()
4688 if (rtw89_mac_get_ctrl_path(rtwdev) && chip->chip_id == RTL8852A) { in rtw89_btc_ntfy_init()
4692 dm->error.map.pta_owner = true; in rtw89_btc_ntfy_init()
4697 rtw89_btc_fw_set_slots(rtwdev, CXST_MAX, dm->slot); in rtw89_btc_ntfy_init()
4707 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_scan_start()
4708 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_scan_start()
4713 btc->dm.cnt_notify[BTC_NCNT_SCAN_START]++; in rtw89_btc_ntfy_scan_start()
4714 wl->status.map.scan = true; in rtw89_btc_ntfy_scan_start()
4715 wl->scan_info.band[phy_idx] = band; in rtw89_btc_ntfy_scan_start()
4716 wl->scan_info.phy_map |= BIT(phy_idx); in rtw89_btc_ntfy_scan_start()
4719 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_scan_start()
4720 wl->dbcc_info.scan_band[phy_idx] = band; in rtw89_btc_ntfy_scan_start()
4730 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_scan_finish()
4731 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_scan_finish()
4735 btc->dm.cnt_notify[BTC_NCNT_SCAN_FINISH]++; in rtw89_btc_ntfy_scan_finish()
4737 wl->status.map.scan = false; in rtw89_btc_ntfy_scan_finish()
4738 wl->scan_info.phy_map &= ~BIT(phy_idx); in rtw89_btc_ntfy_scan_finish()
4741 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_scan_finish()
4751 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_switch_band()
4752 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_switch_band()
4757 btc->dm.cnt_notify[BTC_NCNT_SWITCH_BAND]++; in rtw89_btc_ntfy_switch_band()
4759 wl->scan_info.band[phy_idx] = band; in rtw89_btc_ntfy_switch_band()
4760 wl->scan_info.phy_map |= BIT(phy_idx); in rtw89_btc_ntfy_switch_band()
4763 if (rtwdev->dbcc_en) { in rtw89_btc_ntfy_switch_band()
4764 wl->dbcc_info.scan_band[phy_idx] = band; in rtw89_btc_ntfy_switch_band()
4774 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_specific_packet()
4775 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_btc_ntfy_specific_packet()
4776 struct rtw89_btc_wl_info *wl = &cx->wl; in rtw89_btc_ntfy_specific_packet()
4777 struct rtw89_btc_bt_link_info *b = &cx->bt.link_info; in rtw89_btc_ntfy_specific_packet()
4778 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in rtw89_btc_ntfy_specific_packet()
4779 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in rtw89_btc_ntfy_specific_packet()
4786 cnt = ++cx->cnt_wl[BTC_WCNT_DHCP]; in rtw89_btc_ntfy_specific_packet()
4789 wl->status.map.connecting = true; in rtw89_btc_ntfy_specific_packet()
4793 cnt = ++cx->cnt_wl[BTC_WCNT_EAPOL]; in rtw89_btc_ntfy_specific_packet()
4796 wl->status.map._4way = true; in rtw89_btc_ntfy_specific_packet()
4798 if (hfp->exist || hid->exist) in rtw89_btc_ntfy_specific_packet()
4802 cnt = ++cx->cnt_wl[BTC_WCNT_EAPOL]; in rtw89_btc_ntfy_specific_packet()
4806 wl->status.map._4way = false; in rtw89_btc_ntfy_specific_packet()
4807 cancel_delayed_work(&rtwdev->coex_act1_work); in rtw89_btc_ntfy_specific_packet()
4810 cnt = ++cx->cnt_wl[BTC_WCNT_ARP]; in rtw89_btc_ntfy_specific_packet()
4826 cancel_delayed_work(&rtwdev->coex_act1_work); in rtw89_btc_ntfy_specific_packet()
4827 ieee80211_queue_delayed_work(rtwdev->hw, in rtw89_btc_ntfy_specific_packet()
4828 &rtwdev->coex_act1_work, delay); in rtw89_btc_ntfy_specific_packet()
4831 btc->dm.cnt_notify[BTC_NCNT_SPECIAL_PACKET]++; in rtw89_btc_ntfy_specific_packet()
4840 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_eapol_packet_work()
4843 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_eapol_packet_work()
4851 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_arp_packet_work()
4853 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_arp_packet_work()
4861 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_dhcp_packet_work()
4864 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_dhcp_packet_work()
4872 mutex_lock(&rtwdev->mutex); in rtw89_btc_ntfy_icmp_packet_work()
4875 mutex_unlock(&rtwdev->mutex); in rtw89_btc_ntfy_icmp_packet_work()
4880 const struct rtw89_chip_info *chip = rtwdev->chip; in _update_bt_info()
4881 struct rtw89_btc *btc = &rtwdev->btc; in _update_bt_info()
4882 struct rtw89_btc_cx *cx = &btc->cx; in _update_bt_info()
4883 struct rtw89_btc_bt_info *bt = &cx->bt; in _update_bt_info()
4884 struct rtw89_btc_bt_link_info *b = &bt->link_info; in _update_bt_info()
4885 struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc; in _update_bt_info()
4886 struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc; in _update_bt_info()
4887 struct rtw89_btc_bt_a2dp_desc *a2dp = &b->a2dp_desc; in _update_bt_info()
4888 struct rtw89_btc_bt_pan_desc *pan = &b->pan_desc; in _update_bt_info()
4894 if (!memcmp(bt->raw_info, buf, BTC_BTINFO_MAX)) { in _update_bt_info()
4896 "[BTC], %s(): return by bt-info duplicate!!\n", in _update_bt_info()
4898 cx->cnt_bt[BTC_BCNT_INFOSAME]++; in _update_bt_info()
4902 memcpy(bt->raw_info, buf, BTC_BTINFO_MAX); in _update_bt_info()
4906 __func__, bt->raw_info[2]); in _update_bt_info()
4908 /* reset to mo-connect before update */ in _update_bt_info()
4909 b->status.val = BTC_BLINK_NOCONNECT; in _update_bt_info()
4910 b->profile_cnt.last = b->profile_cnt.now; in _update_bt_info()
4911 b->relink.last = b->relink.now; in _update_bt_info()
4912 a2dp->exist_last = a2dp->exist; in _update_bt_info()
4913 b->multi_link.last = b->multi_link.now; in _update_bt_info()
4914 bt->inq_pag.last = bt->inq_pag.now; in _update_bt_info()
4915 b->profile_cnt.now = 0; in _update_bt_info()
4916 hid->type = 0; in _update_bt_info()
4918 /* parse raw info low-Byte2 */ in _update_bt_info()
4919 btinfo.val = bt->raw_info[BTC_BTINFO_L2]; in _update_bt_info()
4920 b->status.map.connect = btinfo.lb2.connect; in _update_bt_info()
4921 b->status.map.sco_busy = btinfo.lb2.sco_busy; in _update_bt_info()
4922 b->status.map.acl_busy = btinfo.lb2.acl_busy; in _update_bt_info()
4923 b->status.map.inq_pag = btinfo.lb2.inq_pag; in _update_bt_info()
4924 bt->inq_pag.now = btinfo.lb2.inq_pag; in _update_bt_info()
4925 cx->cnt_bt[BTC_BCNT_INQPAG] += !!(bt->inq_pag.now && !bt->inq_pag.last); in _update_bt_info()
4927 hfp->exist = btinfo.lb2.hfp; in _update_bt_info()
4928 b->profile_cnt.now += (u8)hfp->exist; in _update_bt_info()
4929 hid->exist = btinfo.lb2.hid; in _update_bt_info()
4930 b->profile_cnt.now += (u8)hid->exist; in _update_bt_info()
4931 a2dp->exist = btinfo.lb2.a2dp; in _update_bt_info()
4932 b->profile_cnt.now += (u8)a2dp->exist; in _update_bt_info()
4933 pan->active = btinfo.lb2.pan; in _update_bt_info()
4935 /* parse raw info low-Byte3 */ in _update_bt_info()
4936 btinfo.val = bt->raw_info[BTC_BTINFO_L3]; in _update_bt_info()
4938 cx->cnt_bt[BTC_BCNT_RETRY]++; in _update_bt_info()
4939 b->cqddr = btinfo.lb3.cqddr; in _update_bt_info()
4940 cx->cnt_bt[BTC_BCNT_INQ] += !!(btinfo.lb3.inq && !bt->inq); in _update_bt_info()
4941 bt->inq = btinfo.lb3.inq; in _update_bt_info()
4942 cx->cnt_bt[BTC_BCNT_PAGE] += !!(btinfo.lb3.pag && !bt->pag); in _update_bt_info()
4943 bt->pag = btinfo.lb3.pag; in _update_bt_info()
4945 b->status.map.mesh_busy = btinfo.lb3.mesh_busy; in _update_bt_info()
4946 /* parse raw info high-Byte0 */ in _update_bt_info()
4947 btinfo.val = bt->raw_info[BTC_BTINFO_H0]; in _update_bt_info()
4948 /* raw val is dBm unit, translate from -100~ 0dBm to 0~100%*/ in _update_bt_info()
4949 b->rssi = chip->ops->btc_get_bt_rssi(rtwdev, btinfo.hb0.rssi); in _update_bt_info()
4951 /* parse raw info high-Byte1 */ in _update_bt_info()
4952 btinfo.val = bt->raw_info[BTC_BTINFO_H1]; in _update_bt_info()
4953 b->status.map.ble_connect = btinfo.hb1.ble_connect; in _update_bt_info()
4955 hid->type |= (hid->exist ? BTC_HID_BLE : BTC_HID_RCU); in _update_bt_info()
4957 cx->cnt_bt[BTC_BCNT_REINIT] += !!(btinfo.hb1.reinit && !bt->reinit); in _update_bt_info()
4958 bt->reinit = btinfo.hb1.reinit; in _update_bt_info()
4959 cx->cnt_bt[BTC_BCNT_RELINK] += !!(btinfo.hb1.relink && !b->relink.now); in _update_bt_info()
4960 b->relink.now = btinfo.hb1.relink; in _update_bt_info()
4961 cx->cnt_bt[BTC_BCNT_IGNOWL] += !!(btinfo.hb1.igno_wl && !bt->igno_wl); in _update_bt_info()
4962 bt->igno_wl = btinfo.hb1.igno_wl; in _update_bt_info()
4964 if (bt->igno_wl && !cx->wl.status.map.rf_off) in _update_bt_info()
4967 hid->type |= (btinfo.hb1.voice ? BTC_HID_RCU_VOICE : 0); in _update_bt_info()
4968 bt->ble_scan_en = btinfo.hb1.ble_scan; in _update_bt_info()
4970 cx->cnt_bt[BTC_BCNT_ROLESW] += !!(btinfo.hb1.role_sw && !b->role_sw); in _update_bt_info()
4971 b->role_sw = btinfo.hb1.role_sw; in _update_bt_info()
4973 b->multi_link.now = btinfo.hb1.multi_link; in _update_bt_info()
4975 /* parse raw info high-Byte2 */ in _update_bt_info()
4976 btinfo.val = bt->raw_info[BTC_BTINFO_H2]; in _update_bt_info()
4977 pan->exist = btinfo.hb2.pan_active; in _update_bt_info()
4978 b->profile_cnt.now += (u8)pan->exist; in _update_bt_info()
4980 cx->cnt_bt[BTC_BCNT_AFH] += !!(btinfo.hb2.afh_update && !b->afh_update); in _update_bt_info()
4981 b->afh_update = btinfo.hb2.afh_update; in _update_bt_info()
4982 a2dp->active = btinfo.hb2.a2dp_active; in _update_bt_info()
4983 b->slave_role = btinfo.hb2.slave; in _update_bt_info()
4984 hid->slot_info = btinfo.hb2.hid_slot; in _update_bt_info()
4985 hid->pair_cnt = btinfo.hb2.hid_cnt; in _update_bt_info()
4986 hid->type |= (hid->slot_info == BTC_HID_218 ? in _update_bt_info()
4988 /* parse raw info high-Byte3 */ in _update_bt_info()
4989 btinfo.val = bt->raw_info[BTC_BTINFO_H3]; in _update_bt_info()
4990 a2dp->bitpool = btinfo.hb3.a2dp_bitpool; in _update_bt_info()
4992 if (b->tx_3m != (u32)btinfo.hb3.tx_3m) in _update_bt_info()
4993 cx->cnt_bt[BTC_BCNT_RATECHG]++; in _update_bt_info()
4994 b->tx_3m = (u32)btinfo.hb3.tx_3m; in _update_bt_info()
4996 a2dp->sink = btinfo.hb3.a2dp_sink; in _update_bt_info()
4998 if (b->profile_cnt.now || b->status.map.ble_connect) in _update_bt_info()
5003 if (!a2dp->exist_last && a2dp->exist) { in _update_bt_info()
5004 a2dp->vendor_id = 0; in _update_bt_info()
5005 a2dp->flush_time = 0; in _update_bt_info()
5006 a2dp->play_latency = 1; in _update_bt_info()
5007 ieee80211_queue_delayed_work(rtwdev->hw, in _update_bt_info()
5008 &rtwdev->coex_bt_devinfo_work, in _update_bt_info()
5012 if (a2dp->exist && (a2dp->flush_time == 0 || a2dp->vendor_id == 0 || in _update_bt_info()
5013 a2dp->play_latency == 1)) in _update_bt_info()
5032 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_role_info()
5035 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_role_info()
5036 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_role_info()
5044 vif->type == NL80211_IFTYPE_STATION); in rtw89_btc_ntfy_role_info()
5045 rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC], port=%d\n", rtwvif->port); in rtw89_btc_ntfy_role_info()
5047 chan->band_type, chan->channel, chan->band_width); in rtw89_btc_ntfy_role_info()
5052 vif->bss_conf.beacon_int, vif->bss_conf.dtim_period); in rtw89_btc_ntfy_role_info()
5056 rtwsta->mac_id); in rtw89_btc_ntfy_role_info()
5060 sta->deflink.he_cap.has_he, in rtw89_btc_ntfy_role_info()
5061 sta->deflink.vht_cap.vht_supported, in rtw89_btc_ntfy_role_info()
5062 sta->deflink.ht_cap.ht_supported); in rtw89_btc_ntfy_role_info()
5063 if (sta->deflink.he_cap.has_he) in rtw89_btc_ntfy_role_info()
5065 if (sta->deflink.vht_cap.vht_supported) in rtw89_btc_ntfy_role_info()
5067 if (sta->deflink.ht_cap.ht_supported) in rtw89_btc_ntfy_role_info()
5073 if (rtwvif->wifi_role >= RTW89_WIFI_ROLE_MLME_MAX) in rtw89_btc_ntfy_role_info()
5077 "[BTC], wifi_role=%d\n", rtwvif->wifi_role); in rtw89_btc_ntfy_role_info()
5079 r.role = rtwvif->wifi_role; in rtw89_btc_ntfy_role_info()
5080 r.phy = rtwvif->phy_idx; in rtw89_btc_ntfy_role_info()
5081 r.pid = rtwvif->port; in rtw89_btc_ntfy_role_info()
5084 r.bcn_period = vif->bss_conf.beacon_int; in rtw89_btc_ntfy_role_info()
5085 r.dtim_period = vif->bss_conf.dtim_period; in rtw89_btc_ntfy_role_info()
5086 r.band = chan->band_type; in rtw89_btc_ntfy_role_info()
5087 r.ch = chan->channel; in rtw89_btc_ntfy_role_info()
5088 r.bw = chan->band_width; in rtw89_btc_ntfy_role_info()
5089 ether_addr_copy(r.mac_addr, rtwvif->mac_addr); in rtw89_btc_ntfy_role_info()
5091 if (rtwsta && vif->type == NL80211_IFTYPE_STATION) in rtw89_btc_ntfy_role_info()
5092 r.mac_id = rtwsta->mac_id; in rtw89_btc_ntfy_role_info()
5094 btc->dm.cnt_notify[BTC_NCNT_ROLE_INFO]++; in rtw89_btc_ntfy_role_info()
5096 wlinfo = &wl->link_info[r.pid]; in rtw89_btc_ntfy_role_info()
5099 if (chip->chip_id == RTL8852A) in rtw89_btc_ntfy_role_info()
5104 if (wlinfo->role == RTW89_WIFI_ROLE_STATION && in rtw89_btc_ntfy_role_info()
5105 wlinfo->connected == MLME_NO_LINK) in rtw89_btc_ntfy_role_info()
5106 btc->dm.leak_ap = 0; in rtw89_btc_ntfy_role_info()
5109 wl->status.map.connecting = 1; in rtw89_btc_ntfy_role_info()
5111 wl->status.map.connecting = 0; in rtw89_btc_ntfy_role_info()
5114 wl->status.map._4way = false; in rtw89_btc_ntfy_role_info()
5121 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_radio_state()
5122 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_radio_state()
5123 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_radio_state()
5128 btc->dm.cnt_notify[BTC_NCNT_RADIO_STATE]++; in rtw89_btc_ntfy_radio_state()
5132 wl->status.map.rf_off = 1; in rtw89_btc_ntfy_radio_state()
5133 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_radio_state()
5134 wl->status.map.busy = 0; in rtw89_btc_ntfy_radio_state()
5137 wl->status.map.rf_off = 0; in rtw89_btc_ntfy_radio_state()
5138 wl->status.map.lps = BTC_LPS_RF_OFF; in rtw89_btc_ntfy_radio_state()
5139 wl->status.map.busy = 0; in rtw89_btc_ntfy_radio_state()
5143 wl->status.map.rf_off = 0; in rtw89_btc_ntfy_radio_state()
5144 wl->status.map.lps = BTC_LPS_OFF; in rtw89_btc_ntfy_radio_state()
5149 btc->dm.cnt_dm[BTC_DCNT_BTCNT_FREEZE] = 0; in rtw89_btc_ntfy_radio_state()
5155 chip->ops->btc_init_cfg(rtwdev); in rtw89_btc_ntfy_radio_state()
5164 wl->status.map.rf_off_pre = wl->status.map.rf_off; in rtw89_btc_ntfy_radio_state()
5165 wl->status.map.lps_pre = wl->status.map.lps; in rtw89_btc_ntfy_radio_state()
5172 struct rtw89_btc *btc = &rtwdev->btc; in _ntfy_wl_rfk()
5173 struct rtw89_btc_cx *cx = &btc->cx; in _ntfy_wl_rfk()
5174 struct rtw89_btc_wl_info *wl = &cx->wl; in _ntfy_wl_rfk()
5177 wl->rfk_info.type = type; in _ntfy_wl_rfk()
5178 wl->rfk_info.path_map = FIELD_GET(BTC_RFK_PATH_MAP, phy_path); in _ntfy_wl_rfk()
5179 wl->rfk_info.phy_map = FIELD_GET(BTC_RFK_PHY_MAP, phy_path); in _ntfy_wl_rfk()
5180 wl->rfk_info.band = FIELD_GET(BTC_RFK_BAND_MAP, phy_path); in _ntfy_wl_rfk()
5184 __func__, wl->rfk_info.phy_map, wl->rfk_info.path_map, in _ntfy_wl_rfk()
5190 wl->rfk_info.state = result ? BTC_WRFK_START : BTC_WRFK_STOP; in _ntfy_wl_rfk()
5194 btc->dm.cnt_notify[BTC_NCNT_WL_RFK]++; in _ntfy_wl_rfk()
5198 if (wl->rfk_info.state == BTC_WRFK_STOP) { in _ntfy_wl_rfk()
5202 wl->rfk_info.state = state; in _ntfy_wl_rfk()
5207 wl->rfk_info.state = BTC_WRFK_STOP; in _ntfy_wl_rfk()
5210 cancel_delayed_work(&rtwdev->coex_rfk_chk_work); in _ntfy_wl_rfk()
5219 if (wl->rfk_info.state == BTC_WRFK_START || in _ntfy_wl_rfk()
5220 wl->rfk_info.state == BTC_WRFK_STOP) in _ntfy_wl_rfk()
5223 if (wl->rfk_info.state == BTC_WRFK_START) in _ntfy_wl_rfk()
5224 ieee80211_queue_delayed_work(rtwdev->hw, in _ntfy_wl_rfk()
5225 &rtwdev->coex_rfk_chk_work, in _ntfy_wl_rfk()
5231 __func__, btc->dm.cnt_notify[BTC_NCNT_WL_RFK], result); in _ntfy_wl_rfk()
5255 state == BTC_WRFK_ONESHOT_START ? "ONE-SHOT_START" : in rtw89_btc_ntfy_wl_rfk()
5256 "ONE-SHOT_STOP"); in rtw89_btc_ntfy_wl_rfk()
5258 if (state != BTC_WRFK_START || rtwdev->is_bt_iqk_timeout) { in rtw89_btc_ntfy_wl_rfk()
5267 rtwdev->is_bt_iqk_timeout = true; in rtw89_btc_ntfy_wl_rfk()
5285 struct rtw89_dev *rtwdev = iter_data->rtwdev; in rtw89_btc_ntfy_wl_sta_iter()
5286 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_wl_sta_iter()
5287 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_wl_sta_iter()
5289 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; in rtw89_btc_ntfy_wl_sta_iter()
5291 struct rtw89_vif *rtwvif = rtwsta->rtwvif; in rtw89_btc_ntfy_wl_sta_iter()
5292 struct rtw89_traffic_stats *stats = &rtwvif->stats; in rtw89_btc_ntfy_wl_sta_iter()
5293 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_ntfy_wl_sta_iter()
5296 u8 port = rtwvif->port; in rtw89_btc_ntfy_wl_sta_iter()
5304 rssi = ewma_rssi_read(&rtwsta->avg_rssi) >> RSSI_FACTOR; in rtw89_btc_ntfy_wl_sta_iter()
5307 link_info = &wl->link_info[port]; in rtw89_btc_ntfy_wl_sta_iter()
5308 link_info->stat.traffic = rtwvif->stats; in rtw89_btc_ntfy_wl_sta_iter()
5309 link_info_t = &link_info->stat.traffic; in rtw89_btc_ntfy_wl_sta_iter()
5311 if (link_info->connected == MLME_NO_LINK) { in rtw89_btc_ntfy_wl_sta_iter()
5312 link_info->rx_rate_drop_cnt = 0; in rtw89_btc_ntfy_wl_sta_iter()
5316 link_info->stat.rssi = rssi; in rtw89_btc_ntfy_wl_sta_iter()
5318 link_info->rssi_state[i] = in rtw89_btc_ntfy_wl_sta_iter()
5320 link_info->rssi_state[i], in rtw89_btc_ntfy_wl_sta_iter()
5321 link_info->stat.rssi, in rtw89_btc_ntfy_wl_sta_iter()
5322 chip->wl_rssi_thres[i]); in rtw89_btc_ntfy_wl_sta_iter()
5323 if (BTC_RSSI_LOW(link_info->rssi_state[i])) in rtw89_btc_ntfy_wl_sta_iter()
5326 if (btc->mdinfo.ant.type == BTC_ANT_DEDICATED && in rtw89_btc_ntfy_wl_sta_iter()
5327 BTC_RSSI_CHANGE(link_info->rssi_state[i])) in rtw89_btc_ntfy_wl_sta_iter()
5330 iter_data->rssi_map_all |= rssi_map; in rtw89_btc_ntfy_wl_sta_iter()
5332 last_tx_rate = link_info_t->tx_rate; in rtw89_btc_ntfy_wl_sta_iter()
5333 last_rx_rate = link_info_t->rx_rate; in rtw89_btc_ntfy_wl_sta_iter()
5334 last_tx_lvl = (u16)link_info_t->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
5335 last_rx_lvl = (u16)link_info_t->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
5337 if (stats->tx_tfc_lv != RTW89_TFC_IDLE || in rtw89_btc_ntfy_wl_sta_iter()
5338 stats->rx_tfc_lv != RTW89_TFC_IDLE) in rtw89_btc_ntfy_wl_sta_iter()
5341 if (stats->tx_tfc_lv > stats->rx_tfc_lv) in rtw89_btc_ntfy_wl_sta_iter()
5346 link_info = &wl->link_info[port]; in rtw89_btc_ntfy_wl_sta_iter()
5347 if (link_info->busy != busy || link_info->dir != dir) { in rtw89_btc_ntfy_wl_sta_iter()
5349 link_info->busy = busy; in rtw89_btc_ntfy_wl_sta_iter()
5350 link_info->dir = dir; in rtw89_btc_ntfy_wl_sta_iter()
5353 iter_data->busy_all |= busy; in rtw89_btc_ntfy_wl_sta_iter()
5354 iter_data->dir_all |= BIT(dir); in rtw89_btc_ntfy_wl_sta_iter()
5356 if (rtwsta->rx_hw_rate <= RTW89_HW_RATE_CCK2 && in rtw89_btc_ntfy_wl_sta_iter()
5358 link_info_t->rx_tfc_lv > RTW89_TFC_IDLE) in rtw89_btc_ntfy_wl_sta_iter()
5359 link_info->rx_rate_drop_cnt++; in rtw89_btc_ntfy_wl_sta_iter()
5361 if (last_tx_rate != rtwsta->ra_report.hw_rate || in rtw89_btc_ntfy_wl_sta_iter()
5362 last_rx_rate != rtwsta->rx_hw_rate || in rtw89_btc_ntfy_wl_sta_iter()
5363 last_tx_lvl != link_info_t->tx_tfc_lv || in rtw89_btc_ntfy_wl_sta_iter()
5364 last_rx_lvl != link_info_t->rx_tfc_lv) in rtw89_btc_ntfy_wl_sta_iter()
5367 link_info_t->tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
5368 link_info_t->rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
5370 wl->role_info.active_role[port].tx_lvl = (u16)stats->tx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
5371 wl->role_info.active_role[port].rx_lvl = (u16)stats->rx_tfc_lv; in rtw89_btc_ntfy_wl_sta_iter()
5372 wl->role_info.active_role[port].tx_rate = rtwsta->ra_report.hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
5373 wl->role_info.active_role[port].rx_rate = rtwsta->rx_hw_rate; in rtw89_btc_ntfy_wl_sta_iter()
5376 iter_data->is_sta_change = true; in rtw89_btc_ntfy_wl_sta_iter()
5379 iter_data->is_traffic_change = true; in rtw89_btc_ntfy_wl_sta_iter()
5386 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_ntfy_wl_sta()
5387 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in rtw89_btc_ntfy_wl_sta()
5391 ieee80211_iterate_stations_atomic(rtwdev->hw, in rtw89_btc_ntfy_wl_sta()
5395 wl->rssi_level = 0; in rtw89_btc_ntfy_wl_sta()
5396 btc->dm.cnt_notify[BTC_NCNT_WL_STA]++; in rtw89_btc_ntfy_wl_sta()
5397 for (i = BTC_WL_RSSI_THMAX; i > 0; i--) { in rtw89_btc_ntfy_wl_sta()
5399 if (data.rssi_map_all & BIT(i - 1)) { in rtw89_btc_ntfy_wl_sta()
5400 wl->rssi_level = i; in rtw89_btc_ntfy_wl_sta()
5406 __func__, !!wl->status.map.busy); in rtw89_btc_ntfy_wl_sta()
5408 _write_scbd(rtwdev, BTC_WSCB_WLBUSY, (!!wl->status.map.busy)); in rtw89_btc_ntfy_wl_sta()
5413 wl->status.map.busy = data.busy_all; in rtw89_btc_ntfy_wl_sta()
5414 wl->status.map.traffic_dir = data.dir_all; in rtw89_btc_ntfy_wl_sta()
5416 } else if (btc->dm.cnt_notify[BTC_NCNT_WL_STA] >= in rtw89_btc_ntfy_wl_sta()
5417 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] + BTC_NHM_CHK_INTVL) { in rtw89_btc_ntfy_wl_sta()
5418 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] = in rtw89_btc_ntfy_wl_sta()
5419 btc->dm.cnt_notify[BTC_NCNT_WL_STA]; in rtw89_btc_ntfy_wl_sta()
5420 } else if (btc->dm.cnt_notify[BTC_NCNT_WL_STA] < in rtw89_btc_ntfy_wl_sta()
5421 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST]) { in rtw89_btc_ntfy_wl_sta()
5422 btc->dm.cnt_dm[BTC_DCNT_WL_STA_LAST] = in rtw89_btc_ntfy_wl_sta()
5423 btc->dm.cnt_notify[BTC_NCNT_WL_STA]; in rtw89_btc_ntfy_wl_sta()
5430 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_c2h_handle()
5431 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in rtw89_btc_c2h_handle()
5432 u8 *buf = &skb->data[RTW89_C2H_HEADER_LEN]; in rtw89_btc_c2h_handle()
5434 len -= RTW89_C2H_HEADER_LEN; in rtw89_btc_c2h_handle()
5446 pfwinfo->event[func]++; in rtw89_btc_c2h_handle()
5453 btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE]++; in rtw89_btc_c2h_handle()
5459 btc->cx.cnt_bt[BTC_BCNT_SCBDUPDATE]++; in rtw89_btc_c2h_handle()
5465 btc->dbg.rb_done = true; in rtw89_btc_c2h_handle()
5466 btc->dbg.rb_val = le32_to_cpu(*((__le32 *)buf)); in rtw89_btc_c2h_handle()
5470 btc->dbg.rb_done = true; in rtw89_btc_c2h_handle()
5471 btc->dbg.rb_val = buf[0]; in rtw89_btc_c2h_handle()
5474 btc->dm.cnt_dm[BTC_DCNT_CX_RUNINFO]++; in rtw89_btc_c2h_handle()
5483 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_cx_info()
5484 struct rtw89_hal *hal = &rtwdev->hal; in _show_cx_info()
5485 struct rtw89_btc *btc = &rtwdev->btc; in _show_cx_info()
5486 struct rtw89_btc_dm *dm = &btc->dm; in _show_cx_info()
5487 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_cx_info()
5488 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_cx_info()
5491 if (!(dm->coex_info_map & BTC_COEX_INFO_CX)) in _show_cx_info()
5494 dm->cnt_notify[BTC_NCNT_SHOW_COEX_INFO]++; in _show_cx_info()
5497 chip->chip_id); in _show_cx_info()
5503 seq_printf(m, " %-15s : Coex:%d.%d.%d(branch:%d), ", in _show_cx_info()
5506 if (dm->wl_fw_cx_offload != BTC_CX_FW_OFFLOAD) in _show_cx_info()
5507 dm->error.map.offload_mismatch = true; in _show_cx_info()
5509 dm->error.map.offload_mismatch = false; in _show_cx_info()
5511 ver_main = FIELD_GET(GENMASK(31, 24), wl->ver_info.fw_coex); in _show_cx_info()
5512 ver_sub = FIELD_GET(GENMASK(23, 16), wl->ver_info.fw_coex); in _show_cx_info()
5513 ver_hotfix = FIELD_GET(GENMASK(15, 8), wl->ver_info.fw_coex); in _show_cx_info()
5514 id_branch = FIELD_GET(GENMASK(7, 0), wl->ver_info.fw_coex); in _show_cx_info()
5518 ver_main = FIELD_GET(GENMASK(31, 24), chip->wlcx_desired); in _show_cx_info()
5519 ver_sub = FIELD_GET(GENMASK(23, 16), chip->wlcx_desired); in _show_cx_info()
5520 ver_hotfix = FIELD_GET(GENMASK(15, 8), chip->wlcx_desired); in _show_cx_info()
5522 (wl->ver_info.fw_coex >= chip->wlcx_desired ? in _show_cx_info()
5526 bt->ver_info.fw_coex, in _show_cx_info()
5527 (bt->ver_info.fw_coex >= chip->btcx_desired ? in _show_cx_info()
5528 "Match" : "Mismatch"), chip->btcx_desired); in _show_cx_info()
5530 if (bt->enable.now && bt->ver_info.fw == 0) in _show_cx_info()
5535 ver_main = FIELD_GET(GENMASK(31, 24), wl->ver_info.fw); in _show_cx_info()
5536 ver_sub = FIELD_GET(GENMASK(23, 16), wl->ver_info.fw); in _show_cx_info()
5537 ver_hotfix = FIELD_GET(GENMASK(15, 8), wl->ver_info.fw); in _show_cx_info()
5538 id_branch = FIELD_GET(GENMASK(7, 0), wl->ver_info.fw); in _show_cx_info()
5539 seq_printf(m, " %-15s : WL_FW:%d.%d.%d.%d, BT_FW:0x%x(%s)\n", in _show_cx_info()
5542 bt->ver_info.fw, bt->run_patch_code ? "patch" : "ROM"); in _show_cx_info()
5544 seq_printf(m, " %-15s : cv:%x, rfe_type:0x%x, ant_iso:%d, ant_pg:%d, %s", in _show_cx_info()
5545 "[hw_info]", btc->mdinfo.cv, btc->mdinfo.rfe_type, in _show_cx_info()
5546 btc->mdinfo.ant.isolation, btc->mdinfo.ant.num, in _show_cx_info()
5547 (btc->mdinfo.ant.num > 1 ? "" : (btc->mdinfo.ant.single_pos ? in _show_cx_info()
5551 btc->cx.other.type, rtwdev->dbcc_en, hal->tx_nss, in _show_cx_info()
5552 hal->rx_nss); in _show_cx_info()
5557 struct rtw89_btc *btc = &rtwdev->btc; in _show_wl_role_info()
5559 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_wl_role_info()
5560 struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; in _show_wl_role_info()
5564 if (rtwdev->dbcc_en) { in _show_wl_role_info()
5566 " %-15s : PHY0_band(op:%d/scan:%d/real:%d), ", in _show_wl_role_info()
5567 "[dbcc_info]", wl_dinfo->op_band[RTW89_PHY_0], in _show_wl_role_info()
5568 wl_dinfo->scan_band[RTW89_PHY_0], in _show_wl_role_info()
5569 wl_dinfo->real_band[RTW89_PHY_0]); in _show_wl_role_info()
5572 wl_dinfo->op_band[RTW89_PHY_1], in _show_wl_role_info()
5573 wl_dinfo->scan_band[RTW89_PHY_1], in _show_wl_role_info()
5574 wl_dinfo->real_band[RTW89_PHY_1]); in _show_wl_role_info()
5578 plink = &btc->cx.wl.link_info[i]; in _show_wl_role_info()
5580 if (!plink->active) in _show_wl_role_info()
5584 … " [port_%d] : role=%d(phy-%d), connect=%d(client_cnt=%d), mode=%d, center_ch=%d, bw=%d", in _show_wl_role_info()
5585 plink->pid, (u32)plink->role, plink->phy, in _show_wl_role_info()
5586 (u32)plink->connected, plink->client_cnt - 1, in _show_wl_role_info()
5587 (u32)plink->mode, plink->ch, (u32)plink->bw); in _show_wl_role_info()
5589 if (plink->connected == MLME_NO_LINK) in _show_wl_role_info()
5594 plink->mac_id, plink->tx_time, plink->tx_retry); in _show_wl_role_info()
5597 " [port_%d] : rssi=-%ddBm(%d), busy=%d, dir=%s, ", in _show_wl_role_info()
5598 plink->pid, 110 - plink->stat.rssi, in _show_wl_role_info()
5599 plink->stat.rssi, plink->busy, in _show_wl_role_info()
5600 plink->dir == RTW89_TFC_UL ? "UL" : "DL"); in _show_wl_role_info()
5602 t = &plink->stat.traffic; in _show_wl_role_info()
5606 (u32)t->tx_rate, t->tx_tfc_lv); in _show_wl_role_info()
5609 (u32)t->rx_rate, in _show_wl_role_info()
5610 t->rx_tfc_lv, plink->rx_rate_drop_cnt); in _show_wl_role_info()
5616 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_wl_info()
5617 struct rtw89_btc *btc = &rtwdev->btc; in _show_wl_info()
5618 struct rtw89_btc_cx *cx = &btc->cx; in _show_wl_info()
5619 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_wl_info()
5620 struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info; in _show_wl_info()
5621 struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1; in _show_wl_info()
5624 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_WL)) in _show_wl_info()
5629 if (chip->chip_id == RTL8852A) in _show_wl_info()
5630 mode = wl_rinfo->link_mode; in _show_wl_info()
5632 mode = wl_rinfo_v1->link_mode; in _show_wl_info()
5634 seq_printf(m, " %-15s : link_mode:%d, ", "[status]", mode); in _show_wl_info()
5638 wl->status.map.rf_off, wl->status.map.lps, in _show_wl_info()
5639 wl->status.map.scan ? "Y" : "N", in _show_wl_info()
5640 wl->scan_info.band[RTW89_PHY_0], wl->scan_info.phy_map); in _show_wl_info()
5644 wl->status.map.connecting ? "Y" : "N", in _show_wl_info()
5645 wl->status.map.roaming ? "Y" : "N", in _show_wl_info()
5646 wl->status.map._4way ? "Y" : "N", in _show_wl_info()
5647 wl->status.map.init_ok ? "Y" : "N"); in _show_wl_info()
5660 struct rtw89_btc *btc = &rtwdev->btc; in _show_bt_profile_info()
5661 struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info; in _show_bt_profile_info()
5662 struct rtw89_btc_bt_hfp_desc hfp = bt_linfo->hfp_desc; in _show_bt_profile_info()
5663 struct rtw89_btc_bt_hid_desc hid = bt_linfo->hid_desc; in _show_bt_profile_info()
5664 struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; in _show_bt_profile_info()
5665 struct rtw89_btc_bt_pan_desc pan = bt_linfo->pan_desc; in _show_bt_profile_info()
5668 seq_printf(m, " %-15s : type:%s, sut_pwr:%d, golden-rx:%d", in _show_bt_profile_info()
5670 bt_linfo->sut_pwr_level[0], in _show_bt_profile_info()
5671 bt_linfo->golden_rx_shift[0]); in _show_bt_profile_info()
5676 "\n\r %-15s : type:%s%s%s%s%s pair-cnt:%d, sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
5682 hid.type & BTC_HID_RCU_VOICE ? "RCU-Voice," : "", in _show_bt_profile_info()
5683 hid.pair_cnt, bt_linfo->sut_pwr_level[1], in _show_bt_profile_info()
5684 bt_linfo->golden_rx_shift[1]); in _show_bt_profile_info()
5689 " %-15s : type:%s, bit-pool:%d, flush-time:%d, ", in _show_bt_profile_info()
5695 "vid:0x%x, Dev-name:0x%x, sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
5697 bt_linfo->sut_pwr_level[2], in _show_bt_profile_info()
5698 bt_linfo->golden_rx_shift[2]); in _show_bt_profile_info()
5702 seq_printf(m, " %-15s : sut_pwr:%d, golden-rx:%d\n", in _show_bt_profile_info()
5704 bt_linfo->sut_pwr_level[3], in _show_bt_profile_info()
5705 bt_linfo->golden_rx_shift[3]); in _show_bt_profile_info()
5711 struct rtw89_btc *btc = &rtwdev->btc; in _show_bt_info()
5712 struct rtw89_btc_cx *cx = &btc->cx; in _show_bt_info()
5713 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_bt_info()
5714 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_bt_info()
5715 struct rtw89_btc_module *module = &btc->mdinfo; in _show_bt_info()
5716 struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; in _show_bt_info()
5717 u8 *afh = bt_linfo->afh_map; in _show_bt_info()
5719 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_BT)) in _show_bt_info()
5724 seq_printf(m, " %-15s : enable:%s, btg:%s%s, connect:%s, ", in _show_bt_info()
5725 "[status]", bt->enable.now ? "Y" : "N", in _show_bt_info()
5726 bt->btg_type ? "Y" : "N", in _show_bt_info()
5727 (bt->enable.now && (bt->btg_type != module->bt_pos) ? in _show_bt_info()
5728 "(efuse-mismatch!!)" : ""), in _show_bt_info()
5729 (bt_linfo->status.map.connect ? "Y" : "N")); in _show_bt_info()
5732 bt->igno_wl ? "Y" : "N", in _show_bt_info()
5733 bt->mbx_avl ? "Y" : "N", bt->rfk_info.val); in _show_bt_info()
5735 seq_printf(m, " %-15s : profile:%s%s%s%s%s ", in _show_bt_info()
5737 (bt_linfo->profile_cnt.now == 0) ? "None," : "", in _show_bt_info()
5738 bt_linfo->hfp_desc.exist ? "HFP," : "", in _show_bt_info()
5739 bt_linfo->hid_desc.exist ? "HID," : "", in _show_bt_info()
5740 bt_linfo->a2dp_desc.exist ? in _show_bt_info()
5741 (bt_linfo->a2dp_desc.sink ? "A2DP_sink," : "A2DP,") : "", in _show_bt_info()
5742 bt_linfo->pan_desc.exist ? "PAN," : ""); in _show_bt_info()
5745 "multi-link:%s, role:%s, ble-connect:%s, CQDDR:%s, A2DP_active:%s, PAN_active:%s\n", in _show_bt_info()
5746 bt_linfo->multi_link.now ? "Y" : "N", in _show_bt_info()
5747 bt_linfo->slave_role ? "Slave" : "Master", in _show_bt_info()
5748 bt_linfo->status.map.ble_connect ? "Y" : "N", in _show_bt_info()
5749 bt_linfo->cqddr ? "Y" : "N", in _show_bt_info()
5750 bt_linfo->a2dp_desc.active ? "Y" : "N", in _show_bt_info()
5751 bt_linfo->pan_desc.active ? "Y" : "N"); in _show_bt_info()
5754 " %-15s : rssi:%ddBm, tx_rate:%dM, %s%s%s", in _show_bt_info()
5755 "[link]", bt_linfo->rssi - 100, in _show_bt_info()
5756 bt_linfo->tx_3m ? 3 : 2, in _show_bt_info()
5757 bt_linfo->status.map.inq_pag ? " inq-page!!" : "", in _show_bt_info()
5758 bt_linfo->status.map.acl_busy ? " acl_busy!!" : "", in _show_bt_info()
5759 bt_linfo->status.map.mesh_busy ? " mesh_busy!!" : ""); in _show_bt_info()
5763 bt_linfo->relink.now ? " ReLink!!" : "", in _show_bt_info()
5767 seq_printf(m, "wl_ch_map[en:%d/ch:%d/bw:%d]\n", in _show_bt_info()
5768 wl->afh_info.en, wl->afh_info.ch, wl->afh_info.bw); in _show_bt_info()
5771 " %-15s : retry:%d, relink:%d, rate_chg:%d, reinit:%d, reenable:%d, ", in _show_bt_info()
5772 "[stat_cnt]", cx->cnt_bt[BTC_BCNT_RETRY], in _show_bt_info()
5773 cx->cnt_bt[BTC_BCNT_RELINK], cx->cnt_bt[BTC_BCNT_RATECHG], in _show_bt_info()
5774 cx->cnt_bt[BTC_BCNT_REINIT], cx->cnt_bt[BTC_BCNT_REENABLE]); in _show_bt_info()
5777 "role-switch:%d, afh:%d, inq_page:%d(inq:%d/page:%d), igno_wl:%d\n", in _show_bt_info()
5778 cx->cnt_bt[BTC_BCNT_ROLESW], cx->cnt_bt[BTC_BCNT_AFH], in _show_bt_info()
5779 cx->cnt_bt[BTC_BCNT_INQPAG], cx->cnt_bt[BTC_BCNT_INQ], in _show_bt_info()
5780 cx->cnt_bt[BTC_BCNT_PAGE], cx->cnt_bt[BTC_BCNT_IGNOWL]); in _show_bt_info()
5785 " %-15s : raw_data[%02x %02x %02x %02x %02x %02x] (type:%s/cnt:%d/same:%d)\n", in _show_bt_info()
5786 "[bt_info]", bt->raw_info[2], bt->raw_info[3], in _show_bt_info()
5787 bt->raw_info[4], bt->raw_info[5], bt->raw_info[6], in _show_bt_info()
5788 bt->raw_info[7], in _show_bt_info()
5789 bt->raw_info[0] == BTC_BTINFO_AUTO ? "auto" : "reply", in _show_bt_info()
5790 cx->cnt_bt[BTC_BCNT_INFOUPDATE], in _show_bt_info()
5791 cx->cnt_bt[BTC_BCNT_INFOSAME]); in _show_bt_info()
5794 " %-15s : Hi-rx = %d, Hi-tx = %d, Lo-rx = %d, Lo-tx = %d (bt_polut_wl_tx = %d)\n", in _show_bt_info()
5795 "[trx_req_cnt]", cx->cnt_bt[BTC_BCNT_HIPRI_RX], in _show_bt_info()
5796 cx->cnt_bt[BTC_BCNT_HIPRI_TX], cx->cnt_bt[BTC_BCNT_LOPRI_RX], in _show_bt_info()
5797 cx->cnt_bt[BTC_BCNT_LOPRI_TX], cx->cnt_bt[BTC_BCNT_POLUT]); in _show_bt_info()
5954 seq_printf(m, " %-15s : ", prefix); in seq_print_segment()
5957 seq_printf(m, "-> %-20s", in seq_print_segment()
5960 seq_printf(m, "-> %-15s", in seq_print_segment()
5963 seq_printf(m, "-> %-13s", in seq_print_segment()
5965 if (i == (len - 1) || (i % seg_len) == (seg_len - 1)) in seq_print_segment()
5972 struct rtw89_btc *btc = &rtwdev->btc; in _show_dm_step()
5973 struct rtw89_btc_dm *dm = &btc->dm; in _show_dm_step()
5977 len = dm->dm_step.step_ov ? RTW89_BTC_DM_MAXSTEP : dm->dm_step.step_pos; in _show_dm_step()
5978 start_idx = dm->dm_step.step_ov ? dm->dm_step.step_pos : 0; in _show_dm_step()
5980 seq_print_segment(m, "[dm_steps]", dm->dm_step.step, len, 6, start_idx, in _show_dm_step()
5981 ARRAY_SIZE(dm->dm_step.step)); in _show_dm_step()
5986 struct rtw89_btc *btc = &rtwdev->btc; in _show_dm_info()
5987 struct rtw89_btc_module *module = &btc->mdinfo; in _show_dm_info()
5988 struct rtw89_btc_dm *dm = &btc->dm; in _show_dm_info()
5989 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_dm_info()
5990 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_dm_info()
5992 if (!(dm->coex_info_map & BTC_COEX_INFO_DM)) in _show_dm_info()
5996 (btc->ctrl.manual ? "(Manual)" : "(Auto)")); in _show_dm_info()
5999 " %-15s : type:%s, reason:%s(), action:%s(), ant_path:%ld, run_cnt:%d\n", in _show_dm_info()
6001 module->ant.type == BTC_ANT_SHARED ? "shared" : "dedicated", in _show_dm_info()
6002 steps_to_str(dm->run_reason), in _show_dm_info()
6003 steps_to_str(dm->run_action | BTC_ACT_EXT_BIT), in _show_dm_info()
6004 FIELD_GET(GENMASK(7, 0), dm->set_ant_path), in _show_dm_info()
6005 dm->cnt_dm[BTC_DCNT_RUN]); in _show_dm_info()
6009 …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()
6010 "[dm_flag]", dm->wl_only, dm->bt_only, btc->ctrl.igno_bt, in _show_dm_info()
6011 dm->freerun, btc->lps, dm->wl_mimo_ps); in _show_dm_info()
6013 seq_printf(m, "leak_ap:%d, fw_offload:%s%s\n", dm->leak_ap, in _show_dm_info()
6015 (dm->wl_fw_cx_offload == BTC_CX_FW_OFFLOAD ? in _show_dm_info()
6018 if (dm->rf_trx_para.wl_tx_power == 0xff) in _show_dm_info()
6020 " %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:orig, ", in _show_dm_info()
6021 "[trx_ctrl]", wl->rssi_level, dm->trx_para_level); in _show_dm_info()
6025 " %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:%d, ", in _show_dm_info()
6026 "[trx_ctrl]", wl->rssi_level, dm->trx_para_level, in _show_dm_info()
6027 dm->rf_trx_para.wl_tx_power); in _show_dm_info()
6030 "wl_rx_lvl:%d, bt_tx_pwr_dec:%d, bt_rx_lna:%d(%s-tbl), wl_btg_rx:%d\n", in _show_dm_info()
6031 dm->rf_trx_para.wl_rx_gain, dm->rf_trx_para.bt_tx_power, in _show_dm_info()
6032 dm->rf_trx_para.bt_rx_gain, in _show_dm_info()
6033 (bt->hi_lna_rx ? "Hi" : "Ori"), dm->wl_btg_rx); in _show_dm_info()
6036 … " %-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()
6037 "[dm_ctrl]", dm->wl_tx_limit.enable, dm->wl_tx_limit.tx_time, in _show_dm_info()
6038 dm->wl_tx_limit.tx_retry, btc->bt_req_len, bt->scan_rx_low_pri); in _show_dm_info()
6043 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_error()
6044 struct rtw89_btc *btc = &rtwdev->btc; in _show_error()
6045 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_error()
6050 if (chip->chip_id == RTL8852A) { in _show_error()
6051 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo; in _show_error()
6052 except_cnt = le32_to_cpu(pcysta->except_cnt); in _show_error()
6053 exception_map = le32_to_cpu(pcysta->exception); in _show_error()
6055 pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1; in _show_error()
6056 except_cnt = le32_to_cpu(pcysta_v1->except_cnt); in _show_error()
6057 exception_map = le32_to_cpu(pcysta_v1->except_map); in _show_error()
6060 if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW] == 0 && except_cnt == 0 && in _show_error()
6061 !pfwinfo->len_mismch && !pfwinfo->fver_mismch) in _show_error()
6064 seq_printf(m, " %-15s : ", "[error]"); in _show_error()
6066 if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW]) { in _show_error()
6068 "overflow-cnt: %d, ", in _show_error()
6069 pfwinfo->event[BTF_EVNT_BUF_OVERFLOW]); in _show_error()
6072 if (pfwinfo->len_mismch) { in _show_error()
6074 "len-mismatch: 0x%x, ", in _show_error()
6075 pfwinfo->len_mismch); in _show_error()
6078 if (pfwinfo->fver_mismch) { in _show_error()
6080 "fver-mismatch: 0x%x, ", in _show_error()
6081 pfwinfo->fver_mismch); in _show_error()
6087 "exception-type: 0x%x, exception-cnt = %d", in _show_error()
6095 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_fbtc_tdma()
6096 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_tdma()
6097 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_tdma()
6101 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_tdma()
6104 pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo; in _show_fbtc_tdma()
6105 if (!pcinfo->valid) in _show_fbtc_tdma()
6108 if (chip->chip_id == RTL8852A) in _show_fbtc_tdma()
6109 t = &pfwinfo->rpt_fbtc_tdma.finfo; in _show_fbtc_tdma()
6111 t = &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma; in _show_fbtc_tdma()
6114 " %-15s : ", "[tdma_policy]"); in _show_fbtc_tdma()
6117 (u32)t->type, in _show_fbtc_tdma()
6118 t->rxflctrl, t->txpause); in _show_fbtc_tdma()
6122 t->wtgle_n, t->leak_n, t->ext_ctrl); in _show_fbtc_tdma()
6126 (u32)btc->policy_type); in _show_fbtc_tdma()
6128 s = pfwinfo->rpt_fbtc_slots.finfo.slot; in _show_fbtc_tdma()
6131 if (dm->update_slot_map == BIT(CXST_MAX) - 1) in _show_fbtc_tdma()
6134 if (!(dm->update_slot_map & BIT(i))) in _show_fbtc_tdma()
6139 " %-15s : %d[%d/0x%x/%d]", in _show_fbtc_tdma()
6157 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_slots()
6158 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_slots()
6164 pcinfo = &pfwinfo->rpt_fbtc_slots.cinfo; in _show_fbtc_slots()
6165 if (!pcinfo->valid) in _show_fbtc_slots()
6168 pslots = &pfwinfo->rpt_fbtc_slots.finfo; in _show_fbtc_slots()
6171 s = pslots->slot[i]; in _show_fbtc_slots()
6174 " %-15s : %02d[%03d/0x%x/%d]", in _show_fbtc_slots()
6190 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta()
6191 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta()
6192 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta()
6193 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta()
6201 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta()
6202 if (!pcinfo->valid) in _show_fbtc_cysta()
6205 pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo; in _show_fbtc_cysta()
6208 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta()
6209 "[cycle_cnt]", pcysta->cycles, pcysta->bcn_cnt[CXBCN_ALL], in _show_fbtc_cysta()
6210 pcysta->bcn_cnt[CXBCN_ALL_OK], in _show_fbtc_cysta()
6211 pcysta->bcn_cnt[CXBCN_BT_SLOT], in _show_fbtc_cysta()
6212 pcysta->bcn_cnt[CXBCN_BT_OK]); in _show_fbtc_cysta()
6215 if (!pcysta->slot_cnt[i]) in _show_fbtc_cysta()
6218 ", %d:%d", (u32)i, pcysta->slot_cnt[i]); in _show_fbtc_cysta()
6221 if (dm->tdma_now.rxflctrl) { in _show_fbtc_cysta()
6223 ", leak_rx:%d", pcysta->leakrx_cnt); in _show_fbtc_cysta()
6226 if (pcysta->collision_cnt) { in _show_fbtc_cysta()
6228 ", collision:%d", pcysta->collision_cnt); in _show_fbtc_cysta()
6231 if (pcysta->skip_cnt) { in _show_fbtc_cysta()
6233 ", skip:%d", pcysta->skip_cnt); in _show_fbtc_cysta()
6237 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta()
6239 pcysta->tavg_cycle[CXT_WL], in _show_fbtc_cysta()
6240 pcysta->tavg_cycle[CXT_BT], in _show_fbtc_cysta()
6241 pcysta->tavg_lk / 1000, pcysta->tavg_lk % 1000); in _show_fbtc_cysta()
6244 pcysta->tmax_cycle[CXT_WL], in _show_fbtc_cysta()
6245 pcysta->tmax_cycle[CXT_BT], in _show_fbtc_cysta()
6246 pcysta->tmax_lk / 1000, pcysta->tmax_lk % 1000); in _show_fbtc_cysta()
6249 pcysta->tmaxdiff_cycle[CXT_WL], in _show_fbtc_cysta()
6250 pcysta->tmaxdiff_cycle[CXT_BT]); in _show_fbtc_cysta()
6252 if (pcysta->cycles == 0) in _show_fbtc_cysta()
6255 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta()
6258 if (pcysta->cycles <= slot_pair) in _show_fbtc_cysta()
6261 c_begin = pcysta->cycles - slot_pair + 1; in _show_fbtc_cysta()
6263 c_end = pcysta->cycles; in _show_fbtc_cysta()
6267 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta()
6271 " %-15s : ->b%02d->w%02d", "[cycle_step]", in _show_fbtc_cysta()
6272 pcysta->tslot_cycle[store_index], in _show_fbtc_cysta()
6273 pcysta->tslot_cycle[store_index + 1]); in _show_fbtc_cysta()
6276 "->b%02d->w%02d", in _show_fbtc_cysta()
6277 pcysta->tslot_cycle[store_index], in _show_fbtc_cysta()
6278 pcysta->tslot_cycle[store_index + 1]); in _show_fbtc_cysta()
6283 if (a2dp->exist) { in _show_fbtc_cysta()
6285 " %-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta()
6287 pcysta->a2dpept, pcysta->a2dpeptto); in _show_fbtc_cysta()
6291 pcysta->tavg_a2dpept, pcysta->tmax_a2dpept); in _show_fbtc_cysta()
6292 r.val = dm->tdma_now.rxflctrl; in _show_fbtc_cysta()
6297 pcysta->cycles_a2dp[CXT_FLCTRL_ON], in _show_fbtc_cysta()
6298 pcysta->cycles_a2dp[CXT_FLCTRL_OFF]); in _show_fbtc_cysta()
6302 pcysta->tavg_a2dp[CXT_FLCTRL_ON], in _show_fbtc_cysta()
6303 pcysta->tavg_a2dp[CXT_FLCTRL_OFF]); in _show_fbtc_cysta()
6307 pcysta->tmax_a2dp[CXT_FLCTRL_ON], in _show_fbtc_cysta()
6308 pcysta->tmax_a2dp[CXT_FLCTRL_OFF]); in _show_fbtc_cysta()
6316 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_cysta_v1()
6317 struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; in _show_fbtc_cysta_v1()
6318 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_cysta_v1()
6319 struct rtw89_btc_dm *dm = &btc->dm; in _show_fbtc_cysta_v1()
6326 pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo; in _show_fbtc_cysta_v1()
6327 if (!pcinfo->valid) in _show_fbtc_cysta_v1()
6330 pcysta = &pfwinfo->rpt_fbtc_cysta.finfo_v1; in _show_fbtc_cysta_v1()
6332 " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]", in _show_fbtc_cysta_v1()
6334 le16_to_cpu(pcysta->cycles), in _show_fbtc_cysta_v1()
6335 le32_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]), in _show_fbtc_cysta_v1()
6336 le32_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]), in _show_fbtc_cysta_v1()
6337 le32_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]), in _show_fbtc_cysta_v1()
6338 le32_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK])); in _show_fbtc_cysta_v1()
6341 if (!le32_to_cpu(pcysta->slot_cnt[i])) in _show_fbtc_cysta_v1()
6345 le32_to_cpu(pcysta->slot_cnt[i])); in _show_fbtc_cysta_v1()
6348 if (dm->tdma_now.rxflctrl) in _show_fbtc_cysta_v1()
6349 seq_printf(m, ", leak_rx:%d", le32_to_cpu(pcysta->leak_slot.cnt_rximr)); in _show_fbtc_cysta_v1()
6351 if (le32_to_cpu(pcysta->collision_cnt)) in _show_fbtc_cysta_v1()
6352 seq_printf(m, ", collision:%d", le32_to_cpu(pcysta->collision_cnt)); in _show_fbtc_cysta_v1()
6354 if (le32_to_cpu(pcysta->skip_cnt)) in _show_fbtc_cysta_v1()
6355 seq_printf(m, ", skip:%d", le32_to_cpu(pcysta->skip_cnt)); in _show_fbtc_cysta_v1()
6359 seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]", in _show_fbtc_cysta_v1()
6361 le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]), in _show_fbtc_cysta_v1()
6362 le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]), in _show_fbtc_cysta_v1()
6363 le16_to_cpu(pcysta->leak_slot.tavg) / 1000, in _show_fbtc_cysta_v1()
6364 le16_to_cpu(pcysta->leak_slot.tavg) % 1000); in _show_fbtc_cysta_v1()
6367 le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]), in _show_fbtc_cysta_v1()
6368 le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]), in _show_fbtc_cysta_v1()
6369 le16_to_cpu(pcysta->leak_slot.tmax) / 1000, in _show_fbtc_cysta_v1()
6370 le16_to_cpu(pcysta->leak_slot.tmax) % 1000); in _show_fbtc_cysta_v1()
6373 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_WL]), in _show_fbtc_cysta_v1()
6374 le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_BT])); in _show_fbtc_cysta_v1()
6376 cycle = le16_to_cpu(pcysta->cycles); in _show_fbtc_cysta_v1()
6380 /* 1 cycle record 1 wl-slot and 1 bt-slot */ in _show_fbtc_cysta_v1()
6386 c_begin = cycle - slot_pair + 1; in _show_fbtc_cysta_v1()
6390 if (a2dp->exist) in _show_fbtc_cysta_v1()
6397 store_index = ((cycle - 1) % slot_pair) * 2; in _show_fbtc_cysta_v1()
6400 seq_printf(m, "\n\r %-15s : ", "[cycle_step]"); in _show_fbtc_cysta_v1()
6402 seq_printf(m, "->b%02d", in _show_fbtc_cysta_v1()
6403 le16_to_cpu(pcysta->slot_step_time[store_index])); in _show_fbtc_cysta_v1()
6404 if (a2dp->exist) { in _show_fbtc_cysta_v1()
6405 a2dp_trx = &pcysta->a2dp_trx[store_index]; in _show_fbtc_cysta_v1()
6407 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v1()
6408 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v1()
6409 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v1()
6410 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v1()
6411 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v1()
6412 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v1()
6414 seq_printf(m, "->w%02d", in _show_fbtc_cysta_v1()
6415 le16_to_cpu(pcysta->slot_step_time[store_index + 1])); in _show_fbtc_cysta_v1()
6416 if (a2dp->exist) { in _show_fbtc_cysta_v1()
6417 a2dp_trx = &pcysta->a2dp_trx[store_index + 1]; in _show_fbtc_cysta_v1()
6419 a2dp_trx->empty_cnt, in _show_fbtc_cysta_v1()
6420 a2dp_trx->retry_cnt, in _show_fbtc_cysta_v1()
6421 a2dp_trx->tx_rate ? 3 : 2, in _show_fbtc_cysta_v1()
6422 a2dp_trx->tx_cnt, in _show_fbtc_cysta_v1()
6423 a2dp_trx->ack_cnt, in _show_fbtc_cysta_v1()
6424 a2dp_trx->nack_cnt); in _show_fbtc_cysta_v1()
6431 if (a2dp->exist) { in _show_fbtc_cysta_v1()
6432 seq_printf(m, "%-15s : a2dp_ept:%d, a2dp_late:%d", in _show_fbtc_cysta_v1()
6434 le16_to_cpu(pcysta->a2dp_ept.cnt), in _show_fbtc_cysta_v1()
6435 le16_to_cpu(pcysta->a2dp_ept.cnt_timeout)); in _show_fbtc_cysta_v1()
6438 le16_to_cpu(pcysta->a2dp_ept.tavg), in _show_fbtc_cysta_v1()
6439 le16_to_cpu(pcysta->a2dp_ept.tmax)); in _show_fbtc_cysta_v1()
6447 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_fbtc_nullsta()
6448 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_nullsta()
6449 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_nullsta()
6455 if (!btc->dm.tdma_now.rxflctrl) in _show_fbtc_nullsta()
6458 pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo; in _show_fbtc_nullsta()
6459 if (!pcinfo->valid) in _show_fbtc_nullsta()
6462 if (chip->chip_id == RTL8852A) { in _show_fbtc_nullsta()
6463 ns = &pfwinfo->rpt_fbtc_nullsta.finfo; in _show_fbtc_nullsta()
6465 seq_printf(m, " %-15s : ", "[null_sta]"); in _show_fbtc_nullsta()
6469 seq_printf(m, ", null-%d", i); in _show_fbtc_nullsta()
6471 seq_printf(m, "null-%d", i); in _show_fbtc_nullsta()
6473 le32_to_cpu(ns->result[i][1])); in _show_fbtc_nullsta()
6475 le32_to_cpu(ns->result[i][0])); in _show_fbtc_nullsta()
6477 le32_to_cpu(ns->result[i][2])); in _show_fbtc_nullsta()
6479 le32_to_cpu(ns->result[i][3])); in _show_fbtc_nullsta()
6481 le32_to_cpu(ns->avg_t[i]) / 1000, in _show_fbtc_nullsta()
6482 le32_to_cpu(ns->avg_t[i]) % 1000); in _show_fbtc_nullsta()
6484 le32_to_cpu(ns->max_t[i]) / 1000, in _show_fbtc_nullsta()
6485 le32_to_cpu(ns->max_t[i]) % 1000); in _show_fbtc_nullsta()
6488 ns_v1 = &pfwinfo->rpt_fbtc_nullsta.finfo_v1; in _show_fbtc_nullsta()
6490 seq_printf(m, " %-15s : ", "[null_sta]"); in _show_fbtc_nullsta()
6494 seq_printf(m, ", null-%d", i); in _show_fbtc_nullsta()
6496 seq_printf(m, "null-%d", i); in _show_fbtc_nullsta()
6498 le32_to_cpu(ns_v1->result[i][4])); in _show_fbtc_nullsta()
6500 le32_to_cpu(ns_v1->result[i][1])); in _show_fbtc_nullsta()
6502 le32_to_cpu(ns_v1->result[i][0])); in _show_fbtc_nullsta()
6504 le32_to_cpu(ns_v1->result[i][2])); in _show_fbtc_nullsta()
6506 le32_to_cpu(ns_v1->result[i][3])); in _show_fbtc_nullsta()
6508 le32_to_cpu(ns_v1->avg_t[i]) / 1000, in _show_fbtc_nullsta()
6509 le32_to_cpu(ns_v1->avg_t[i]) % 1000); in _show_fbtc_nullsta()
6511 le32_to_cpu(ns_v1->max_t[i]) / 1000, in _show_fbtc_nullsta()
6512 le32_to_cpu(ns_v1->max_t[i]) % 1000); in _show_fbtc_nullsta()
6520 struct rtw89_btc *btc = &rtwdev->btc; in _show_fbtc_step()
6521 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_fbtc_step()
6529 pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; in _show_fbtc_step()
6530 if (!pcinfo->valid) in _show_fbtc_step()
6533 pstep = &pfwinfo->rpt_fbtc_step.finfo; in _show_fbtc_step()
6534 pos_old = le16_to_cpu(pstep->pos_old); in _show_fbtc_step()
6535 pos_new = le16_to_cpu(pstep->pos_new); in _show_fbtc_step()
6537 if (pcinfo->req_fver != pstep->fver) in _show_fbtc_step()
6548 n_stop = btc->ctrl.trace_step - 1; in _show_fbtc_step()
6554 type = pstep->step[i].type; in _show_fbtc_step()
6555 val = pstep->step[i].val; in _show_fbtc_step()
6556 diff_t = le16_to_cpu(pstep->step[i].difft); in _show_fbtc_step()
6562 seq_printf(m, " %-15s : ", "[steps]"); in _show_fbtc_step()
6564 seq_printf(m, "-> %s(%02d)(%02d)", in _show_fbtc_step()
6589 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_fw_dm_msg()
6590 struct rtw89_btc *btc = &rtwdev->btc; in _show_fw_dm_msg()
6592 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_DM)) in _show_fw_dm_msg()
6599 if (chip->chip_id == RTL8852A) in _show_fw_dm_msg()
6610 const struct rtw89_chip_info *chip = rtwdev->chip; in _get_gnt()
6614 if (chip->chip_id == RTL8852A || chip->chip_id == RTL8852B) { in _get_gnt()
6618 gnt = &gnt_cfg->band[0]; in _get_gnt()
6619 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S0_SW_CTRL); in _get_gnt()
6620 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S0_STA); in _get_gnt()
6621 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S0_SW_CTRL); in _get_gnt()
6622 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S0_STA); in _get_gnt()
6624 gnt = &gnt_cfg->band[1]; in _get_gnt()
6625 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S1_SW_CTRL); in _get_gnt()
6626 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S1_STA); in _get_gnt()
6627 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S1_SW_CTRL); in _get_gnt()
6628 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S1_STA); in _get_gnt()
6629 } else if (chip->chip_id == RTL8852C) { in _get_gnt()
6633 gnt = &gnt_cfg->band[0]; in _get_gnt()
6634 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S0_SWCTRL); in _get_gnt()
6635 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S0); in _get_gnt()
6636 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S0_SWCTRL); in _get_gnt()
6637 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S0); in _get_gnt()
6639 gnt = &gnt_cfg->band[1]; in _get_gnt()
6640 gnt->gnt_bt_sw_en = !!(val & B_AX_GNT_BT_RFC_S1_SWCTRL); in _get_gnt()
6641 gnt->gnt_bt = !!(status & B_AX_GNT_BT_RFC_S1); in _get_gnt()
6642 gnt->gnt_wl_sw_en = !!(val & B_AX_GNT_WL_RFC_S1_SWCTRL); in _get_gnt()
6643 gnt->gnt_wl = !!(status & B_AX_GNT_WL_RFC_S1); in _get_gnt()
6651 const struct rtw89_chip_info *chip = rtwdev->chip; in _show_mreg()
6652 struct rtw89_btc *btc = &rtwdev->btc; in _show_mreg()
6653 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_mreg()
6657 struct rtw89_btc_cx *cx = &btc->cx; in _show_mreg()
6658 struct rtw89_btc_wl_info *wl = &btc->cx.wl; in _show_mreg()
6659 struct rtw89_btc_bt_info *bt = &btc->cx.bt; in _show_mreg()
6665 if (!(btc->dm.coex_info_map & BTC_COEX_INFO_MREG)) in _show_mreg()
6671 " %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n", in _show_mreg()
6672 "[scoreboard]", wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE], in _show_mreg()
6673 bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD], in _show_mreg()
6674 cx->cnt_bt[BTC_BCNT_SCBDUPDATE]); in _show_mreg()
6676 /* To avoid I/O if WL LPS or power-off */ in _show_mreg()
6677 if (!wl->status.map.lps && !wl->status.map.rf_off) { in _show_mreg()
6678 if (chip->chip_id == RTL8852A) in _show_mreg()
6679 btc->dm.pta_owner = rtw89_mac_get_ctrl_path(rtwdev); in _show_mreg()
6680 else if (chip->chip_id == RTL8852C) in _show_mreg()
6681 btc->dm.pta_owner = 0; in _show_mreg()
6686 " %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], ", in _show_mreg()
6688 chip->chip_id == RTL8852C ? "HW" : in _show_mreg()
6689 btc->dm.pta_owner == BTC_CTRL_BY_WL ? "WL" : "BT", in _show_mreg()
6694 seq_printf(m, "phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n", in _show_mreg()
6700 pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo; in _show_mreg()
6701 if (!pcinfo->valid) { in _show_mreg()
6708 pmreg = &pfwinfo->rpt_fbtc_mregval.finfo; in _show_mreg()
6711 __func__, pmreg->reg_num); in _show_mreg()
6713 for (i = 0; i < pmreg->reg_num; i++) { in _show_mreg()
6714 type = (u8)le16_to_cpu(chip->mon_reg[i].type); in _show_mreg()
6715 offset = le32_to_cpu(chip->mon_reg[i].offset); in _show_mreg()
6716 val = le32_to_cpu(pmreg->mreg_val[i]); in _show_mreg()
6719 seq_printf(m, " %-15s : %d_0x%04x=0x%08x", in _show_mreg()
6729 pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo; in _show_mreg()
6730 if (!pcinfo->valid) { in _show_mreg()
6737 gdbg = &pfwinfo->rpt_fbtc_gpio_dbg.finfo; in _show_mreg()
6738 if (!gdbg->en_map) in _show_mreg()
6741 seq_printf(m, " %-15s : enable_map:0x%08x", in _show_mreg()
6742 "[gpio_dbg]", gdbg->en_map); in _show_mreg()
6745 if (!(gdbg->en_map & BIT(i))) in _show_mreg()
6747 seq_printf(m, ", %d->GPIO%d", (u32)i, gdbg->gpio_map[i]); in _show_mreg()
6754 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary()
6755 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary()
6758 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary()
6759 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary()
6760 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary()
6761 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_summary()
6762 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary()
6765 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary()
6770 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary()
6771 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary()
6772 prptctrl = &pfwinfo->rpt_ctrl.finfo; in _show_summary()
6775 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ", in _show_summary()
6776 "[summary]", pfwinfo->cnt_h2c, in _show_summary()
6777 pfwinfo->cnt_h2c_fail, prptctrl->h2c_cnt, in _show_summary()
6778 pfwinfo->cnt_c2h, prptctrl->c2h_cnt); in _show_summary()
6782 pfwinfo->event[BTF_EVNT_RPT], prptctrl->rpt_cnt, in _show_summary()
6783 prptctrl->rpt_enable, dm->error.val); in _show_summary()
6785 if (dm->error.map.wl_fw_hang) in _show_summary()
6789 " %-15s : send_ok:%d, send_fail:%d, recv:%d", in _show_summary()
6790 "[mailbox]", prptctrl->mb_send_ok_cnt, in _show_summary()
6791 prptctrl->mb_send_fail_cnt, prptctrl->mb_recv_cnt); in _show_summary()
6795 prptctrl->mb_a2dp_empty_cnt, in _show_summary()
6796 prptctrl->mb_a2dp_flct_cnt, in _show_summary()
6797 prptctrl->mb_a2dp_full_cnt); in _show_summary()
6800 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]", in _show_summary()
6801 "[RFK]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary()
6802 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary()
6803 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary()
6804 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary()
6808 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REQ], in _show_summary()
6809 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_GO], in _show_summary()
6810 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REJECT], in _show_summary()
6811 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT], in _show_summary()
6812 prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_FAIL]); in _show_summary()
6814 if (prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT] > 0) in _show_summary()
6815 bt->rfk_info.map.timeout = 1; in _show_summary()
6817 bt->rfk_info.map.timeout = 0; in _show_summary()
6819 dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; in _show_summary()
6822 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x", in _show_summary()
6823 "[summary]", pfwinfo->cnt_h2c, in _show_summary()
6824 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, in _show_summary()
6825 pfwinfo->event[BTF_EVNT_RPT], in _show_summary()
6826 btc->fwinfo.rpt_en_map); in _show_summary()
6831 cnt_sum += dm->cnt_notify[i]; in _show_summary()
6834 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary()
6845 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary()
6858 struct rtw89_btc *btc = &rtwdev->btc; in _show_summary_v1()
6859 struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo; in _show_summary_v1()
6862 struct rtw89_btc_cx *cx = &btc->cx; in _show_summary_v1()
6863 struct rtw89_btc_dm *dm = &btc->dm; in _show_summary_v1()
6864 struct rtw89_btc_wl_info *wl = &cx->wl; in _show_summary_v1()
6865 struct rtw89_btc_bt_info *bt = &cx->bt; in _show_summary_v1()
6866 u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify; in _show_summary_v1()
6869 if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY)) in _show_summary_v1()
6874 pcinfo = &pfwinfo->rpt_ctrl.cinfo; in _show_summary_v1()
6875 if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { in _show_summary_v1()
6876 prptctrl = &pfwinfo->rpt_ctrl.finfo_v1; in _show_summary_v1()
6879 " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ", in _show_summary_v1()
6880 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v1()
6881 pfwinfo->cnt_h2c_fail, in _show_summary_v1()
6882 le32_to_cpu(prptctrl->rpt_info.cnt_h2c), in _show_summary_v1()
6883 pfwinfo->cnt_c2h, in _show_summary_v1()
6884 le32_to_cpu(prptctrl->rpt_info.cnt_c2h)); in _show_summary_v1()
6888 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v1()
6889 le32_to_cpu(prptctrl->rpt_info.cnt), in _show_summary_v1()
6890 le32_to_cpu(prptctrl->rpt_info.en), in _show_summary_v1()
6891 dm->error.val); in _show_summary_v1()
6893 if (dm->error.map.wl_fw_hang) in _show_summary_v1()
6897 " %-15s : send_ok:%d, send_fail:%d, recv:%d, ", in _show_summary_v1()
6899 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok), in _show_summary_v1()
6900 le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail), in _show_summary_v1()
6901 le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv)); in _show_summary_v1()
6905 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty), in _show_summary_v1()
6906 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl), in _show_summary_v1()
6907 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx), in _show_summary_v1()
6908 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack), in _show_summary_v1()
6909 le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack)); in _show_summary_v1()
6912 " %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]", in _show_summary_v1()
6913 "[RFK]", cx->cnt_wl[BTC_WCNT_RFK_REQ], in _show_summary_v1()
6914 cx->cnt_wl[BTC_WCNT_RFK_GO], in _show_summary_v1()
6915 cx->cnt_wl[BTC_WCNT_RFK_REJECT], in _show_summary_v1()
6916 cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]); in _show_summary_v1()
6920 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ]), in _show_summary_v1()
6921 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_GO]), in _show_summary_v1()
6922 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REJECT]), in _show_summary_v1()
6923 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT]), in _show_summary_v1()
6924 le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_FAIL])); in _show_summary_v1()
6926 if (le32_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0) in _show_summary_v1()
6927 bt->rfk_info.map.timeout = 1; in _show_summary_v1()
6929 bt->rfk_info.map.timeout = 0; in _show_summary_v1()
6931 dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; in _show_summary_v1()
6934 " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x", in _show_summary_v1()
6935 "[summary]", pfwinfo->cnt_h2c, in _show_summary_v1()
6936 pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, in _show_summary_v1()
6937 pfwinfo->event[BTF_EVNT_RPT], in _show_summary_v1()
6938 btc->fwinfo.rpt_en_map); in _show_summary_v1()
6943 cnt_sum += dm->cnt_notify[i]; in _show_summary_v1()
6946 " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ", in _show_summary_v1()
6957 " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ", in _show_summary_v1()
6970 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_btc_dump_info()
6971 struct rtw89_fw_suit *fw_suit = &rtwdev->fw.normal; in rtw89_btc_dump_info()
6972 struct rtw89_btc *btc = &rtwdev->btc; in rtw89_btc_dump_info()
6973 struct rtw89_btc_cx *cx = &btc->cx; in rtw89_btc_dump_info()
6974 struct rtw89_btc_bt_info *bt = &cx->bt; in rtw89_btc_dump_info()
6978 fw_suit->major_ver, fw_suit->minor_ver, in rtw89_btc_dump_info()
6979 fw_suit->sub_ver, fw_suit->sub_idex); in rtw89_btc_dump_info()
6980 seq_printf(m, "manual %d\n", btc->ctrl.manual); in rtw89_btc_dump_info()
6984 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()
6986 bt->raw_info[2], bt->raw_info[3], in rtw89_btc_dump_info()
6987 bt->raw_info[4], bt->raw_info[5], in rtw89_btc_dump_info()
6988 bt->raw_info[6], bt->raw_info[7], in rtw89_btc_dump_info()
6989 bt->raw_info[0] == BTC_BTINFO_AUTO ? "auto" : "reply", in rtw89_btc_dump_info()
6990 cx->cnt_bt[BTC_BCNT_INFOUPDATE], in rtw89_btc_dump_info()
6991 cx->cnt_bt[BTC_BCNT_INFOSAME]); in rtw89_btc_dump_info()
7001 if (chip->chip_id == RTL8852A) in rtw89_btc_dump_info()