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], &para[1]); in rtw_coex_wl_ccklock_action()
149 rtw_fw_bt_wifi_control(rtwdev, para[0], &para[1]); in rtw_coex_wl_ccklock_action()
155 rtw_fw_bt_wifi_control(rtwdev, para[0], &para[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], &para[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()
287 static u16 rtw_coex_read_scbd(struct rtw_dev *rtwdev) in rtw_coex_read_scbd() argument
289 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_read_scbd()
294 return (rtw_read16(rtwdev, REG_WIFI_BT_INFO)) & ~(BIT_BT_INT_EN); in rtw_coex_read_scbd()
297 static void rtw_coex_check_rfk(struct rtw_dev *rtwdev) in rtw_coex_check_rfk() argument
299 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_check_rfk()
300 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_check_rfk()
312 btk = !!(rtw_coex_read_scbd(rtwdev) & COEX_SCBD_BT_RFK); in rtw_coex_check_rfk()
315 wlk = !!(rtw_read8(rtwdev, REG_ARFR4) & BIT_WL_RFK); in rtw_coex_check_rfk()
328 static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) in rtw_coex_query_bt_info() argument
330 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_query_bt_info()
336 rtw_fw_query_bt_info(rtwdev); in rtw_coex_query_bt_info()
339 static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev) in rtw_coex_monitor_bt_enable() argument
341 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_monitor_bt_enable()
342 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_monitor_bt_enable()
349 score_board = rtw_coex_read_scbd(rtwdev); in rtw_coex_monitor_bt_enable()
354 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: BT state changed (%d) -> (%d)\n", in rtw_coex_monitor_bt_enable()
364 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_monitor_bt_enable()
372 static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_update_wl_link_info() argument
374 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_wl_link_info()
377 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_link_info()
378 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_coex_update_wl_link_info()
386 scan = rtw_flag_check(rtwdev, RTW_FLAG_SCANNING); in rtw_coex_update_wl_link_info()
387 coex_stat->wl_connected = !!rtwdev->sta_cnt; in rtw_coex_update_wl_link_info()
388 coex_stat->wl_gl_busy = rtw_flag_check(rtwdev, RTW_FLAG_BUSY_TRAFFIC); in rtw_coex_update_wl_link_info()
401 rtw_coex_wl_noisy_detect(rtwdev); in rtw_coex_update_wl_link_info()
406 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_wl_link_info()
407 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_wl_link_info()
426 if (rtwdev->hal.current_band_type == RTW_BAND_5G) in rtw_coex_update_wl_link_info()
447 void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb) in rtw_coex_info_response() argument
449 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_response()
459 static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, in rtw_coex_info_request() argument
462 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_request()
467 rtw_fw_query_bt_mp_info(rtwdev, req); in rtw_coex_info_request()
471 rtw_err(rtwdev, "coex request time out\n"); in rtw_coex_info_request()
477 rtw_err(rtwdev, "failed to get coex info response\n"); in rtw_coex_info_request()
486 static bool rtw_coex_get_bt_scan_type(struct rtw_dev *rtwdev, u8 *scan_type) in rtw_coex_get_bt_scan_type() argument
494 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_scan_type()
507 static bool rtw_coex_set_lna_constrain_level(struct rtw_dev *rtwdev, in rtw_coex_set_lna_constrain_level() argument
516 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_set_lna_constrain_level()
527 static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev) in rtw_coex_update_bt_link_info() argument
529 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_bt_link_info()
532 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_bt_link_info()
543 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_bt_link_info()
551 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_bt_link_info()
552 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_bt_link_info()
561 if (rtw_coex_get_bt_scan_type(rtwdev, &scan_type)) { in rtw_coex_update_bt_link_info()
631 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: bt status(%d)\n", coex_dm->bt_status); in rtw_coex_update_bt_link_info()
634 static void rtw_coex_update_wl_ch_info(struct rtw_dev *rtwdev, u8 type) in rtw_coex_update_wl_ch_info() argument
636 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_ch_info()
637 struct rtw_coex_dm *coex_dm = &rtwdev->coex.dm; in rtw_coex_update_wl_ch_info()
638 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_update_wl_ch_info()
644 bw = rtwdev->hal.current_band_width; in rtw_coex_update_wl_ch_info()
647 center_chan = rtwdev->hal.current_channel; in rtw_coex_update_wl_ch_info()
673 rtw_fw_wl_ch_info(rtwdev, link, center_chan, bw); in rtw_coex_update_wl_ch_info()
676 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
678 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_tx_power()
686 rtw_fw_force_bt_tx_power(rtwdev, bt_pwr_dec_lvl); in rtw_coex_set_bt_tx_power()
689 static void rtw_coex_set_bt_rx_gain(struct rtw_dev *rtwdev, u8 bt_lna_lvl) in rtw_coex_set_bt_rx_gain() argument
691 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_rx_gain()
701 rtw_coex_set_lna_constrain_level(rtwdev, bt_lna_lvl); in rtw_coex_set_bt_rx_gain()
702 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, true); in rtw_coex_set_bt_rx_gain()
704 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, false); in rtw_coex_set_bt_rx_gain()
708 static void rtw_coex_set_rf_para(struct rtw_dev *rtwdev, in rtw_coex_set_rf_para() argument
711 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_rf_para()
718 rtw_coex_set_wl_tx_power(rtwdev, para.wl_pwr_dec_lvl); in rtw_coex_set_rf_para()
719 rtw_coex_set_bt_tx_power(rtwdev, para.bt_pwr_dec_lvl + offset); in rtw_coex_set_rf_para()
720 rtw_coex_set_wl_rx_gain(rtwdev, para.wl_low_gain_en); in rtw_coex_set_rf_para()
721 rtw_coex_set_bt_rx_gain(rtwdev, para.bt_lna_lvl); in rtw_coex_set_rf_para()
724 u32 rtw_coex_read_indirect_reg(struct rtw_dev *rtwdev, u16 addr) in rtw_coex_read_indirect_reg() argument
728 if (!ltecoex_read_reg(rtwdev, addr, &val)) { in rtw_coex_read_indirect_reg()
729 rtw_err(rtwdev, "failed to read indirect register\n"); in rtw_coex_read_indirect_reg()
736 void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr, in rtw_coex_write_indirect_reg() argument
742 tmp = rtw_coex_read_indirect_reg(rtwdev, addr); in rtw_coex_write_indirect_reg()
745 if (!ltecoex_reg_write(rtwdev, addr, tmp)) in rtw_coex_write_indirect_reg()
746 rtw_err(rtwdev, "failed to write indirect register\n"); in rtw_coex_write_indirect_reg()
749 static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control) in rtw_coex_coex_ctrl_owner() argument
752 rtw_write32_set(rtwdev, REG_SYS_SDIO_CTRL, BIT_LTE_MUX_CTRL_PATH); in rtw_coex_coex_ctrl_owner()
754 rtw_write32_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT_LTE_MUX_CTRL_PATH); in rtw_coex_coex_ctrl_owner()
757 static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_bt() argument
759 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0xc000, state); in rtw_coex_set_gnt_bt()
760 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x0c00, state); in rtw_coex_set_gnt_bt()
763 static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_wl() argument
765 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x3000, state); in rtw_coex_set_gnt_wl()
766 rtw_coex_write_indirect_reg(rtwdev, 0x38, 0x0300, state); in rtw_coex_set_gnt_wl()
769 static void rtw_coex_set_table(struct rtw_dev *rtwdev, u32 table0, u32 table1) in rtw_coex_set_table() argument
772 rtw_write32(rtwdev, REG_BT_COEX_TABLE0, table0); in rtw_coex_set_table()
773 rtw_write32(rtwdev, REG_BT_COEX_TABLE1, table1); in rtw_coex_set_table()
774 rtw_write32(rtwdev, REG_BT_COEX_BRK_TABLE, DEF_BRK_TABLE_VAL); in rtw_coex_set_table()
777 static void rtw_coex_table(struct rtw_dev *rtwdev, u8 type) in rtw_coex_table() argument
779 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_table()
781 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_table()
782 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_table()
788 rtw_coex_set_table(rtwdev, in rtw_coex_table()
794 rtw_coex_set_table(rtwdev, in rtw_coex_table()
800 static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable) in rtw_coex_ignore_wlan_act() argument
802 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ignore_wlan_act()
807 rtw_fw_bt_ignore_wlan_action(rtwdev, enable); in rtw_coex_ignore_wlan_act()
810 static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, in rtw_coex_power_save_state() argument
813 struct rtw_lps_conf *lps_conf = &rtwdev->lps_conf; in rtw_coex_power_save_state()
815 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_save_state()
819 lps_mode = rtwdev->lps_conf.mode; in rtw_coex_power_save_state()
827 if (rtwvif && rtw_in_lps(rtwdev)) in rtw_coex_power_save_state()
828 rtw_leave_lps(rtwdev, rtwvif); in rtw_coex_power_save_state()
833 rtw_fw_coex_tdma_type(rtwdev, 0x8, 0, 0, 0, 0); in rtw_coex_power_save_state()
836 if (rtwvif && rtw_in_lps(rtwdev)) in rtw_coex_power_save_state()
837 rtw_leave_lps(rtwdev, rtwvif); in rtw_coex_power_save_state()
844 static void rtw_coex_set_tdma(struct rtw_dev *rtwdev, u8 byte1, u8 byte2, in rtw_coex_set_tdma() argument
847 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_tdma()
849 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_tdma()
861 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
867 rtw_coex_power_save_state(rtwdev, ps_type, 0x50, 0x4); in rtw_coex_set_tdma()
870 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
879 rtw_fw_coex_tdma_type(rtwdev, byte1, byte2, byte3, byte4, byte5); in rtw_coex_set_tdma()
882 static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase) in rtw_coex_tdma() argument
884 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma()
886 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_tdma()
887 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_tdma()
892 rtw_coex_tdma_timer_base(rtwdev, 3); in rtw_coex_tdma()
894 rtw_coex_tdma_timer_base(rtwdev, 0); in rtw_coex_tdma()
909 rtw_write8_set(rtwdev, REG_BCN_CTRL, BIT_EN_BCN_FUNCTION); in rtw_coex_tdma()
910 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, true); in rtw_coex_tdma()
912 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, false); in rtw_coex_tdma()
917 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
926 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
938 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: coex tdma type (%d)\n", type); in rtw_coex_tdma()
941 static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase) in rtw_coex_set_ant_path() argument
943 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_ant_path()
955 rtw_coex_check_rfk(rtwdev); in rtw_coex_set_ant_path()
961 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
963 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
971 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
974 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
977 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
980 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
984 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
991 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
994 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
997 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1004 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1011 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1014 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1017 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1024 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1027 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1030 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1037 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1040 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1043 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1050 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1053 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1056 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1067 rtw_coex_set_ant_switch(rtwdev, ctrl_type, pos_type); in rtw_coex_set_ant_path()
1070 static u8 rtw_coex_algorithm(struct rtw_dev *rtwdev) in rtw_coex_algorithm() argument
1072 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_algorithm()
1133 static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev) in rtw_coex_action_coex_all_off() argument
1135 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_coex_all_off()
1136 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_coex_all_off()
1149 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_coex_all_off()
1150 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_coex_all_off()
1151 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_coex_all_off()
1154 static void rtw_coex_action_freerun(struct rtw_dev *rtwdev) in rtw_coex_action_freerun() argument
1156 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_freerun()
1159 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_freerun()
1160 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_freerun()
1169 rtw_coex_update_wl_ch_info(rtwdev, COEX_MEDIA_CONNECT); in rtw_coex_action_freerun()
1171 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_freerun()
1173 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_freerun()
1188 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[level]); in rtw_coex_action_freerun()
1190 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[level]); in rtw_coex_action_freerun()
1192 rtw_coex_table(rtwdev, 100); in rtw_coex_action_freerun()
1193 rtw_coex_tdma(rtwdev, false, 100); in rtw_coex_action_freerun()
1196 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev) in rtw_coex_action_bt_whql_test() argument
1198 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_whql_test()
1199 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_whql_test()
1212 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_whql_test()
1213 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_whql_test()
1214 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_whql_test()
1215 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_whql_test()
1218 static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_relink() argument
1220 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_relink()
1221 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_relink()
1234 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_relink()
1235 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_relink()
1236 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_relink()
1237 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_relink()
1240 static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev) in rtw_coex_action_bt_idle() argument
1242 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_idle()
1245 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_idle()
1246 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_idle()
1263 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_bt_idle()
1264 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_idle()
1265 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1269 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_idle()
1298 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_idle()
1299 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_idle()
1300 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1303 static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) in rtw_coex_action_bt_inquiry() argument
1305 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_inquiry()
1307 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_inquiry()
1308 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_inquiry()
1358 rtw_dbg(rtwdev, RTW_DBG_COEX, "coex: wifi hi(%d), bt page(%d)\n", in rtw_coex_action_bt_inquiry()
1361 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_inquiry()
1362 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_inquiry()
1363 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_inquiry()
1364 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_inquiry()
1367 static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hfp() argument
1369 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hfp()
1371 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hfp()
1372 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hfp()
1395 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hfp()
1396 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hfp()
1397 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_hfp()
1398 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hfp()
1401 static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hid() argument
1403 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hid()
1405 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hid()
1406 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hid()
1410 wl_bw = rtwdev->hal.current_band_width; in rtw_coex_action_bt_hid()
1460 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hid()
1461 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hid()
1462 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_hid()
1463 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hid()
1466 static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp() argument
1468 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp()
1471 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp()
1472 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp()
1499 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp()
1500 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp()
1501 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp()
1502 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp()
1505 static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dpsink() argument
1507 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dpsink()
1509 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dpsink()
1510 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dpsink()
1535 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dpsink()
1536 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dpsink()
1537 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dpsink()
1538 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dpsink()
1541 static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan() argument
1543 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan()
1545 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan()
1546 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan()
1570 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan()
1571 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan()
1572 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_pan()
1573 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan()
1576 static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_hid() argument
1578 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_hid()
1581 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_hid()
1582 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_hid()
1612 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_hid()
1613 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_hid()
1614 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_hid()
1615 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp_hid()
1618 static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan() argument
1620 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan()
1622 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan()
1623 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan()
1648 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan()
1649 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
1650 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_pan()
1651 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan()
1654 static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan_hid() argument
1656 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan_hid()
1658 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan_hid()
1659 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan_hid()
1680 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan_hid()
1681 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan_hid()
1682 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_pan_hid()
1683 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan_hid()
1686 static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan_hid() argument
1688 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan_hid()
1690 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan_hid()
1691 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan_hid()
1712 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan_hid()
1713 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan_hid()
1714 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_bt_a2dp_pan_hid()
1715 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan_hid()
1718 static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev) in rtw_coex_action_wl_under5g() argument
1720 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_under5g()
1721 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_under5g()
1724 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_wl_under5g()
1736 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_action_wl_under5g()
1737 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_under5g()
1738 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_under5g()
1739 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_under5g()
1742 static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev) in rtw_coex_action_wl_only() argument
1744 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_only()
1745 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_only()
1758 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_only()
1759 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_only()
1760 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_only()
1761 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_only()
1764 static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev) in rtw_coex_action_wl_native_lps() argument
1766 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_native_lps()
1767 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_native_lps()
1768 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_native_lps()
1784 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_native_lps()
1785 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_native_lps()
1786 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_native_lps()
1787 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_native_lps()
1790 static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) in rtw_coex_action_wl_linkscan() argument
1792 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_linkscan()
1794 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_linkscan()
1795 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_linkscan()
1818 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_linkscan()
1819 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_linkscan()
1820 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_linkscan()
1821 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_linkscan()
1824 static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_not_connected() argument
1826 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_not_connected()
1827 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_not_connected()
1840 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_action_wl_not_connected()
1841 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_not_connected()
1842 rtw_coex_table(rtwdev, table_case); in rtw_coex_action_wl_not_connected()
1843 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_not_connected()
1846 static void rtw_coex_action_wl_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_connected() argument
1848 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_connected()
1851 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_connected()
1858 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
1862 algorithm = rtw_coex_algorithm(rtwdev); in rtw_coex_action_wl_connected()
1866 rtw_coex_action_bt_hfp(rtwdev); in rtw_coex_action_wl_connected()
1869 rtw_coex_action_bt_hid(rtwdev); in rtw_coex_action_wl_connected()
1873 rtw_coex_action_bt_a2dpsink(rtwdev); in rtw_coex_action_wl_connected()
1875 rtw_coex_action_bt_a2dp(rtwdev); in rtw_coex_action_wl_connected()
1878 rtw_coex_action_bt_pan(rtwdev); in rtw_coex_action_wl_connected()
1881 rtw_coex_action_bt_a2dp_hid(rtwdev); in rtw_coex_action_wl_connected()
1884 rtw_coex_action_bt_a2dp_pan(rtwdev); in rtw_coex_action_wl_connected()
1887 rtw_coex_action_bt_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
1890 rtw_coex_action_bt_a2dp_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
1894 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_action_wl_connected()
1899 static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_run_coex() argument
1901 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_run_coex()
1905 lockdep_assert_held(&rtwdev->mutex); in rtw_coex_run_coex()
1910 rtw_coex_update_wl_link_info(rtwdev, reason); in rtw_coex_run_coex()
1912 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_run_coex()
1929 rtw_coex_action_wl_under5g(rtwdev); in rtw_coex_run_coex()
1934 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_run_coex()
1936 rtw_coex_action_wl_only(rtwdev); in rtw_coex_run_coex()
1941 rtw_coex_action_wl_native_lps(rtwdev); in rtw_coex_run_coex()
1946 rtw_coex_action_bt_whql_test(rtwdev); in rtw_coex_run_coex()
1951 rtw_coex_action_bt_relink(rtwdev); in rtw_coex_run_coex()
1956 rtw_coex_action_bt_inquiry(rtwdev); in rtw_coex_run_coex()
1963 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_run_coex()
1968 rtw_coex_action_wl_linkscan(rtwdev); in rtw_coex_run_coex()
1973 rtw_coex_action_wl_connected(rtwdev); in rtw_coex_run_coex()
1975 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
1978 rtw_coex_set_gnt_fix(rtwdev); in rtw_coex_run_coex()
1979 rtw_coex_limited_wl(rtwdev); in rtw_coex_run_coex()
1982 static void rtw_coex_init_coex_var(struct rtw_dev *rtwdev) in rtw_coex_init_coex_var() argument
1984 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_init_coex_var()
2007 static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in __rtw_coex_init_hw_config() argument
2009 struct rtw_coex *coex = &rtwdev->coex; in __rtw_coex_init_hw_config()
2011 rtw_coex_init_coex_var(rtwdev); in __rtw_coex_init_hw_config()
2012 rtw_coex_monitor_bt_enable(rtwdev); in __rtw_coex_init_hw_config()
2013 rtw_coex_set_rfe_type(rtwdev); in __rtw_coex_init_hw_config()
2014 rtw_coex_set_init(rtwdev); in __rtw_coex_init_hw_config()
2017 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_RSP, 1); in __rtw_coex_init_hw_config()
2020 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACON, 1); in __rtw_coex_init_hw_config()
2023 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACONQ, 1); in __rtw_coex_init_hw_config()
2027 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in __rtw_coex_init_hw_config()
2028 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in __rtw_coex_init_hw_config()
2031 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WONLY); in __rtw_coex_init_hw_config()
2032 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN, in __rtw_coex_init_hw_config()
2036 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_INIT); in __rtw_coex_init_hw_config()
2037 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN, in __rtw_coex_init_hw_config()
2044 rtw_coex_table(rtwdev, 0); in __rtw_coex_init_hw_config()
2045 rtw_coex_tdma(rtwdev, true, 0); in __rtw_coex_init_hw_config()
2046 rtw_coex_query_bt_info(rtwdev); in __rtw_coex_init_hw_config()
2049 void rtw_coex_power_on_setting(struct rtw_dev *rtwdev) in rtw_coex_power_on_setting() argument
2051 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_on_setting()
2057 rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, BIT(0) | BIT(1)); in rtw_coex_power_on_setting()
2059 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_power_on_setting()
2060 rtw_coex_set_rfe_type(rtwdev); in rtw_coex_power_on_setting()
2063 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_POWERON); in rtw_coex_power_on_setting()
2066 rtw_write8(rtwdev, 0xff1a, 0x0); in rtw_coex_power_on_setting()
2069 void rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in rtw_coex_init_hw_config() argument
2071 __rtw_coex_init_hw_config(rtwdev, wifi_only); in rtw_coex_init_hw_config()
2074 void rtw_coex_ips_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_ips_notify() argument
2076 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ips_notify()
2086 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in rtw_coex_ips_notify()
2088 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in rtw_coex_ips_notify()
2089 rtw_coex_action_coex_all_off(rtwdev); in rtw_coex_ips_notify()
2091 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_ips_notify()
2094 __rtw_coex_init_hw_config(rtwdev, false); in rtw_coex_ips_notify()
2101 void rtw_coex_lps_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_lps_notify() argument
2103 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_lps_notify()
2114 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2117 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_lps_notify()
2119 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2125 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2128 rtw_coex_query_bt_info(rtwdev); in rtw_coex_lps_notify()
2132 void rtw_coex_scan_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_scan_notify() argument
2134 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_scan_notify()
2143 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN | in rtw_coex_scan_notify()
2147 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_scan_notify()
2148 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSCANSTART); in rtw_coex_scan_notify()
2153 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_scan_notify()
2154 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSCANSTART); in rtw_coex_scan_notify()
2157 rtw_coex_run_coex(rtwdev, COEX_RSN_SCANFINISH); in rtw_coex_scan_notify()
2161 void rtw_coex_switchband_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_switchband_notify() argument
2163 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_switchband_notify()
2169 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSWITCHBAND); in rtw_coex_switchband_notify()
2171 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSWITCHBAND); in rtw_coex_switchband_notify()
2173 rtw_coex_scan_notify(rtwdev, COEX_SCAN_START_2G); in rtw_coex_switchband_notify()
2176 void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_connect_notify() argument
2178 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_connect_notify()
2184 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN | in rtw_coex_connect_notify()
2188 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2189 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONSTART); in rtw_coex_connect_notify()
2191 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2192 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONFINISH); in rtw_coex_connect_notify()
2198 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_connect_notify()
2200 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONSTART); in rtw_coex_connect_notify()
2206 ieee80211_queue_delayed_work(rtwdev->hw, &coex->defreeze_work, in rtw_coex_connect_notify()
2212 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONFINISH); in rtw_coex_connect_notify()
2216 void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_media_status_notify() argument
2218 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_media_status_notify()
2226 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2228 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_media_status_notify()
2229 rtw_coex_run_coex(rtwdev, COEX_RSN_5GMEDIA); in rtw_coex_media_status_notify()
2231 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2234 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_media_status_notify()
2237 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 1); in rtw_coex_media_status_notify()
2242 rtw_fw_bt_wifi_control(rtwdev, para[0], &para[1]); in rtw_coex_media_status_notify()
2244 rtw_coex_run_coex(rtwdev, COEX_RSN_2GMEDIA); in rtw_coex_media_status_notify()
2246 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_media_status_notify()
2248 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 0); in rtw_coex_media_status_notify()
2250 rtw_coex_run_coex(rtwdev, COEX_RSN_MEDIADISCON); in rtw_coex_media_status_notify()
2253 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_media_status_notify()
2256 void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_bt_info_notify() argument
2258 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_bt_info_notify()
2260 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_bt_info_notify()
2279 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_bt_info_notify()
2282 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2292 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2306 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
2307 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2346 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, true); in rtw_coex_bt_info_notify()
2348 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_bt_info_notify()
2350 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_bt_info_notify()
2377 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2397 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_bt_info_notify()
2403 rtw_coex_ignore_wlan_act(rtwdev, false); in rtw_coex_bt_info_notify()
2425 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
2426 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2429 void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_wl_fwdbginfo_notify() argument
2431 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_fwdbginfo_notify()
2453 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
2454 rtw_coex_wl_ccklock_detect(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
2457 void rtw_coex_wl_status_change_notify(struct rtw_dev *rtwdev) in rtw_coex_wl_status_change_notify() argument
2459 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_status_change_notify()
2464 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_status_change_notify()
2469 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_relink_work() local
2471 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_relink_work()
2473 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
2475 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_bt_relink_work()
2476 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
2481 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_reenable_work() local
2483 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_reenable_work()
2485 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
2487 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
2492 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_defreeze_work() local
2494 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_defreeze_work()
2495 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_defreeze_work()
2497 mutex_lock(&rtwdev->mutex); in rtw_coex_defreeze_work()
2500 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_defreeze_work()
2501 mutex_unlock(&rtwdev->mutex); in rtw_coex_defreeze_work()