Lines Matching +full:wifi +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0
7 * This file is for RTL8723B Co-exist mechanism
26 "BT Info[wifi fw]",
44 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_bt_rssi_state()
46 u8 bt_rssi_state = coex_sta->pre_bt_rssi_state; in btc8723b2ant_bt_rssi_state()
48 bt_rssi = coex_sta->bt_rssi; in btc8723b2ant_bt_rssi_state()
50 if (level_num == 2) { in btc8723b2ant_bt_rssi_state()
51 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8723b2ant_bt_rssi_state()
52 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8723b2ant_bt_rssi_state()
78 return coex_sta->pre_bt_rssi_state; in btc8723b2ant_bt_rssi_state()
81 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8723b2ant_bt_rssi_state()
82 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8723b2ant_bt_rssi_state()
93 } else if ((coex_sta->pre_bt_rssi_state == in btc8723b2ant_bt_rssi_state()
95 (coex_sta->pre_bt_rssi_state == in btc8723b2ant_bt_rssi_state()
124 coex_sta->pre_bt_rssi_state = bt_rssi_state; in btc8723b2ant_bt_rssi_state()
133 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_wifi_rssi_state()
135 u8 wifi_rssi_state = coex_sta->pre_wifi_rssi_state[index]; in btc8723b2ant_wifi_rssi_state()
137 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in btc8723b2ant_wifi_rssi_state()
139 if (level_num == 2) { in btc8723b2ant_wifi_rssi_state()
140 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
142 (coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
148 "[BTCoex], wifi RSSI state switch to High\n"); in btc8723b2ant_wifi_rssi_state()
152 "[BTCoex], wifi RSSI state stay at Low\n"); in btc8723b2ant_wifi_rssi_state()
158 "[BTCoex], wifi RSSI state switch to Low\n"); in btc8723b2ant_wifi_rssi_state()
162 "[BTCoex], wifi RSSI state stay at High\n"); in btc8723b2ant_wifi_rssi_state()
168 "[BTCoex], wifi RSSI thresh error!!\n"); in btc8723b2ant_wifi_rssi_state()
169 return coex_sta->pre_wifi_rssi_state[index]; in btc8723b2ant_wifi_rssi_state()
172 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
174 (coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
180 "[BTCoex], wifi RSSI state switch to Medium\n"); in btc8723b2ant_wifi_rssi_state()
184 "[BTCoex], wifi RSSI state stay at Low\n"); in btc8723b2ant_wifi_rssi_state()
186 } else if ((coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
188 (coex_sta->pre_wifi_rssi_state[index] == in btc8723b2ant_wifi_rssi_state()
194 "[BTCoex], wifi RSSI state switch to High\n"); in btc8723b2ant_wifi_rssi_state()
198 "[BTCoex], wifi RSSI state switch to Low\n"); in btc8723b2ant_wifi_rssi_state()
202 "[BTCoex], wifi RSSI state stay at Medium\n"); in btc8723b2ant_wifi_rssi_state()
208 "[BTCoex], wifi RSSI state switch to Medium\n"); in btc8723b2ant_wifi_rssi_state()
212 "[BTCoex], wifi RSSI state stay at High\n"); in btc8723b2ant_wifi_rssi_state()
217 coex_sta->pre_wifi_rssi_state[index] = wifi_rssi_state; in btc8723b2ant_wifi_rssi_state()
234 btcoexist->btc_set(btcoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, in btc8723b2ant_limited_rx()
237 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, in btc8723b2ant_limited_rx()
240 btcoexist->btc_set(btcoexist, BTC_SET_U1_AGG_BUF_SIZE, &rx_agg_size); in btc8723b2ant_limited_rx()
242 btcoexist->btc_set(btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); in btc8723b2ant_limited_rx()
247 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_monitor_bt_ctr()
248 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8723b2ant_monitor_bt_ctr()
256 u32tmp = btcoexist->btc_read_4byte(btcoexist, reg_hp_txrx); in btc8723b2ant_monitor_bt_ctr()
260 u32tmp = btcoexist->btc_read_4byte(btcoexist, reg_lp_txrx); in btc8723b2ant_monitor_bt_ctr()
264 coex_sta->high_priority_tx = reg_hp_tx; in btc8723b2ant_monitor_bt_ctr()
265 coex_sta->high_priority_rx = reg_hp_rx; in btc8723b2ant_monitor_bt_ctr()
266 coex_sta->low_priority_tx = reg_lp_tx; in btc8723b2ant_monitor_bt_ctr()
267 coex_sta->low_priority_rx = reg_lp_rx; in btc8723b2ant_monitor_bt_ctr()
269 if ((coex_sta->low_priority_tx > 1050) && in btc8723b2ant_monitor_bt_ctr()
270 (!coex_sta->c2h_bt_inquiry_page)) in btc8723b2ant_monitor_bt_ctr()
271 coex_sta->pop_event_cnt++; in btc8723b2ant_monitor_bt_ctr()
273 if ((coex_sta->low_priority_rx >= 950) && in btc8723b2ant_monitor_bt_ctr()
274 (coex_sta->low_priority_rx >= coex_sta->low_priority_tx) && in btc8723b2ant_monitor_bt_ctr()
275 (!coex_sta->under_ips)) in btc8723b2ant_monitor_bt_ctr()
276 bt_link_info->slave_role = true; in btc8723b2ant_monitor_bt_ctr()
278 bt_link_info->slave_role = false; in btc8723b2ant_monitor_bt_ctr()
288 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); in btc8723b2ant_monitor_bt_ctr()
293 if (coex_sta->under_ips) { in btc8723b2ant_monitor_wifi_ctr()
294 coex_sta->crc_ok_cck = 0; in btc8723b2ant_monitor_wifi_ctr()
295 coex_sta->crc_ok_11g = 0; in btc8723b2ant_monitor_wifi_ctr()
296 coex_sta->crc_ok_11n = 0; in btc8723b2ant_monitor_wifi_ctr()
297 coex_sta->crc_ok_11n_agg = 0; in btc8723b2ant_monitor_wifi_ctr()
299 coex_sta->crc_err_cck = 0; in btc8723b2ant_monitor_wifi_ctr()
300 coex_sta->crc_err_11g = 0; in btc8723b2ant_monitor_wifi_ctr()
301 coex_sta->crc_err_11n = 0; in btc8723b2ant_monitor_wifi_ctr()
302 coex_sta->crc_err_11n_agg = 0; in btc8723b2ant_monitor_wifi_ctr()
304 coex_sta->crc_ok_cck = in btc8723b2ant_monitor_wifi_ctr()
305 btcoexist->btc_read_4byte(btcoexist, 0xf88); in btc8723b2ant_monitor_wifi_ctr()
306 coex_sta->crc_ok_11g = in btc8723b2ant_monitor_wifi_ctr()
307 btcoexist->btc_read_2byte(btcoexist, 0xf94); in btc8723b2ant_monitor_wifi_ctr()
308 coex_sta->crc_ok_11n = in btc8723b2ant_monitor_wifi_ctr()
309 btcoexist->btc_read_2byte(btcoexist, 0xf90); in btc8723b2ant_monitor_wifi_ctr()
310 coex_sta->crc_ok_11n_agg = in btc8723b2ant_monitor_wifi_ctr()
311 btcoexist->btc_read_2byte(btcoexist, 0xfb8); in btc8723b2ant_monitor_wifi_ctr()
313 coex_sta->crc_err_cck = in btc8723b2ant_monitor_wifi_ctr()
314 btcoexist->btc_read_4byte(btcoexist, 0xf84); in btc8723b2ant_monitor_wifi_ctr()
315 coex_sta->crc_err_11g = in btc8723b2ant_monitor_wifi_ctr()
316 btcoexist->btc_read_2byte(btcoexist, 0xf96); in btc8723b2ant_monitor_wifi_ctr()
317 coex_sta->crc_err_11n = in btc8723b2ant_monitor_wifi_ctr()
318 btcoexist->btc_read_2byte(btcoexist, 0xf92); in btc8723b2ant_monitor_wifi_ctr()
319 coex_sta->crc_err_11n_agg = in btc8723b2ant_monitor_wifi_ctr()
320 btcoexist->btc_read_2byte(btcoexist, 0xfba); in btc8723b2ant_monitor_wifi_ctr()
324 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x1); in btc8723b2ant_monitor_wifi_ctr()
325 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x0); in btc8723b2ant_monitor_wifi_ctr()
330 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_query_bt_info()
333 coex_sta->c2h_bt_info_req_sent = true; in btc8723b2ant_query_bt_info()
341 btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); in btc8723b2ant_query_bt_info()
354 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8723b2ant_is_wifi_status_changed()
356 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8723b2ant_is_wifi_status_changed()
357 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8723b2ant_is_wifi_status_changed()
358 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, in btc8723b2ant_is_wifi_status_changed()
377 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_is_wifi_status_changed()
378 coex_dm->switch_thres_offset; in btc8723b2ant_is_wifi_status_changed()
380 btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, tmp, 0); in btc8723b2ant_is_wifi_status_changed()
392 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8723b2ant_update_bt_link_info()
395 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8723b2ant_update_bt_link_info()
397 bt_link_info->bt_link_exist = coex_sta->bt_link_exist; in btc8723b2ant_update_bt_link_info()
398 bt_link_info->sco_exist = coex_sta->sco_exist; in btc8723b2ant_update_bt_link_info()
399 bt_link_info->a2dp_exist = coex_sta->a2dp_exist; in btc8723b2ant_update_bt_link_info()
400 bt_link_info->pan_exist = coex_sta->pan_exist; in btc8723b2ant_update_bt_link_info()
401 bt_link_info->hid_exist = coex_sta->hid_exist; in btc8723b2ant_update_bt_link_info()
405 bt_link_info->pan_exist = true; in btc8723b2ant_update_bt_link_info()
406 bt_link_info->bt_link_exist = true; in btc8723b2ant_update_bt_link_info()
410 if (bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8723b2ant_update_bt_link_info()
411 !bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8723b2ant_update_bt_link_info()
412 bt_link_info->sco_only = true; in btc8723b2ant_update_bt_link_info()
414 bt_link_info->sco_only = false; in btc8723b2ant_update_bt_link_info()
417 if (!bt_link_info->sco_exist && bt_link_info->a2dp_exist && in btc8723b2ant_update_bt_link_info()
418 !bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8723b2ant_update_bt_link_info()
419 bt_link_info->a2dp_only = true; in btc8723b2ant_update_bt_link_info()
421 bt_link_info->a2dp_only = false; in btc8723b2ant_update_bt_link_info()
424 if (!bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8723b2ant_update_bt_link_info()
425 bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8723b2ant_update_bt_link_info()
426 bt_link_info->pan_only = true; in btc8723b2ant_update_bt_link_info()
428 bt_link_info->pan_only = false; in btc8723b2ant_update_bt_link_info()
431 if (!bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8723b2ant_update_bt_link_info()
432 !bt_link_info->pan_exist && bt_link_info->hid_exist) in btc8723b2ant_update_bt_link_info()
433 bt_link_info->hid_only = true; in btc8723b2ant_update_bt_link_info()
435 bt_link_info->hid_only = false; in btc8723b2ant_update_bt_link_info()
440 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_action_algorithm()
441 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8723b2ant_action_algorithm()
446 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8723b2ant_action_algorithm()
448 if (!bt_link_info->bt_link_exist) { in btc8723b2ant_action_algorithm()
454 if (bt_link_info->sco_exist) in btc8723b2ant_action_algorithm()
456 if (bt_link_info->hid_exist) in btc8723b2ant_action_algorithm()
458 if (bt_link_info->pan_exist) in btc8723b2ant_action_algorithm()
460 if (bt_link_info->a2dp_exist) in btc8723b2ant_action_algorithm()
464 if (bt_link_info->sco_exist) { in btc8723b2ant_action_algorithm()
469 if (bt_link_info->hid_exist) { in btc8723b2ant_action_algorithm()
473 } else if (bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
477 } else if (bt_link_info->pan_exist) { in btc8723b2ant_action_algorithm()
493 } else if (num_of_diff_profile == 2) { in btc8723b2ant_action_algorithm()
494 if (bt_link_info->sco_exist) { in btc8723b2ant_action_algorithm()
495 if (bt_link_info->hid_exist) { in btc8723b2ant_action_algorithm()
499 } else if (bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
503 } else if (bt_link_info->pan_exist) { in btc8723b2ant_action_algorithm()
518 if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
519 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
523 } else if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
524 bt_link_info->pan_exist) { in btc8723b2ant_action_algorithm()
537 } else if (bt_link_info->pan_exist && in btc8723b2ant_action_algorithm()
538 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
555 if (bt_link_info->sco_exist) { in btc8723b2ant_action_algorithm()
556 if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
557 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
561 } else if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
562 bt_link_info->pan_exist) { in btc8723b2ant_action_algorithm()
576 } else if (bt_link_info->pan_exist && in btc8723b2ant_action_algorithm()
577 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
593 if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
594 bt_link_info->pan_exist && in btc8723b2ant_action_algorithm()
595 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
612 if (bt_link_info->sco_exist) { in btc8723b2ant_action_algorithm()
613 if (bt_link_info->hid_exist && in btc8723b2ant_action_algorithm()
614 bt_link_info->pan_exist && in btc8723b2ant_action_algorithm()
615 bt_link_info->a2dp_exist) { in btc8723b2ant_action_algorithm()
636 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_fw_dac_swing_level()
649 btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); in btc8723b2ant_set_fw_dac_swing_level()
655 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_fw_dec_bt_pwr()
663 btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter); in btc8723b2ant_set_fw_dec_bt_pwr()
669 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_dec_bt_pwr()
673 coex_dm->cur_dec_bt_pwr_lvl = dec_bt_pwr_lvl; in btc8723b2ant_dec_bt_pwr()
678 coex_dm->pre_dec_bt_pwr_lvl, in btc8723b2ant_dec_bt_pwr()
679 coex_dm->cur_dec_bt_pwr_lvl); in btc8723b2ant_dec_bt_pwr()
681 if (coex_dm->pre_dec_bt_pwr_lvl == coex_dm->cur_dec_bt_pwr_lvl) in btc8723b2ant_dec_bt_pwr()
684 btc8723b2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr_lvl); in btc8723b2ant_dec_bt_pwr()
686 coex_dm->pre_dec_bt_pwr_lvl = coex_dm->cur_dec_bt_pwr_lvl; in btc8723b2ant_dec_bt_pwr()
700 btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter); in halbtc8723b2ant_set_bt_auto_report()
707 coex_dm->cur_bt_auto_report = enable_auto_report; in btc8723b2ant_bt_auto_report()
710 if (coex_dm->pre_bt_auto_report == coex_dm->cur_bt_auto_report) in btc8723b2ant_bt_auto_report()
714 coex_dm->cur_bt_auto_report); in btc8723b2ant_bt_auto_report()
716 coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report; in btc8723b2ant_bt_auto_report()
722 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_fw_dac_swing_lvl()
727 coex_dm->cur_fw_dac_swing_lvl = fw_dac_swing_lvl; in btc8723b2ant_fw_dac_swing_lvl()
732 coex_dm->pre_fw_dac_swing_lvl, in btc8723b2ant_fw_dac_swing_lvl()
733 coex_dm->cur_fw_dac_swing_lvl); in btc8723b2ant_fw_dac_swing_lvl()
735 if (coex_dm->pre_fw_dac_swing_lvl == in btc8723b2ant_fw_dac_swing_lvl()
736 coex_dm->cur_fw_dac_swing_lvl) in btc8723b2ant_fw_dac_swing_lvl()
741 coex_dm->cur_fw_dac_swing_lvl); in btc8723b2ant_fw_dac_swing_lvl()
742 coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; in btc8723b2ant_fw_dac_swing_lvl()
748 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b_set_penalty_txrate()
756 h2c_parameter[2] = 0x00; in btc8723b_set_penalty_txrate()
763 "[BTCoex], set WiFi Low-Penalty Retry: %s", in btc8723b_set_penalty_txrate()
766 btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); in btc8723b_set_penalty_txrate()
772 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_low_penalty_ra()
778 coex_dm->cur_low_penalty_ra = low_penalty_ra; in btc8723b2ant_low_penalty_ra()
783 coex_dm->pre_low_penalty_ra, in btc8723b2ant_low_penalty_ra()
784 coex_dm->cur_low_penalty_ra); in btc8723b2ant_low_penalty_ra()
786 if (coex_dm->pre_low_penalty_ra == coex_dm->cur_low_penalty_ra) in btc8723b2ant_low_penalty_ra()
789 btc8723b_set_penalty_txrate(btcoexist, coex_dm->cur_low_penalty_ra); in btc8723b2ant_low_penalty_ra()
791 coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; in btc8723b2ant_low_penalty_ra()
797 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_dac_swing_reg()
802 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x883, 0x3e, val); in btc8723b2ant_set_dac_swing_reg()
819 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_dac_swing()
825 coex_dm->cur_dac_swing_on = dac_swing_on; in btc8723b2ant_dac_swing()
826 coex_dm->cur_dac_swing_lvl = dac_swing_lvl; in btc8723b2ant_dac_swing()
831 coex_dm->pre_dac_swing_on, in btc8723b2ant_dac_swing()
832 coex_dm->pre_dac_swing_lvl, in btc8723b2ant_dac_swing()
833 coex_dm->cur_dac_swing_on, in btc8723b2ant_dac_swing()
834 coex_dm->cur_dac_swing_lvl); in btc8723b2ant_dac_swing()
836 if ((coex_dm->pre_dac_swing_on == coex_dm->cur_dac_swing_on) && in btc8723b2ant_dac_swing()
837 (coex_dm->pre_dac_swing_lvl == coex_dm->cur_dac_swing_lvl)) in btc8723b2ant_dac_swing()
844 coex_dm->pre_dac_swing_on = coex_dm->cur_dac_swing_on; in btc8723b2ant_dac_swing()
845 coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; in btc8723b2ant_dac_swing()
852 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_coex_table()
856 btcoexist->btc_write_4byte(btcoexist, 0x6c0, val0x6c0); in btc8723b2ant_set_coex_table()
860 btcoexist->btc_write_4byte(btcoexist, 0x6c4, val0x6c4); in btc8723b2ant_set_coex_table()
864 btcoexist->btc_write_4byte(btcoexist, 0x6c8, val0x6c8); in btc8723b2ant_set_coex_table()
868 btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); in btc8723b2ant_set_coex_table()
876 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_coex_table()
882 coex_dm->cur_val0x6c0 = val0x6c0; in btc8723b2ant_coex_table()
883 coex_dm->cur_val0x6c4 = val0x6c4; in btc8723b2ant_coex_table()
884 coex_dm->cur_val0x6c8 = val0x6c8; in btc8723b2ant_coex_table()
885 coex_dm->cur_val0x6cc = val0x6cc; in btc8723b2ant_coex_table()
890 coex_dm->pre_val0x6c0, coex_dm->pre_val0x6c4, in btc8723b2ant_coex_table()
891 coex_dm->pre_val0x6c8, coex_dm->pre_val0x6cc); in btc8723b2ant_coex_table()
894 coex_dm->cur_val0x6c0, coex_dm->cur_val0x6c4, in btc8723b2ant_coex_table()
895 coex_dm->cur_val0x6c8, coex_dm->cur_val0x6cc); in btc8723b2ant_coex_table()
897 if ((coex_dm->pre_val0x6c0 == coex_dm->cur_val0x6c0) && in btc8723b2ant_coex_table()
898 (coex_dm->pre_val0x6c4 == coex_dm->cur_val0x6c4) && in btc8723b2ant_coex_table()
899 (coex_dm->pre_val0x6c8 == coex_dm->cur_val0x6c8) && in btc8723b2ant_coex_table()
900 (coex_dm->pre_val0x6cc == coex_dm->cur_val0x6cc)) in btc8723b2ant_coex_table()
906 coex_dm->pre_val0x6c0 = coex_dm->cur_val0x6c0; in btc8723b2ant_coex_table()
907 coex_dm->pre_val0x6c4 = coex_dm->cur_val0x6c4; in btc8723b2ant_coex_table()
908 coex_dm->pre_val0x6c8 = coex_dm->cur_val0x6c8; in btc8723b2ant_coex_table()
909 coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; in btc8723b2ant_coex_table()
924 case 2: in btc8723b2ant_coex_table_with_type()
988 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_fw_ignore_wlan_act()
998 btcoexist->btc_fill_h2c(btcoexist, 0x63, 1, h2c_parameter); in btc8723b2ant_set_fw_ignore_wlan_act()
1007 btcoexist->btc_set(btcoexist, BTC_SET_U1_LPS_VAL, &lps); in btc8723b2ant_set_lps_rpwm()
1008 btcoexist->btc_set(btcoexist, BTC_SET_U1_RPWM_VAL, &rpwm); in btc8723b2ant_set_lps_rpwm()
1014 coex_dm->cur_lps = lps_val; in btc8723b2ant_lps_rpwm()
1015 coex_dm->cur_rpwm = rpwm_val; in btc8723b2ant_lps_rpwm()
1018 if ((coex_dm->pre_lps == coex_dm->cur_lps) && in btc8723b2ant_lps_rpwm()
1019 (coex_dm->pre_rpwm == coex_dm->cur_rpwm)) in btc8723b2ant_lps_rpwm()
1024 coex_dm->pre_lps = coex_dm->cur_lps; in btc8723b2ant_lps_rpwm()
1025 coex_dm->pre_rpwm = coex_dm->cur_rpwm; in btc8723b2ant_lps_rpwm()
1031 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_ignore_wlan_act()
1036 coex_dm->cur_ignore_wlan_act = enable; in btc8723b2ant_ignore_wlan_act()
1041 coex_dm->pre_ignore_wlan_act, in btc8723b2ant_ignore_wlan_act()
1042 coex_dm->cur_ignore_wlan_act); in btc8723b2ant_ignore_wlan_act()
1044 if (coex_dm->pre_ignore_wlan_act == in btc8723b2ant_ignore_wlan_act()
1045 coex_dm->cur_ignore_wlan_act) in btc8723b2ant_ignore_wlan_act()
1050 coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; in btc8723b2ant_ignore_wlan_act()
1056 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_set_fw_ps_tdma()
1058 if ((coex_sta->a2dp_exist) && (coex_sta->hid_exist)) in btc8723b2ant_set_fw_ps_tdma()
1063 h2c_parameter[2] = byte3; in btc8723b2ant_set_fw_ps_tdma()
1067 coex_dm->ps_tdma_para[0] = byte1; in btc8723b2ant_set_fw_ps_tdma()
1068 coex_dm->ps_tdma_para[1] = byte2; in btc8723b2ant_set_fw_ps_tdma()
1069 coex_dm->ps_tdma_para[2] = byte3; in btc8723b2ant_set_fw_ps_tdma()
1070 coex_dm->ps_tdma_para[3] = byte4; in btc8723b2ant_set_fw_ps_tdma()
1071 coex_dm->ps_tdma_para[4] = byte5; in btc8723b2ant_set_fw_ps_tdma()
1076 h2c_parameter[1] << 24 | h2c_parameter[2] << 16 | in btc8723b2ant_set_fw_ps_tdma()
1079 btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); in btc8723b2ant_set_fw_ps_tdma()
1093 struct btc_board_info *board_info = &btcoexist->board_info; in btc8723b2ant_set_ant_path()
1097 u8 h2c_parameter[2] = {0}; in btc8723b2ant_set_ant_path()
1099 btcoexist->btc_get(btcoexist, BTC_GET_BL_EXT_SWITCH, &pg_ext_switch); in btc8723b2ant_set_ant_path()
1100 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in btc8723b2ant_set_ant_path()
1106 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x39, 0x8, 0x1); in btc8723b2ant_set_ant_path()
1107 btcoexist->btc_write_1byte(btcoexist, 0x974, 0xff); in btc8723b2ant_set_ant_path()
1108 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x944, 0x3, 0x3); in btc8723b2ant_set_ant_path()
1109 btcoexist->btc_write_1byte(btcoexist, 0x930, 0x77); in btc8723b2ant_set_ant_path()
1110 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x67, 0x20, 0x1); in btc8723b2ant_set_ant_path()
1115 btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, in btc8723b2ant_set_ant_path()
1118 btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18); in btc8723b2ant_set_ant_path()
1121 btcoexist->btc_write_4byte(btcoexist, 0x948, 0x0); in btc8723b2ant_set_ant_path()
1123 /* WiFi TRx Mask off */ in btc8723b2ant_set_ant_path()
1124 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, in btc8723b2ant_set_ant_path()
1127 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) { in btc8723b2ant_set_ant_path()
1142 btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, h2c_parameter); in btc8723b2ant_set_ant_path()
1147 btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, in btc8723b2ant_set_ant_path()
1150 btcoexist->btc_write_1byte(btcoexist, 0x765, 0x0); in btc8723b2ant_set_ant_path()
1158 u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); in btc8723b2ant_set_ant_path()
1161 btcoexist->btc_write_4byte(btcoexist, 0x4c, u32tmp); in btc8723b2ant_set_ant_path()
1164 /* fixed internal switch S1->WiFi, S0->BT */ in btc8723b2ant_set_ant_path()
1165 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) in btc8723b2ant_set_ant_path()
1166 btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); in btc8723b2ant_set_ant_path()
1168 btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); in btc8723b2ant_set_ant_path()
1172 /* ext switch main at wifi */ in btc8723b2ant_set_ant_path()
1173 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x92c, in btc8723b2ant_set_ant_path()
1177 /* ext switch aux at wifi */ in btc8723b2ant_set_ant_path()
1178 btcoexist->btc_write_1byte_bitmask(btcoexist, in btc8723b2ant_set_ant_path()
1186 u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); in btc8723b2ant_set_ant_path()
1189 btcoexist->btc_write_4byte(btcoexist, 0x4c, u32tmp); in btc8723b2ant_set_ant_path()
1192 /* fixed ext switch, S1->Main, S0->Aux */ in btc8723b2ant_set_ant_path()
1193 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x64, 0x1, 0x0); in btc8723b2ant_set_ant_path()
1196 /* fixed internal switch S1->WiFi, S0->BT */ in btc8723b2ant_set_ant_path()
1197 btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); in btc8723b2ant_set_ant_path()
1200 /* fixed internal switch S0->WiFi, S1->BT */ in btc8723b2ant_set_ant_path()
1201 btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); in btc8723b2ant_set_ant_path()
1210 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_ps_tdma()
1211 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8723b2ant_ps_tdma()
1215 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_ps_tdma()
1216 coex_dm->switch_thres_offset; in btc8723b2ant_ps_tdma()
1218 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, tmp, 0); in btc8723b2ant_ps_tdma()
1219 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_ps_tdma()
1220 coex_dm->switch_thres_offset; in btc8723b2ant_ps_tdma()
1221 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_ps_tdma()
1227 coex_dm->cur_ps_tdma_on = turn_on; in btc8723b2ant_ps_tdma()
1228 coex_dm->cur_ps_tdma = type; in btc8723b2ant_ps_tdma()
1232 /* for WiFi RSSI low or BT RSSI low */ in btc8723b2ant_ps_tdma()
1234 coex_dm->is_switch_to_1dot5_ant = true; in btc8723b2ant_ps_tdma()
1236 coex_dm->is_switch_to_1dot5_ant = false; in btc8723b2ant_ps_tdma()
1242 coex_dm->pre_ps_tdma_on, coex_dm->cur_ps_tdma_on); in btc8723b2ant_ps_tdma()
1245 coex_dm->pre_ps_tdma, coex_dm->cur_ps_tdma); in btc8723b2ant_ps_tdma()
1247 if ((coex_dm->pre_ps_tdma_on == coex_dm->cur_ps_tdma_on) && in btc8723b2ant_ps_tdma()
1248 (coex_dm->pre_ps_tdma == coex_dm->cur_ps_tdma)) in btc8723b2ant_ps_tdma()
1252 if (coex_sta->scan_ap_num <= 5) { in btc8723b2ant_ps_tdma()
1253 if (coex_sta->a2dp_bit_pool >= 45) in btc8723b2ant_ps_tdma()
1254 wifi_duration_adjust = -15; in btc8723b2ant_ps_tdma()
1255 else if (coex_sta->a2dp_bit_pool >= 35) in btc8723b2ant_ps_tdma()
1256 wifi_duration_adjust = -10; in btc8723b2ant_ps_tdma()
1259 } else if (coex_sta->scan_ap_num <= 20) { in btc8723b2ant_ps_tdma()
1260 if (coex_sta->a2dp_bit_pool >= 45) in btc8723b2ant_ps_tdma()
1261 wifi_duration_adjust = -15; in btc8723b2ant_ps_tdma()
1262 else if (coex_sta->a2dp_bit_pool >= 35) in btc8723b2ant_ps_tdma()
1263 wifi_duration_adjust = -10; in btc8723b2ant_ps_tdma()
1266 } else if (coex_sta->scan_ap_num <= 40) { in btc8723b2ant_ps_tdma()
1267 if (coex_sta->a2dp_bit_pool >= 45) in btc8723b2ant_ps_tdma()
1268 wifi_duration_adjust = -15; in btc8723b2ant_ps_tdma()
1269 else if (coex_sta->a2dp_bit_pool >= 35) in btc8723b2ant_ps_tdma()
1270 wifi_duration_adjust = -10; in btc8723b2ant_ps_tdma()
1272 wifi_duration_adjust = -5; in btc8723b2ant_ps_tdma()
1274 if (coex_sta->a2dp_bit_pool >= 45) in btc8723b2ant_ps_tdma()
1275 wifi_duration_adjust = -15; in btc8723b2ant_ps_tdma()
1276 else if (coex_sta->a2dp_bit_pool >= 35) in btc8723b2ant_ps_tdma()
1277 wifi_duration_adjust = -10; in btc8723b2ant_ps_tdma()
1279 wifi_duration_adjust = -10; in btc8723b2ant_ps_tdma()
1282 if ((bt_link_info->slave_role) && (bt_link_info->a2dp_exist)) in btc8723b2ant_ps_tdma()
1283 /* 0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) */ in btc8723b2ant_ps_tdma()
1294 case 2: in btc8723b2ant_ps_tdma()
1467 coex_dm->pre_ps_tdma_on = coex_dm->cur_ps_tdma_on; in btc8723b2ant_ps_tdma()
1468 coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; in btc8723b2ant_ps_tdma()
1476 btcoexist->btc_get(btcoexist, BTC_GET_U1_LPS_MODE, &lps_mode); in btc8723b2ant_ps_tdma_check_for_power_save_state()
1506 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8723b2ant_power_save_state()
1508 btcoexist->btc_set(btcoexist, BTC_SET_ACT_NORMAL_LPS, NULL); in btc8723b2ant_power_save_state()
1509 coex_sta->force_lps_on = false; in btc8723b2ant_power_save_state()
1518 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8723b2ant_power_save_state()
1521 btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); in btc8723b2ant_power_save_state()
1522 coex_sta->force_lps_on = true; in btc8723b2ant_power_save_state()
1527 btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); in btc8723b2ant_power_save_state()
1528 coex_sta->force_lps_on = false; in btc8723b2ant_power_save_state()
1547 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_coex_alloff()
1563 coex_sta->pop_event_cnt = 0; in btc8723b2ant_init_coex_dm()
1568 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_action_bt_inquiry()
1573 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8723b2ant_action_bt_inquiry()
1575 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8723b2ant_action_bt_inquiry()
1578 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8723b2ant_action_bt_inquiry()
1579 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8723b2ant_action_bt_inquiry()
1580 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8723b2ant_action_bt_inquiry()
1584 if (coex_sta->bt_abnormal_scan) { in btc8723b2ant_action_bt_inquiry()
1589 "[BTCoex], Wifi link process + BT Inq/Page!!\n"); in btc8723b2ant_action_bt_inquiry()
1594 "[BTCoex], Wifi connected + BT Inq/Page!!\n"); in btc8723b2ant_action_bt_inquiry()
1610 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_action_wifi_link_process()
1619 u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x948); in btc8723b2ant_action_wifi_link_process()
1620 u8tmpa = btcoexist->btc_read_1byte(btcoexist, 0x765); in btc8723b2ant_action_wifi_link_process()
1621 u8tmpb = btcoexist->btc_read_1byte(btcoexist, 0x76e); in btc8723b2ant_action_wifi_link_process()
1630 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_action_wifi_idle_process()
1633 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_wifi_idle_process()
1634 coex_dm->switch_thres_offset - coex_dm->switch_thres_offset; in btc8723b2ant_action_wifi_idle_process()
1636 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_wifi_idle_process()
1637 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_wifi_idle_process()
1639 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_wifi_idle_process()
1640 coex_dm->switch_thres_offset - coex_dm->switch_thres_offset; in btc8723b2ant_action_wifi_idle_process()
1641 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_wifi_idle_process()
1643 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num); in btc8723b2ant_action_wifi_idle_process()
1646 if (BTC_RSSI_HIGH(wifi_rssi_state1) && (coex_sta->hid_exist) && in btc8723b2ant_action_wifi_idle_process()
1647 (coex_sta->a2dp_exist)) { in btc8723b2ant_action_wifi_idle_process()
1649 "[BTCoex], Wifi idle process for BT HID+A2DP exist!!\n"); in btc8723b2ant_action_wifi_idle_process()
1671 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_is_common_action()
1676 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8723b2ant_is_common_action()
1677 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8723b2ant_is_common_action()
1679 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8723b2ant_is_common_action()
1683 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8723b2ant_is_common_action()
1689 "[BTCoex], Wifi non-connected idle!!\n"); in btc8723b2ant_is_common_action()
1691 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8723b2ant_is_common_action()
1704 coex_dm->bt_status) { in btc8723b2ant_is_common_action()
1706 btcoexist->btc_set(btcoexist, in btc8723b2ant_is_common_action()
1713 "[BTCoex], Wifi connected + BT non connected-idle!!\n"); in btc8723b2ant_is_common_action()
1715 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8723b2ant_is_common_action()
1729 coex_dm->bt_status) { in btc8723b2ant_is_common_action()
1731 btcoexist->btc_set(btcoexist, in btc8723b2ant_is_common_action()
1738 "[BTCoex], Wifi connected + BT connected-idle!!\n"); in btc8723b2ant_is_common_action()
1742 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8723b2ant_is_common_action()
1757 btcoexist->btc_set(btcoexist, in btc8723b2ant_is_common_action()
1763 "[BTCoex], Wifi Connected-Busy + BT Busy!!\n"); in btc8723b2ant_is_common_action()
1767 "[BTCoex], Wifi Connected-Idle + BT Busy!!\n"); in btc8723b2ant_is_common_action()
1783 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_tdma_duration_adjust()
1785 /*0: no change, +1: increase WiFi duration, -1: decrease WiFi duration*/ in btc8723b2ant_tdma_duration_adjust()
1792 if (!coex_dm->auto_tdma_adjust) { in btc8723b2ant_tdma_duration_adjust()
1793 coex_dm->auto_tdma_adjust = true; in btc8723b2ant_tdma_duration_adjust()
1802 coex_dm->ps_tdma_du_adj_type = 13; in btc8723b2ant_tdma_duration_adjust()
1803 } else if (max_interval == 2) { in btc8723b2ant_tdma_duration_adjust()
1807 coex_dm->ps_tdma_du_adj_type = 14; in btc8723b2ant_tdma_duration_adjust()
1812 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
1817 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
1824 coex_dm->ps_tdma_du_adj_type = 9; in btc8723b2ant_tdma_duration_adjust()
1825 } else if (max_interval == 2) { in btc8723b2ant_tdma_duration_adjust()
1829 coex_dm->ps_tdma_du_adj_type = 10; in btc8723b2ant_tdma_duration_adjust()
1834 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
1839 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
1848 coex_dm->ps_tdma_du_adj_type = 5; in btc8723b2ant_tdma_duration_adjust()
1849 } else if (max_interval == 2) { in btc8723b2ant_tdma_duration_adjust()
1853 coex_dm->ps_tdma_du_adj_type = 6; in btc8723b2ant_tdma_duration_adjust()
1858 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
1863 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
1870 coex_dm->ps_tdma_du_adj_type = 1; in btc8723b2ant_tdma_duration_adjust()
1871 } else if (max_interval == 2) { in btc8723b2ant_tdma_duration_adjust()
1874 true, 2); in btc8723b2ant_tdma_duration_adjust()
1875 coex_dm->ps_tdma_du_adj_type = 2; in btc8723b2ant_tdma_duration_adjust()
1880 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
1885 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
1898 retry_count = coex_sta->bt_retry_cnt; in btc8723b2ant_tdma_duration_adjust()
1900 if ((coex_sta->low_priority_tx) > 1050 || in btc8723b2ant_tdma_duration_adjust()
1901 (coex_sta->low_priority_rx) > 1250) in btc8723b2ant_tdma_duration_adjust()
1911 /* no retry in the last 2-second duration*/ in btc8723b2ant_tdma_duration_adjust()
1914 dn--; in btc8723b2ant_tdma_duration_adjust()
1920 /* if retry count during continuous n*2 in btc8723b2ant_tdma_duration_adjust()
1921 * seconds is 0, enlarge WiFi duration in btc8723b2ant_tdma_duration_adjust()
1929 "[BTCoex], Increase wifi duration!!\n"); in btc8723b2ant_tdma_duration_adjust()
1930 } /* <=3 retry in the last 2-second duration*/ in btc8723b2ant_tdma_duration_adjust()
1932 up--; in btc8723b2ant_tdma_duration_adjust()
1938 if (dn == 2) { in btc8723b2ant_tdma_duration_adjust()
1939 /* if continuous 2 retry count(every 2 in btc8723b2ant_tdma_duration_adjust()
1940 * seconds) >0 and < 3, reduce WiFi duration in btc8723b2ant_tdma_duration_adjust()
1942 if (wait_count <= 2) in btc8723b2ant_tdma_duration_adjust()
1950 * need to adjust wifi duration in in btc8723b2ant_tdma_duration_adjust()
1959 result = -1; in btc8723b2ant_tdma_duration_adjust()
1961 "[BTCoex], Decrease wifi duration for retry_counter<3!!\n"); in btc8723b2ant_tdma_duration_adjust()
1965 * WiFi duration in btc8723b2ant_tdma_duration_adjust()
1975 * adjust wifi duration in maximum time interval in btc8723b2ant_tdma_duration_adjust()
1984 result = -1; in btc8723b2ant_tdma_duration_adjust()
1986 "[BTCoex], Decrease wifi duration for retry_counter>3!!\n"); in btc8723b2ant_tdma_duration_adjust()
1993 if (coex_dm->cur_ps_tdma == 71) { in btc8723b2ant_tdma_duration_adjust()
1997 coex_dm->ps_tdma_du_adj_type = 5; in btc8723b2ant_tdma_duration_adjust()
1998 } else if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2002 coex_dm->ps_tdma_du_adj_type = 5; in btc8723b2ant_tdma_duration_adjust()
2003 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2007 coex_dm->ps_tdma_du_adj_type = 6; in btc8723b2ant_tdma_duration_adjust()
2008 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2012 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
2013 } else if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2017 coex_dm->ps_tdma_du_adj_type = 8; in btc8723b2ant_tdma_duration_adjust()
2019 if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2023 coex_dm->ps_tdma_du_adj_type = 13; in btc8723b2ant_tdma_duration_adjust()
2024 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2028 coex_dm->ps_tdma_du_adj_type = 14; in btc8723b2ant_tdma_duration_adjust()
2029 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2033 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
2034 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2038 coex_dm->ps_tdma_du_adj_type = 16; in btc8723b2ant_tdma_duration_adjust()
2041 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2042 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2046 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2048 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2052 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2054 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2058 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2060 } else if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2064 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2066 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2070 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2072 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2076 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2080 if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2084 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2086 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2090 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2092 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2096 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2098 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2102 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2104 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2108 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2110 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2114 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2119 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2123 coex_dm->ps_tdma_du_adj_type = 71; in btc8723b2ant_tdma_duration_adjust()
2124 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2127 true, 2); in btc8723b2ant_tdma_duration_adjust()
2128 coex_dm->ps_tdma_du_adj_type = 2; in btc8723b2ant_tdma_duration_adjust()
2129 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2133 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
2134 } else if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2138 coex_dm->ps_tdma_du_adj_type = 4; in btc8723b2ant_tdma_duration_adjust()
2140 if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2144 coex_dm->ps_tdma_du_adj_type = 9; in btc8723b2ant_tdma_duration_adjust()
2145 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2149 coex_dm->ps_tdma_du_adj_type = 10; in btc8723b2ant_tdma_duration_adjust()
2150 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2154 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
2155 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2159 coex_dm->ps_tdma_du_adj_type = 12; in btc8723b2ant_tdma_duration_adjust()
2162 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2163 if (coex_dm->cur_ps_tdma == 71) { in btc8723b2ant_tdma_duration_adjust()
2167 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2169 } else if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2172 true, 2); in btc8723b2ant_tdma_duration_adjust()
2173 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2174 2; in btc8723b2ant_tdma_duration_adjust()
2175 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2179 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2181 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2185 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2187 } else if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2191 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2193 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2197 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2199 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2203 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2207 if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2211 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2213 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2216 true, 2); in btc8723b2ant_tdma_duration_adjust()
2217 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2218 2; in btc8723b2ant_tdma_duration_adjust()
2219 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2223 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2225 } else if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2229 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2231 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2235 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2237 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2241 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2243 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2247 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2252 } else if (max_interval == 2) { in btc8723b2ant_tdma_duration_adjust()
2254 if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2258 coex_dm->ps_tdma_du_adj_type = 6; in btc8723b2ant_tdma_duration_adjust()
2259 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2263 coex_dm->ps_tdma_du_adj_type = 6; in btc8723b2ant_tdma_duration_adjust()
2264 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2268 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
2269 } else if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2273 coex_dm->ps_tdma_du_adj_type = 8; in btc8723b2ant_tdma_duration_adjust()
2275 if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2279 coex_dm->ps_tdma_du_adj_type = 14; in btc8723b2ant_tdma_duration_adjust()
2280 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2284 coex_dm->ps_tdma_du_adj_type = 14; in btc8723b2ant_tdma_duration_adjust()
2285 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2289 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
2290 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2294 coex_dm->ps_tdma_du_adj_type = 16; in btc8723b2ant_tdma_duration_adjust()
2296 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2297 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2301 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2303 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2307 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2309 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2313 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2315 } else if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2319 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2321 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2325 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2327 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2331 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2335 if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2339 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2341 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2345 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2347 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2351 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2353 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2357 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2359 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2363 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2365 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2369 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2374 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2377 true, 2); in btc8723b2ant_tdma_duration_adjust()
2378 coex_dm->ps_tdma_du_adj_type = 2; in btc8723b2ant_tdma_duration_adjust()
2379 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2382 true, 2); in btc8723b2ant_tdma_duration_adjust()
2383 coex_dm->ps_tdma_du_adj_type = 2; in btc8723b2ant_tdma_duration_adjust()
2384 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2388 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
2389 } else if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2393 coex_dm->ps_tdma_du_adj_type = 4; in btc8723b2ant_tdma_duration_adjust()
2395 if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2399 coex_dm->ps_tdma_du_adj_type = 10; in btc8723b2ant_tdma_duration_adjust()
2400 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2404 coex_dm->ps_tdma_du_adj_type = 10; in btc8723b2ant_tdma_duration_adjust()
2405 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2409 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
2410 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2414 coex_dm->ps_tdma_du_adj_type = 12; in btc8723b2ant_tdma_duration_adjust()
2416 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2417 if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2420 true, 2); in btc8723b2ant_tdma_duration_adjust()
2421 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2422 2; in btc8723b2ant_tdma_duration_adjust()
2423 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2427 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2429 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2433 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2435 } else if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2439 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2441 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2445 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2447 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2451 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2455 if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2459 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2461 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2464 true, 2); in btc8723b2ant_tdma_duration_adjust()
2465 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2466 2; in btc8723b2ant_tdma_duration_adjust()
2467 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2470 true, 2); in btc8723b2ant_tdma_duration_adjust()
2471 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2472 2; in btc8723b2ant_tdma_duration_adjust()
2473 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2477 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2479 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2483 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2485 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2489 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2496 if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2500 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
2501 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2505 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
2506 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2510 coex_dm->ps_tdma_du_adj_type = 7; in btc8723b2ant_tdma_duration_adjust()
2511 } else if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2515 coex_dm->ps_tdma_du_adj_type = 8; in btc8723b2ant_tdma_duration_adjust()
2517 if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2521 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
2522 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2526 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
2527 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2531 coex_dm->ps_tdma_du_adj_type = 15; in btc8723b2ant_tdma_duration_adjust()
2532 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2536 coex_dm->ps_tdma_du_adj_type = 16; in btc8723b2ant_tdma_duration_adjust()
2538 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2539 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2543 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2545 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2549 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2551 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2555 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2557 } else if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2561 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2563 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2567 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2569 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2573 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2577 if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2581 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2583 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2587 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2589 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2593 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2595 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2599 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2601 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2605 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2607 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2611 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2616 if (coex_dm->cur_ps_tdma == 5) { in btc8723b2ant_tdma_duration_adjust()
2620 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
2621 } else if (coex_dm->cur_ps_tdma == 6) { in btc8723b2ant_tdma_duration_adjust()
2625 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
2626 } else if (coex_dm->cur_ps_tdma == 7) { in btc8723b2ant_tdma_duration_adjust()
2630 coex_dm->ps_tdma_du_adj_type = 3; in btc8723b2ant_tdma_duration_adjust()
2631 } else if (coex_dm->cur_ps_tdma == 8) { in btc8723b2ant_tdma_duration_adjust()
2635 coex_dm->ps_tdma_du_adj_type = 4; in btc8723b2ant_tdma_duration_adjust()
2637 if (coex_dm->cur_ps_tdma == 13) { in btc8723b2ant_tdma_duration_adjust()
2641 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
2642 } else if (coex_dm->cur_ps_tdma == 14) { in btc8723b2ant_tdma_duration_adjust()
2646 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
2647 } else if (coex_dm->cur_ps_tdma == 15) { in btc8723b2ant_tdma_duration_adjust()
2651 coex_dm->ps_tdma_du_adj_type = 11; in btc8723b2ant_tdma_duration_adjust()
2652 } else if (coex_dm->cur_ps_tdma == 16) { in btc8723b2ant_tdma_duration_adjust()
2656 coex_dm->ps_tdma_du_adj_type = 12; in btc8723b2ant_tdma_duration_adjust()
2658 if (result == -1) { in btc8723b2ant_tdma_duration_adjust()
2659 if (coex_dm->cur_ps_tdma == 1) { in btc8723b2ant_tdma_duration_adjust()
2663 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2665 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2669 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2671 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2675 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2677 } else if (coex_dm->cur_ps_tdma == 9) { in btc8723b2ant_tdma_duration_adjust()
2681 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2683 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2687 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2689 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2693 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2697 if (coex_dm->cur_ps_tdma == 4) { in btc8723b2ant_tdma_duration_adjust()
2701 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2703 } else if (coex_dm->cur_ps_tdma == 3) { in btc8723b2ant_tdma_duration_adjust()
2707 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2709 } else if (coex_dm->cur_ps_tdma == 2) { in btc8723b2ant_tdma_duration_adjust()
2713 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2715 } else if (coex_dm->cur_ps_tdma == 12) { in btc8723b2ant_tdma_duration_adjust()
2719 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2721 } else if (coex_dm->cur_ps_tdma == 11) { in btc8723b2ant_tdma_duration_adjust()
2725 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2727 } else if (coex_dm->cur_ps_tdma == 10) { in btc8723b2ant_tdma_duration_adjust()
2731 coex_dm->ps_tdma_du_adj_type = in btc8723b2ant_tdma_duration_adjust()
2745 if (coex_dm->cur_ps_tdma != coex_dm->ps_tdma_du_adj_type) { in btc8723b2ant_tdma_duration_adjust()
2749 coex_dm->cur_ps_tdma, coex_dm->ps_tdma_du_adj_type); in btc8723b2ant_tdma_duration_adjust()
2751 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8723b2ant_tdma_duration_adjust()
2752 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8723b2ant_tdma_duration_adjust()
2753 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8723b2ant_tdma_duration_adjust()
2757 coex_dm->ps_tdma_du_adj_type); in btc8723b2ant_tdma_duration_adjust()
2770 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_sco()
2772 btcoexist, 2, BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_sco()
2773 coex_dm->switch_thres_offset, in btc8723b2ant_action_sco()
2776 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_sco()
2782 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_sco()
2786 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_sco()
2790 btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_sco()
2792 /* for SCO quality & wifi performance balance at 11n mode */ in btc8723b2ant_action_sco()
2812 u8 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_hid()
2813 coex_dm->switch_thres_offset; in btc8723b2ant_action_hid()
2815 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_hid()
2816 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_hid()
2818 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_hid()
2824 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_hid()
2828 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_hid()
2834 /* for HID quality & wifi performance balance at 11n mode */ in btc8723b2ant_action_hid()
2858 u8 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_a2dp()
2859 coex_dm->switch_thres_offset; in btc8723b2ant_action_a2dp()
2861 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_a2dp()
2862 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, 40, 0); in btc8723b2ant_action_a2dp()
2863 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_a2dp()
2865 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num); in btc8723b2ant_action_a2dp()
2870 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8723b2ant_action_a2dp()
2878 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_a2dp()
2889 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_a2dp()
2895 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_a2dp()
2917 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_a2dp()
2931 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_a2dp_pan_hs()
2932 coex_dm->switch_thres_offset; in btc8723b2ant_action_a2dp_pan_hs()
2934 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_a2dp_pan_hs()
2935 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_a2dp_pan_hs()
2937 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_a2dp_pan_hs()
2938 coex_dm->switch_thres_offset; in btc8723b2ant_action_a2dp_pan_hs()
2939 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_a2dp_pan_hs()
2941 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_a2dp_pan_hs()
2947 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_a2dp_pan_hs()
2961 btc8723b2ant_tdma_duration_adjust(btcoexist, false, true, 2); in btc8723b2ant_action_a2dp_pan_hs()
2964 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_a2dp_pan_hs()
2978 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr()
2979 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr()
2981 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_pan_edr()
2982 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_pan_edr()
2984 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr()
2985 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr()
2986 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_pan_edr()
2988 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_pan_edr()
2994 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_pan_edr()
3015 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_pan_edr()
3030 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_hs()
3031 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_hs()
3033 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_pan_hs()
3034 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_pan_hs()
3036 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_hs()
3037 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_hs()
3038 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_pan_hs()
3040 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_pan_hs()
3046 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_pan_hs()
3053 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_pan_hs()
3068 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr_a2dp()
3069 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr_a2dp()
3071 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_pan_edr_a2dp()
3072 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_pan_edr_a2dp()
3074 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr_a2dp()
3075 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr_a2dp()
3076 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_pan_edr_a2dp()
3078 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_pan_edr_a2dp()
3083 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_pan_edr_a2dp()
3093 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_pan_edr_a2dp()
3123 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr_hid()
3124 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr_hid()
3126 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_pan_edr_hid()
3127 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_pan_edr_hid()
3129 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_pan_edr_hid()
3130 coex_dm->switch_thres_offset; in btc8723b2ant_action_pan_edr_hid()
3131 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_pan_edr_hid()
3132 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_pan_edr_hid()
3137 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_pan_edr_hid()
3156 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8723b2ant_action_pan_edr_hid()
3161 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8723b2ant_action_pan_edr_hid()
3164 btc8723b2ant_tdma_duration_adjust(btcoexist, true, false, 2); in btc8723b2ant_action_pan_edr_hid()
3167 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8723b2ant_action_pan_edr_hid()
3169 btc8723b2ant_tdma_duration_adjust(btcoexist, true, true, 2); in btc8723b2ant_action_pan_edr_hid()
3187 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_hid_a2dp_pan_edr()
3188 coex_dm->switch_thres_offset; in btc8723b2ant_action_hid_a2dp_pan_edr()
3190 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_hid_a2dp_pan_edr()
3191 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_hid_a2dp_pan_edr()
3193 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_hid_a2dp_pan_edr()
3194 coex_dm->switch_thres_offset; in btc8723b2ant_action_hid_a2dp_pan_edr()
3195 bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0); in btc8723b2ant_action_hid_a2dp_pan_edr()
3197 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_hid_a2dp_pan_edr()
3203 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_hid_a2dp_pan_edr()
3217 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_hid_a2dp_pan_edr()
3224 true, 2); in btc8723b2ant_action_hid_a2dp_pan_edr()
3247 u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_hid_a2dp()
3248 coex_dm->switch_thres_offset; in btc8723b2ant_action_hid_a2dp()
3250 wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8723b2ant_action_hid_a2dp()
3251 wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8723b2ant_action_hid_a2dp()
3253 tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES - in btc8723b2ant_action_hid_a2dp()
3254 coex_dm->switch_thres_offset; in btc8723b2ant_action_hid_a2dp()
3257 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8723b2ant_action_hid_a2dp()
3262 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8723b2ant_action_hid_a2dp()
3266 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_hid_a2dp()
3268 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_hid_a2dp()
3280 NORMAL_EXEC, 2); in btc8723b2ant_action_hid_a2dp()
3282 btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8723b2ant_action_hid_a2dp()
3307 btcoexist->btc_write_1byte(btcoexist, 0x456, 0x38); in btc8723b2ant_action_hid_a2dp()
3308 btcoexist->btc_write_2byte(btcoexist, 0x42a, 0x0808); in btc8723b2ant_action_hid_a2dp()
3309 btcoexist->btc_write_4byte(btcoexist, 0x430, 0x0); in btc8723b2ant_action_hid_a2dp()
3310 btcoexist->btc_write_4byte(btcoexist, 0x434, 0x01010000); in btc8723b2ant_action_hid_a2dp()
3347 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8723b2ant_run_coexist_mechanism()
3351 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8723b2ant_run_coexist_mechanism()
3358 if (btcoexist->manual_control) { in btc8723b2ant_run_coexist_mechanism()
3364 if (coex_sta->under_ips) { in btc8723b2ant_run_coexist_mechanism()
3366 "[BTCoex], wifi is under IPS !!!\n"); in btc8723b2ant_run_coexist_mechanism()
3371 if (coex_sta->c2h_bt_inquiry_page && in btc8723b2ant_run_coexist_mechanism()
3379 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8723b2ant_run_coexist_mechanism()
3380 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8723b2ant_run_coexist_mechanism()
3381 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8723b2ant_run_coexist_mechanism()
3385 "[BTCoex], WiFi is under Link Process !!\n"); in btc8723b2ant_run_coexist_mechanism()
3391 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in btc8723b2ant_run_coexist_mechanism()
3395 if ((num_of_wifi_link >= 2) || in btc8723b2ant_run_coexist_mechanism()
3398 "############# [BTCoex], Multi-Port num_of_wifi_link = %d, wifi_link_status = 0x%x\n", in btc8723b2ant_run_coexist_mechanism()
3401 if (bt_link_info->bt_link_exist) in btc8723b2ant_run_coexist_mechanism()
3406 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8723b2ant_run_coexist_mechanism()
3414 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8723b2ant_run_coexist_mechanism()
3417 coex_dm->cur_algorithm = algorithm; in btc8723b2ant_run_coexist_mechanism()
3420 coex_dm->cur_algorithm); in btc8723b2ant_run_coexist_mechanism()
3424 "[BTCoex], Action 2-Ant common\n"); in btc8723b2ant_run_coexist_mechanism()
3425 coex_dm->auto_tdma_adjust = false; in btc8723b2ant_run_coexist_mechanism()
3427 if (coex_dm->cur_algorithm != coex_dm->pre_algorithm) { in btc8723b2ant_run_coexist_mechanism()
3430 coex_dm->pre_algorithm, in btc8723b2ant_run_coexist_mechanism()
3431 coex_dm->cur_algorithm); in btc8723b2ant_run_coexist_mechanism()
3432 coex_dm->auto_tdma_adjust = false; in btc8723b2ant_run_coexist_mechanism()
3434 switch (coex_dm->cur_algorithm) { in btc8723b2ant_run_coexist_mechanism()
3437 "[BTCoex], Action 2-Ant, algorithm = SCO\n"); in btc8723b2ant_run_coexist_mechanism()
3442 "[BTCoex], Action 2-Ant, algorithm = HID\n"); in btc8723b2ant_run_coexist_mechanism()
3447 "[BTCoex], Action 2-Ant, algorithm = A2DP\n"); in btc8723b2ant_run_coexist_mechanism()
3452 "[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS)\n"); in btc8723b2ant_run_coexist_mechanism()
3457 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)\n"); in btc8723b2ant_run_coexist_mechanism()
3462 "[BTCoex], Action 2-Ant, algorithm = HS mode\n"); in btc8723b2ant_run_coexist_mechanism()
3467 "[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"); in btc8723b2ant_run_coexist_mechanism()
3472 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID\n"); in btc8723b2ant_run_coexist_mechanism()
3477 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN\n"); in btc8723b2ant_run_coexist_mechanism()
3482 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"); in btc8723b2ant_run_coexist_mechanism()
3487 "[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"); in btc8723b2ant_run_coexist_mechanism()
3491 coex_dm->pre_algorithm = coex_dm->cur_algorithm; in btc8723b2ant_run_coexist_mechanism()
3498 u8 h2c_parameter[2] = {0}; in btc8723b2ant_wifioff_hwcfg()
3502 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in btc8723b2ant_wifioff_hwcfg()
3504 /* WiFi standby while GNT_BT 0 -> 1 */ in btc8723b2ant_wifioff_hwcfg()
3505 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); in btc8723b2ant_wifioff_hwcfg()
3507 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in btc8723b2ant_wifioff_hwcfg()
3511 btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, h2c_parameter); in btc8723b2ant_wifioff_hwcfg()
3513 btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18); in btc8723b2ant_wifioff_hwcfg()
3516 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_IS_IN_MP_MODE, in btc8723b2ant_wifioff_hwcfg()
3520 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x67, 0x20, 0x0); in btc8723b2ant_wifioff_hwcfg()
3522 /* BT select s0/s1 is controlled by WiFi */ in btc8723b2ant_wifioff_hwcfg()
3523 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x67, 0x20, 0x1); in btc8723b2ant_wifioff_hwcfg()
3531 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_init_hwconfig()
3535 "[BTCoex], 2Ant Init HW Config!!\n"); in ex_btc8723b2ant_init_hwconfig()
3536 coex_dm->bt_rf0x1e_backup = in ex_btc8723b2ant_init_hwconfig()
3537 btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff); in ex_btc8723b2ant_init_hwconfig()
3540 u8tmp = btcoexist->btc_read_1byte(btcoexist, 0x790); in ex_btc8723b2ant_init_hwconfig()
3543 btcoexist->btc_write_1byte(btcoexist, 0x790, u8tmp); in ex_btc8723b2ant_init_hwconfig()
3548 coex_sta->dis_ver_info_cnt = 0; in ex_btc8723b2ant_init_hwconfig()
3555 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in ex_btc8723b2ant_init_hwconfig()
3556 btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3); in ex_btc8723b2ant_init_hwconfig()
3557 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1); in ex_btc8723b2ant_init_hwconfig()
3558 btcoexist->auto_report_2ant = true; in ex_btc8723b2ant_init_hwconfig()
3563 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8723b2ant_power_on_setting()
3567 btcoexist->btc_write_1byte(btcoexist, 0x67, 0x20); in ex_btc8723b2ant_power_on_setting()
3570 u16tmp = btcoexist->btc_read_2byte(btcoexist, 0x2); in ex_btc8723b2ant_power_on_setting()
3571 btcoexist->btc_write_2byte(btcoexist, 0x2, u16tmp | BIT0 | BIT1); in ex_btc8723b2ant_power_on_setting()
3573 btcoexist->btc_write_4byte(btcoexist, 0x948, 0x0); in ex_btc8723b2ant_power_on_setting()
3575 if (btcoexist->chip_interface == BTC_INTF_USB) { in ex_btc8723b2ant_power_on_setting()
3577 board_info->btdm_ant_pos = BTC_ANTENNA_AT_AUX_PORT; in ex_btc8723b2ant_power_on_setting()
3580 if (board_info->single_ant_path == 0) { in ex_btc8723b2ant_power_on_setting()
3582 board_info->btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT; in ex_btc8723b2ant_power_on_setting()
3583 } else if (board_info->single_ant_path == 1) { in ex_btc8723b2ant_power_on_setting()
3585 board_info->btdm_ant_pos = BTC_ANTENNA_AT_AUX_PORT; in ex_btc8723b2ant_power_on_setting()
3587 btcoexist->btc_set(btcoexist, BTC_SET_ACT_ANTPOSREGRISTRY_CTRL, in ex_btc8723b2ant_power_on_setting()
3594 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8723b2ant_pre_load_firmware()
3595 u8 u8tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ in ex_btc8723b2ant_pre_load_firmware()
3606 * NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and in ex_btc8723b2ant_pre_load_firmware()
3609 if (btcoexist->chip_interface == BTC_INTF_USB) { in ex_btc8723b2ant_pre_load_firmware()
3612 btcoexist->btc_write_local_reg_1byte(btcoexist, 0xfe08, u8tmp); in ex_btc8723b2ant_pre_load_firmware()
3615 if (board_info->single_ant_path == 0) { in ex_btc8723b2ant_pre_load_firmware()
3616 } else if (board_info->single_ant_path == 1) { in ex_btc8723b2ant_pre_load_firmware()
3621 if (btcoexist->chip_interface == BTC_INTF_PCI) in ex_btc8723b2ant_pre_load_firmware()
3622 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x384, in ex_btc8723b2ant_pre_load_firmware()
3624 else if (btcoexist->chip_interface == BTC_INTF_SDIO) in ex_btc8723b2ant_pre_load_firmware()
3625 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x60, in ex_btc8723b2ant_pre_load_firmware()
3632 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_init_coex_dm()
3642 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8723b2ant_display_coex_info()
3643 struct btc_stack_info *stack_info = &btcoexist->stack_info; in ex_btc8723b2ant_display_coex_info()
3644 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in ex_btc8723b2ant_display_coex_info()
3658 if (btcoexist->manual_control) { in ex_btc8723b2ant_display_coex_info()
3663 seq_printf(m, "\n %-35s = %d/ %d ", in ex_btc8723b2ant_display_coex_info()
3665 board_info->pg_ant_num, board_info->btdm_ant_num); in ex_btc8723b2ant_display_coex_info()
3667 seq_printf(m, "\n %-35s = %s / %d", in ex_btc8723b2ant_display_coex_info()
3669 ((stack_info->profile_notified) ? "Yes" : "No"), in ex_btc8723b2ant_display_coex_info()
3670 stack_info->hci_version); in ex_btc8723b2ant_display_coex_info()
3672 btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver); in ex_btc8723b2ant_display_coex_info()
3673 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in ex_btc8723b2ant_display_coex_info()
3674 seq_printf(m, "\n %-35s = %d_%x/ 0x%x/ 0x%x(%d)", in ex_btc8723b2ant_display_coex_info()
3679 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in ex_btc8723b2ant_display_coex_info()
3680 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL, in ex_btc8723b2ant_display_coex_info()
3682 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifi_hs_chnl); in ex_btc8723b2ant_display_coex_info()
3684 seq_printf(m, "\n %-35s = %d / %d(%d)", in ex_btc8723b2ant_display_coex_info()
3688 seq_printf(m, "\n %-35s = %3ph ", in ex_btc8723b2ant_display_coex_info()
3689 "H2C Wifi inform bt chnl Info", coex_dm->wifi_chnl_info); in ex_btc8723b2ant_display_coex_info()
3691 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in ex_btc8723b2ant_display_coex_info()
3692 btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi); in ex_btc8723b2ant_display_coex_info()
3693 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num); in ex_btc8723b2ant_display_coex_info()
3694 seq_printf(m, "\n %-35s = %d/ %d/ %d", in ex_btc8723b2ant_display_coex_info()
3695 "Wifi rssi/ HS rssi/ AP#", wifi_rssi, bt_hs_rssi, ap_num); in ex_btc8723b2ant_display_coex_info()
3697 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in ex_btc8723b2ant_display_coex_info()
3698 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in ex_btc8723b2ant_display_coex_info()
3699 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in ex_btc8723b2ant_display_coex_info()
3700 seq_printf(m, "\n %-35s = %d/ %d/ %d ", in ex_btc8723b2ant_display_coex_info()
3701 "Wifi link/ roam/ scan", link, roam, scan); in ex_btc8723b2ant_display_coex_info()
3703 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8723b2ant_display_coex_info()
3704 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in ex_btc8723b2ant_display_coex_info()
3705 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in ex_btc8723b2ant_display_coex_info()
3706 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, in ex_btc8723b2ant_display_coex_info()
3708 seq_printf(m, "\n %-35s = %s / %s/ %s ", in ex_btc8723b2ant_display_coex_info()
3709 "Wifi status", (wifi_under_5g ? "5G" : "2.4G"), in ex_btc8723b2ant_display_coex_info()
3716 seq_printf(m, "\n %-35s = %d / %d / %d / %d", in ex_btc8723b2ant_display_coex_info()
3718 bt_link_info->sco_exist, bt_link_info->hid_exist, in ex_btc8723b2ant_display_coex_info()
3719 bt_link_info->pan_exist, bt_link_info->a2dp_exist); in ex_btc8723b2ant_display_coex_info()
3720 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO, m); in ex_btc8723b2ant_display_coex_info()
3722 bt_info_ext = coex_sta->bt_info_ext; in ex_btc8723b2ant_display_coex_info()
3723 seq_printf(m, "\n %-35s = %s", in ex_btc8723b2ant_display_coex_info()
3728 if (coex_sta->bt_info_c2h_cnt[i]) { in ex_btc8723b2ant_display_coex_info()
3729 seq_printf(m, "\n %-35s = %7ph(%d)", in ex_btc8723b2ant_display_coex_info()
3731 coex_sta->bt_info_c2h[i], in ex_btc8723b2ant_display_coex_info()
3732 coex_sta->bt_info_c2h_cnt[i]); in ex_btc8723b2ant_display_coex_info()
3736 seq_printf(m, "\n %-35s = %s/%s", in ex_btc8723b2ant_display_coex_info()
3738 ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")), in ex_btc8723b2ant_display_coex_info()
3739 ((coex_sta->under_lps ? "LPS ON" : "LPS OFF"))); in ex_btc8723b2ant_display_coex_info()
3740 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD, m); in ex_btc8723b2ant_display_coex_info()
3744 "\n %-35s", "============[Sw mechanism]============"); in ex_btc8723b2ant_display_coex_info()
3745 seq_printf(m, "\n %-35s = %d/ %d/ %d ", in ex_btc8723b2ant_display_coex_info()
3746 "SM1[ShRf/ LpRA/ LimDig]", coex_dm->cur_rf_rx_lpf_shrink, in ex_btc8723b2ant_display_coex_info()
3747 coex_dm->cur_low_penalty_ra, coex_dm->limited_dig); in ex_btc8723b2ant_display_coex_info()
3748 seq_printf(m, "\n %-35s = %d/ %d/ %d(0x%x) ", in ex_btc8723b2ant_display_coex_info()
3750 coex_dm->cur_agc_table_en, coex_dm->cur_adc_back_off, in ex_btc8723b2ant_display_coex_info()
3751 coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl); in ex_btc8723b2ant_display_coex_info()
3754 seq_printf(m, "\n %-35s", in ex_btc8723b2ant_display_coex_info()
3757 ps_tdma_case = coex_dm->cur_ps_tdma; in ex_btc8723b2ant_display_coex_info()
3758 seq_printf(m, "\n %-35s = %5ph case-%d (auto:%d)", in ex_btc8723b2ant_display_coex_info()
3759 "PS TDMA", coex_dm->ps_tdma_para, in ex_btc8723b2ant_display_coex_info()
3760 ps_tdma_case, coex_dm->auto_tdma_adjust); in ex_btc8723b2ant_display_coex_info()
3762 seq_printf(m, "\n %-35s = %d/ %d ", in ex_btc8723b2ant_display_coex_info()
3763 "DecBtPwr/ IgnWlanAct", coex_dm->cur_dec_bt_pwr_lvl, in ex_btc8723b2ant_display_coex_info()
3764 coex_dm->cur_ignore_wlan_act); in ex_btc8723b2ant_display_coex_info()
3767 seq_printf(m, "\n %-35s", in ex_btc8723b2ant_display_coex_info()
3770 seq_printf(m, "\n %-35s = 0x%x", in ex_btc8723b2ant_display_coex_info()
3771 "RF-A, 0x1e initVal", coex_dm->bt_rf0x1e_backup); in ex_btc8723b2ant_display_coex_info()
3773 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778); in ex_btc8723b2ant_display_coex_info()
3774 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x880); in ex_btc8723b2ant_display_coex_info()
3775 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3779 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x948); in ex_btc8723b2ant_display_coex_info()
3780 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x67); in ex_btc8723b2ant_display_coex_info()
3781 u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x765); in ex_btc8723b2ant_display_coex_info()
3782 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3786 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x92c); in ex_btc8723b2ant_display_coex_info()
3787 u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x930); in ex_btc8723b2ant_display_coex_info()
3788 u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x944); in ex_btc8723b2ant_display_coex_info()
3789 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3791 u32tmp[0] & 0x3, u32tmp[1] & 0xff, u32tmp[2] & 0x3); in ex_btc8723b2ant_display_coex_info()
3793 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x39); in ex_btc8723b2ant_display_coex_info()
3794 u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x40); in ex_btc8723b2ant_display_coex_info()
3795 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c); in ex_btc8723b2ant_display_coex_info()
3796 u8tmp[2] = btcoexist->btc_read_1byte(btcoexist, 0x64); in ex_btc8723b2ant_display_coex_info()
3797 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3800 ((u32tmp[0] & 0x01800000) >> 23), u8tmp[2] & 0x1); in ex_btc8723b2ant_display_coex_info()
3802 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550); in ex_btc8723b2ant_display_coex_info()
3803 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522); in ex_btc8723b2ant_display_coex_info()
3804 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3807 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50); in ex_btc8723b2ant_display_coex_info()
3808 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x49c); in ex_btc8723b2ant_display_coex_info()
3809 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3810 "0xc50(dig)/0x49c(null-drop)", u32tmp[0] & 0xff, u8tmp[0]); in ex_btc8723b2ant_display_coex_info()
3812 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xda0); in ex_btc8723b2ant_display_coex_info()
3813 u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0xda4); in ex_btc8723b2ant_display_coex_info()
3814 u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0xda8); in ex_btc8723b2ant_display_coex_info()
3815 u32tmp[3] = btcoexist->btc_read_4byte(btcoexist, 0xcf0); in ex_btc8723b2ant_display_coex_info()
3817 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5b); in ex_btc8723b2ant_display_coex_info()
3818 u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c); in ex_btc8723b2ant_display_coex_info()
3823 (u32tmp[2] & 0xffff) + in ex_btc8723b2ant_display_coex_info()
3828 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3829 "OFDM-CCA/OFDM-FA/CCK-FA", in ex_btc8723b2ant_display_coex_info()
3832 u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0); in ex_btc8723b2ant_display_coex_info()
3833 u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4); in ex_btc8723b2ant_display_coex_info()
3834 u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8); in ex_btc8723b2ant_display_coex_info()
3835 u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x6cc); in ex_btc8723b2ant_display_coex_info()
3836 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", in ex_btc8723b2ant_display_coex_info()
3838 u32tmp[0], u32tmp[1], u32tmp[2], u8tmp[0]); in ex_btc8723b2ant_display_coex_info()
3840 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8723b2ant_display_coex_info()
3841 "0x770(high-pri rx/tx)", in ex_btc8723b2ant_display_coex_info()
3842 coex_sta->high_priority_rx, coex_sta->high_priority_tx); in ex_btc8723b2ant_display_coex_info()
3843 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8723b2ant_display_coex_info()
3844 "0x774(low-pri rx/tx)", coex_sta->low_priority_rx, in ex_btc8723b2ant_display_coex_info()
3845 coex_sta->low_priority_tx); in ex_btc8723b2ant_display_coex_info()
3846 if (btcoexist->auto_report_2ant) in ex_btc8723b2ant_display_coex_info()
3848 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS, m); in ex_btc8723b2ant_display_coex_info()
3853 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_ips_notify()
3858 coex_sta->under_ips = true; in ex_btc8723b2ant_ips_notify()
3865 coex_sta->under_ips = false; in ex_btc8723b2ant_ips_notify()
3874 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_lps_notify()
3879 coex_sta->under_lps = true; in ex_btc8723b2ant_lps_notify()
3883 coex_sta->under_lps = false; in ex_btc8723b2ant_lps_notify()
3889 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_scan_notify()
3893 u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x948); in ex_btc8723b2ant_scan_notify()
3894 u8tmpa = btcoexist->btc_read_1byte(btcoexist, 0x765); in ex_btc8723b2ant_scan_notify()
3895 u8tmpb = btcoexist->btc_read_1byte(btcoexist, 0x76e); in ex_btc8723b2ant_scan_notify()
3903 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, in ex_btc8723b2ant_scan_notify()
3904 &coex_sta->scan_ap_num); in ex_btc8723b2ant_scan_notify()
3913 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_connect_notify()
3926 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_media_status_notify()
3940 btcoexist->btc_get(btcoexist, in ex_btc8723b2ant_media_status_notify()
3946 btcoexist->btc_get(btcoexist, in ex_btc8723b2ant_media_status_notify()
3949 h2c_parameter[2] = 0x30; in ex_btc8723b2ant_media_status_notify()
3951 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, in ex_btc8723b2ant_media_status_notify()
3954 h2c_parameter[2] = 0x30; in ex_btc8723b2ant_media_status_notify()
3956 h2c_parameter[2] = 0x20; in ex_btc8723b2ant_media_status_notify()
3960 coex_dm->wifi_chnl_info[0] = h2c_parameter[0]; in ex_btc8723b2ant_media_status_notify()
3961 coex_dm->wifi_chnl_info[1] = h2c_parameter[1]; in ex_btc8723b2ant_media_status_notify()
3962 coex_dm->wifi_chnl_info[2] = h2c_parameter[2]; in ex_btc8723b2ant_media_status_notify()
3967 h2c_parameter[2]); in ex_btc8723b2ant_media_status_notify()
3969 btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter); in ex_btc8723b2ant_media_status_notify()
3975 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_special_packet_notify()
3985 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_bt_info_notify()
3991 coex_sta->c2h_bt_info_req_sent = false; in ex_btc8723b2ant_bt_info_notify()
3996 coex_sta->bt_info_c2h_cnt[rsp_source]++; in ex_btc8723b2ant_bt_info_notify()
4002 coex_sta->bt_info_c2h[rsp_source][i] = tmpbuf[i]; in ex_btc8723b2ant_bt_info_notify()
4005 if (i == length - 1) in ex_btc8723b2ant_bt_info_notify()
4013 if (btcoexist->manual_control) { in ex_btc8723b2ant_bt_info_notify()
4020 coex_sta->bt_retry_cnt = in ex_btc8723b2ant_bt_info_notify()
4021 coex_sta->bt_info_c2h[rsp_source][2] & 0xf; in ex_btc8723b2ant_bt_info_notify()
4023 if (coex_sta->bt_retry_cnt >= 1) in ex_btc8723b2ant_bt_info_notify()
4024 coex_sta->pop_event_cnt++; in ex_btc8723b2ant_bt_info_notify()
4026 coex_sta->bt_rssi = in ex_btc8723b2ant_bt_info_notify()
4027 coex_sta->bt_info_c2h[rsp_source][3] * 2 + 10; in ex_btc8723b2ant_bt_info_notify()
4029 coex_sta->bt_info_ext = coex_sta->bt_info_c2h[rsp_source][4]; in ex_btc8723b2ant_bt_info_notify()
4031 if (coex_sta->bt_info_c2h[rsp_source][2] & 0x20) in ex_btc8723b2ant_bt_info_notify()
4032 coex_sta->c2h_bt_remote_name_req = true; in ex_btc8723b2ant_bt_info_notify()
4034 coex_sta->c2h_bt_remote_name_req = false; in ex_btc8723b2ant_bt_info_notify()
4036 if (coex_sta->bt_info_c2h[rsp_source][1] == 0x49) in ex_btc8723b2ant_bt_info_notify()
4037 coex_sta->a2dp_bit_pool = in ex_btc8723b2ant_bt_info_notify()
4038 coex_sta->bt_info_c2h[rsp_source][6]; in ex_btc8723b2ant_bt_info_notify()
4040 coex_sta->a2dp_bit_pool = 0; in ex_btc8723b2ant_bt_info_notify()
4042 /* Here we need to resend some wifi info to BT in ex_btc8723b2ant_bt_info_notify()
4045 if ((coex_sta->bt_info_ext & BIT1)) { in ex_btc8723b2ant_bt_info_notify()
4047 "[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"); in ex_btc8723b2ant_bt_info_notify()
4048 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in ex_btc8723b2ant_bt_info_notify()
4060 if ((coex_sta->bt_info_ext & BIT3)) { in ex_btc8723b2ant_bt_info_notify()
4068 if (!btcoexist->auto_report_2ant) { in ex_btc8723b2ant_bt_info_notify()
4069 if (!(coex_sta->bt_info_ext & BIT4)) in ex_btc8723b2ant_bt_info_notify()
4077 coex_sta->c2h_bt_inquiry_page = true; in ex_btc8723b2ant_bt_info_notify()
4079 coex_sta->c2h_bt_inquiry_page = false; in ex_btc8723b2ant_bt_info_notify()
4083 coex_sta->bt_link_exist = false; in ex_btc8723b2ant_bt_info_notify()
4084 coex_sta->pan_exist = false; in ex_btc8723b2ant_bt_info_notify()
4085 coex_sta->a2dp_exist = false; in ex_btc8723b2ant_bt_info_notify()
4086 coex_sta->hid_exist = false; in ex_btc8723b2ant_bt_info_notify()
4087 coex_sta->sco_exist = false; in ex_btc8723b2ant_bt_info_notify()
4090 coex_sta->bt_link_exist = true; in ex_btc8723b2ant_bt_info_notify()
4092 coex_sta->pan_exist = true; in ex_btc8723b2ant_bt_info_notify()
4094 coex_sta->pan_exist = false; in ex_btc8723b2ant_bt_info_notify()
4096 coex_sta->a2dp_exist = true; in ex_btc8723b2ant_bt_info_notify()
4098 coex_sta->a2dp_exist = false; in ex_btc8723b2ant_bt_info_notify()
4100 coex_sta->hid_exist = true; in ex_btc8723b2ant_bt_info_notify()
4102 coex_sta->hid_exist = false; in ex_btc8723b2ant_bt_info_notify()
4104 coex_sta->sco_exist = true; in ex_btc8723b2ant_bt_info_notify()
4106 coex_sta->sco_exist = false; in ex_btc8723b2ant_bt_info_notify()
4108 if ((!coex_sta->hid_exist) && in ex_btc8723b2ant_bt_info_notify()
4109 (!coex_sta->c2h_bt_inquiry_page) && in ex_btc8723b2ant_bt_info_notify()
4110 (!coex_sta->sco_exist)) { in ex_btc8723b2ant_bt_info_notify()
4111 if (coex_sta->high_priority_tx + in ex_btc8723b2ant_bt_info_notify()
4112 coex_sta->high_priority_rx >= 160) { in ex_btc8723b2ant_bt_info_notify()
4113 coex_sta->hid_exist = true; in ex_btc8723b2ant_bt_info_notify()
4122 coex_dm->bt_status = BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE; in ex_btc8723b2ant_bt_info_notify()
4124 "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"); in ex_btc8723b2ant_bt_info_notify()
4127 coex_dm->bt_status = BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE; in ex_btc8723b2ant_bt_info_notify()
4129 "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"); in ex_btc8723b2ant_bt_info_notify()
4132 coex_dm->bt_status = BT_8723B_2ANT_BT_STATUS_SCO_BUSY; in ex_btc8723b2ant_bt_info_notify()
4136 coex_dm->bt_status = BT_8723B_2ANT_BT_STATUS_ACL_BUSY; in ex_btc8723b2ant_bt_info_notify()
4140 coex_dm->bt_status = BT_8723B_2ANT_BT_STATUS_MAX; in ex_btc8723b2ant_bt_info_notify()
4142 "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"); in ex_btc8723b2ant_bt_info_notify()
4145 if ((BT_8723B_2ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) || in ex_btc8723b2ant_bt_info_notify()
4146 (BT_8723B_2ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || in ex_btc8723b2ant_bt_info_notify()
4147 (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status)) { in ex_btc8723b2ant_bt_info_notify()
4155 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy); in ex_btc8723b2ant_bt_info_notify()
4157 coex_dm->limited_dig = limited_dig; in ex_btc8723b2ant_bt_info_notify()
4158 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_LIMITED_DIG, &limited_dig); in ex_btc8723b2ant_bt_info_notify()
4165 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_halt_notify()
4176 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_pnp_notify()
4185 * BTCoexistence think wifi is still under IPS/LPS in ex_btc8723b2ant_pnp_notify()
4190 coex_sta->under_ips = false; in ex_btc8723b2ant_pnp_notify()
4191 coex_sta->under_lps = false; in ex_btc8723b2ant_pnp_notify()
4203 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8723b2ant_periodical()
4204 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in ex_btc8723b2ant_periodical()
4209 if (coex_sta->dis_ver_info_cnt <= 5) { in ex_btc8723b2ant_periodical()
4210 coex_sta->dis_ver_info_cnt += 1; in ex_btc8723b2ant_periodical()
4211 if (coex_sta->dis_ver_info_cnt == 3) { in ex_btc8723b2ant_periodical()
4222 if (!btcoexist->auto_report_2ant) { in ex_btc8723b2ant_periodical()
4228 /* for some BT speakers that High-Priority pkts appear before in ex_btc8723b2ant_periodical()
4231 if ((coex_sta->high_priority_tx + in ex_btc8723b2ant_periodical()
4232 coex_sta->high_priority_rx < 50) && in ex_btc8723b2ant_periodical()
4233 (bt_link_info->hid_exist)) in ex_btc8723b2ant_periodical()
4234 bt_link_info->hid_exist = false; in ex_btc8723b2ant_periodical()
4237 coex_dm->auto_tdma_adjust) in ex_btc8723b2ant_periodical()