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 const 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 const 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()
237 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_detect()
243 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_ccklock_detect()
252 ieee80211_queue_delayed_work(rtwdev->hw, &coex->wl_ccklock_work, in rtw_coex_wl_ccklock_detect()
258 static void rtw_coex_wl_noisy_detect(struct rtw_dev *rtwdev) in rtw_coex_wl_noisy_detect() argument
260 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_noisy_detect()
262 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_wl_noisy_detect()
303 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], wl_noisy_level = %d\n", in rtw_coex_wl_noisy_detect()
308 static void rtw_coex_tdma_timer_base(struct rtw_dev *rtwdev, u8 type) in rtw_coex_tdma_timer_base() argument
310 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma_timer_base()
323 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], tbtt_interval = %d\n", in rtw_coex_tdma_timer_base()
345 rtw_fw_bt_wifi_control(rtwdev, para[0], ¶[1]); in rtw_coex_tdma_timer_base()
347 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): h2c_0x69 = 0x%x\n", in rtw_coex_tdma_timer_base()
352 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_tdma_timer_base()
355 static void rtw_coex_set_wl_pri_mask(struct rtw_dev *rtwdev, u8 bitmap, in rtw_coex_set_wl_pri_mask() argument
363 rtw_write8_mask(rtwdev, addr, BIT(bitmap), data); in rtw_coex_set_wl_pri_mask()
366 void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set) in rtw_coex_write_scbd() argument
368 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_write_scbd()
369 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_write_scbd()
396 rtw_write16(rtwdev, REG_WIFI_BT_INFO, val); in rtw_coex_write_scbd()
401 static u16 rtw_coex_read_scbd(struct rtw_dev *rtwdev) in rtw_coex_read_scbd() argument
403 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_read_scbd()
408 return (rtw_read16(rtwdev, REG_WIFI_BT_INFO)) & ~(BIT_BT_INT_EN); in rtw_coex_read_scbd()
411 static void rtw_coex_check_rfk(struct rtw_dev *rtwdev) in rtw_coex_check_rfk() argument
413 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_check_rfk()
414 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_check_rfk()
423 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_check_rfk()
429 btk = !!(rtw_coex_read_scbd(rtwdev) & COEX_SCBD_BT_RFK); in rtw_coex_check_rfk()
432 wlk = !!(rtw_read8(rtwdev, REG_ARFR4) & BIT_WL_RFK); in rtw_coex_check_rfk()
437 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_check_rfk()
449 static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) in rtw_coex_query_bt_info() argument
451 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_query_bt_info()
457 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_query_bt_info()
459 rtw_fw_query_bt_info(rtwdev); in rtw_coex_query_bt_info()
462 static void rtw_coex_gnt_workaround(struct rtw_dev *rtwdev, bool force, u8 mode) in rtw_coex_gnt_workaround() argument
464 rtw_coex_set_gnt_fix(rtwdev); in rtw_coex_gnt_workaround()
467 static void rtw_coex_monitor_bt_ctr(struct rtw_dev *rtwdev) in rtw_coex_monitor_bt_ctr() argument
469 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_monitor_bt_ctr()
473 tmp = rtw_read32(rtwdev, REG_BT_ACT_STATISTICS); in rtw_coex_monitor_bt_ctr()
477 tmp = rtw_read32(rtwdev, REG_BT_ACT_STATISTICS_1); in rtw_coex_monitor_bt_ctr()
481 rtw_write8(rtwdev, REG_BT_COEX_ENH_INTR_CTRL, in rtw_coex_monitor_bt_ctr()
484 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_monitor_bt_ctr()
490 static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev) in rtw_coex_monitor_bt_enable() argument
492 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_monitor_bt_enable()
493 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_monitor_bt_enable()
500 score_board = rtw_coex_read_scbd(rtwdev); in rtw_coex_monitor_bt_enable()
505 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_monitor_bt_enable()
515 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_monitor_bt_enable()
525 static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_update_wl_link_info() argument
527 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_link_info()
528 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_wl_link_info()
531 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_coex_update_wl_link_info()
540 scan = test_bit(RTW_FLAG_SCANNING, rtwdev->flags); in rtw_coex_update_wl_link_info()
541 coex_stat->wl_connected = !!rtwdev->sta_cnt; in rtw_coex_update_wl_link_info()
543 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_update_wl_link_info()
548 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_update_wl_link_info()
564 rtw_coex_wl_noisy_detect(rtwdev); in rtw_coex_update_wl_link_info()
569 rssi = rtwdev->dm_info.min_rssi; in rtw_coex_update_wl_link_info()
570 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, in rtw_coex_update_wl_link_info()
577 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, true); in rtw_coex_update_wl_link_info()
579 rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false); in rtw_coex_update_wl_link_info()
595 if (rtwdev->hal.current_band_type == RTW_BAND_5G) in rtw_coex_update_wl_link_info()
616 void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb) in rtw_coex_info_response() argument
618 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_response()
630 static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, in rtw_coex_info_request() argument
633 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_info_request()
638 rtw_fw_query_bt_mp_info(rtwdev, req); in rtw_coex_info_request()
642 rtw_err(rtwdev, "coex request time out\n"); in rtw_coex_info_request()
648 rtw_err(rtwdev, "failed to get coex info response\n"); in rtw_coex_info_request()
657 static bool rtw_coex_get_bt_scan_type(struct rtw_dev *rtwdev, u8 *scan_type) in rtw_coex_get_bt_scan_type() argument
664 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_scan_type()
674 static bool rtw_coex_set_lna_constrain_level(struct rtw_dev *rtwdev, in rtw_coex_set_lna_constrain_level() argument
682 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_set_lna_constrain_level()
707 static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev) in rtw_coex_update_bt_link_info() argument
709 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_bt_link_info()
710 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_update_bt_link_info()
723 rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state, rssi, in rtw_coex_update_bt_link_info()
732 if (rtw_coex_get_bt_scan_type(rtwdev, &scan_type)) { in rtw_coex_update_bt_link_info()
803 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(), %s!!!\n", __func__, in rtw_coex_update_bt_link_info()
807 static void rtw_coex_update_wl_ch_info(struct rtw_dev *rtwdev, u8 type) in rtw_coex_update_wl_ch_info() argument
809 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_update_wl_ch_info()
810 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_update_wl_ch_info()
811 struct rtw_coex_dm *coex_dm = &rtwdev->coex.dm; in rtw_coex_update_wl_ch_info()
812 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_update_wl_ch_info()
818 bw = rtwdev->hal.current_band_width; in rtw_coex_update_wl_ch_info()
821 center_chan = rtwdev->hal.current_channel; in rtw_coex_update_wl_ch_info()
851 rtw_fw_wl_ch_info(rtwdev, link, center_chan, bw); in rtw_coex_update_wl_ch_info()
852 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_update_wl_ch_info()
857 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
859 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_tx_power()
867 rtw_fw_force_bt_tx_power(rtwdev, bt_pwr_dec_lvl); in rtw_coex_set_bt_tx_power()
870 static void rtw_coex_set_bt_rx_gain(struct rtw_dev *rtwdev, u8 bt_lna_lvl) in rtw_coex_set_bt_rx_gain() argument
872 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_bt_rx_gain()
882 rtw_coex_set_lna_constrain_level(rtwdev, bt_lna_lvl); in rtw_coex_set_bt_rx_gain()
883 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, true); in rtw_coex_set_bt_rx_gain()
885 rtw_coex_write_scbd(rtwdev, COEX_SCBD_RXGAIN, false); in rtw_coex_set_bt_rx_gain()
887 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): bt_rx_LNA_level = %d\n", in rtw_coex_set_bt_rx_gain()
891 static void rtw_coex_set_rf_para(struct rtw_dev *rtwdev, in rtw_coex_set_rf_para() argument
894 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_rf_para()
901 rtw_coex_set_wl_tx_power(rtwdev, para.wl_pwr_dec_lvl); in rtw_coex_set_rf_para()
902 rtw_coex_set_bt_tx_power(rtwdev, para.bt_pwr_dec_lvl + offset); in rtw_coex_set_rf_para()
903 rtw_coex_set_wl_rx_gain(rtwdev, para.wl_low_gain_en); in rtw_coex_set_rf_para()
904 rtw_coex_set_bt_rx_gain(rtwdev, para.bt_lna_lvl); in rtw_coex_set_rf_para()
907 u32 rtw_coex_read_indirect_reg(struct rtw_dev *rtwdev, u16 addr) in rtw_coex_read_indirect_reg() argument
911 if (!ltecoex_read_reg(rtwdev, addr, &val)) { in rtw_coex_read_indirect_reg()
912 rtw_err(rtwdev, "failed to read indirect register\n"); in rtw_coex_read_indirect_reg()
920 void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr, in rtw_coex_write_indirect_reg() argument
926 tmp = rtw_coex_read_indirect_reg(rtwdev, addr); in rtw_coex_write_indirect_reg()
929 if (!ltecoex_reg_write(rtwdev, addr, tmp)) in rtw_coex_write_indirect_reg()
930 rtw_err(rtwdev, "failed to write indirect register\n"); in rtw_coex_write_indirect_reg()
934 static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control) in rtw_coex_coex_ctrl_owner() argument
936 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_coex_ctrl_owner()
940 rtw_write8_set(rtwdev, REG_SYS_SDIO_CTRL + 3, in rtw_coex_coex_ctrl_owner()
943 rtw_write8_set(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
945 rtw_write8_clr(rtwdev, REG_SYS_SDIO_CTRL + 3, in rtw_coex_coex_ctrl_owner()
948 rtw_write8_clr(rtwdev, btg_reg->addr, btg_reg->mask); in rtw_coex_coex_ctrl_owner()
952 static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_bt() argument
954 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0xc000, state); in rtw_coex_set_gnt_bt()
955 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0c00, state); in rtw_coex_set_gnt_bt()
958 static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state) in rtw_coex_set_gnt_wl() argument
960 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x3000, state); in rtw_coex_set_gnt_wl()
961 rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0300, state); in rtw_coex_set_gnt_wl()
964 static void rtw_coex_mimo_ps(struct rtw_dev *rtwdev, bool force, bool state) in rtw_coex_mimo_ps() argument
966 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_mimo_ps()
973 rtw_set_txrx_1ss(rtwdev, state); in rtw_coex_mimo_ps()
975 rtw_coex_update_wl_ch_info(rtwdev, (u8)coex_stat->wl_connected); in rtw_coex_mimo_ps()
977 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_mimo_ps()
981 static void rtw_btc_wltoggle_table_a(struct rtw_dev *rtwdev, bool force, in rtw_btc_wltoggle_table_a() argument
984 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_btc_wltoggle_table_a()
985 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_btc_wltoggle_table_a()
1007 rtw_fw_bt_wifi_control(rtwdev, h2c_para[0], &h2c_para[1]); in rtw_btc_wltoggle_table_a()
1009 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_btc_wltoggle_table_a()
1016 static void rtw_btc_wltoggle_table_b(struct rtw_dev *rtwdev, bool force, in rtw_btc_wltoggle_table_b() argument
1019 struct rtw_coex *coex = &rtwdev->coex; in rtw_btc_wltoggle_table_b()
1036 rtw_fw_bt_wifi_control(rtwdev, cur_h2c_para[0], &cur_h2c_para[1]); in rtw_btc_wltoggle_table_b()
1038 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_btc_wltoggle_table_b()
1044 static void rtw_coex_set_table(struct rtw_dev *rtwdev, bool force, u32 table0, in rtw_coex_set_table() argument
1048 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_table()
1053 if (table0 == rtw_read32(rtwdev, REG_BT_COEX_TABLE0) && in rtw_coex_set_table()
1054 table1 == rtw_read32(rtwdev, REG_BT_COEX_TABLE1)) in rtw_coex_set_table()
1057 rtw_write32(rtwdev, REG_BT_COEX_TABLE0, table0); in rtw_coex_set_table()
1058 rtw_write32(rtwdev, REG_BT_COEX_TABLE1, table1); in rtw_coex_set_table()
1059 rtw_write32(rtwdev, REG_BT_COEX_BRK_TABLE, DEF_BRK_TABLE_VAL); in rtw_coex_set_table()
1061 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_table()
1066 static void rtw_coex_table(struct rtw_dev *rtwdev, bool force, u8 type) in rtw_coex_table() argument
1068 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_table()
1069 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_table()
1071 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_table()
1076 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], Coex_Table - %d\n", type); in rtw_coex_table()
1080 rtw_coex_set_table(rtwdev, force, in rtw_coex_table()
1086 rtw_coex_set_table(rtwdev, force, in rtw_coex_table()
1091 rtw_btc_wltoggle_table_a(rtwdev, true, type); in rtw_coex_table()
1094 static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable) in rtw_coex_ignore_wlan_act() argument
1096 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ignore_wlan_act()
1101 rtw_fw_bt_ignore_wlan_action(rtwdev, enable); in rtw_coex_ignore_wlan_act()
1104 static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, in rtw_coex_power_save_state() argument
1107 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_save_state()
1111 lps_mode = rtwdev->lps_conf.mode; in rtw_coex_power_save_state()
1117 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_power_save_state()
1119 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
1124 rtw_fw_coex_tdma_type(rtwdev, 0, 0, 0, 0, 0); in rtw_coex_power_save_state()
1126 rtw_leave_lps(rtwdev); in rtw_coex_power_save_state()
1127 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_power_save_state()
1135 static void rtw_coex_set_tdma(struct rtw_dev *rtwdev, u8 byte1, u8 byte2, in rtw_coex_set_tdma() argument
1138 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_tdma()
1139 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_tdma()
1146 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): AP mode\n", in rtw_coex_set_tdma()
1156 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
1159 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_tdma()
1167 rtw_coex_power_save_state(rtwdev, ps_type, 0x50, 0x4); in rtw_coex_set_tdma()
1169 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_tdma()
1174 rtw_coex_power_save_state(rtwdev, ps_type, 0x0, 0x0); in rtw_coex_set_tdma()
1183 rtw_fw_coex_tdma_type(rtwdev, byte1, byte2, byte3, byte4, byte5); in rtw_coex_set_tdma()
1194 static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase) in rtw_coex_tdma() argument
1196 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_tdma()
1197 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_tdma()
1200 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_tdma()
1206 rtw_coex_tdma_timer_base(rtwdev, TDMA_TIMER_TYPE_4SLOT); in rtw_coex_tdma()
1208 rtw_coex_tdma_timer_base(rtwdev, TDMA_TIMER_TYPE_2SLOT); in rtw_coex_tdma()
1216 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_tdma()
1223 wl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_tdma()
1228 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, false); in rtw_coex_tdma()
1230 rtw_coex_write_scbd(rtwdev, COEX_SCBD_TDMA, true); in rtw_coex_tdma()
1238 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
1247 rtw_coex_set_tdma(rtwdev, in rtw_coex_tdma()
1256 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], coex tdma type(%s, %d)\n", in rtw_coex_tdma()
1260 static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase) in rtw_coex_set_ant_path() argument
1262 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_set_ant_path()
1275 rtw_coex_check_rfk(rtwdev); in rtw_coex_set_ant_path()
1277 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1283 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1287 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1289 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1295 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1299 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1302 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1305 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1308 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1312 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1318 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1321 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_LOW); in rtw_coex_set_ant_path()
1324 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1327 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1333 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1336 rtw_coex_coex_ctrl_owner(rtwdev, false); in rtw_coex_set_ant_path()
1342 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1345 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1348 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1351 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1357 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1361 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1364 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1367 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1373 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1377 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1380 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH); in rtw_coex_set_ant_path()
1383 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1389 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_set_ant_path()
1392 rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1395 rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_HW_PTA); in rtw_coex_set_ant_path()
1398 rtw_coex_coex_ctrl_owner(rtwdev, true); in rtw_coex_set_ant_path()
1410 rtw_coex_set_ant_switch(rtwdev, ctrl_type, pos_type); in rtw_coex_set_ant_path()
1460 static u8 rtw_coex_algorithm(struct rtw_dev *rtwdev) in rtw_coex_algorithm() argument
1462 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_algorithm()
1520 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_algorithm()
1527 static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev) in rtw_coex_action_coex_all_off() argument
1529 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_coex_all_off()
1530 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_coex_all_off()
1533 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_coex_all_off()
1534 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_coex_all_off()
1546 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_coex_all_off()
1547 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_coex_all_off()
1550 static void rtw_coex_action_freerun(struct rtw_dev *rtwdev) in rtw_coex_action_freerun() argument
1552 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_freerun()
1553 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_freerun()
1556 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_freerun()
1560 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_freerun()
1568 rtw_coex_update_wl_ch_info(rtwdev, COEX_MEDIA_CONNECT); in rtw_coex_action_freerun()
1570 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_freerun()
1572 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_freerun()
1587 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[level]); in rtw_coex_action_freerun()
1589 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[level]); in rtw_coex_action_freerun()
1591 rtw_coex_table(rtwdev, false, 100); in rtw_coex_action_freerun()
1592 rtw_coex_tdma(rtwdev, false, 100); in rtw_coex_action_freerun()
1595 static void rtw_coex_action_rf4ce(struct rtw_dev *rtwdev) in rtw_coex_action_rf4ce() argument
1597 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_rf4ce()
1598 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_rf4ce()
1601 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_rf4ce()
1603 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_rf4ce()
1604 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_rf4ce()
1616 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_rf4ce()
1617 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_rf4ce()
1620 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev) in rtw_coex_action_bt_whql_test() argument
1622 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_whql_test()
1623 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_whql_test()
1626 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_whql_test()
1628 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_whql_test()
1629 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_whql_test()
1641 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_whql_test()
1642 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_whql_test()
1645 static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_relink() argument
1647 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_relink()
1648 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_relink()
1650 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_relink()
1654 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_relink()
1656 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_relink()
1657 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_relink()
1681 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_relink()
1682 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_relink()
1685 static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev) in rtw_coex_action_bt_idle() argument
1687 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_idle()
1688 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_idle()
1691 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_idle()
1695 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_idle()
1696 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_idle()
1712 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN); in rtw_coex_action_bt_idle()
1716 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_idle()
1750 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_idle()
1751 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_idle()
1754 static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) in rtw_coex_action_bt_inquiry() argument
1756 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_inquiry()
1757 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_inquiry()
1759 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_inquiry()
1764 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_inquiry()
1765 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_inquiry()
1766 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_inquiry()
1775 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1788 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1804 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1809 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1817 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1830 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1835 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1840 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_action_bt_inquiry()
1847 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], wifi hi(%d), bt page(%d)\n", in rtw_coex_action_bt_inquiry()
1850 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_inquiry()
1851 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_inquiry()
1854 static void rtw_coex_action_bt_game_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_game_hid() argument
1856 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_game_hid()
1857 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_game_hid()
1859 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_game_hid()
1863 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_game_hid()
1864 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_game_hid()
1891 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[6]); in rtw_coex_action_bt_game_hid()
1893 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[5]); in rtw_coex_action_bt_game_hid()
1895 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_game_hid()
1898 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_game_hid()
1899 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_game_hid()
1902 static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hfp() argument
1904 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hfp()
1905 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hfp()
1907 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hfp()
1910 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_hfp()
1911 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hfp()
1912 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hfp()
1929 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_hfp()
1930 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_hfp()
1933 static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_hid() argument
1935 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_hid()
1936 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_hid()
1938 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_hid()
1943 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_hid()
1944 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_hid()
1945 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_hid()
2007 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_hid()
2009 rtw_btc_wltoggle_table_a(rtwdev, true, table_case); in rtw_coex_action_bt_hid()
2010 rtw_btc_wltoggle_table_b(rtwdev, false, 1, COEX_WL_SLOT_TOGLLE); in rtw_coex_action_bt_hid()
2013 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_hid()
2016 static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp() argument
2018 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp()
2019 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp()
2022 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp()
2026 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp()
2028 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp()
2029 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp()
2054 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp()
2055 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp()
2058 static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dpsink() argument
2060 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dpsink()
2061 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dpsink()
2063 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dpsink()
2067 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dpsink()
2069 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dpsink()
2070 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dpsink()
2093 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dpsink()
2094 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dpsink()
2097 static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan() argument
2099 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan()
2100 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan()
2102 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan()
2105 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_pan()
2106 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan()
2107 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan()
2130 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_pan()
2131 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan()
2134 static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_hid() argument
2136 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_hid()
2137 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_hid()
2140 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_hid()
2147 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_hid()
2148 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_hid()
2149 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_hid()
2183 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_hid()
2185 rtw_btc_wltoggle_table_a(rtwdev, true, table_case); in rtw_coex_action_bt_a2dp_hid()
2186 rtw_btc_wltoggle_table_b(rtwdev, false, interval, COEX_WL_SLOT_TOGLLE); in rtw_coex_action_bt_a2dp_hid()
2188 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_bt_a2dp_hid()
2191 static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan() argument
2193 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan()
2194 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan()
2196 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan()
2200 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_pan()
2202 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan()
2203 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
2240 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[1]); in rtw_coex_action_bt_a2dp_pan()
2242 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan()
2244 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_pan()
2245 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan()
2248 static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_pan_hid() argument
2250 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_pan_hid()
2251 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_pan_hid()
2253 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_pan_hid()
2256 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_pan_hid()
2258 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_pan_hid()
2259 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_pan_hid()
2279 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_pan_hid()
2280 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_pan_hid()
2283 static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev) in rtw_coex_action_bt_a2dp_pan_hid() argument
2285 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_bt_a2dp_pan_hid()
2286 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_bt_a2dp_pan_hid()
2288 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_bt_a2dp_pan_hid()
2291 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_bt_a2dp_pan_hid()
2292 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_bt_a2dp_pan_hid()
2293 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_bt_a2dp_pan_hid()
2313 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_bt_a2dp_pan_hid()
2314 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_bt_a2dp_pan_hid()
2317 static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev) in rtw_coex_action_wl_under5g() argument
2319 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_under5g()
2320 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_under5g()
2321 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_under5g()
2325 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_under5g()
2327 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_action_wl_under5g()
2328 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_under5g()
2330 rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false); in rtw_coex_action_wl_under5g()
2345 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_under5g()
2346 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_under5g()
2349 static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev) in rtw_coex_action_wl_only() argument
2351 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_only()
2352 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_only()
2355 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_only()
2356 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_only()
2357 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_only()
2369 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_only()
2370 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_only()
2373 static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev) in rtw_coex_action_wl_native_lps() argument
2375 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_native_lps()
2376 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_native_lps()
2377 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_native_lps()
2384 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_native_lps()
2386 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_native_lps()
2401 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_tx[6]); in rtw_coex_action_wl_native_lps()
2403 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[5]); in rtw_coex_action_wl_native_lps()
2405 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_native_lps()
2408 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_native_lps()
2409 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_native_lps()
2412 static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) in rtw_coex_action_wl_linkscan() argument
2414 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_linkscan()
2415 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_linkscan()
2417 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_linkscan()
2421 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_linkscan()
2422 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_linkscan()
2423 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_linkscan()
2448 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_linkscan()
2449 rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); in rtw_coex_action_wl_linkscan()
2452 static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_not_connected() argument
2454 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_action_wl_not_connected()
2455 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_action_wl_not_connected()
2458 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_not_connected()
2459 rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); in rtw_coex_action_wl_not_connected()
2460 rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); in rtw_coex_action_wl_not_connected()
2472 rtw_coex_table(rtwdev, false, table_case); in rtw_coex_action_wl_not_connected()
2473 rtw_coex_tdma(rtwdev, false, tdma_case); in rtw_coex_action_wl_not_connected()
2476 static void rtw_coex_action_wl_connected(struct rtw_dev *rtwdev) in rtw_coex_action_wl_connected() argument
2478 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_action_wl_connected()
2482 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_action_wl_connected()
2484 algorithm = rtw_coex_algorithm(rtwdev); in rtw_coex_action_wl_connected()
2488 rtw_coex_action_bt_hfp(rtwdev); in rtw_coex_action_wl_connected()
2491 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2492 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2494 rtw_coex_action_bt_hid(rtwdev); in rtw_coex_action_wl_connected()
2497 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2498 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2500 rtw_coex_action_bt_a2dpsink(rtwdev); in rtw_coex_action_wl_connected()
2502 rtw_coex_action_bt_a2dp(rtwdev); in rtw_coex_action_wl_connected()
2505 rtw_coex_action_bt_pan(rtwdev); in rtw_coex_action_wl_connected()
2508 if (rtw_coex_freerun_check(rtwdev)) in rtw_coex_action_wl_connected()
2509 rtw_coex_action_freerun(rtwdev); in rtw_coex_action_wl_connected()
2511 rtw_coex_action_bt_a2dp_hid(rtwdev); in rtw_coex_action_wl_connected()
2514 rtw_coex_action_bt_a2dp_pan(rtwdev); in rtw_coex_action_wl_connected()
2517 rtw_coex_action_bt_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
2520 rtw_coex_action_bt_a2dp_pan_hid(rtwdev); in rtw_coex_action_wl_connected()
2524 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_action_wl_connected()
2529 static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) in rtw_coex_run_coex() argument
2531 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_run_coex()
2532 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_run_coex()
2537 lockdep_assert_held(&rtwdev->mutex); in rtw_coex_run_coex()
2539 if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) in rtw_coex_run_coex()
2544 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): reason = %d\n", __func__, in rtw_coex_run_coex()
2548 rtw_coex_update_wl_link_info(rtwdev, reason); in rtw_coex_run_coex()
2550 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_run_coex()
2553 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2559 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2565 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2572 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_run_coex()
2583 rtw_coex_action_wl_under5g(rtwdev); in rtw_coex_run_coex()
2587 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], WiFi is single-port 2G!!\n"); in rtw_coex_run_coex()
2592 rtw_coex_action_rf4ce(rtwdev); in rtw_coex_run_coex()
2594 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
2596 rtw_coex_action_wl_only(rtwdev); in rtw_coex_run_coex()
2601 rtw_coex_action_wl_native_lps(rtwdev); in rtw_coex_run_coex()
2606 rtw_coex_action_bt_game_hid(rtwdev); in rtw_coex_run_coex()
2611 rtw_coex_action_bt_whql_test(rtwdev); in rtw_coex_run_coex()
2616 rtw_coex_action_bt_relink(rtwdev); in rtw_coex_run_coex()
2621 rtw_coex_action_bt_inquiry(rtwdev); in rtw_coex_run_coex()
2628 rtw_coex_action_bt_idle(rtwdev); in rtw_coex_run_coex()
2633 rtw_coex_action_wl_linkscan(rtwdev); in rtw_coex_run_coex()
2638 rtw_coex_action_wl_connected(rtwdev); in rtw_coex_run_coex()
2641 rtw_coex_action_wl_not_connected(rtwdev); in rtw_coex_run_coex()
2650 rtw_coex_mimo_ps(rtwdev, true, true); in rtw_coex_run_coex()
2652 rtw_coex_mimo_ps(rtwdev, false, true); in rtw_coex_run_coex()
2654 rtw_coex_mimo_ps(rtwdev, false, false); in rtw_coex_run_coex()
2658 rtw_coex_gnt_workaround(rtwdev, false, coex_stat->wl_coex_mode); in rtw_coex_run_coex()
2659 rtw_coex_limited_wl(rtwdev); in rtw_coex_run_coex()
2662 static void rtw_coex_init_coex_var(struct rtw_dev *rtwdev) in rtw_coex_init_coex_var() argument
2664 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_init_coex_var()
2689 static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in __rtw_coex_init_hw_config() argument
2691 struct rtw_coex *coex = &rtwdev->coex; in __rtw_coex_init_hw_config()
2694 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in __rtw_coex_init_hw_config()
2696 rtw_coex_init_coex_var(rtwdev); in __rtw_coex_init_hw_config()
2698 coex_stat->kt_ver = u8_get_bits(rtw_read8(rtwdev, 0xf1), GENMASK(7, 4)); in __rtw_coex_init_hw_config()
2700 rtw_coex_monitor_bt_enable(rtwdev); in __rtw_coex_init_hw_config()
2701 rtw_coex_wl_slot_extend(rtwdev, coex_stat->wl_slot_extend); in __rtw_coex_init_hw_config()
2703 rtw_write8_set(rtwdev, REG_BCN_CTRL, BIT_EN_BCN_FUNCTION); in __rtw_coex_init_hw_config()
2705 rtw_coex_set_rfe_type(rtwdev); in __rtw_coex_init_hw_config()
2706 rtw_coex_set_init(rtwdev); in __rtw_coex_init_hw_config()
2709 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_RSP, 1); in __rtw_coex_init_hw_config()
2712 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACON, 1); in __rtw_coex_init_hw_config()
2715 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_TX_BEACONQ, 1); in __rtw_coex_init_hw_config()
2719 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in __rtw_coex_init_hw_config()
2720 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in __rtw_coex_init_hw_config()
2723 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): RF Off\n", in __rtw_coex_init_hw_config()
2726 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WONLY); in __rtw_coex_init_hw_config()
2727 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, in __rtw_coex_init_hw_config()
2731 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_INIT); in __rtw_coex_init_hw_config()
2732 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, in __rtw_coex_init_hw_config()
2739 rtw_coex_table(rtwdev, true, 1); in __rtw_coex_init_hw_config()
2740 rtw_coex_tdma(rtwdev, true, 0); in __rtw_coex_init_hw_config()
2741 rtw_coex_query_bt_info(rtwdev); in __rtw_coex_init_hw_config()
2744 void rtw_coex_power_on_setting(struct rtw_dev *rtwdev) in rtw_coex_power_on_setting() argument
2746 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_power_on_setting()
2749 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_power_on_setting()
2755 rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, in rtw_coex_power_on_setting()
2758 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_power_on_setting()
2759 rtw_coex_set_rfe_type(rtwdev); in rtw_coex_power_on_setting()
2762 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_POWERON); in rtw_coex_power_on_setting()
2764 rtw_coex_table(rtwdev, true, table_case); in rtw_coex_power_on_setting()
2766 rtw_write8(rtwdev, 0xff1a, 0x0); in rtw_coex_power_on_setting()
2767 rtw_coex_set_gnt_debug(rtwdev); in rtw_coex_power_on_setting()
2770 void rtw_coex_power_off_setting(struct rtw_dev *rtwdev) in rtw_coex_power_off_setting() argument
2772 rtw_write16(rtwdev, REG_WIFI_BT_INFO, BIT_BT_INT_EN); in rtw_coex_power_off_setting()
2775 void rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) in rtw_coex_init_hw_config() argument
2777 __rtw_coex_init_hw_config(rtwdev, wifi_only); in rtw_coex_init_hw_config()
2780 void rtw_coex_ips_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_ips_notify() argument
2782 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_ips_notify()
2789 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], IPS ENTER notify\n"); in rtw_coex_ips_notify()
2794 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ALL, false); in rtw_coex_ips_notify()
2796 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WOFF); in rtw_coex_ips_notify()
2797 rtw_coex_action_coex_all_off(rtwdev); in rtw_coex_ips_notify()
2799 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], IPS LEAVE notify\n"); in rtw_coex_ips_notify()
2801 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_ips_notify()
2803 __rtw_coex_init_hw_config(rtwdev, false); in rtw_coex_ips_notify()
2809 void rtw_coex_lps_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_lps_notify() argument
2811 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_lps_notify()
2818 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], LPS ENABLE notify\n"); in rtw_coex_lps_notify()
2824 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2827 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false); in rtw_coex_lps_notify()
2828 rtw_coex_write_scbd(rtwdev, COEX_SCBD_WLBUSY, false); in rtw_coex_lps_notify()
2830 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2833 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], LPS DISABLE notify\n"); in rtw_coex_lps_notify()
2838 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_lps_notify()
2841 rtw_coex_query_bt_info(rtwdev); in rtw_coex_lps_notify()
2843 rtw_coex_run_coex(rtwdev, COEX_RSN_LPS); in rtw_coex_lps_notify()
2847 void rtw_coex_scan_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_scan_notify() argument
2849 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_scan_notify()
2856 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_scan_notify()
2859 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2862 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_scan_notify()
2863 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSCANSTART); in rtw_coex_scan_notify()
2865 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2871 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_scan_notify()
2872 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSCANSTART); in rtw_coex_scan_notify()
2876 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_scan_notify()
2881 rtw_coex_run_coex(rtwdev, COEX_RSN_SCANFINISH); in rtw_coex_scan_notify()
2885 void rtw_coex_switchband_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_switchband_notify() argument
2887 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_switchband_notify()
2893 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): TO_5G\n", in rtw_coex_switchband_notify()
2896 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_switchband_notify()
2899 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): TO_2G\n", in rtw_coex_switchband_notify()
2904 rtw_coex_run_coex(rtwdev, COEX_RSN_5GSWITCHBAND); in rtw_coex_switchband_notify()
2906 rtw_coex_run_coex(rtwdev, COEX_RSN_2GSWITCHBAND); in rtw_coex_switchband_notify()
2908 rtw_coex_scan_notify(rtwdev, COEX_SCAN_START_2G); in rtw_coex_switchband_notify()
2911 void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_connect_notify() argument
2913 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_connect_notify()
2919 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true); in rtw_coex_connect_notify()
2922 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G start\n", in rtw_coex_connect_notify()
2925 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2926 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONSTART); in rtw_coex_connect_notify()
2928 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G finish\n", in rtw_coex_connect_notify()
2931 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_connect_notify()
2932 rtw_coex_run_coex(rtwdev, COEX_RSN_5GCONFINISH); in rtw_coex_connect_notify()
2938 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_connect_notify()
2941 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G start\n", in rtw_coex_connect_notify()
2944 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_connect_notify()
2946 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONSTART); in rtw_coex_connect_notify()
2952 ieee80211_queue_delayed_work(rtwdev->hw, &coex->defreeze_work, in rtw_coex_connect_notify()
2959 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G finish\n", in rtw_coex_connect_notify()
2961 rtw_coex_run_coex(rtwdev, COEX_RSN_2GCONFINISH); in rtw_coex_connect_notify()
2965 void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type) in rtw_coex_media_status_notify() argument
2967 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_media_status_notify()
2974 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G\n", __func__); in rtw_coex_media_status_notify()
2976 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2978 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_5G); in rtw_coex_media_status_notify()
2979 rtw_coex_run_coex(rtwdev, COEX_RSN_5GMEDIA); in rtw_coex_media_status_notify()
2981 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 2G\n", __func__); in rtw_coex_media_status_notify()
2985 rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, true); in rtw_coex_media_status_notify()
2988 rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); in rtw_coex_media_status_notify()
2991 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 1); in rtw_coex_media_status_notify()
2992 rtw_coex_run_coex(rtwdev, COEX_RSN_2GMEDIA); in rtw_coex_media_status_notify()
2994 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): disconnect!!\n", in rtw_coex_media_status_notify()
2996 rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 0); in rtw_coex_media_status_notify()
2997 rtw_coex_run_coex(rtwdev, COEX_RSN_MEDIADISCON); in rtw_coex_media_status_notify()
3000 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_media_status_notify()
3003 void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_bt_info_notify() argument
3005 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_bt_info_notify()
3006 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_bt_info_notify()
3025 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3033 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3037 rtw_coex_monitor_bt_enable(rtwdev); in rtw_coex_bt_info_notify()
3040 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
3046 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3056 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3059 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
3068 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3071 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3077 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3083 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3097 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3121 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3196 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3200 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3217 ieee80211_queue_delayed_work(rtwdev->hw, in rtw_coex_bt_info_notify()
3225 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3232 rtw_coex_update_wl_ch_info(rtwdev, type); in rtw_coex_bt_info_notify()
3238 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_info_notify()
3240 rtw_coex_ignore_wlan_act(rtwdev, false); in rtw_coex_bt_info_notify()
3263 rtw_coex_update_bt_link_info(rtwdev); in rtw_coex_bt_info_notify()
3264 rtw_coex_run_coex(rtwdev, COEX_RSN_BTINFO); in rtw_coex_bt_info_notify()
3271 void rtw_coex_bt_hid_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_bt_hid_info_notify() argument
3273 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_bt_hid_info_notify()
3274 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_bt_hid_info_notify()
3286 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_hid_info_notify()
3354 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_bt_hid_info_notify()
3357 rtw_coex_run_coex(rtwdev, COEX_RSN_BTSTATUS); in rtw_coex_bt_hid_info_notify()
3361 void rtw_coex_query_bt_hid_list(struct rtw_dev *rtwdev) in rtw_coex_query_bt_hid_list() argument
3363 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_query_bt_hid_list()
3364 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_query_bt_hid_list()
3380 rtw_fw_coex_query_hid_info(rtwdev, COEX_BT_HIDINFO_LIST, 0); in rtw_coex_query_bt_hid_list()
3390 rtw_fw_coex_query_hid_info(rtwdev, in rtw_coex_query_bt_hid_list()
3396 void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) in rtw_coex_wl_fwdbginfo_notify() argument
3398 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_wl_fwdbginfo_notify()
3403 rtw_dbg(rtwdev, RTW_DBG_COEX, in rtw_coex_wl_fwdbginfo_notify()
3423 rtw_coex_wl_ccklock_action(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
3424 rtw_coex_wl_ccklock_detect(rtwdev); in rtw_coex_wl_fwdbginfo_notify()
3427 void rtw_coex_wl_status_change_notify(struct rtw_dev *rtwdev, u32 type) in rtw_coex_wl_status_change_notify() argument
3429 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_status_change_notify()
3432 void rtw_coex_wl_status_check(struct rtw_dev *rtwdev) in rtw_coex_wl_status_check() argument
3434 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_status_check()
3440 rtw_coex_monitor_bt_ctr(rtwdev); in rtw_coex_wl_status_check()
3445 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_relink_work() local
3447 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_relink_work()
3449 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
3451 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_bt_relink_work()
3452 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_relink_work()
3457 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_reenable_work() local
3459 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_reenable_work()
3461 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
3463 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_reenable_work()
3468 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_defreeze_work() local
3470 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_defreeze_work()
3471 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_defreeze_work()
3473 mutex_lock(&rtwdev->mutex); in rtw_coex_defreeze_work()
3476 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_defreeze_work()
3477 mutex_unlock(&rtwdev->mutex); in rtw_coex_defreeze_work()
3482 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_remain_work() local
3484 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_remain_work()
3486 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
3487 coex_stat->wl_gl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); in rtw_coex_wl_remain_work()
3488 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_remain_work()
3489 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_remain_work()
3494 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_remain_work() local
3496 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_remain_work()
3498 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
3500 rtw_coex_run_coex(rtwdev, COEX_RSN_BTSTATUS); in rtw_coex_bt_remain_work()
3501 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_remain_work()
3506 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_connecting_work() local
3508 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_connecting_work()
3510 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_connecting_work()
3512 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], WL connecting stop!!\n"); in rtw_coex_wl_connecting_work()
3513 rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS); in rtw_coex_wl_connecting_work()
3514 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_connecting_work()
3519 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_bt_multi_link_remain_work() local
3521 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_bt_multi_link_remain_work()
3523 mutex_lock(&rtwdev->mutex); in rtw_coex_bt_multi_link_remain_work()
3525 mutex_unlock(&rtwdev->mutex); in rtw_coex_bt_multi_link_remain_work()
3530 struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, in rtw_coex_wl_ccklock_work() local
3532 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; in rtw_coex_wl_ccklock_work()
3534 mutex_lock(&rtwdev->mutex); in rtw_coex_wl_ccklock_work()
3536 mutex_unlock(&rtwdev->mutex); in rtw_coex_wl_ccklock_work()
3582 static u8 rtw_coex_get_table_index(struct rtw_dev *rtwdev, u32 wl_reg_6c0, in rtw_coex_get_table_index() argument
3585 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_get_table_index()
3586 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_get_table_index()
3619 static u8 rtw_coex_get_tdma_index(struct rtw_dev *rtwdev, u8 *tdma_para) in rtw_coex_get_tdma_index() argument
3621 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_get_tdma_index()
3622 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_get_tdma_index()
3657 static int rtw_coex_addr_info(struct rtw_dev *rtwdev, in rtw_coex_addr_info() argument
3702 static int rtw_coex_val_info(struct rtw_dev *rtwdev, in rtw_coex_val_info() argument
3715 rtw_read32_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3718 rtw_read16_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3721 rtw_read8_mask(rtwdev, reg->addr, reg->mask)); in rtw_coex_val_info()
3734 rtw_read_rf(rtwdev, rf_path, reg->addr, reg->mask)); in rtw_coex_val_info()
3737 static void rtw_coex_set_coexinfo_hw(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_set_coexinfo_hw() argument
3739 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_set_coexinfo_hw()
3750 n_addr += rtw_coex_addr_info(rtwdev, reg, addr_info, n_addr); in rtw_coex_set_coexinfo_hw()
3751 n_val += rtw_coex_val_info(rtwdev, reg, val_info, n_val); in rtw_coex_set_coexinfo_hw()
3764 static bool rtw_coex_get_bt_reg(struct rtw_dev *rtwdev, in rtw_coex_get_bt_reg() argument
3777 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_reg()
3790 static bool rtw_coex_get_bt_patch_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_patch_version() argument
3798 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_patch_version()
3809 static bool rtw_coex_get_bt_supported_version(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_version() argument
3817 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_version()
3828 static bool rtw_coex_get_bt_supported_feature(struct rtw_dev *rtwdev, in rtw_coex_get_bt_supported_feature() argument
3836 skb = rtw_coex_info_request(rtwdev, &req); in rtw_coex_get_bt_supported_feature()
3871 struct rtw_dev *rtwdev; member
3880 struct rtw_dev *rtwdev = vif_iter_data->rtwdev; in rtw_coex_vif_stat_iter() local
3893 rtw_iterate_stas_atomic(rtwdev, rtw_coex_sta_stat_iter, in rtw_coex_vif_stat_iter()
3911 void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m) in rtw_coex_display_coex_info() argument
3913 const struct rtw_chip_info *chip = rtwdev->chip; in rtw_coex_display_coex_info()
3914 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_coex_display_coex_info()
3915 struct rtw_coex *coex = &rtwdev->coex; in rtw_coex_display_coex_info()
3918 struct rtw_hal *hal = &rtwdev->hal; in rtw_coex_display_coex_info()
3919 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_coex_display_coex_info()
3920 struct rtw_fw_state *fw = &rtwdev->fw; in rtw_coex_display_coex_info()
3929 score_board_BW = rtw_coex_read_scbd(rtwdev); in rtw_coex_display_coex_info()
3931 wl_reg_6c0 = rtw_read32(rtwdev, REG_BT_COEX_TABLE0); in rtw_coex_display_coex_info()
3932 wl_reg_6c4 = rtw_read32(rtwdev, REG_BT_COEX_TABLE1); in rtw_coex_display_coex_info()
3933 wl_reg_6c8 = rtw_read32(rtwdev, REG_BT_COEX_BRK_TABLE); in rtw_coex_display_coex_info()
3934 wl_reg_6cc = rtw_read32(rtwdev, REG_BT_COEX_TABLE_H); in rtw_coex_display_coex_info()
3935 wl_reg_778 = rtw_read8(rtwdev, REG_BT_STAT_CTRL); in rtw_coex_display_coex_info()
3937 sys_lte = rtw_read8(rtwdev, 0x73); in rtw_coex_display_coex_info()
3938 lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38); in rtw_coex_display_coex_info()
3939 bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54); in rtw_coex_display_coex_info()
3942 rtw_coex_get_bt_supported_version(rtwdev, in rtw_coex_display_coex_info()
3944 rtw_coex_get_bt_patch_version(rtwdev, &coex_stat->patch_ver); in rtw_coex_display_coex_info()
3945 rtw_coex_get_bt_supported_feature(rtwdev, in rtw_coex_display_coex_info()
3947 rtw_coex_get_bt_reg(rtwdev, 3, 0xae, &coex_stat->bt_reg_vendor_ae); in rtw_coex_display_coex_info()
3948 rtw_coex_get_bt_reg(rtwdev, 3, 0xac, &coex_stat->bt_reg_vendor_ac); in rtw_coex_display_coex_info()
3954 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); in rtw_coex_display_coex_info()
4053 "Scanning", test_bit(RTW_FLAG_SCANNING, rtwdev->flags)); in rtw_coex_display_coex_info()
4057 rtwdev->stats.tx_throughput, rtwdev->stats.rx_throughput); in rtw_coex_display_coex_info()
4060 test_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags), in rtw_coex_display_coex_info()
4061 test_bit(RTW_FLAG_LEISURE_PS_DEEP, rtwdev->flags), in rtw_coex_display_coex_info()
4062 rtwdev->lps_conf.mode); in rtw_coex_display_coex_info()
4064 vif_iter_data.rtwdev = rtwdev; in rtw_coex_display_coex_info()
4066 rtw_iterate_vifs_atomic(rtwdev, rtw_coex_vif_stat_iter, &vif_iter_data); in rtw_coex_display_coex_info()
4075 rtw_coex_get_tdma_index(rtwdev, in rtw_coex_display_coex_info()
4093 rtw_coex_get_table_index(rtwdev, wl_reg_6c0, wl_reg_6c4), in rtw_coex_display_coex_info()
4157 rtw_coex_set_coexinfo_hw(rtwdev, m); in rtw_coex_display_coex_info()