Lines Matching refs:rtwdev
12 static u8 rtw_coex_next_rssi_state(struct rtw_dev *rtwdev, u8 pre_state, in rtw_coex_next_rssi_state() argument
15 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_next_rssi_state()
35 static void rtw_coex_limited_tx(struct rtw_dev *rtwdev, in rtw_coex_limited_tx() argument
38 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_limited_tx()
39 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_limited_tx()
52 coex_stat->darfrc = rtw_read32(rtwdev, REG_DARFRC); in rtw_coex_limited_tx()
53 coex_stat->darfrch = rtw_read32(rtwdev, REG_DARFRCH); in rtw_coex_limited_tx()
54 coex_stat->retry_limit = rtw_read16(rtwdev, REG_RETRY_LIMIT); in rtw_coex_limited_tx()
59 rtw_read8(rtwdev, REG_AMPDU_MAX_TIME_V1); in rtw_coex_limited_tx()
68 rtw_write8_set(rtwdev, REG_TX_HANG_CTRL, BIT_EN_GNT_BT_AWAKE); in rtw_coex_limited_tx()
73 rtw_write8_set(rtwdev, REG_LIFETIME_EN, 0xf); in rtw_coex_limited_tx()
74 rtw_write16(rtwdev, REG_RETRY_LIMIT, 0x0808); in rtw_coex_limited_tx()
78 rtw_write32(rtwdev, REG_DARFRC, 0x1000000); in rtw_coex_limited_tx()
79 rtw_write32(rtwdev, REG_DARFRCH, 0x1010101); in rtw_coex_limited_tx()
81 rtw_write32(rtwdev, REG_DARFRC, 0x1000000); in rtw_coex_limited_tx()
82 rtw_write32(rtwdev, REG_DARFRCH, 0x4030201); in rtw_coex_limited_tx()
85 rtw_write8_clr(rtwdev, REG_TX_HANG_CTRL, BIT_EN_GNT_BT_AWAKE); in rtw_coex_limited_tx()
86 rtw_write8_clr(rtwdev, REG_LIFETIME_EN, 0xf); in rtw_coex_limited_tx()
88 rtw_write16(rtwdev, REG_RETRY_LIMIT, coex_stat->retry_limit); in rtw_coex_limited_tx()
89 rtw_write32(rtwdev, REG_DARFRC, coex_stat->darfrc); in rtw_coex_limited_tx()
90 rtw_write32(rtwdev, REG_DARFRCH, coex_stat->darfrch); in rtw_coex_limited_tx()
94 rtw_write8(rtwdev, REG_AMPDU_MAX_TIME_V1, 0x20); in rtw_coex_limited_tx()
96 rtw_write8(rtwdev, REG_AMPDU_MAX_TIME_V1, in rtw_coex_limited_tx()
100 static void rtw_coex_limited_wl(struct rtw_dev *rtwdev) in rtw_coex_limited_wl() argument
102 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_limited_wl()
118 rtw_coex_limited_tx(rtwdev, tx_limit, tx_agg_ctrl); in rtw_coex_limited_wl()
121 static void rtw_coex_wl_ccklock_action(struct rtw_dev *rtwdev) in rtw_coex_wl_ccklock_action() argument
123 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_ccklock_action()
134 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_wl_ccklock_action()
149 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_wl_ccklock_action()
155 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_wl_ccklock_action()
160 static void rtw_coex_wl_ccklock_detect(struct rtw_dev *rtwdev) in rtw_coex_wl_ccklock_detect() argument
162 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_ccklock_detect()
171 static void rtw_coex_wl_noisy_detect(struct rtw_dev *rtwdev) in rtw_coex_wl_noisy_detect() argument
173 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_noisy_detect()
175 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_wl_noisy_detect()
217 static void rtw_coex_tdma_timer_base(struct rtw_dev *rtwdev, u8 type) in rtw_coex_tdma_timer_base() argument
219 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma_timer_base()
235 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_tdma_timer_base()
239 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_tdma_timer_base()
242 static void rtw_coex_set_wl_pri_mask(struct rtw_dev *rtwdev, u8 bitmap, in rtw_coex_set_wl_pri_mask() argument
250 rtw_write8_mask(rtwdev, addr, BIT(bitmap), data); in rtw_coex_set_wl_pri_mask()
253 void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set) in rtw_coex_write_scbd() argument
255 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_write_scbd()
256 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_write_scbd()
283 rtw_write16(rtwdev, REG_WIFI_BT_INFO, val); in rtw_coex_write_scbd()
288 static u16 rtw_coex_read_scbd(struct rtw_dev *rtwdev) in rtw_coex_read_scbd() argument
290 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_read_scbd()
295 return (rtw_read16(rtwdev, REG_WIFI_BT_INFO)) & ~(BIT_BT_INT_EN); in rtw_coex_read_scbd()
298 static void rtw_coex_check_rfk(struct rtw_dev *rtwdev) in rtw_coex_check_rfk() argument
300 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_check_rfk()
301 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_check_rfk()
313 btk = !!(rtw_coex_read_scbd(rtwdev) & COEX_SCBD_BT_RFK); in rtw_coex_check_rfk()
316 wlk = !!(rtw_read8(rtwdev, REG_ARFR4) & BIT_WL_RFK); in rtw_coex_check_rfk()
329 static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) in rtw_coex_query_bt_info() argument
331 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_query_bt_info()
337 rtw_fw_query_bt_info(rtwdev); in rtw_coex_query_bt_info()
340 static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev) in rtw_coex_monitor_bt_enable() argument
342 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_monitor_bt_enable()
343 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_monitor_bt_enable()
350 score_board = rtw_coex_read_scbd(rtwdev); in rtw_coex_monitor_bt_enable()
355 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: BT state changed (%d) -> (%d)\n", in rtw_coex_monitor_bt_enable()
365 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_monitor_bt_enable()
373 static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_update_wl_link_info() argument
375 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_wl_link_info()
378 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_link_info()
379 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_coex_update_wl_link_info()
388 scan = test_bit(RTW_FLAG_SCANNING, rtwdev->flags); in rtw_coex_update_wl_link_info()
389 coex_stat->wl_connected = !!rtwdev->sta_cnt; in rtw_coex_update_wl_link_info()
391 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_update_wl_link_info()
396 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_update_wl_link_info()
412 rtw_coex_wl_noisy_detect(rtwdev); in rtw_coex_update_wl_link_info()
417 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_wl_link_info()
418 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_wl_link_info()
437 if (rtwdev->hal.current_band_type == RTW_BAND_5G) in rtw_coex_update_wl_link_info()
458 void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb) in rtw_coex_info_response() argument
460 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_response()
470 static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, in rtw_coex_info_request() argument
473 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_request()
478 rtw_fw_query_bt_mp_info(rtwdev, req); in rtw_coex_info_request()
482 rtw_err(rtwdev, "coex request time out\n"); in rtw_coex_info_request()
488 rtw_err(rtwdev, "failed to get coex info response\n"); in rtw_coex_info_request()
497 static bool rtw_coex_get_bt_scan_type(struct rtw_dev *rtwdev, u8 *scan_type) in rtw_coex_get_bt_scan_type() argument
505 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_scan_type()
518 static bool rtw_coex_set_lna_constrain_level(struct rtw_dev *rtwdev, in rtw_coex_set_lna_constrain_level() argument
527 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_set_lna_constrain_level()
538 static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev) in rtw_coex_update_bt_link_info() argument
540 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_bt_link_info()
543 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_bt_link_info()
554 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_bt_link_info()
562 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_bt_link_info()
563 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_bt_link_info()
572 if (rtw_coex_get_bt_scan_type(rtwdev, &scan_type)) { in rtw_coex_update_bt_link_info()
642 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: bt status(%d)\n", coex_dm->bt_status); in rtw_coex_update_bt_link_info()
645 static void rtw_coex_update_wl_ch_info(struct rtw_dev *rtwdev, u8 type) in rtw_coex_update_wl_ch_info() argument
647 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_ch_info()
648 struct rtw_coex_dm *coex_dm = &rtwdev->coex.dm; in rtw_coex_update_wl_ch_info()
649 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_update_wl_ch_info()
655 bw = rtwdev->hal.current_band_width; in rtw_coex_update_wl_ch_info()
658 center_chan = rtwdev->hal.current_channel; in rtw_coex_update_wl_ch_info()
684 rtw_fw_wl_ch_info(rtwdev, link, center_chan, bw); in rtw_coex_update_wl_ch_info()
687 static void rtw_coex_set_bt_tx_power(struct rtw_dev *rtwdev, u8 bt_pwr_dec_lvl) in rtw_coex_set_bt_tx_power() argument
689 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_tx_power()
697 rtw_fw_force_bt_tx_power(rtwdev, bt_pwr_dec_lvl); in rtw_coex_set_bt_tx_power()
700 static void rtw_coex_set_bt_rx_gain(struct rtw_dev *rtwdev, u8 bt_lna_lvl) in rtw_coex_set_bt_rx_gain() argument
702 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_rx_gain()
712 rtw_coex_set_lna_constrain_level(rtwdev, bt_lna_lvl); in rtw_coex_set_bt_rx_gain()
713 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, true); in rtw_coex_set_bt_rx_gain()
715 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, false); in rtw_coex_set_bt_rx_gain()
719 static void rtw_coex_set_rf_para(struct rtw_dev *rtwdev, in rtw_coex_set_rf_para() argument
722 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_rf_para()
729 rtw_coex_set_wl_tx_power(rtwdev, para.wl_pwr_dec_lvl); in rtw_coex_set_rf_para()
730 rtw_coex_set_bt_tx_power(rtwdev, para.bt_pwr_dec_lvl + offset); in rtw_coex_set_rf_para()
731 rtw_coex_set_wl_rx_gain(rtwdev, para.wl_low_gain_en); in rtw_coex_set_rf_para()
732 rtw_coex_set_bt_rx_gain(rtwdev, para.bt_lna_lvl); in rtw_coex_set_rf_para()
735 u32 rtw_coex_read_indirect_reg(struct rtw_dev *rtwdev, u16 addr) in rtw_coex_read_indirect_reg() argument
739 if (!ltecoex_read_reg(rtwdev, addr, &val)) { in rtw_coex_read_indirect_reg()
740 rtw_err(rtwdev, "failed to read indirect register\n"); in rtw_coex_read_indirect_reg()
748 void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr, in rtw_coex_write_indirect_reg() argument
754 tmp = rtw_coex_read_indirect_reg(rtwdev, addr); in rtw_coex_write_indirect_reg()
757 if (!ltecoex_reg_write(rtwdev, addr, tmp)) in rtw_coex_write_indirect_reg()
758 rtw_err(rtwdev, "failed to write indirect register\n"); in rtw_coex_write_indirect_reg()
762 static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control) in rtw_coex_coex_ctrl_owner() argument
764 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_coex_ctrl_owner()
768 rtw_write32_set(rtwdev, REG_SYS_SDIO_CTRL, BIT_LTE_MUX_CTRL_PATH); in rtw_coex_coex_ctrl_owner()
770 rtw_write8_set(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
772 rtw_write32_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT_LTE_MUX_CTRL_PATH); in rtw_coex_coex_ctrl_owner()
774 rtw_write8_clr(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
778 static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_bt() argument
780 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0xc000, state); in rtw_coex_set_gnt_bt()
781 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x0c00, state); in rtw_coex_set_gnt_bt()
784 static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_wl() argument
786 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x3000, state); in rtw_coex_set_gnt_wl()
787 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x0300, state); in rtw_coex_set_gnt_wl()
790 static void rtw_coex_set_table(struct rtw_dev *rtwdev, u32 table0, u32 table1) in rtw_coex_set_table() argument
793 rtw_write32(rtwdev, REG_BT_COEX_TABLE0, table0); in rtw_coex_set_table()
794 rtw_write32(rtwdev, REG_BT_COEX_TABLE1, table1); in rtw_coex_set_table()
795 rtw_write32(rtwdev, REG_BT_COEX_BRK_TABLE, DEF_BRK_TABLE_VAL); in rtw_coex_set_table()
798 static void rtw_coex_table(struct rtw_dev *rtwdev, u8 type) in rtw_coex_table() argument
800 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_table()
802 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_table()
803 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_table()
809 rtw_coex_set_table(rtwdev, in rtw_coex_table()
815 rtw_coex_set_table(rtwdev, in rtw_coex_table()
821 static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable) in rtw_coex_ignore_wlan_act() argument
823 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ignore_wlan_act()
828 rtw_fw_bt_ignore_wlan_action(rtwdev, enable); in rtw_coex_ignore_wlan_act()
831 static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, in rtw_coex_power_save_state() argument
834 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_save_state()
838 lps_mode = rtwdev->lps_conf.mode; in rtw_coex_power_save_state()
845 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
850 rtw_fw_coex_tdma_type(rtwdev, 0x8, 0, 0, 0, 0); in rtw_coex_power_save_state()
852 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
859 static void rtw_coex_set_tdma(struct rtw_dev *rtwdev, u8 byte1, u8 byte2, in rtw_coex_set_tdma() argument
862 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_tdma()
864 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_tdma()
876 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
882 rtw_coex_power_save_state(rtwdev, ps_type, 0x50, 0x4); in rtw_coex_set_tdma()
885 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
894 rtw_fw_coex_tdma_type(rtwdev, byte1, byte2, byte3, byte4, byte5); in rtw_coex_set_tdma()
897 static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase) in rtw_coex_tdma() argument
899 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma()
902 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_tdma()
903 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_tdma()
909 rtw_coex_tdma_timer_base(rtwdev, 3); in rtw_coex_tdma()
911 rtw_coex_tdma_timer_base(rtwdev, 0); in rtw_coex_tdma()
926 rtw_write8_set(rtwdev, REG_BCN_CTRL, BIT_EN_BCN_FUNCTION); in rtw_coex_tdma()
928 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_tdma()
933 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, false); in rtw_coex_tdma()
935 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, true); in rtw_coex_tdma()
939 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
948 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
960 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: coex tdma type (%d)\n", type); in rtw_coex_tdma()
963 static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase) in rtw_coex_set_ant_path() argument
965 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_ant_path()
977 rtw_coex_check_rfk(rtwdev); in rtw_coex_set_ant_path()
983 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
985 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
993 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
996 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
999 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1002 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1006 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1013 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1016 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1019 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1026 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1033 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1036 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1039 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1046 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1049 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1052 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1059 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1062 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1065 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1072 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1075 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1078 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1089 rtw_coex_set_ant_switch(rtwdev, ctrl_type, pos_type); in rtw_coex_set_ant_path()
1092 static u8 rtw_coex_algorithm(struct rtw_dev *rtwdev) in rtw_coex_algorithm() argument
1094 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_algorithm()
1155 static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev) in rtw_coex_action_coex_all_off() argument
1157 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_coex_all_off()
1158 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_coex_all_off()
1171 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_coex_all_off()
1172 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_coex_all_off()
1173 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_coex_all_off()
1176 static void rtw_coex_action_freerun(struct rtw_dev *rtwdev) in rtw_coex_action_freerun() argument
1178 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_freerun()
1181 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_freerun()
1182 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_freerun()
1191 rtw_coex_update_wl_ch_info(rtwdev, COEX_MEDIA_CONNECT); in rtw_coex_action_freerun()
1193 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_freerun()
1195 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_freerun()
1210 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[level]); in rtw_coex_action_freerun()
1212 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[level]); in rtw_coex_action_freerun()
1214 rtw_coex_table(rtwdev, 100); in rtw_coex_action_freerun()
1215 rtw_coex_tdma(rtwdev, false, 100); in rtw_coex_action_freerun()
1218 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev) in rtw_coex_action_bt_whql_test() argument
1220 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_whql_test()
1221 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_whql_test()
1234 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_whql_test()
1235 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_whql_test()
1236 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_whql_test()
1237 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_whql_test()
1240 static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_relink() argument
1242 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_relink()
1243 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_relink()
1256 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_relink()
1257 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_relink()
1258 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_relink()
1259 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_relink()
1262 static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev) in rtw_coex_action_bt_idle() argument
1264 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_idle()
1267 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_idle()
1268 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_idle()
1285 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_bt_idle()
1286 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_idle()
1287 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1291 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_idle()
1320 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_idle()
1321 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_idle()
1322 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1325 static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) in rtw_coex_action_bt_inquiry() argument
1327 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_inquiry()
1329 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_inquiry()
1330 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_inquiry()
1397 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: wifi hi(%d), bt page(%d)\n", in rtw_coex_action_bt_inquiry()
1400 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_inquiry()
1401 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_inquiry()
1402 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_inquiry()
1403 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_inquiry()
1406 static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hfp() argument
1408 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hfp()
1410 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hfp()
1411 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hfp()
1434 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hfp()
1435 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hfp()
1436 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_hfp()
1437 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hfp()
1440 static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hid() argument
1442 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hid()
1444 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hid()
1445 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hid()
1449 wl_bw = rtwdev->hal.current_band_width; in rtw_coex_action_bt_hid()
1499 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hid()
1500 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hid()
1501 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_hid()
1502 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hid()
1505 static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp() argument
1507 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp()
1510 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp()
1511 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp()
1538 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp()
1539 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp()
1540 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp()
1541 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp()
1544 static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dpsink() argument
1546 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dpsink()
1548 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dpsink()
1549 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dpsink()
1574 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dpsink()
1575 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dpsink()
1576 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dpsink()
1577 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dpsink()
1580 static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan() argument
1582 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan()
1584 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan()
1585 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan()
1609 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan()
1610 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan()
1611 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_pan()
1612 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan()
1615 static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_hid() argument
1617 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_hid()
1620 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_hid()
1621 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_hid()
1652 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_hid()
1653 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_hid()
1654 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_hid()
1655 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp_hid()
1658 static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan() argument
1660 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan()
1662 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan()
1663 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan()
1688 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan()
1689 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
1690 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_pan()
1691 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan()
1694 static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan_hid() argument
1696 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan_hid()
1698 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan_hid()
1699 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan_hid()
1720 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan_hid()
1721 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan_hid()
1722 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_pan_hid()
1723 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan_hid()
1726 static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan_hid() argument
1728 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan_hid()
1730 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan_hid()
1731 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan_hid()
1752 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan_hid()
1753 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan_hid()
1754 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_pan_hid()
1755 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan_hid()
1758 static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev) in rtw_coex_action_wl_under5g() argument
1760 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_under5g()
1761 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_under5g()
1764 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_wl_under5g()
1776 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_action_wl_under5g()
1777 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_under5g()
1778 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_under5g()
1779 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_under5g()
1782 static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev) in rtw_coex_action_wl_only() argument
1784 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_only()
1785 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_only()
1798 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_only()
1799 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_only()
1800 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_only()
1801 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_only()
1804 static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev) in rtw_coex_action_wl_native_lps() argument
1806 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_native_lps()
1807 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_native_lps()
1808 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_native_lps()
1824 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_native_lps()
1825 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_native_lps()
1826 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_native_lps()
1827 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_native_lps()
1830 static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) in rtw_coex_action_wl_linkscan() argument
1832 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_linkscan()
1834 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_linkscan()
1835 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_linkscan()
1860 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_linkscan()
1861 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_linkscan()
1862 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_linkscan()
1863 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_wl_linkscan()
1866 static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_not_connected() argument
1868 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_not_connected()
1869 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_not_connected()
1882 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_not_connected()
1883 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_not_connected()
1884 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_not_connected()
1885 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_not_connected()
1888 static void rtw_coex_action_wl_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_connected() argument
1890 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_connected()
1893 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_connected()
1900 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
1904 algorithm = rtw_coex_algorithm(rtwdev); in rtw_coex_action_wl_connected()
1908 rtw_coex_action_bt_hfp(rtwdev); in rtw_coex_action_wl_connected()
1911 rtw_coex_action_bt_hid(rtwdev); in rtw_coex_action_wl_connected()
1915 rtw_coex_action_bt_a2dpsink(rtwdev); in rtw_coex_action_wl_connected()
1917 rtw_coex_action_bt_a2dp(rtwdev); in rtw_coex_action_wl_connected()
1920 rtw_coex_action_bt_pan(rtwdev); in rtw_coex_action_wl_connected()
1923 rtw_coex_action_bt_a2dp_hid(rtwdev); in rtw_coex_action_wl_connected()
1926 rtw_coex_action_bt_a2dp_pan(rtwdev); in rtw_coex_action_wl_connected()
1929 rtw_coex_action_bt_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
1932 rtw_coex_action_bt_a2dp_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
1936 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_action_wl_connected()
1941 static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_run_coex() argument
1943 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_run_coex()
1947 lockdep_assert_held(&rtwdev->mutex); in rtw_coex_run_coex()
1949 if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) in rtw_coex_run_coex()
1955 rtw_coex_update_wl_link_info(rtwdev, reason); in rtw_coex_run_coex()
1957 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_run_coex()
1975 rtw_coex_action_wl_under5g(rtwdev); in rtw_coex_run_coex()
1980 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_run_coex()
1982 rtw_coex_action_wl_only(rtwdev); in rtw_coex_run_coex()
1987 rtw_coex_action_wl_native_lps(rtwdev); in rtw_coex_run_coex()
1992 rtw_coex_action_bt_whql_test(rtwdev); in rtw_coex_run_coex()
1997 rtw_coex_action_bt_relink(rtwdev); in rtw_coex_run_coex()
2002 rtw_coex_action_bt_inquiry(rtwdev); in rtw_coex_run_coex()
2009 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_run_coex()
2014 rtw_coex_action_wl_linkscan(rtwdev); in rtw_coex_run_coex()
2019 rtw_coex_action_wl_connected(rtwdev); in rtw_coex_run_coex()
2021 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
2024 rtw_coex_set_gnt_fix(rtwdev); in rtw_coex_run_coex()
2025 rtw_coex_limited_wl(rtwdev); in rtw_coex_run_coex()
2028 static void rtw_coex_init_coex_var(struct rtw_dev *rtwdev) in rtw_coex_init_coex_var() argument
2030 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_init_coex_var()
2053 static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in __rtw_coex_init_hw_config() argument
2055 struct rtw_coex *coex = &rtwdev->coex; in __rtw_coex_init_hw_config()
2057 rtw_coex_init_coex_var(rtwdev); in __rtw_coex_init_hw_config()
2058 rtw_coex_monitor_bt_enable(rtwdev); in __rtw_coex_init_hw_config()
2059 rtw_coex_set_rfe_type(rtwdev); in __rtw_coex_init_hw_config()
2060 rtw_coex_set_init(rtwdev); in __rtw_coex_init_hw_config()
2063 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_RSP, 1); in __rtw_coex_init_hw_config()
2066 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACON, 1); in __rtw_coex_init_hw_config()
2069 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACONQ, 1); in __rtw_coex_init_hw_config()
2073 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in __rtw_coex_init_hw_config()
2074 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in __rtw_coex_init_hw_config()
2077 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WONLY); in __rtw_coex_init_hw_config()
2078 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN, in __rtw_coex_init_hw_config()
2082 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_INIT); in __rtw_coex_init_hw_config()
2083 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN, in __rtw_coex_init_hw_config()
2090 rtw_coex_table(rtwdev, 0); in __rtw_coex_init_hw_config()
2091 rtw_coex_tdma(rtwdev, true, 0); in __rtw_coex_init_hw_config()
2092 rtw_coex_query_bt_info(rtwdev); in __rtw_coex_init_hw_config()
2095 void rtw_coex_power_on_setting(struct rtw_dev *rtwdev) in rtw_coex_power_on_setting() argument
2097 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_on_setting()
2103 rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, BIT(0) | BIT(1)); in rtw_coex_power_on_setting()
2105 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_power_on_setting()
2106 rtw_coex_set_rfe_type(rtwdev); in rtw_coex_power_on_setting()
2109 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_POWERON); in rtw_coex_power_on_setting()
2112 rtw_write8(rtwdev, 0xff1a, 0x0); in rtw_coex_power_on_setting()
2115 void rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in rtw_coex_init_hw_config() argument
2117 __rtw_coex_init_hw_config(rtwdev, wifi_only); in rtw_coex_init_hw_config()
2120 void rtw_coex_ips_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_ips_notify() argument
2122 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ips_notify()
2132 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in rtw_coex_ips_notify()
2134 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in rtw_coex_ips_notify()
2135 rtw_coex_action_coex_all_off(rtwdev); in rtw_coex_ips_notify()
2137 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_ips_notify()
2140 __rtw_coex_init_hw_config(rtwdev, false); in rtw_coex_ips_notify()
2147 void rtw_coex_lps_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_lps_notify() argument
2149 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_lps_notify()
2160 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2163 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_lps_notify()
2165 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2171 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2174 rtw_coex_query_bt_info(rtwdev); in rtw_coex_lps_notify()
2178 void rtw_coex_scan_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_scan_notify() argument
2180 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_scan_notify()
2189 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN | in rtw_coex_scan_notify()
2193 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_scan_notify()
2194 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSCANSTART); in rtw_coex_scan_notify()
2199 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_scan_notify()
2200 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSCANSTART); in rtw_coex_scan_notify()
2203 rtw_coex_run_coex(rtwdev, COEX_RSN_SCANFINISH); in rtw_coex_scan_notify()
2207 void rtw_coex_switchband_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_switchband_notify() argument
2209 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_switchband_notify()
2215 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSWITCHBAND); in rtw_coex_switchband_notify()
2217 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSWITCHBAND); in rtw_coex_switchband_notify()
2219 rtw_coex_scan_notify(rtwdev, COEX_SCAN_START_2G); in rtw_coex_switchband_notify()
2222 void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_connect_notify() argument
2224 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_connect_notify()
2230 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN | in rtw_coex_connect_notify()
2234 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2235 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONSTART); in rtw_coex_connect_notify()
2237 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2238 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONFINISH); in rtw_coex_connect_notify()
2244 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_connect_notify()
2246 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONSTART); in rtw_coex_connect_notify()
2252 ieee80211_queue_delayed_work(rtwdev->hw, &coex->defreeze_work, in rtw_coex_connect_notify()
2258 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONFINISH); in rtw_coex_connect_notify()
2262 void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_media_status_notify() argument
2264 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_media_status_notify()
2272 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2274 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_media_status_notify()
2275 rtw_coex_run_coex(rtwdev, COEX_RSN_5GMEDIA); in rtw_coex_media_status_notify()
2277 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2280 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_media_status_notify()
2283 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 1); in rtw_coex_media_status_notify()
2288 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_media_status_notify()
2290 rtw_coex_run_coex(rtwdev, COEX_RSN_2GMEDIA); in rtw_coex_media_status_notify()
2292 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_media_status_notify()
2294 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 0); in rtw_coex_media_status_notify()
2296 rtw_coex_run_coex(rtwdev, COEX_RSN_MEDIADISCON); in rtw_coex_media_status_notify()
2299 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_media_status_notify()
2302 void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_bt_info_notify() argument
2304 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_bt_info_notify()
2306 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_bt_info_notify()
2326 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_bt_info_notify()
2329 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2339 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2353 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
2354 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2386 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2406 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, true); in rtw_coex_bt_info_notify()
2408 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_bt_info_notify()
2410 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_bt_info_notify()
2437 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2457 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_bt_info_notify()
2463 rtw_coex_ignore_wlan_act(rtwdev, false); in rtw_coex_bt_info_notify()
2485 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
2486 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2489 void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_wl_fwdbginfo_notify() argument
2491 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_fwdbginfo_notify()
2513 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
2514 rtw_coex_wl_ccklock_detect(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
2517 void rtw_coex_wl_status_change_notify(struct rtw_dev *rtwdev) in rtw_coex_wl_status_change_notify() argument
2519 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_status_change_notify()
2524 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_status_change_notify()
2529 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_relink_work() local
2531 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_relink_work()
2533 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
2535 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_bt_relink_work()
2536 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
2541 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_reenable_work() local
2543 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_reenable_work()
2545 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
2547 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
2552 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_defreeze_work() local
2554 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_defreeze_work()
2555 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_defreeze_work()
2557 mutex_lock(&rtwdev->mutex); in rtw_coex_defreeze_work()
2560 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_defreeze_work()
2561 mutex_unlock(&rtwdev->mutex); in rtw_coex_defreeze_work()
2566 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_remain_work() local
2568 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_remain_work()
2570 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
2571 coex_stat->wl_gl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_wl_remain_work()
2572 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_remain_work()
2573 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
2578 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_remain_work() local
2580 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_remain_work()
2582 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
2584 rtw_coex_run_coex(rtwdev, COEX_RSN_BTSTATUS); in rtw_coex_bt_remain_work()
2585 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
2631 static int rtw_coex_addr_info(struct rtw_dev *rtwdev, in rtw_coex_addr_info() argument
2676 static int rtw_coex_val_info(struct rtw_dev *rtwdev, in rtw_coex_val_info() argument
2689 rtw_read32_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
2692 rtw_read16_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
2695 rtw_read8_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
2708 rtw_read_rf(rtwdev, rf_path, reg->addr, reg->mask)); in rtw_coex_val_info()
2711 static void rtw_coex_set_coexinfo_hw(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_set_coexinfo_hw() argument
2713 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_coexinfo_hw()
2724 n_addr += rtw_coex_addr_info(rtwdev, reg, addr_info, n_addr); in rtw_coex_set_coexinfo_hw()
2725 n_val += rtw_coex_val_info(rtwdev, reg, val_info, n_val); in rtw_coex_set_coexinfo_hw()
2738 static bool rtw_coex_get_bt_reg(struct rtw_dev *rtwdev, in rtw_coex_get_bt_reg() argument
2751 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_reg()
2763 static bool rtw_coex_get_bt_patch_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_patch_version() argument
2772 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_patch_version()
2784 static bool rtw_coex_get_bt_supported_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_version() argument
2793 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_version()
2805 static bool rtw_coex_get_bt_supported_feature(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_feature() argument
2814 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_feature()
2850 struct rtw_dev *rtwdev; member
2859 struct rtw_dev *rtwdev = vif_iter_data->rtwdev; in rtw_coex_vif_stat_iter() local
2872 rtw_iterate_stas_atomic(rtwdev, rtw_coex_sta_stat_iter, in rtw_coex_vif_stat_iter()
2876 void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_display_coex_info() argument
2878 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_display_coex_info()
2879 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_display_coex_info()
2880 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_display_coex_info()
2883 struct rtw_hal *hal = &rtwdev->hal; in rtw_coex_display_coex_info()
2884 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_display_coex_info()
2885 struct rtw_fw_state *fw = &rtwdev->fw; in rtw_coex_display_coex_info()
2895 score_board_BW = rtw_coex_read_scbd(rtwdev); in rtw_coex_display_coex_info()
2897 wl_reg_6c0 = rtw_read32(rtwdev, 0x6c0); in rtw_coex_display_coex_info()
2898 wl_reg_6c4 = rtw_read32(rtwdev, 0x6c4); in rtw_coex_display_coex_info()
2899 wl_reg_6c8 = rtw_read32(rtwdev, 0x6c8); in rtw_coex_display_coex_info()
2900 wl_reg_6cc = rtw_read32(rtwdev, 0x6cc); in rtw_coex_display_coex_info()
2901 wl_reg_778 = rtw_read32(rtwdev, 0x778); in rtw_coex_display_coex_info()
2902 bt_hi_pri = rtw_read32(rtwdev, 0x770); in rtw_coex_display_coex_info()
2903 bt_lo_pri = rtw_read32(rtwdev, 0x774); in rtw_coex_display_coex_info()
2904 rtw_write8(rtwdev, 0x76e, 0xc); in rtw_coex_display_coex_info()
2905 sys_lte = rtw_read8(rtwdev, 0x73); in rtw_coex_display_coex_info()
2906 lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38); in rtw_coex_display_coex_info()
2907 bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54); in rtw_coex_display_coex_info()
2910 rtw_coex_get_bt_supported_version(rtwdev, in rtw_coex_display_coex_info()
2912 rtw_coex_get_bt_patch_version(rtwdev, &coex_stat->patch_ver); in rtw_coex_display_coex_info()
2913 rtw_coex_get_bt_supported_feature(rtwdev, in rtw_coex_display_coex_info()
2915 rtw_coex_get_bt_reg(rtwdev, 3, 0xae, &coex_stat->bt_reg_vendor_ae); in rtw_coex_display_coex_info()
2916 rtw_coex_get_bt_reg(rtwdev, 3, 0xac, &coex_stat->bt_reg_vendor_ac); in rtw_coex_display_coex_info()
3003 "Scanning", test_bit(RTW_FLAG_SCANNING, rtwdev->flags)); in rtw_coex_display_coex_info()
3007 rtwdev->stats.tx_throughput, rtwdev->stats.rx_throughput); in rtw_coex_display_coex_info()
3010 test_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags), in rtw_coex_display_coex_info()
3011 test_bit(RTW_FLAG_LEISURE_PS_DEEP, rtwdev->flags), in rtw_coex_display_coex_info()
3012 rtwdev->lps_conf.mode); in rtw_coex_display_coex_info()
3014 vif_iter_data.rtwdev = rtwdev; in rtw_coex_display_coex_info()
3016 rtw_iterate_vifs_atomic(rtwdev, rtw_coex_vif_stat_iter, &vif_iter_data); in rtw_coex_display_coex_info()
3076 rtw_coex_set_coexinfo_hw(rtwdev, m); in rtw_coex_display_coex_info()