Lines Matching refs:rtwdev
13 static u8 rtw_coex_next_rssi_state(struct rtw_dev *rtwdev, u8 pre_state, in rtw_coex_next_rssi_state() argument
16 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_next_rssi_state()
36 static void rtw_coex_limited_tx(struct rtw_dev *rtwdev, in rtw_coex_limited_tx() argument
39 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_limited_tx()
40 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_limited_tx()
53 coex_stat->darfrc = rtw_read32(rtwdev, REG_DARFRC); in rtw_coex_limited_tx()
54 coex_stat->darfrch = rtw_read32(rtwdev, REG_DARFRCH); in rtw_coex_limited_tx()
55 coex_stat->retry_limit = rtw_read16(rtwdev, REG_RETRY_LIMIT); in rtw_coex_limited_tx()
60 rtw_read8(rtwdev, REG_AMPDU_MAX_TIME_V1); in rtw_coex_limited_tx()
69 rtw_write8_set(rtwdev, REG_TX_HANG_CTRL, BIT_EN_GNT_BT_AWAKE); in rtw_coex_limited_tx()
75 rtw_write8_set(rtwdev, REG_LIFETIME_EN, 0xf); in rtw_coex_limited_tx()
76 rtw_write16(rtwdev, REG_RETRY_LIMIT, 0x0808); in rtw_coex_limited_tx()
79 rtw_write32(rtwdev, REG_DARFRC, 0x1000000); in rtw_coex_limited_tx()
80 rtw_write32(rtwdev, REG_DARFRCH, 0x4030201); in rtw_coex_limited_tx()
82 rtw_write8_clr(rtwdev, REG_TX_HANG_CTRL, BIT_EN_GNT_BT_AWAKE); in rtw_coex_limited_tx()
83 rtw_write8_clr(rtwdev, REG_LIFETIME_EN, 0xf); in rtw_coex_limited_tx()
85 rtw_write16(rtwdev, REG_RETRY_LIMIT, coex_stat->retry_limit); in rtw_coex_limited_tx()
86 rtw_write32(rtwdev, REG_DARFRC, coex_stat->darfrc); in rtw_coex_limited_tx()
87 rtw_write32(rtwdev, REG_DARFRCH, coex_stat->darfrch); in rtw_coex_limited_tx()
91 rtw_write8(rtwdev, REG_AMPDU_MAX_TIME_V1, 0x20); in rtw_coex_limited_tx()
93 rtw_write8(rtwdev, REG_AMPDU_MAX_TIME_V1, in rtw_coex_limited_tx()
97 static void rtw_coex_limited_wl(struct rtw_dev *rtwdev) in rtw_coex_limited_wl() argument
99 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_limited_wl()
109 rtw_coex_limited_tx(rtwdev, tx_limit, tx_agg_ctrl); in rtw_coex_limited_wl()
112 static bool rtw_coex_freerun_check(struct rtw_dev *rtwdev) in rtw_coex_freerun_check() argument
114 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_freerun_check()
117 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_freerun_check()
148 static void rtw_coex_wl_slot_extend(struct rtw_dev *rtwdev, bool enable) in rtw_coex_wl_slot_extend() argument
150 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_slot_extend()
163 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_wl_slot_extend()
166 static void rtw_coex_wl_ccklock_action(struct rtw_dev *rtwdev) in rtw_coex_wl_ccklock_action() argument
168 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_ccklock_action()
176 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_action()
178 rtw_coex_wl_slot_extend(rtwdev, false); in rtw_coex_wl_ccklock_action()
189 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_action()
194 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_action()
196 rtw_coex_wl_slot_extend(rtwdev, false); in rtw_coex_wl_ccklock_action()
199 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_action()
202 rtw_coex_wl_slot_extend(rtwdev, true); in rtw_coex_wl_ccklock_action()
206 static void rtw_coex_wl_ccklock_detect(struct rtw_dev *rtwdev) in rtw_coex_wl_ccklock_detect() argument
208 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_ccklock_detect()
233 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_detect()
239 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_detect()
248 ieee80211_queue_delayed_work(rtwdev->hw, &coex->wl_ccklock_work, in rtw_coex_wl_ccklock_detect()
254 static void rtw_coex_wl_noisy_detect(struct rtw_dev *rtwdev) in rtw_coex_wl_noisy_detect() argument
256 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_noisy_detect()
258 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_wl_noisy_detect()
299 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], wl_noisy_level = %d\n", in rtw_coex_wl_noisy_detect()
304 static void rtw_coex_tdma_timer_base(struct rtw_dev *rtwdev, u8 type) in rtw_coex_tdma_timer_base() argument
306 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma_timer_base()
319 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], tbtt_interval = %d\n", in rtw_coex_tdma_timer_base()
341 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_tdma_timer_base()
343 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): h2c_0x69 = 0x%x\n", in rtw_coex_tdma_timer_base()
348 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_tdma_timer_base()
351 static void rtw_coex_set_wl_pri_mask(struct rtw_dev *rtwdev, u8 bitmap, in rtw_coex_set_wl_pri_mask() argument
359 rtw_write8_mask(rtwdev, addr, BIT(bitmap), data); in rtw_coex_set_wl_pri_mask()
362 void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set) in rtw_coex_write_scbd() argument
364 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_write_scbd()
365 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_write_scbd()
392 rtw_write16(rtwdev, REG_WIFI_BT_INFO, val); in rtw_coex_write_scbd()
397 static u16 rtw_coex_read_scbd(struct rtw_dev *rtwdev) in rtw_coex_read_scbd() argument
399 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_read_scbd()
404 return (rtw_read16(rtwdev, REG_WIFI_BT_INFO)) & ~(BIT_BT_INT_EN); in rtw_coex_read_scbd()
407 static void rtw_coex_check_rfk(struct rtw_dev *rtwdev) in rtw_coex_check_rfk() argument
409 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_check_rfk()
410 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_check_rfk()
419 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_check_rfk()
425 btk = !!(rtw_coex_read_scbd(rtwdev) & COEX_SCBD_BT_RFK); in rtw_coex_check_rfk()
428 wlk = !!(rtw_read8(rtwdev, REG_ARFR4) & BIT_WL_RFK); in rtw_coex_check_rfk()
433 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_check_rfk()
445 static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) in rtw_coex_query_bt_info() argument
447 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_query_bt_info()
453 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_query_bt_info()
455 rtw_fw_query_bt_info(rtwdev); in rtw_coex_query_bt_info()
458 static void rtw_coex_gnt_workaround(struct rtw_dev *rtwdev, bool force, u8 mode) in rtw_coex_gnt_workaround() argument
460 rtw_coex_set_gnt_fix(rtwdev); in rtw_coex_gnt_workaround()
463 static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev) in rtw_coex_monitor_bt_enable() argument
465 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_monitor_bt_enable()
466 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_monitor_bt_enable()
473 score_board = rtw_coex_read_scbd(rtwdev); in rtw_coex_monitor_bt_enable()
478 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_monitor_bt_enable()
488 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_monitor_bt_enable()
498 static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_update_wl_link_info() argument
500 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_wl_link_info()
503 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_link_info()
504 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_coex_update_wl_link_info()
513 scan = test_bit(RTW_FLAG_SCANNING, rtwdev->flags); in rtw_coex_update_wl_link_info()
514 coex_stat->wl_connected = !!rtwdev->sta_cnt; in rtw_coex_update_wl_link_info()
516 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_update_wl_link_info()
521 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_update_wl_link_info()
537 rtw_coex_wl_noisy_detect(rtwdev); in rtw_coex_update_wl_link_info()
542 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_wl_link_info()
543 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_wl_link_info()
550 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, true); in rtw_coex_update_wl_link_info()
552 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_update_wl_link_info()
568 if (rtwdev->hal.current_band_type == RTW_BAND_5G) in rtw_coex_update_wl_link_info()
589 void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb) in rtw_coex_info_response() argument
591 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_response()
603 static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, in rtw_coex_info_request() argument
606 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_request()
611 rtw_fw_query_bt_mp_info(rtwdev, req); in rtw_coex_info_request()
615 rtw_err(rtwdev, "coex request time out\n"); in rtw_coex_info_request()
621 rtw_err(rtwdev, "failed to get coex info response\n"); in rtw_coex_info_request()
630 static bool rtw_coex_get_bt_scan_type(struct rtw_dev *rtwdev, u8 *scan_type) in rtw_coex_get_bt_scan_type() argument
637 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_scan_type()
647 static bool rtw_coex_set_lna_constrain_level(struct rtw_dev *rtwdev, in rtw_coex_set_lna_constrain_level() argument
655 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_set_lna_constrain_level()
680 static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev) in rtw_coex_update_bt_link_info() argument
682 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_bt_link_info()
685 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_bt_link_info()
696 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, rssi, in rtw_coex_update_bt_link_info()
705 if (rtw_coex_get_bt_scan_type(rtwdev, &scan_type)) { in rtw_coex_update_bt_link_info()
776 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(), %s!!!\n", __func__, in rtw_coex_update_bt_link_info()
780 static void rtw_coex_update_wl_ch_info(struct rtw_dev *rtwdev, u8 type) in rtw_coex_update_wl_ch_info() argument
782 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_ch_info()
783 struct rtw_coex_dm *coex_dm = &rtwdev->coex.dm; in rtw_coex_update_wl_ch_info()
789 bw = rtwdev->hal.current_band_width; in rtw_coex_update_wl_ch_info()
792 center_chan = rtwdev->hal.current_channel; in rtw_coex_update_wl_ch_info()
820 rtw_fw_wl_ch_info(rtwdev, link, center_chan, bw); in rtw_coex_update_wl_ch_info()
821 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_update_wl_ch_info()
826 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
828 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_tx_power()
836 rtw_fw_force_bt_tx_power(rtwdev, bt_pwr_dec_lvl); in rtw_coex_set_bt_tx_power()
839 static void rtw_coex_set_bt_rx_gain(struct rtw_dev *rtwdev, u8 bt_lna_lvl) in rtw_coex_set_bt_rx_gain() argument
841 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_rx_gain()
851 rtw_coex_set_lna_constrain_level(rtwdev, bt_lna_lvl); in rtw_coex_set_bt_rx_gain()
852 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, true); in rtw_coex_set_bt_rx_gain()
854 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, false); in rtw_coex_set_bt_rx_gain()
856 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): bt_rx_LNA_level = %d\n", in rtw_coex_set_bt_rx_gain()
860 static void rtw_coex_set_rf_para(struct rtw_dev *rtwdev, in rtw_coex_set_rf_para() argument
863 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_rf_para()
870 rtw_coex_set_wl_tx_power(rtwdev, para.wl_pwr_dec_lvl); in rtw_coex_set_rf_para()
871 rtw_coex_set_bt_tx_power(rtwdev, para.bt_pwr_dec_lvl + offset); in rtw_coex_set_rf_para()
872 rtw_coex_set_wl_rx_gain(rtwdev, para.wl_low_gain_en); in rtw_coex_set_rf_para()
873 rtw_coex_set_bt_rx_gain(rtwdev, para.bt_lna_lvl); in rtw_coex_set_rf_para()
876 u32 rtw_coex_read_indirect_reg(struct rtw_dev *rtwdev, u16 addr) in rtw_coex_read_indirect_reg() argument
880 if (!ltecoex_read_reg(rtwdev, addr, &val)) { in rtw_coex_read_indirect_reg()
881 rtw_err(rtwdev, "failed to read indirect register\n"); in rtw_coex_read_indirect_reg()
889 void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr, in rtw_coex_write_indirect_reg() argument
895 tmp = rtw_coex_read_indirect_reg(rtwdev, addr); in rtw_coex_write_indirect_reg()
898 if (!ltecoex_reg_write(rtwdev, addr, tmp)) in rtw_coex_write_indirect_reg()
899 rtw_err(rtwdev, "failed to write indirect register\n"); in rtw_coex_write_indirect_reg()
903 static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control) in rtw_coex_coex_ctrl_owner() argument
905 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_coex_ctrl_owner()
909 rtw_write8_set(rtwdev, REG_SYS_SDIO_CTRL + 3, in rtw_coex_coex_ctrl_owner()
912 rtw_write8_set(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
914 rtw_write8_clr(rtwdev, REG_SYS_SDIO_CTRL + 3, in rtw_coex_coex_ctrl_owner()
917 rtw_write8_clr(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
921 static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_bt() argument
923 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0xc000, state); in rtw_coex_set_gnt_bt()
924 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0c00, state); in rtw_coex_set_gnt_bt()
927 static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_wl() argument
929 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x3000, state); in rtw_coex_set_gnt_wl()
930 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0300, state); in rtw_coex_set_gnt_wl()
933 static void rtw_btc_wltoggle_table_a(struct rtw_dev *rtwdev, bool force, in rtw_btc_wltoggle_table_a() argument
936 struct rtw_chip_info *chip = rtwdev->chip; in rtw_btc_wltoggle_table_a()
937 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_btc_wltoggle_table_a()
959 rtw_fw_bt_wifi_control(rtwdev, h2c_para[0], &h2c_para[1]); in rtw_btc_wltoggle_table_a()
961 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_btc_wltoggle_table_a()
968 static void rtw_btc_wltoggle_table_b(struct rtw_dev *rtwdev, bool force, in rtw_btc_wltoggle_table_b() argument
971 struct rtw_coex *coex = &rtwdev->coex; in rtw_btc_wltoggle_table_b()
988 rtw_fw_bt_wifi_control(rtwdev, cur_h2c_para[0], &cur_h2c_para[1]); in rtw_btc_wltoggle_table_b()
990 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_btc_wltoggle_table_b()
996 static void rtw_coex_set_table(struct rtw_dev *rtwdev, bool force, u32 table0, in rtw_coex_set_table() argument
1000 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_table()
1005 if (table0 == rtw_read32(rtwdev, REG_BT_COEX_TABLE0) && in rtw_coex_set_table()
1006 table1 == rtw_read32(rtwdev, REG_BT_COEX_TABLE1)) in rtw_coex_set_table()
1009 rtw_write32(rtwdev, REG_BT_COEX_TABLE0, table0); in rtw_coex_set_table()
1010 rtw_write32(rtwdev, REG_BT_COEX_TABLE1, table1); in rtw_coex_set_table()
1011 rtw_write32(rtwdev, REG_BT_COEX_BRK_TABLE, DEF_BRK_TABLE_VAL); in rtw_coex_set_table()
1013 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_table()
1018 static void rtw_coex_table(struct rtw_dev *rtwdev, bool force, u8 type) in rtw_coex_table() argument
1020 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_table()
1022 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_table()
1023 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_table()
1028 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], Coex_Table - %d\n", type); in rtw_coex_table()
1032 rtw_coex_set_table(rtwdev, force, in rtw_coex_table()
1038 rtw_coex_set_table(rtwdev, force, in rtw_coex_table()
1043 rtw_btc_wltoggle_table_a(rtwdev, true, type); in rtw_coex_table()
1046 static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable) in rtw_coex_ignore_wlan_act() argument
1048 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ignore_wlan_act()
1053 rtw_fw_bt_ignore_wlan_action(rtwdev, enable); in rtw_coex_ignore_wlan_act()
1056 static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, in rtw_coex_power_save_state() argument
1059 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_save_state()
1063 lps_mode = rtwdev->lps_conf.mode; in rtw_coex_power_save_state()
1069 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_power_save_state()
1071 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
1076 rtw_fw_coex_tdma_type(rtwdev, 0, 0, 0, 0, 0); in rtw_coex_power_save_state()
1078 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
1079 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_power_save_state()
1087 static void rtw_coex_set_tdma(struct rtw_dev *rtwdev, u8 byte1, u8 byte2, in rtw_coex_set_tdma() argument
1090 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_tdma()
1092 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_tdma()
1098 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): AP mode\n", in rtw_coex_set_tdma()
1108 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
1110 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_tdma()
1118 rtw_coex_power_save_state(rtwdev, ps_type, 0x50, 0x4); in rtw_coex_set_tdma()
1120 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_tdma()
1125 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
1134 rtw_fw_coex_tdma_type(rtwdev, byte1, byte2, byte3, byte4, byte5); in rtw_coex_set_tdma()
1145 static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase) in rtw_coex_tdma() argument
1147 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma()
1150 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_tdma()
1151 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_tdma()
1157 rtw_coex_tdma_timer_base(rtwdev, TDMA_TIMER_TYPE_4SLOT); in rtw_coex_tdma()
1159 rtw_coex_tdma_timer_base(rtwdev, TDMA_TIMER_TYPE_2SLOT); in rtw_coex_tdma()
1167 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_tdma()
1174 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_tdma()
1179 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, false); in rtw_coex_tdma()
1181 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, true); in rtw_coex_tdma()
1189 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
1198 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
1207 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], coex tdma type(%s, %d)\n", in rtw_coex_tdma()
1211 static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase) in rtw_coex_set_ant_path() argument
1213 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_ant_path()
1226 rtw_coex_check_rfk(rtwdev); in rtw_coex_set_ant_path()
1228 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1234 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1238 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1240 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1246 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1250 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1253 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1256 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1259 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1263 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1269 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1272 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1275 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1278 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1284 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1287 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1293 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1296 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1299 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1302 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1308 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1312 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1315 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1318 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1324 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1328 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1331 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1334 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1340 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1343 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1346 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1349 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1361 rtw_coex_set_ant_switch(rtwdev, ctrl_type, pos_type); in rtw_coex_set_ant_path()
1411 static u8 rtw_coex_algorithm(struct rtw_dev *rtwdev) in rtw_coex_algorithm() argument
1413 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_algorithm()
1471 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_algorithm()
1478 static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev) in rtw_coex_action_coex_all_off() argument
1480 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_coex_all_off()
1481 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_coex_all_off()
1484 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_coex_all_off()
1485 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_coex_all_off()
1497 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_coex_all_off()
1498 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_coex_all_off()
1501 static void rtw_coex_action_freerun(struct rtw_dev *rtwdev) in rtw_coex_action_freerun() argument
1503 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_freerun()
1506 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_freerun()
1507 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_freerun()
1511 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_freerun()
1519 rtw_coex_update_wl_ch_info(rtwdev, COEX_MEDIA_CONNECT); in rtw_coex_action_freerun()
1521 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_freerun()
1523 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_freerun()
1538 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[level]); in rtw_coex_action_freerun()
1540 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[level]); in rtw_coex_action_freerun()
1542 rtw_coex_table(rtwdev, false, 100); in rtw_coex_action_freerun()
1543 rtw_coex_tdma(rtwdev, false, 100); in rtw_coex_action_freerun()
1546 static void rtw_coex_action_rf4ce(struct rtw_dev *rtwdev) in rtw_coex_action_rf4ce() argument
1548 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_rf4ce()
1549 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_rf4ce()
1552 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_rf4ce()
1554 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_rf4ce()
1555 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_rf4ce()
1567 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_rf4ce()
1568 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_rf4ce()
1571 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev) in rtw_coex_action_bt_whql_test() argument
1573 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_whql_test()
1574 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_whql_test()
1577 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_whql_test()
1579 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_whql_test()
1580 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_whql_test()
1592 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_whql_test()
1593 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_whql_test()
1596 static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_relink() argument
1598 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_relink()
1600 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_relink()
1601 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_relink()
1605 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_relink()
1607 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_relink()
1608 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_relink()
1632 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_relink()
1633 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_relink()
1636 static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev) in rtw_coex_action_bt_idle() argument
1638 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_idle()
1641 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_idle()
1642 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_idle()
1646 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_idle()
1647 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_idle()
1663 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_bt_idle()
1667 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_idle()
1701 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_idle()
1702 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1705 static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) in rtw_coex_action_bt_inquiry() argument
1707 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_inquiry()
1709 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_inquiry()
1710 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_inquiry()
1715 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_inquiry()
1716 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_inquiry()
1717 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_inquiry()
1726 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1739 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1755 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1760 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1768 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1781 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1786 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1791 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1798 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], wifi hi(%d), bt page(%d)\n", in rtw_coex_action_bt_inquiry()
1801 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_inquiry()
1802 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_inquiry()
1805 static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hfp() argument
1807 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hfp()
1809 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hfp()
1810 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hfp()
1813 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_hfp()
1814 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hfp()
1815 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hfp()
1837 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_hfp()
1838 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hfp()
1841 static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hid() argument
1843 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hid()
1845 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hid()
1846 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hid()
1851 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_hid()
1852 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hid()
1853 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hid()
1915 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_hid()
1917 rtw_btc_wltoggle_table_a(rtwdev, true, table_case); in rtw_coex_action_bt_hid()
1918 rtw_btc_wltoggle_table_b(rtwdev, false, 1, COEX_WL_SLOT_TOGLLE); in rtw_coex_action_bt_hid()
1921 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_hid()
1924 static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp() argument
1926 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp()
1929 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp()
1930 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp()
1934 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp()
1936 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp()
1937 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp()
1962 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp()
1963 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp()
1966 static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dpsink() argument
1968 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dpsink()
1970 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dpsink()
1971 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dpsink()
1975 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dpsink()
1977 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dpsink()
1978 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dpsink()
2001 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dpsink()
2002 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dpsink()
2005 static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan() argument
2007 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan()
2009 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan()
2010 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan()
2013 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_pan()
2014 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan()
2015 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan()
2038 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_pan()
2039 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan()
2042 static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_hid() argument
2044 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_hid()
2047 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_hid()
2048 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_hid()
2055 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_hid()
2056 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_hid()
2057 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_hid()
2091 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_hid()
2093 rtw_btc_wltoggle_table_a(rtwdev, true, table_case); in rtw_coex_action_bt_a2dp_hid()
2094 rtw_btc_wltoggle_table_b(rtwdev, false, interval, COEX_WL_SLOT_TOGLLE); in rtw_coex_action_bt_a2dp_hid()
2096 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp_hid()
2099 static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan() argument
2101 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan()
2103 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan()
2104 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan()
2108 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_pan()
2110 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan()
2111 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
2148 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[1]); in rtw_coex_action_bt_a2dp_pan()
2150 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
2152 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_pan()
2153 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan()
2156 static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan_hid() argument
2158 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan_hid()
2160 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan_hid()
2161 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan_hid()
2164 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_pan_hid()
2166 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan_hid()
2167 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan_hid()
2187 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_pan_hid()
2188 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan_hid()
2191 static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan_hid() argument
2193 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan_hid()
2195 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan_hid()
2196 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan_hid()
2199 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_pan_hid()
2200 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan_hid()
2201 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan_hid()
2221 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_pan_hid()
2222 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan_hid()
2225 static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev) in rtw_coex_action_wl_under5g() argument
2227 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_under5g()
2228 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_under5g()
2231 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_under5g()
2233 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_action_wl_under5g()
2234 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_under5g()
2236 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_wl_under5g()
2248 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_under5g()
2249 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_under5g()
2252 static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev) in rtw_coex_action_wl_only() argument
2254 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_only()
2255 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_only()
2258 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_only()
2259 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_only()
2260 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_only()
2272 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_only()
2273 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_only()
2276 static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev) in rtw_coex_action_wl_native_lps() argument
2278 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_native_lps()
2279 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_native_lps()
2280 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_native_lps()
2286 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_native_lps()
2288 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_native_lps()
2289 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_native_lps()
2301 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_native_lps()
2302 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_native_lps()
2305 static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) in rtw_coex_action_wl_linkscan() argument
2307 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_linkscan()
2309 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_linkscan()
2310 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_linkscan()
2314 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_linkscan()
2315 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_linkscan()
2316 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_linkscan()
2341 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_linkscan()
2342 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_wl_linkscan()
2345 static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_not_connected() argument
2347 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_not_connected()
2348 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_not_connected()
2351 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_not_connected()
2352 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_not_connected()
2353 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_not_connected()
2365 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_not_connected()
2366 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_not_connected()
2369 static void rtw_coex_action_wl_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_connected() argument
2371 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_connected()
2375 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_connected()
2377 algorithm = rtw_coex_algorithm(rtwdev); in rtw_coex_action_wl_connected()
2381 rtw_coex_action_bt_hfp(rtwdev); in rtw_coex_action_wl_connected()
2384 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2385 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2387 rtw_coex_action_bt_hid(rtwdev); in rtw_coex_action_wl_connected()
2390 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2391 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2393 rtw_coex_action_bt_a2dpsink(rtwdev); in rtw_coex_action_wl_connected()
2395 rtw_coex_action_bt_a2dp(rtwdev); in rtw_coex_action_wl_connected()
2398 rtw_coex_action_bt_pan(rtwdev); in rtw_coex_action_wl_connected()
2401 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2402 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2404 rtw_coex_action_bt_a2dp_hid(rtwdev); in rtw_coex_action_wl_connected()
2407 rtw_coex_action_bt_a2dp_pan(rtwdev); in rtw_coex_action_wl_connected()
2410 rtw_coex_action_bt_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
2413 rtw_coex_action_bt_a2dp_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
2417 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_action_wl_connected()
2422 static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_run_coex() argument
2424 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_run_coex()
2429 lockdep_assert_held(&rtwdev->mutex); in rtw_coex_run_coex()
2431 if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) in rtw_coex_run_coex()
2436 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): reason = %d\n", __func__, in rtw_coex_run_coex()
2440 rtw_coex_update_wl_link_info(rtwdev, reason); in rtw_coex_run_coex()
2442 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_run_coex()
2445 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2451 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2457 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2464 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2475 rtw_coex_action_wl_under5g(rtwdev); in rtw_coex_run_coex()
2479 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], WiFi is single-port 2G!!\n"); in rtw_coex_run_coex()
2484 rtw_coex_action_rf4ce(rtwdev); in rtw_coex_run_coex()
2486 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
2488 rtw_coex_action_wl_only(rtwdev); in rtw_coex_run_coex()
2493 rtw_coex_action_wl_native_lps(rtwdev); in rtw_coex_run_coex()
2498 rtw_coex_action_bt_whql_test(rtwdev); in rtw_coex_run_coex()
2503 rtw_coex_action_bt_relink(rtwdev); in rtw_coex_run_coex()
2508 rtw_coex_action_bt_inquiry(rtwdev); in rtw_coex_run_coex()
2515 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_run_coex()
2520 rtw_coex_action_wl_linkscan(rtwdev); in rtw_coex_run_coex()
2525 rtw_coex_action_wl_connected(rtwdev); in rtw_coex_run_coex()
2528 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
2533 rtw_coex_gnt_workaround(rtwdev, false, coex_stat->wl_coex_mode); in rtw_coex_run_coex()
2534 rtw_coex_limited_wl(rtwdev); in rtw_coex_run_coex()
2537 static void rtw_coex_init_coex_var(struct rtw_dev *rtwdev) in rtw_coex_init_coex_var() argument
2539 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_init_coex_var()
2564 static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in __rtw_coex_init_hw_config() argument
2566 struct rtw_coex *coex = &rtwdev->coex; in __rtw_coex_init_hw_config()
2569 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in __rtw_coex_init_hw_config()
2571 rtw_coex_init_coex_var(rtwdev); in __rtw_coex_init_hw_config()
2573 coex_stat->kt_ver = u8_get_bits(rtw_read8(rtwdev, 0xf1), GENMASK(7, 4)); in __rtw_coex_init_hw_config()
2575 rtw_coex_monitor_bt_enable(rtwdev); in __rtw_coex_init_hw_config()
2576 rtw_coex_wl_slot_extend(rtwdev, coex_stat->wl_slot_extend); in __rtw_coex_init_hw_config()
2578 rtw_write8_set(rtwdev, REG_BCN_CTRL, BIT_EN_BCN_FUNCTION); in __rtw_coex_init_hw_config()
2580 rtw_coex_set_rfe_type(rtwdev); in __rtw_coex_init_hw_config()
2581 rtw_coex_set_init(rtwdev); in __rtw_coex_init_hw_config()
2584 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_RSP, 1); in __rtw_coex_init_hw_config()
2587 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACON, 1); in __rtw_coex_init_hw_config()
2590 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACONQ, 1); in __rtw_coex_init_hw_config()
2594 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in __rtw_coex_init_hw_config()
2595 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in __rtw_coex_init_hw_config()
2598 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): RF Off\n", in __rtw_coex_init_hw_config()
2601 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WONLY); in __rtw_coex_init_hw_config()
2602 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, in __rtw_coex_init_hw_config()
2606 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_INIT); in __rtw_coex_init_hw_config()
2607 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, in __rtw_coex_init_hw_config()
2614 rtw_coex_table(rtwdev, true, 1); in __rtw_coex_init_hw_config()
2615 rtw_coex_tdma(rtwdev, true, 0); in __rtw_coex_init_hw_config()
2616 rtw_coex_query_bt_info(rtwdev); in __rtw_coex_init_hw_config()
2619 void rtw_coex_power_on_setting(struct rtw_dev *rtwdev) in rtw_coex_power_on_setting() argument
2621 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_on_setting()
2624 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_power_on_setting()
2630 rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, in rtw_coex_power_on_setting()
2633 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_power_on_setting()
2634 rtw_coex_set_rfe_type(rtwdev); in rtw_coex_power_on_setting()
2637 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_POWERON); in rtw_coex_power_on_setting()
2639 rtw_coex_table(rtwdev, true, table_case); in rtw_coex_power_on_setting()
2641 rtw_write8(rtwdev, 0xff1a, 0x0); in rtw_coex_power_on_setting()
2642 rtw_coex_set_gnt_debug(rtwdev); in rtw_coex_power_on_setting()
2645 void rtw_coex_power_off_setting(struct rtw_dev *rtwdev) in rtw_coex_power_off_setting() argument
2647 rtw_write16(rtwdev, REG_WIFI_BT_INFO, BIT_BT_INT_EN); in rtw_coex_power_off_setting()
2650 void rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in rtw_coex_init_hw_config() argument
2652 __rtw_coex_init_hw_config(rtwdev, wifi_only); in rtw_coex_init_hw_config()
2655 void rtw_coex_ips_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_ips_notify() argument
2657 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ips_notify()
2664 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], IPS ENTER notify\n"); in rtw_coex_ips_notify()
2669 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in rtw_coex_ips_notify()
2671 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in rtw_coex_ips_notify()
2672 rtw_coex_action_coex_all_off(rtwdev); in rtw_coex_ips_notify()
2674 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], IPS LEAVE notify\n"); in rtw_coex_ips_notify()
2676 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_ips_notify()
2678 __rtw_coex_init_hw_config(rtwdev, false); in rtw_coex_ips_notify()
2684 void rtw_coex_lps_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_lps_notify() argument
2686 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_lps_notify()
2693 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], LPS ENABLE notify\n"); in rtw_coex_lps_notify()
2699 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2702 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_lps_notify()
2703 rtw_coex_write_scbd(rtwdev, COEX_SCBD_WLBUSY, false); in rtw_coex_lps_notify()
2705 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2708 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], LPS DISABLE notify\n"); in rtw_coex_lps_notify()
2713 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2716 rtw_coex_query_bt_info(rtwdev); in rtw_coex_lps_notify()
2718 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2722 void rtw_coex_scan_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_scan_notify() argument
2724 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_scan_notify()
2731 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_scan_notify()
2734 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2737 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_scan_notify()
2738 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSCANSTART); in rtw_coex_scan_notify()
2740 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2746 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_scan_notify()
2747 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSCANSTART); in rtw_coex_scan_notify()
2751 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2756 rtw_coex_run_coex(rtwdev, COEX_RSN_SCANFINISH); in rtw_coex_scan_notify()
2760 void rtw_coex_switchband_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_switchband_notify() argument
2762 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_switchband_notify()
2768 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): TO_5G\n", in rtw_coex_switchband_notify()
2771 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_switchband_notify()
2774 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): TO_2G\n", in rtw_coex_switchband_notify()
2779 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSWITCHBAND); in rtw_coex_switchband_notify()
2781 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSWITCHBAND); in rtw_coex_switchband_notify()
2783 rtw_coex_scan_notify(rtwdev, COEX_SCAN_START_2G); in rtw_coex_switchband_notify()
2786 void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_connect_notify() argument
2788 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_connect_notify()
2794 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_connect_notify()
2797 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G start\n", in rtw_coex_connect_notify()
2800 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2801 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONSTART); in rtw_coex_connect_notify()
2803 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G finish\n", in rtw_coex_connect_notify()
2806 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2807 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONFINISH); in rtw_coex_connect_notify()
2813 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_connect_notify()
2816 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G start\n", in rtw_coex_connect_notify()
2819 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_connect_notify()
2821 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONSTART); in rtw_coex_connect_notify()
2827 ieee80211_queue_delayed_work(rtwdev->hw, &coex->defreeze_work, in rtw_coex_connect_notify()
2834 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G finish\n", in rtw_coex_connect_notify()
2836 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONFINISH); in rtw_coex_connect_notify()
2840 void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_media_status_notify() argument
2842 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_media_status_notify()
2849 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G\n", __func__); in rtw_coex_media_status_notify()
2851 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2853 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_media_status_notify()
2854 rtw_coex_run_coex(rtwdev, COEX_RSN_5GMEDIA); in rtw_coex_media_status_notify()
2856 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G\n", __func__); in rtw_coex_media_status_notify()
2860 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2863 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_media_status_notify()
2866 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 1); in rtw_coex_media_status_notify()
2867 rtw_coex_run_coex(rtwdev, COEX_RSN_2GMEDIA); in rtw_coex_media_status_notify()
2869 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): disconnect!!\n", in rtw_coex_media_status_notify()
2871 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 0); in rtw_coex_media_status_notify()
2872 rtw_coex_run_coex(rtwdev, COEX_RSN_MEDIADISCON); in rtw_coex_media_status_notify()
2875 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_media_status_notify()
2878 void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_bt_info_notify() argument
2880 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_bt_info_notify()
2882 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_bt_info_notify()
2900 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2908 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2912 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_bt_info_notify()
2915 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
2921 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2931 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2934 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
2943 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
2946 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2952 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2958 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2972 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
2996 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3071 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3075 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3092 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3100 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3107 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_bt_info_notify()
3113 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3115 rtw_coex_ignore_wlan_act(rtwdev, false); in rtw_coex_bt_info_notify()
3138 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
3139 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
3142 void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_wl_fwdbginfo_notify() argument
3144 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_fwdbginfo_notify()
3149 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_fwdbginfo_notify()
3169 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
3170 rtw_coex_wl_ccklock_detect(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
3173 void rtw_coex_wl_status_change_notify(struct rtw_dev *rtwdev, u32 type) in rtw_coex_wl_status_change_notify() argument
3175 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_status_change_notify()
3180 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_relink_work() local
3182 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_relink_work()
3184 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
3186 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_bt_relink_work()
3187 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
3192 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_reenable_work() local
3194 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_reenable_work()
3196 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
3198 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
3203 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_defreeze_work() local
3205 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_defreeze_work()
3206 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_defreeze_work()
3208 mutex_lock(&rtwdev->mutex); in rtw_coex_defreeze_work()
3211 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_defreeze_work()
3212 mutex_unlock(&rtwdev->mutex); in rtw_coex_defreeze_work()
3217 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_remain_work() local
3219 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_remain_work()
3221 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
3222 coex_stat->wl_gl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_wl_remain_work()
3223 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_remain_work()
3224 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
3229 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_remain_work() local
3231 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_remain_work()
3233 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
3235 rtw_coex_run_coex(rtwdev, COEX_RSN_BTSTATUS); in rtw_coex_bt_remain_work()
3236 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
3241 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_connecting_work() local
3243 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_connecting_work()
3245 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_connecting_work()
3247 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], WL connecting stop!!\n"); in rtw_coex_wl_connecting_work()
3248 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_connecting_work()
3249 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_connecting_work()
3254 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_multi_link_remain_work() local
3256 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_multi_link_remain_work()
3258 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_multi_link_remain_work()
3260 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_multi_link_remain_work()
3265 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_ccklock_work() local
3267 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_ccklock_work()
3269 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_ccklock_work()
3271 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_ccklock_work()
3317 static u8 rtw_coex_get_table_index(struct rtw_dev *rtwdev, u32 wl_reg_6c0, in rtw_coex_get_table_index() argument
3320 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_get_table_index()
3321 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_get_table_index()
3354 static u8 rtw_coex_get_tdma_index(struct rtw_dev *rtwdev, u8 *tdma_para) in rtw_coex_get_tdma_index() argument
3356 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_get_tdma_index()
3357 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_get_tdma_index()
3392 static int rtw_coex_addr_info(struct rtw_dev *rtwdev, in rtw_coex_addr_info() argument
3437 static int rtw_coex_val_info(struct rtw_dev *rtwdev, in rtw_coex_val_info() argument
3450 rtw_read32_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3453 rtw_read16_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3456 rtw_read8_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3469 rtw_read_rf(rtwdev, rf_path, reg->addr, reg->mask)); in rtw_coex_val_info()
3472 static void rtw_coex_set_coexinfo_hw(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_set_coexinfo_hw() argument
3474 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_coexinfo_hw()
3485 n_addr += rtw_coex_addr_info(rtwdev, reg, addr_info, n_addr); in rtw_coex_set_coexinfo_hw()
3486 n_val += rtw_coex_val_info(rtwdev, reg, val_info, n_val); in rtw_coex_set_coexinfo_hw()
3499 static bool rtw_coex_get_bt_reg(struct rtw_dev *rtwdev, in rtw_coex_get_bt_reg() argument
3512 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_reg()
3525 static bool rtw_coex_get_bt_patch_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_patch_version() argument
3533 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_patch_version()
3544 static bool rtw_coex_get_bt_supported_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_version() argument
3552 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_version()
3563 static bool rtw_coex_get_bt_supported_feature(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_feature() argument
3571 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_feature()
3606 struct rtw_dev *rtwdev; member
3615 struct rtw_dev *rtwdev = vif_iter_data->rtwdev; in rtw_coex_vif_stat_iter() local
3628 rtw_iterate_stas_atomic(rtwdev, rtw_coex_sta_stat_iter, in rtw_coex_vif_stat_iter()
3645 void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_display_coex_info() argument
3647 struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_display_coex_info()
3648 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_display_coex_info()
3649 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_display_coex_info()
3652 struct rtw_hal *hal = &rtwdev->hal; in rtw_coex_display_coex_info()
3653 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_display_coex_info()
3654 struct rtw_fw_state *fw = &rtwdev->fw; in rtw_coex_display_coex_info()
3664 score_board_BW = rtw_coex_read_scbd(rtwdev); in rtw_coex_display_coex_info()
3666 wl_reg_6c0 = rtw_read32(rtwdev, REG_BT_COEX_TABLE0); in rtw_coex_display_coex_info()
3667 wl_reg_6c4 = rtw_read32(rtwdev, REG_BT_COEX_TABLE1); in rtw_coex_display_coex_info()
3668 wl_reg_6c8 = rtw_read32(rtwdev, REG_BT_COEX_BRK_TABLE); in rtw_coex_display_coex_info()
3669 wl_reg_6cc = rtw_read32(rtwdev, REG_BT_COEX_TABLE_H); in rtw_coex_display_coex_info()
3670 wl_reg_778 = rtw_read8(rtwdev, REG_BT_STAT_CTRL); in rtw_coex_display_coex_info()
3672 bt_hi_pri = rtw_read32(rtwdev, REG_BT_ACT_STATISTICS); in rtw_coex_display_coex_info()
3673 bt_lo_pri = rtw_read32(rtwdev, REG_BT_ACT_STATISTICS_1); in rtw_coex_display_coex_info()
3674 rtw_write8(rtwdev, REG_BT_COEX_ENH_INTR_CTRL, in rtw_coex_display_coex_info()
3683 sys_lte = rtw_read8(rtwdev, 0x73); in rtw_coex_display_coex_info()
3684 lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38); in rtw_coex_display_coex_info()
3685 bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54); in rtw_coex_display_coex_info()
3688 rtw_coex_get_bt_supported_version(rtwdev, in rtw_coex_display_coex_info()
3690 rtw_coex_get_bt_patch_version(rtwdev, &coex_stat->patch_ver); in rtw_coex_display_coex_info()
3691 rtw_coex_get_bt_supported_feature(rtwdev, in rtw_coex_display_coex_info()
3693 rtw_coex_get_bt_reg(rtwdev, 3, 0xae, &coex_stat->bt_reg_vendor_ae); in rtw_coex_display_coex_info()
3694 rtw_coex_get_bt_reg(rtwdev, 3, 0xac, &coex_stat->bt_reg_vendor_ac); in rtw_coex_display_coex_info()
3700 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_display_coex_info()
3799 "Scanning", test_bit(RTW_FLAG_SCANNING, rtwdev->flags)); in rtw_coex_display_coex_info()
3803 rtwdev->stats.tx_throughput, rtwdev->stats.rx_throughput); in rtw_coex_display_coex_info()
3806 test_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags), in rtw_coex_display_coex_info()
3807 test_bit(RTW_FLAG_LEISURE_PS_DEEP, rtwdev->flags), in rtw_coex_display_coex_info()
3808 rtwdev->lps_conf.mode); in rtw_coex_display_coex_info()
3810 vif_iter_data.rtwdev = rtwdev; in rtw_coex_display_coex_info()
3812 rtw_iterate_vifs_atomic(rtwdev, rtw_coex_vif_stat_iter, &vif_iter_data); in rtw_coex_display_coex_info()
3821 rtw_coex_get_tdma_index(rtwdev, in rtw_coex_display_coex_info()
3839 rtw_coex_get_table_index(rtwdev, wl_reg_6c0, wl_reg_6c4), in rtw_coex_display_coex_info()
3903 rtw_coex_set_coexinfo_hw(rtwdev, m); in rtw_coex_display_coex_info()