Lines Matching +full:bt +full:- +full:sco
1 // SPDX-License-Identifier: GPL-2.0
7 * This file is for RTL8821A Co-exist mechanism
28 "BT Info[wifi fw]",
29 "BT Info[bt rsp]",
30 "BT Info[bt auto report]",
45 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_bt_rssi_state()
47 u8 bt_rssi_state = coex_sta->pre_bt_rssi_state; in btc8821a2ant_bt_rssi_state()
49 bt_rssi = coex_sta->bt_rssi; in btc8821a2ant_bt_rssi_state()
52 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8821a2ant_bt_rssi_state()
53 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8821a2ant_bt_rssi_state()
58 "[BTCoex], BT Rssi state switch to High\n"); in btc8821a2ant_bt_rssi_state()
62 "[BTCoex], BT Rssi state stay at Low\n"); in btc8821a2ant_bt_rssi_state()
68 "[BTCoex], BT Rssi state switch to Low\n"); in btc8821a2ant_bt_rssi_state()
72 "[BTCoex], BT Rssi state stay at High\n"); in btc8821a2ant_bt_rssi_state()
78 "[BTCoex], BT Rssi thresh error!!\n"); in btc8821a2ant_bt_rssi_state()
79 return coex_sta->pre_bt_rssi_state; in btc8821a2ant_bt_rssi_state()
82 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8821a2ant_bt_rssi_state()
83 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8821a2ant_bt_rssi_state()
89 "[BTCoex], BT Rssi state switch to Medium\n"); in btc8821a2ant_bt_rssi_state()
93 "[BTCoex], BT Rssi state stay at Low\n"); in btc8821a2ant_bt_rssi_state()
95 } else if ((coex_sta->pre_bt_rssi_state == in btc8821a2ant_bt_rssi_state()
97 (coex_sta->pre_bt_rssi_state == in btc8821a2ant_bt_rssi_state()
104 "[BTCoex], BT Rssi state switch to High\n"); in btc8821a2ant_bt_rssi_state()
108 "[BTCoex], BT Rssi state switch to Low\n"); in btc8821a2ant_bt_rssi_state()
112 "[BTCoex], BT Rssi state stay at Medium\n"); in btc8821a2ant_bt_rssi_state()
118 "[BTCoex], BT Rssi state switch to Medium\n"); in btc8821a2ant_bt_rssi_state()
122 "[BTCoex], BT Rssi state stay at High\n"); in btc8821a2ant_bt_rssi_state()
127 coex_sta->pre_bt_rssi_state = bt_rssi_state; in btc8821a2ant_bt_rssi_state()
136 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_wifi_rssi_state()
138 u8 wifi_rssi_state = coex_sta->pre_wifi_rssi_state[index]; in btc8821a2ant_wifi_rssi_state()
140 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in btc8821a2ant_wifi_rssi_state()
143 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
145 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
172 return coex_sta->pre_wifi_rssi_state[index]; in btc8821a2ant_wifi_rssi_state()
175 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
177 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
190 } else if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
192 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a2ant_wifi_rssi_state()
220 coex_sta->pre_wifi_rssi_state[index] = wifi_rssi_state; in btc8821a2ant_wifi_rssi_state()
235 btcoexist->btc_set(btcoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, in btc8821a2ant_limited_rx()
237 /* decide BT control aggregation buf size or not */ in btc8821a2ant_limited_rx()
238 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, in btc8821a2ant_limited_rx()
240 /* aggregation buf size, works when BT control Rx aggregation size */ in btc8821a2ant_limited_rx()
241 btcoexist->btc_set(btcoexist, BTC_SET_U1_AGG_BUF_SIZE, &rx_agg_size); in btc8821a2ant_limited_rx()
243 btcoexist->btc_set(btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); in btc8821a2ant_limited_rx()
248 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_monitor_bt_ctr()
249 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_monitor_bt_ctr()
256 u4tmp = btcoexist->btc_read_4byte(btcoexist, reg_hp_txrx); in btc8821a2ant_monitor_bt_ctr()
260 u4tmp = btcoexist->btc_read_4byte(btcoexist, reg_lp_txrx); in btc8821a2ant_monitor_bt_ctr()
264 coex_sta->high_priority_tx = reg_hp_tx; in btc8821a2ant_monitor_bt_ctr()
265 coex_sta->high_priority_rx = reg_hp_rx; in btc8821a2ant_monitor_bt_ctr()
266 coex_sta->low_priority_tx = reg_lp_tx; in btc8821a2ant_monitor_bt_ctr()
267 coex_sta->low_priority_rx = reg_lp_rx; in btc8821a2ant_monitor_bt_ctr()
269 if ((coex_sta->low_priority_rx >= 950) && in btc8821a2ant_monitor_bt_ctr()
270 (coex_sta->low_priority_rx >= coex_sta->low_priority_tx) && in btc8821a2ant_monitor_bt_ctr()
271 (!coex_sta->under_ips)) in btc8821a2ant_monitor_bt_ctr()
272 bt_link_info->slave_role = true; in btc8821a2ant_monitor_bt_ctr()
274 bt_link_info->slave_role = false; in btc8821a2ant_monitor_bt_ctr()
284 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); in btc8821a2ant_monitor_bt_ctr()
289 if (coex_sta->under_ips) { in btc8821a2ant_monitor_wifi_ctr()
290 coex_sta->crc_ok_cck = 0; in btc8821a2ant_monitor_wifi_ctr()
291 coex_sta->crc_ok_11g = 0; in btc8821a2ant_monitor_wifi_ctr()
292 coex_sta->crc_ok_11n = 0; in btc8821a2ant_monitor_wifi_ctr()
293 coex_sta->crc_ok_11n_agg = 0; in btc8821a2ant_monitor_wifi_ctr()
295 coex_sta->crc_err_cck = 0; in btc8821a2ant_monitor_wifi_ctr()
296 coex_sta->crc_err_11g = 0; in btc8821a2ant_monitor_wifi_ctr()
297 coex_sta->crc_err_11n = 0; in btc8821a2ant_monitor_wifi_ctr()
298 coex_sta->crc_err_11n_agg = 0; in btc8821a2ant_monitor_wifi_ctr()
300 coex_sta->crc_ok_cck = in btc8821a2ant_monitor_wifi_ctr()
301 btcoexist->btc_read_4byte(btcoexist, 0xf88); in btc8821a2ant_monitor_wifi_ctr()
302 coex_sta->crc_ok_11g = in btc8821a2ant_monitor_wifi_ctr()
303 btcoexist->btc_read_2byte(btcoexist, 0xf94); in btc8821a2ant_monitor_wifi_ctr()
304 coex_sta->crc_ok_11n = in btc8821a2ant_monitor_wifi_ctr()
305 btcoexist->btc_read_2byte(btcoexist, 0xf90); in btc8821a2ant_monitor_wifi_ctr()
306 coex_sta->crc_ok_11n_agg = in btc8821a2ant_monitor_wifi_ctr()
307 btcoexist->btc_read_2byte(btcoexist, 0xfb8); in btc8821a2ant_monitor_wifi_ctr()
309 coex_sta->crc_err_cck = in btc8821a2ant_monitor_wifi_ctr()
310 btcoexist->btc_read_4byte(btcoexist, 0xf84); in btc8821a2ant_monitor_wifi_ctr()
311 coex_sta->crc_err_11g = in btc8821a2ant_monitor_wifi_ctr()
312 btcoexist->btc_read_2byte(btcoexist, 0xf96); in btc8821a2ant_monitor_wifi_ctr()
313 coex_sta->crc_err_11n = in btc8821a2ant_monitor_wifi_ctr()
314 btcoexist->btc_read_2byte(btcoexist, 0xf92); in btc8821a2ant_monitor_wifi_ctr()
315 coex_sta->crc_err_11n_agg = in btc8821a2ant_monitor_wifi_ctr()
316 btcoexist->btc_read_2byte(btcoexist, 0xfba); in btc8821a2ant_monitor_wifi_ctr()
320 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x1); in btc8821a2ant_monitor_wifi_ctr()
321 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x0); in btc8821a2ant_monitor_wifi_ctr()
326 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_query_bt_info()
329 coex_sta->c2h_bt_info_req_sent = true; in btc8821a2ant_query_bt_info()
334 "[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n", in btc8821a2ant_query_bt_info()
337 btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); in btc8821a2ant_query_bt_info()
349 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a2ant_is_wifi_status_changed()
351 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a2ant_is_wifi_status_changed()
352 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a2ant_is_wifi_status_changed()
353 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, in btc8821a2ant_is_wifi_status_changed()
383 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_update_bt_link_info()
386 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a2ant_update_bt_link_info()
388 bt_link_info->bt_link_exist = coex_sta->bt_link_exist; in btc8821a2ant_update_bt_link_info()
389 bt_link_info->sco_exist = coex_sta->sco_exist; in btc8821a2ant_update_bt_link_info()
390 bt_link_info->a2dp_exist = coex_sta->a2dp_exist; in btc8821a2ant_update_bt_link_info()
391 bt_link_info->pan_exist = coex_sta->pan_exist; in btc8821a2ant_update_bt_link_info()
392 bt_link_info->hid_exist = coex_sta->hid_exist; in btc8821a2ant_update_bt_link_info()
396 bt_link_info->pan_exist = true; in btc8821a2ant_update_bt_link_info()
397 bt_link_info->bt_link_exist = true; in btc8821a2ant_update_bt_link_info()
400 /* check if Sco only */ in btc8821a2ant_update_bt_link_info()
401 if (bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8821a2ant_update_bt_link_info()
402 !bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8821a2ant_update_bt_link_info()
403 bt_link_info->sco_only = true; in btc8821a2ant_update_bt_link_info()
405 bt_link_info->sco_only = false; in btc8821a2ant_update_bt_link_info()
408 if (!bt_link_info->sco_exist && bt_link_info->a2dp_exist && in btc8821a2ant_update_bt_link_info()
409 !bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8821a2ant_update_bt_link_info()
410 bt_link_info->a2dp_only = true; in btc8821a2ant_update_bt_link_info()
412 bt_link_info->a2dp_only = false; in btc8821a2ant_update_bt_link_info()
415 if (!bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8821a2ant_update_bt_link_info()
416 bt_link_info->pan_exist && !bt_link_info->hid_exist) in btc8821a2ant_update_bt_link_info()
417 bt_link_info->pan_only = true; in btc8821a2ant_update_bt_link_info()
419 bt_link_info->pan_only = false; in btc8821a2ant_update_bt_link_info()
422 if (!bt_link_info->sco_exist && !bt_link_info->a2dp_exist && in btc8821a2ant_update_bt_link_info()
423 !bt_link_info->pan_exist && bt_link_info->hid_exist) in btc8821a2ant_update_bt_link_info()
424 bt_link_info->hid_only = true; in btc8821a2ant_update_bt_link_info()
426 bt_link_info->hid_only = false; in btc8821a2ant_update_bt_link_info()
431 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_algorithm()
432 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_action_algorithm()
437 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a2ant_action_algorithm()
439 if (!bt_link_info->bt_link_exist) { in btc8821a2ant_action_algorithm()
441 "[BTCoex], No BT link exists!!!\n"); in btc8821a2ant_action_algorithm()
445 if (bt_link_info->sco_exist) in btc8821a2ant_action_algorithm()
447 if (bt_link_info->hid_exist) in btc8821a2ant_action_algorithm()
449 if (bt_link_info->pan_exist) in btc8821a2ant_action_algorithm()
451 if (bt_link_info->a2dp_exist) in btc8821a2ant_action_algorithm()
455 if (bt_link_info->sco_exist) { in btc8821a2ant_action_algorithm()
457 "[BTCoex], SCO only\n"); in btc8821a2ant_action_algorithm()
460 if (bt_link_info->hid_exist) { in btc8821a2ant_action_algorithm()
464 } else if (bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
468 } else if (bt_link_info->pan_exist) { in btc8821a2ant_action_algorithm()
483 if (bt_link_info->sco_exist) { in btc8821a2ant_action_algorithm()
484 if (bt_link_info->hid_exist) { in btc8821a2ant_action_algorithm()
486 "[BTCoex], SCO + HID\n"); in btc8821a2ant_action_algorithm()
488 } else if (bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
490 "[BTCoex], SCO + A2DP ==> SCO\n"); in btc8821a2ant_action_algorithm()
492 } else if (bt_link_info->pan_exist) { in btc8821a2ant_action_algorithm()
496 "[BTCoex], SCO + PAN(HS)\n"); in btc8821a2ant_action_algorithm()
501 "[BTCoex], SCO + PAN(EDR)\n"); in btc8821a2ant_action_algorithm()
506 if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
507 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
511 } else if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
512 bt_link_info->pan_exist) { in btc8821a2ant_action_algorithm()
525 } else if (bt_link_info->pan_exist && in btc8821a2ant_action_algorithm()
526 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
543 if (bt_link_info->sco_exist) { in btc8821a2ant_action_algorithm()
544 if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
545 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
547 "[BTCoex], SCO + HID + A2DP ==> HID\n"); in btc8821a2ant_action_algorithm()
549 } else if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
550 bt_link_info->pan_exist) { in btc8821a2ant_action_algorithm()
554 "[BTCoex], SCO + HID + PAN(HS)\n"); in btc8821a2ant_action_algorithm()
559 "[BTCoex], SCO + HID + PAN(EDR)\n"); in btc8821a2ant_action_algorithm()
562 } else if (bt_link_info->pan_exist && in btc8821a2ant_action_algorithm()
563 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
567 "[BTCoex], SCO + A2DP + PAN(HS)\n"); in btc8821a2ant_action_algorithm()
572 "[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"); in btc8821a2ant_action_algorithm()
577 if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
578 bt_link_info->pan_exist && in btc8821a2ant_action_algorithm()
579 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
596 if (bt_link_info->sco_exist) { in btc8821a2ant_action_algorithm()
597 if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
598 bt_link_info->pan_exist && in btc8821a2ant_action_algorithm()
599 bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
603 "[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n"); in btc8821a2ant_action_algorithm()
608 "[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"); in btc8821a2ant_action_algorithm()
620 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_fw_dac_swing_lvl()
633 btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); in btc8821a2ant_set_fw_dac_swing_lvl()
639 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_fw_dec_bt_pwr()
645 "[BTCoex], decrease Bt Power Level : %u, FW write 0x62 = 0x%x\n", in btc8821a2ant_set_fw_dec_bt_pwr()
648 btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter); in btc8821a2ant_set_fw_dec_bt_pwr()
654 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_dec_bt_pwr()
657 "[BTCoex], %s Dec BT power level = %u\n", in btc8821a2ant_dec_bt_pwr()
659 coex_dm->cur_dec_bt_pwr_lvl = dec_bt_pwr_lvl; in btc8821a2ant_dec_bt_pwr()
664 coex_dm->pre_dec_bt_pwr_lvl, in btc8821a2ant_dec_bt_pwr()
665 coex_dm->cur_dec_bt_pwr_lvl); in btc8821a2ant_dec_bt_pwr()
667 if (coex_dm->pre_dec_bt_pwr_lvl == coex_dm->cur_dec_bt_pwr_lvl) in btc8821a2ant_dec_bt_pwr()
670 btc8821a2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr_lvl); in btc8821a2ant_dec_bt_pwr()
672 coex_dm->pre_dec_bt_pwr_lvl = coex_dm->cur_dec_bt_pwr_lvl; in btc8821a2ant_dec_bt_pwr()
678 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_fw_dac_swing_lvl()
683 coex_dm->cur_fw_dac_swing_lvl = fw_dac_swing_lvl; in btc8821a2ant_fw_dac_swing_lvl()
688 coex_dm->pre_fw_dac_swing_lvl, in btc8821a2ant_fw_dac_swing_lvl()
689 coex_dm->cur_fw_dac_swing_lvl); in btc8821a2ant_fw_dac_swing_lvl()
691 if (coex_dm->pre_fw_dac_swing_lvl == in btc8821a2ant_fw_dac_swing_lvl()
692 coex_dm->cur_fw_dac_swing_lvl) in btc8821a2ant_fw_dac_swing_lvl()
697 coex_dm->cur_fw_dac_swing_lvl); in btc8821a2ant_fw_dac_swing_lvl()
699 coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; in btc8821a2ant_fw_dac_swing_lvl()
705 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_sw_penalty_tx_rate_adaptive()
723 "[BTCoex], set WiFi Low-Penalty Retry: %s", in btc8821a2ant_set_sw_penalty_tx_rate_adaptive()
726 btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); in btc8821a2ant_set_sw_penalty_tx_rate_adaptive()
732 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_low_penalty_ra()
738 coex_dm->cur_low_penalty_ra = low_penalty_ra; in btc8821a2ant_low_penalty_ra()
743 coex_dm->pre_low_penalty_ra, in btc8821a2ant_low_penalty_ra()
744 coex_dm->cur_low_penalty_ra); in btc8821a2ant_low_penalty_ra()
746 if (coex_dm->pre_low_penalty_ra == coex_dm->cur_low_penalty_ra) in btc8821a2ant_low_penalty_ra()
750 coex_dm->cur_low_penalty_ra); in btc8821a2ant_low_penalty_ra()
752 coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; in btc8821a2ant_low_penalty_ra()
758 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_dac_swing_reg()
763 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xc5b, 0x3e, val); in btc8821a2ant_set_dac_swing_reg()
780 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_dac_swing()
787 coex_dm->cur_dac_swing_on = dac_swing_on; in btc8821a2ant_dac_swing()
788 coex_dm->cur_dac_swing_lvl = dac_swing_lvl; in btc8821a2ant_dac_swing()
793 coex_dm->pre_dac_swing_on, in btc8821a2ant_dac_swing()
794 coex_dm->pre_dac_swing_lvl, in btc8821a2ant_dac_swing()
795 coex_dm->cur_dac_swing_on, in btc8821a2ant_dac_swing()
796 coex_dm->cur_dac_swing_lvl); in btc8821a2ant_dac_swing()
798 if ((coex_dm->pre_dac_swing_on == coex_dm->cur_dac_swing_on) && in btc8821a2ant_dac_swing()
799 (coex_dm->pre_dac_swing_lvl == in btc8821a2ant_dac_swing()
800 coex_dm->cur_dac_swing_lvl)) in btc8821a2ant_dac_swing()
807 coex_dm->pre_dac_swing_on = coex_dm->cur_dac_swing_on; in btc8821a2ant_dac_swing()
808 coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; in btc8821a2ant_dac_swing()
815 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_coex_table()
819 btcoexist->btc_write_4byte(btcoexist, 0x6c0, val0x6c0); in btc8821a2ant_set_coex_table()
823 btcoexist->btc_write_4byte(btcoexist, 0x6c4, val0x6c4); in btc8821a2ant_set_coex_table()
827 btcoexist->btc_write_4byte(btcoexist, 0x6c8, val0x6c8); in btc8821a2ant_set_coex_table()
831 btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); in btc8821a2ant_set_coex_table()
838 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_coex_table()
844 coex_dm->cur_val0x6c0 = val0x6c0; in btc8821a2ant_coex_table()
845 coex_dm->cur_val0x6c4 = val0x6c4; in btc8821a2ant_coex_table()
846 coex_dm->cur_val0x6c8 = val0x6c8; in btc8821a2ant_coex_table()
847 coex_dm->cur_val0x6cc = val0x6cc; in btc8821a2ant_coex_table()
852 coex_dm->pre_val0x6c0, in btc8821a2ant_coex_table()
853 coex_dm->pre_val0x6c4, in btc8821a2ant_coex_table()
854 coex_dm->pre_val0x6c8, in btc8821a2ant_coex_table()
855 coex_dm->pre_val0x6cc); in btc8821a2ant_coex_table()
858 coex_dm->cur_val0x6c0, in btc8821a2ant_coex_table()
859 coex_dm->cur_val0x6c4, in btc8821a2ant_coex_table()
860 coex_dm->cur_val0x6c8, in btc8821a2ant_coex_table()
861 coex_dm->cur_val0x6cc); in btc8821a2ant_coex_table()
863 if ((coex_dm->pre_val0x6c0 == coex_dm->cur_val0x6c0) && in btc8821a2ant_coex_table()
864 (coex_dm->pre_val0x6c4 == coex_dm->cur_val0x6c4) && in btc8821a2ant_coex_table()
865 (coex_dm->pre_val0x6c8 == coex_dm->cur_val0x6c8) && in btc8821a2ant_coex_table()
866 (coex_dm->pre_val0x6cc == coex_dm->cur_val0x6cc)) in btc8821a2ant_coex_table()
872 coex_dm->pre_val0x6c0 = coex_dm->cur_val0x6c0; in btc8821a2ant_coex_table()
873 coex_dm->pre_val0x6c4 = coex_dm->cur_val0x6c4; in btc8821a2ant_coex_table()
874 coex_dm->pre_val0x6c8 = coex_dm->cur_val0x6c8; in btc8821a2ant_coex_table()
875 coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; in btc8821a2ant_coex_table()
881 coex_sta->coex_table_type = type; in btc8821a2ant_coex_table_with_type()
964 struct rtl_priv *rtlpriv = btcoex->adapter; in btc8821a2ant_set_fw_ignore_wlan_act()
971 "[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63 = 0x%x\n", in btc8821a2ant_set_fw_ignore_wlan_act()
974 btcoex->btc_fill_h2c(btcoex, 0x63, 1, h2c_parameter); in btc8821a2ant_set_fw_ignore_wlan_act()
983 btcoexist->btc_set(btcoexist, BTC_SET_U1_LPS_VAL, &lps); in btc8821a2ant_set_lps_rpwm()
984 btcoexist->btc_set(btcoexist, BTC_SET_U1_RPWM_VAL, &rpwm); in btc8821a2ant_set_lps_rpwm()
990 coex_dm->cur_lps = lps_val; in btc8821a2ant_lps_rpwm()
991 coex_dm->cur_rpwm = rpwm_val; in btc8821a2ant_lps_rpwm()
994 if ((coex_dm->pre_lps == coex_dm->cur_lps) && in btc8821a2ant_lps_rpwm()
995 (coex_dm->pre_rpwm == coex_dm->cur_rpwm)) in btc8821a2ant_lps_rpwm()
1000 coex_dm->pre_lps = coex_dm->cur_lps; in btc8821a2ant_lps_rpwm()
1001 coex_dm->pre_rpwm = coex_dm->cur_rpwm; in btc8821a2ant_lps_rpwm()
1007 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_ignore_wlan_act()
1012 coex_dm->cur_ignore_wlan_act = enable; in btc8821a2ant_ignore_wlan_act()
1017 coex_dm->pre_ignore_wlan_act, in btc8821a2ant_ignore_wlan_act()
1018 coex_dm->cur_ignore_wlan_act); in btc8821a2ant_ignore_wlan_act()
1020 if (coex_dm->pre_ignore_wlan_act == in btc8821a2ant_ignore_wlan_act()
1021 coex_dm->cur_ignore_wlan_act) in btc8821a2ant_ignore_wlan_act()
1026 coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; in btc8821a2ant_ignore_wlan_act()
1033 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_set_fw_ps_tdma()
1042 coex_dm->ps_tdma_para[0] = byte1; in btc8821a2ant_set_fw_ps_tdma()
1043 coex_dm->ps_tdma_para[1] = byte2; in btc8821a2ant_set_fw_ps_tdma()
1044 coex_dm->ps_tdma_para[2] = byte3; in btc8821a2ant_set_fw_ps_tdma()
1045 coex_dm->ps_tdma_para[3] = byte4; in btc8821a2ant_set_fw_ps_tdma()
1046 coex_dm->ps_tdma_para[4] = byte5; in btc8821a2ant_set_fw_ps_tdma()
1056 btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); in btc8821a2ant_set_fw_ps_tdma()
1078 struct btc_board_info *board_info = &btcoexist->board_info; in btc8821a2ant_set_ant_path()
1083 /* 0x4c[23] = 0, 0x4c[24] = 1 Antenna control by WL/BT */ in btc8821a2ant_set_ant_path()
1084 u4tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); in btc8821a2ant_set_ant_path()
1087 btcoexist->btc_write_4byte(btcoexist, 0x4c, u4tmp); in btc8821a2ant_set_ant_path()
1089 btcoexist->btc_write_4byte(btcoexist, 0x974, 0x3ff); in btc8821a2ant_set_ant_path()
1091 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) { in btc8821a2ant_set_ant_path()
1097 btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, in btc8821a2ant_set_ant_path()
1105 btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, in btc8821a2ant_set_ant_path()
1113 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, 0x30, 0x1); in btc8821a2ant_set_ant_path()
1116 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, 0x30, 0x2); in btc8821a2ant_set_ant_path()
1124 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_ps_tdma()
1136 /* for WiFi RSSI low or BT RSSI low */ in btc8821a2ant_ps_tdma()
1144 coex_dm->cur_ps_tdma_on = turn_on; in btc8821a2ant_ps_tdma()
1145 coex_dm->cur_ps_tdma = type; in btc8821a2ant_ps_tdma()
1150 coex_dm->pre_ps_tdma_on, coex_dm->cur_ps_tdma_on); in btc8821a2ant_ps_tdma()
1153 coex_dm->pre_ps_tdma, coex_dm->cur_ps_tdma); in btc8821a2ant_ps_tdma()
1155 if ((coex_dm->pre_ps_tdma_on == coex_dm->cur_ps_tdma_on) && in btc8821a2ant_ps_tdma()
1156 (coex_dm->pre_ps_tdma == coex_dm->cur_ps_tdma)) in btc8821a2ant_ps_tdma()
1343 coex_dm->pre_ps_tdma_on = coex_dm->cur_ps_tdma_on; in btc8821a2ant_ps_tdma()
1344 coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; in btc8821a2ant_ps_tdma()
1353 btcoexist->btc_get(btcoexist, BTC_GET_U1_LPS_MODE, &lps_mode); in btc8821a2ant_ps_tdma_check_for_power_save_state()
1383 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_power_save_state()
1385 btcoexist->btc_set(btcoexist, BTC_SET_ACT_NORMAL_LPS, NULL); in btc8821a2ant_power_save_state()
1386 coex_sta->force_lps_on = false; in btc8821a2ant_power_save_state()
1395 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_power_save_state()
1398 btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); in btc8821a2ant_power_save_state()
1399 coex_sta->force_lps_on = true; in btc8821a2ant_power_save_state()
1404 btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); in btc8821a2ant_power_save_state()
1405 coex_sta->force_lps_on = false; in btc8821a2ant_power_save_state()
1450 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_bt_inquiry()
1461 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_action_bt_inquiry()
1463 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a2ant_action_bt_inquiry()
1466 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_action_bt_inquiry()
1467 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_action_bt_inquiry()
1468 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_action_bt_inquiry()
1474 "[BTCoex], Wifi link process + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1479 "[BTCoex], Wifi connected + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1484 "[BTCoex], Wifi no-link + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1498 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_wifi_link_process()
1507 u8tmpa = btcoexist->btc_read_1byte(btcoexist, 0x765); in btc8821a2ant_action_wifi_link_process()
1508 u8tmpb = btcoexist->btc_read_1byte(btcoexist, 0x76e); in btc8821a2ant_action_wifi_link_process()
1516 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_wifi_idle_process()
1522 BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES - 20, 0); in btc8821a2ant_action_wifi_idle_process()
1526 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num); in btc8821a2ant_action_wifi_idle_process()
1529 if (BTC_RSSI_HIGH(wifi_rssi_state1) && (coex_sta->hid_exist) && in btc8821a2ant_action_wifi_idle_process()
1530 (coex_sta->a2dp_exist)) { in btc8821a2ant_action_wifi_idle_process()
1532 "[BTCoex], Wifi idle process for BT HID+A2DP exist!!\n"); in btc8821a2ant_action_wifi_idle_process()
1549 } else if (coex_sta->pan_exist) { in btc8821a2ant_action_wifi_idle_process()
1551 "[BTCoex], Wifi idle process for BT PAN exist!!\n"); in btc8821a2ant_action_wifi_idle_process()
1575 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_is_common_action()
1580 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a2ant_is_common_action()
1581 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a2ant_is_common_action()
1583 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a2ant_is_common_action()
1587 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_is_common_action()
1593 "[BTCoex], Wifi non-connected idle!!\n"); in btc8821a2ant_is_common_action()
1595 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8821a2ant_is_common_action()
1612 coex_dm->bt_status) { in btc8821a2ant_is_common_action()
1614 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1621 "[BTCoex], Wifi connected + BT non connected-idle!!\n"); in btc8821a2ant_is_common_action()
1623 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8821a2ant_is_common_action()
1642 coex_dm->bt_status) { in btc8821a2ant_is_common_action()
1644 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1651 "[BTCoex], Wifi connected + BT connected-idle!!\n"); in btc8821a2ant_is_common_action()
1655 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8821a2ant_is_common_action()
1674 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1680 "[BTCoex], Wifi Connected-Busy + BT Busy!!\n"); in btc8821a2ant_is_common_action()
1684 "[BTCoex], Wifi Connected-Idle + BT Busy!!\n"); in btc8821a2ant_is_common_action()
1698 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_tdma_duration_adjust()
1702 * -1: decrease WiFi duration in btc8821a2ant_tdma_duration_adjust()
1710 if (coex_dm->auto_tdma_adjust) { in btc8821a2ant_tdma_duration_adjust()
1711 coex_dm->auto_tdma_adjust = false; in btc8821a2ant_tdma_duration_adjust()
1719 coex_dm->ps_tdma_du_adj_type = 13; in btc8821a2ant_tdma_duration_adjust()
1723 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
1727 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
1733 coex_dm->ps_tdma_du_adj_type = 9; in btc8821a2ant_tdma_duration_adjust()
1737 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
1741 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
1749 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1753 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
1757 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
1763 coex_dm->ps_tdma_du_adj_type = 1; in btc8821a2ant_tdma_duration_adjust()
1767 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
1771 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
1783 /* accquire the BT TRx retry count from BT_Info byte2 */ in btc8821a2ant_tdma_duration_adjust()
1784 retry_count = coex_sta->bt_retry_cnt; in btc8821a2ant_tdma_duration_adjust()
1794 /* no retry in the last 2-second duration */ in btc8821a2ant_tdma_duration_adjust()
1796 dn--; in btc8821a2ant_tdma_duration_adjust()
1814 /* <=3 retry in the last 2-second duration */ in btc8821a2ant_tdma_duration_adjust()
1815 up--; in btc8821a2ant_tdma_duration_adjust()
1839 result = -1; in btc8821a2ant_tdma_duration_adjust()
1861 result = -1; in btc8821a2ant_tdma_duration_adjust()
1871 if (coex_dm->cur_ps_tdma == 71) { in btc8821a2ant_tdma_duration_adjust()
1874 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1875 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
1878 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1879 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
1882 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
1883 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
1886 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
1887 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
1890 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
1892 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
1895 coex_dm->ps_tdma_du_adj_type = 13; in btc8821a2ant_tdma_duration_adjust()
1896 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
1899 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
1900 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
1903 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
1904 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
1907 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
1910 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
1911 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
1915 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1917 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
1921 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1923 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
1927 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1929 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
1933 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1935 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
1939 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1941 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
1945 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1949 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
1953 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1955 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
1959 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1961 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
1965 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1967 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
1971 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1973 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
1977 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1979 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
1983 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1988 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
1991 coex_dm->ps_tdma_du_adj_type = 71; in btc8821a2ant_tdma_duration_adjust()
1992 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
1995 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
1996 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
1999 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2000 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2003 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2005 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2008 coex_dm->ps_tdma_du_adj_type = 9; in btc8821a2ant_tdma_duration_adjust()
2009 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2012 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2013 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2016 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2017 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2020 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2023 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2024 if (coex_dm->cur_ps_tdma == 71) { in btc8821a2ant_tdma_duration_adjust()
2028 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2030 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2034 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2036 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2040 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2042 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2046 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2048 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2052 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2054 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2058 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2060 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2064 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2068 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2072 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2074 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2078 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2080 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2084 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2086 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2090 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2092 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2096 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2098 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2102 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2104 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2108 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2115 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2118 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
2119 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2122 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
2123 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2126 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2127 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2130 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
2132 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2135 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
2136 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2139 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
2140 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2143 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2144 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2147 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
2149 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2150 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2154 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2156 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2160 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2162 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2166 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2168 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2172 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2174 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2178 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2180 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2184 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2188 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2192 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2194 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2198 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2200 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2204 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2206 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2210 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2212 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2216 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2218 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2222 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2227 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2230 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
2231 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2234 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
2235 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2238 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2239 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2242 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2244 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2247 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2248 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2251 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2252 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2255 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2256 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2259 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2261 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2262 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2266 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2268 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2272 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2274 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2278 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2280 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2284 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2286 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2290 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2292 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2296 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2300 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2304 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2306 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2310 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2312 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2316 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2318 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2322 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2324 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2328 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2330 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2334 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2341 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2344 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2345 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2348 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2349 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2352 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2353 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2356 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
2358 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2361 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2362 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2365 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2366 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2369 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2370 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2373 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
2375 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2376 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2380 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2382 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2386 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2388 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2392 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2394 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2398 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2400 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2404 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2406 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2410 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2414 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2418 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2420 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2424 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2426 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2430 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2432 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2436 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2438 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2442 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2444 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2448 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2453 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2456 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2457 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2460 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2461 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2464 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2465 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2468 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2470 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2473 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2474 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2477 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2478 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2481 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2482 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2485 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2487 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2488 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2492 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2494 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2498 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2500 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2504 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2506 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2510 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2512 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2516 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2518 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2522 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2526 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2530 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2532 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2536 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2538 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2542 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2544 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2548 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2550 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2554 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2556 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2560 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2572 if (coex_dm->cur_ps_tdma != coex_dm->ps_tdma_du_adj_type) { in btc8821a2ant_tdma_duration_adjust()
2577 coex_dm->cur_ps_tdma, coex_dm->ps_tdma_du_adj_type); in btc8821a2ant_tdma_duration_adjust()
2579 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_tdma_duration_adjust()
2580 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_tdma_duration_adjust()
2581 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_tdma_duration_adjust()
2585 coex_dm->ps_tdma_du_adj_type); in btc8821a2ant_tdma_duration_adjust()
2593 /* SCO only or SCO+PAN(HS)*/
2596 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_action_sco()
2603 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_sco()
2613 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_sco()
2616 /* for SCO quality at 11b/g mode */ in btc8821a2ant_action_sco()
2619 /* for SCO quality & wifi performance balance at 11n mode */ in btc8821a2ant_action_sco()
2624 if (bt_link_info->sco_only) in btc8821a2ant_action_sco()
2676 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_hid()
2686 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_hid()
2748 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8821a2ant_action_a2dp()
2762 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp()
2777 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_a2dp()
2797 /* preserve identical branches for further fine-tuning */ in btc8821a2ant_action_a2dp()
2806 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp()
2847 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_a2dp_pan_hs()
2870 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp_pan_hs()
2911 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_edr()
2932 /* preserve identical branches for further fine-tuning */ in btc8821a2ant_action_pan_edr()
2940 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr()
2982 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_hs()
2996 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_hs()
3038 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_edr_a2dp()
3056 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr_a2dp()
3119 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr_hid()
3121 /* preserve identical branches for further fine-tuning */ in btc8821a2ant_action_pan_edr_hid()
3194 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_act_hid_a2dp_pan_edr()
3214 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_act_hid_a2dp_pan_edr()
3270 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_hid_a2dp()
3275 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_hid_a2dp()
3284 /* only 802.11N mode we have to dec bt power to 4 degree */ in btc8821a2ant_action_hid_a2dp()
3286 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, in btc8821a2ant_action_hid_a2dp()
3311 /* preserve identical branches for further fine-tuning */ in btc8821a2ant_action_hid_a2dp()
3367 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_run_coexist_mechanism()
3368 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_run_coexist_mechanism()
3376 if (btcoexist->manual_control) { in btc8821a2ant_run_coexist_mechanism()
3382 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in btc8821a2ant_run_coexist_mechanism()
3391 if (coex_sta->under_ips) { in btc8821a2ant_run_coexist_mechanism()
3398 if (coex_sta->c2h_bt_inquiry_page && in btc8821a2ant_run_coexist_mechanism()
3401 "[BTCoex], BT is under inquiry/page scan !!\n"); in btc8821a2ant_run_coexist_mechanism()
3406 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_run_coexist_mechanism()
3407 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_run_coexist_mechanism()
3408 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_run_coexist_mechanism()
3418 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in btc8821a2ant_run_coexist_mechanism()
3425 "############# [BTCoex], Multi-Port num_of_wifi_link = %d, wifi_link_status = 0x%x\n", in btc8821a2ant_run_coexist_mechanism()
3428 if (bt_link_info->bt_link_exist) in btc8821a2ant_run_coexist_mechanism()
3433 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8821a2ant_run_coexist_mechanism()
3441 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8821a2ant_run_coexist_mechanism()
3444 coex_dm->cur_algorithm = algorithm; in btc8821a2ant_run_coexist_mechanism()
3446 "[BTCoex], Algorithm = %d\n", coex_dm->cur_algorithm); in btc8821a2ant_run_coexist_mechanism()
3450 "[BTCoex], Action 2-Ant common\n"); in btc8821a2ant_run_coexist_mechanism()
3451 coex_dm->auto_tdma_adjust = true; in btc8821a2ant_run_coexist_mechanism()
3453 if (coex_dm->cur_algorithm != coex_dm->pre_algorithm) { in btc8821a2ant_run_coexist_mechanism()
3456 coex_dm->pre_algorithm, in btc8821a2ant_run_coexist_mechanism()
3457 coex_dm->cur_algorithm); in btc8821a2ant_run_coexist_mechanism()
3458 coex_dm->auto_tdma_adjust = false; in btc8821a2ant_run_coexist_mechanism()
3460 switch (coex_dm->cur_algorithm) { in btc8821a2ant_run_coexist_mechanism()
3463 "[BTCoex], Action 2-Ant, algorithm = SCO\n"); in btc8821a2ant_run_coexist_mechanism()
3468 "[BTCoex], Action 2-Ant, algorithm = HID\n"); in btc8821a2ant_run_coexist_mechanism()
3473 "[BTCoex], Action 2-Ant, algorithm = A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3478 "[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS)\n"); in btc8821a2ant_run_coexist_mechanism()
3483 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)\n"); in btc8821a2ant_run_coexist_mechanism()
3488 "[BTCoex], Action 2-Ant, algorithm = HS mode\n"); in btc8821a2ant_run_coexist_mechanism()
3493 "[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3498 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID\n"); in btc8821a2ant_run_coexist_mechanism()
3503 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN\n"); in btc8821a2ant_run_coexist_mechanism()
3508 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3513 "[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"); in btc8821a2ant_run_coexist_mechanism()
3517 coex_dm->pre_algorithm = coex_dm->cur_algorithm; in btc8821a2ant_run_coexist_mechanism()
3527 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in btc8821a2ant_wifi_off_hw_cfg()
3529 /* WiFi goto standby while GNT_BT 0-->1 */ in btc8821a2ant_wifi_off_hw_cfg()
3530 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); in btc8821a2ant_wifi_off_hw_cfg()
3531 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in btc8821a2ant_wifi_off_hw_cfg()
3535 btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, h2c_parameter); in btc8821a2ant_wifi_off_hw_cfg()
3537 btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18); in btc8821a2ant_wifi_off_hw_cfg()
3546 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_init_hwconfig()
3553 coex_dm->bt_rf0x1e_backup = in ex_btc8821a2ant_init_hwconfig()
3554 btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff); in ex_btc8821a2ant_init_hwconfig()
3557 u1tmp = btcoexist->btc_read_1byte(btcoexist, 0x790); in ex_btc8821a2ant_init_hwconfig()
3560 btcoexist->btc_write_1byte(btcoexist, 0x790, u1tmp); in ex_btc8821a2ant_init_hwconfig()
3564 coex_sta->dis_ver_info_cnt = 0; in ex_btc8821a2ant_init_hwconfig()
3571 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in ex_btc8821a2ant_init_hwconfig()
3572 btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3); in ex_btc8821a2ant_init_hwconfig()
3573 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1); in ex_btc8821a2ant_init_hwconfig()
3578 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a2ant_pre_load_firmware()
3589 * NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and in ex_btc8821a2ant_pre_load_firmware()
3592 if (btcoexist->chip_interface == BTC_INTF_USB) { in ex_btc8821a2ant_pre_load_firmware()
3595 btcoexist->btc_write_local_reg_1byte(btcoexist, 0xfe08, u8tmp); in ex_btc8821a2ant_pre_load_firmware()
3598 if (board_info->single_ant_path == 0) { in ex_btc8821a2ant_pre_load_firmware()
3599 } else if (board_info->single_ant_path == 1) { in ex_btc8821a2ant_pre_load_firmware()
3604 if (btcoexist->chip_interface == BTC_INTF_PCI) in ex_btc8821a2ant_pre_load_firmware()
3605 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x384, in ex_btc8821a2ant_pre_load_firmware()
3607 else if (btcoexist->chip_interface == BTC_INTF_SDIO) in ex_btc8821a2ant_pre_load_firmware()
3608 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x60, in ex_btc8821a2ant_pre_load_firmware()
3615 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_init_coex_dm()
3626 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a2ant_display_coex_info()
3627 struct btc_stack_info *stack_info = &btcoexist->stack_info; in ex_btc8821a2ant_display_coex_info()
3637 seq_puts(m, "\n ============[BT Coexist info]============"); in ex_btc8821a2ant_display_coex_info()
3639 seq_printf(m, "\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", in ex_btc8821a2ant_display_coex_info()
3640 board_info->pg_ant_num, board_info->btdm_ant_num); in ex_btc8821a2ant_display_coex_info()
3642 if (btcoexist->manual_control) { in ex_btc8821a2ant_display_coex_info()
3643 seq_printf(m, "\n %-35s", "[Action Manual control]!!"); in ex_btc8821a2ant_display_coex_info()
3646 seq_printf(m, "\n %-35s = %s / %d", "BT stack/ hci ext ver", in ex_btc8821a2ant_display_coex_info()
3647 ((stack_info->profile_notified) ? "Yes" : "No"), in ex_btc8821a2ant_display_coex_info()
3648 stack_info->hci_version); in ex_btc8821a2ant_display_coex_info()
3650 btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver); in ex_btc8821a2ant_display_coex_info()
3651 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in ex_btc8821a2ant_display_coex_info()
3652 seq_printf(m, "\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)", in ex_btc8821a2ant_display_coex_info()
3657 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3659 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3661 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3663 seq_printf(m, "\n %-35s = %d / %d(%d)", in ex_btc8821a2ant_display_coex_info()
3667 seq_printf(m, "\n %-35s = %3ph ", in ex_btc8821a2ant_display_coex_info()
3668 "H2C Wifi inform bt chnl Info", in ex_btc8821a2ant_display_coex_info()
3669 coex_dm->wifi_chnl_info); in ex_btc8821a2ant_display_coex_info()
3671 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in ex_btc8821a2ant_display_coex_info()
3672 btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi); in ex_btc8821a2ant_display_coex_info()
3673 seq_printf(m, "\n %-35s = %ld/ %ld", "Wifi rssi/ HS rssi", in ex_btc8821a2ant_display_coex_info()
3676 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in ex_btc8821a2ant_display_coex_info()
3677 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in ex_btc8821a2ant_display_coex_info()
3678 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in ex_btc8821a2ant_display_coex_info()
3679 seq_printf(m, "\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan", in ex_btc8821a2ant_display_coex_info()
3682 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3684 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3686 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3688 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3690 seq_printf(m, "\n %-35s = %s / %s/ %s ", "Wifi status", in ex_btc8821a2ant_display_coex_info()
3698 if (stack_info->profile_notified) { in ex_btc8821a2ant_display_coex_info()
3699 seq_printf(m, "\n %-35s = %d / %d / %d / %d", in ex_btc8821a2ant_display_coex_info()
3700 "SCO/HID/PAN/A2DP", in ex_btc8821a2ant_display_coex_info()
3701 stack_info->sco_exist, stack_info->hid_exist, in ex_btc8821a2ant_display_coex_info()
3702 stack_info->pan_exist, stack_info->a2dp_exist); in ex_btc8821a2ant_display_coex_info()
3704 btcoexist->btc_disp_dbg_msg(btcoexist, in ex_btc8821a2ant_display_coex_info()
3709 bt_info_ext = coex_sta->bt_info_ext; in ex_btc8821a2ant_display_coex_info()
3710 seq_printf(m, "\n %-35s = %s", "BT Info A2DP rate", in ex_btc8821a2ant_display_coex_info()
3714 if (coex_sta->bt_info_c2h_cnt[i]) { in ex_btc8821a2ant_display_coex_info()
3715 seq_printf(m, "\n %-35s = %7ph(%d)", in ex_btc8821a2ant_display_coex_info()
3717 coex_sta->bt_info_c2h[i], in ex_btc8821a2ant_display_coex_info()
3718 coex_sta->bt_info_c2h_cnt[i]); in ex_btc8821a2ant_display_coex_info()
3722 seq_printf(m, "\n %-35s = %s/%s", in ex_btc8821a2ant_display_coex_info()
3724 ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")), in ex_btc8821a2ant_display_coex_info()
3725 ((coex_sta->under_lps ? "LPS ON" : "LPS OFF"))); in ex_btc8821a2ant_display_coex_info()
3726 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD, m); in ex_btc8821a2ant_display_coex_info()
3729 seq_printf(m, "\n %-35s", in ex_btc8821a2ant_display_coex_info()
3731 seq_printf(m, "\n %-35s = %d/ %d/ %d(0x%x) ", in ex_btc8821a2ant_display_coex_info()
3733 coex_dm->cur_agc_table_en, coex_dm->cur_adc_back_off, in ex_btc8821a2ant_display_coex_info()
3734 coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl); in ex_btc8821a2ant_display_coex_info()
3737 seq_printf(m, "\n %-35s", in ex_btc8821a2ant_display_coex_info()
3740 if (!btcoexist->manual_control) { in ex_btc8821a2ant_display_coex_info()
3741 ps_tdma_case = coex_dm->cur_ps_tdma; in ex_btc8821a2ant_display_coex_info()
3742 seq_printf(m, "\n %-35s = %5ph case-%d", in ex_btc8821a2ant_display_coex_info()
3744 coex_dm->ps_tdma_para, ps_tdma_case); in ex_btc8821a2ant_display_coex_info()
3746 seq_printf(m, "\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", in ex_btc8821a2ant_display_coex_info()
3747 coex_dm->cur_dec_bt_pwr_lvl, in ex_btc8821a2ant_display_coex_info()
3748 coex_dm->cur_ignore_wlan_act); in ex_btc8821a2ant_display_coex_info()
3752 seq_printf(m, "\n %-35s", "============[Hw setting]============"); in ex_btc8821a2ant_display_coex_info()
3754 seq_printf(m, "\n %-35s = 0x%x", "RF-A, 0x1e initVal", in ex_btc8821a2ant_display_coex_info()
3755 coex_dm->bt_rf0x1e_backup); in ex_btc8821a2ant_display_coex_info()
3757 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778); in ex_btc8821a2ant_display_coex_info()
3758 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x6cc); in ex_btc8821a2ant_display_coex_info()
3759 seq_printf(m, "\n %-35s = 0x%x/ 0x%x ", in ex_btc8821a2ant_display_coex_info()
3763 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db); in ex_btc8821a2ant_display_coex_info()
3764 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xc5b); in ex_btc8821a2ant_display_coex_info()
3765 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3769 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4); in ex_btc8821a2ant_display_coex_info()
3770 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3774 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40); in ex_btc8821a2ant_display_coex_info()
3775 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c); in ex_btc8821a2ant_display_coex_info()
3776 u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x974); in ex_btc8821a2ant_display_coex_info()
3777 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3781 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550); in ex_btc8821a2ant_display_coex_info()
3782 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522); in ex_btc8821a2ant_display_coex_info()
3783 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3787 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50); in ex_btc8821a2ant_display_coex_info()
3788 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa0a); in ex_btc8821a2ant_display_coex_info()
3789 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3790 "0xc50(DIG)/0xa0a(CCK-TH)", in ex_btc8821a2ant_display_coex_info()
3793 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48); in ex_btc8821a2ant_display_coex_info()
3794 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5b); in ex_btc8821a2ant_display_coex_info()
3795 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c); in ex_btc8821a2ant_display_coex_info()
3796 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3797 "OFDM-FA/ CCK-FA", in ex_btc8821a2ant_display_coex_info()
3800 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0); in ex_btc8821a2ant_display_coex_info()
3801 u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4); in ex_btc8821a2ant_display_coex_info()
3802 u4tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8); in ex_btc8821a2ant_display_coex_info()
3803 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3807 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8821a2ant_display_coex_info()
3808 "0x770 (hi-pri Rx/Tx)", in ex_btc8821a2ant_display_coex_info()
3809 coex_sta->high_priority_rx, coex_sta->high_priority_tx); in ex_btc8821a2ant_display_coex_info()
3810 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8821a2ant_display_coex_info()
3811 "0x774(low-pri Rx/Tx)", in ex_btc8821a2ant_display_coex_info()
3812 coex_sta->low_priority_rx, coex_sta->low_priority_tx); in ex_btc8821a2ant_display_coex_info()
3815 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x41b); in ex_btc8821a2ant_display_coex_info()
3816 seq_printf(m, "\n %-35s = 0x%x", in ex_btc8821a2ant_display_coex_info()
3820 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS, m); in ex_btc8821a2ant_display_coex_info()
3825 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_ips_notify()
3830 coex_sta->under_ips = true; in ex_btc8821a2ant_ips_notify()
3837 coex_sta->under_ips = false; in ex_btc8821a2ant_ips_notify()
3846 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_lps_notify()
3851 coex_sta->under_lps = true; in ex_btc8821a2ant_lps_notify()
3855 coex_sta->under_lps = false; in ex_btc8821a2ant_lps_notify()
3861 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_scan_notify()
3874 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_connect_notify()
3888 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_media_status_notify()
3902 /* only 2.4G we need to inform bt the chnl mask */ in ex_btc8821a2ant_media_status_notify()
3903 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, in ex_btc8821a2ant_media_status_notify()
3909 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in ex_btc8821a2ant_media_status_notify()
3921 coex_dm->wifi_chnl_info[0] = h2c_parameter[0]; in ex_btc8821a2ant_media_status_notify()
3922 coex_dm->wifi_chnl_info[1] = h2c_parameter[1]; in ex_btc8821a2ant_media_status_notify()
3923 coex_dm->wifi_chnl_info[2] = h2c_parameter[2]; in ex_btc8821a2ant_media_status_notify()
3931 btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter); in ex_btc8821a2ant_media_status_notify()
3937 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_special_packet_notify()
3948 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_bt_info_notify()
3954 coex_sta->c2h_bt_info_req_sent = false; in ex_btc8821a2ant_bt_info_notify()
3955 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a2ant_bt_info_notify()
3956 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in ex_btc8821a2ant_bt_info_notify()
3962 coex_sta->bt_info_c2h_cnt[rsp_source]++; in ex_btc8821a2ant_bt_info_notify()
3965 "[BTCoex], Bt info[%d], length = %d, hex data = [", in ex_btc8821a2ant_bt_info_notify()
3968 coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i]; in ex_btc8821a2ant_bt_info_notify()
3971 if (i == length - 1) { in ex_btc8821a2ant_bt_info_notify()
3980 if (btcoexist->manual_control) { in ex_btc8821a2ant_bt_info_notify()
3988 coex_sta->bt_retry_cnt = in ex_btc8821a2ant_bt_info_notify()
3989 coex_sta->bt_info_c2h[rsp_source][2]&0xf; in ex_btc8821a2ant_bt_info_notify()
3991 coex_sta->bt_rssi = in ex_btc8821a2ant_bt_info_notify()
3992 coex_sta->bt_info_c2h[rsp_source][3] * 2 + 10; in ex_btc8821a2ant_bt_info_notify()
3994 coex_sta->bt_info_ext = coex_sta->bt_info_c2h[rsp_source][4]; in ex_btc8821a2ant_bt_info_notify()
3996 coex_sta->bt_tx_rx_mask = in ex_btc8821a2ant_bt_info_notify()
3997 (coex_sta->bt_info_c2h[rsp_source][2] & 0x40); in ex_btc8821a2ant_bt_info_notify()
3998 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TX_RX_MASK, in ex_btc8821a2ant_bt_info_notify()
3999 &coex_sta->bt_tx_rx_mask); in ex_btc8821a2ant_bt_info_notify()
4000 if (coex_sta->bt_tx_rx_mask) { in ex_btc8821a2ant_bt_info_notify()
4001 /* BT into is responded by BT FW and BT RF REG 0x3C != in ex_btc8821a2ant_bt_info_notify()
4002 * 0x01 => Need to switch BT TRx Mask in ex_btc8821a2ant_bt_info_notify()
4005 "[BTCoex], Switch BT TRx Mask since BT RF REG 0x3C != 0x01\n"); in ex_btc8821a2ant_bt_info_notify()
4006 btcoexist->btc_set_bt_reg(btcoexist, BTC_BT_REG_RF, in ex_btc8821a2ant_bt_info_notify()
4010 /* Here we need to resend some wifi info to BT in ex_btc8821a2ant_bt_info_notify()
4011 * because bt is reset and loss of the info in ex_btc8821a2ant_bt_info_notify()
4013 if ((coex_sta->bt_info_ext & BIT1)) { in ex_btc8821a2ant_bt_info_notify()
4014 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_bt_info_notify()
4026 if (!btcoexist->manual_control && !wifi_under_5g) { in ex_btc8821a2ant_bt_info_notify()
4028 "[BTCoex], BT ext info = 0x%x!!\n", in ex_btc8821a2ant_bt_info_notify()
4029 coex_sta->bt_info_ext); in ex_btc8821a2ant_bt_info_notify()
4030 if ((coex_sta->bt_info_ext & BIT(3))) { in ex_btc8821a2ant_bt_info_notify()
4032 "[BTCoex], BT ext info bit3=1, wifi_connected=%d\n", in ex_btc8821a2ant_bt_info_notify()
4037 "[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"); in ex_btc8821a2ant_bt_info_notify()
4044 "[BTCoex], BT ext info bit3=0, wifi_connected=%d\n", in ex_btc8821a2ant_bt_info_notify()
4046 /* BT already NOT ignore Wlan active, do nothing in ex_btc8821a2ant_bt_info_notify()
4052 "[BTCoex], BT ext info bit3 check, set BT to ignore Wlan active!!\n"); in ex_btc8821a2ant_bt_info_notify()
4060 /* check BIT2 first ==> check if bt is under inquiry or page scan*/ in ex_btc8821a2ant_bt_info_notify()
4062 coex_sta->c2h_bt_inquiry_page = true; in ex_btc8821a2ant_bt_info_notify()
4064 coex_sta->c2h_bt_inquiry_page = false; in ex_btc8821a2ant_bt_info_notify()
4068 coex_sta->bt_link_exist = false; in ex_btc8821a2ant_bt_info_notify()
4069 coex_sta->pan_exist = false; in ex_btc8821a2ant_bt_info_notify()
4070 coex_sta->a2dp_exist = false; in ex_btc8821a2ant_bt_info_notify()
4071 coex_sta->hid_exist = false; in ex_btc8821a2ant_bt_info_notify()
4072 coex_sta->sco_exist = false; in ex_btc8821a2ant_bt_info_notify()
4074 coex_sta->bt_link_exist = true; in ex_btc8821a2ant_bt_info_notify()
4076 coex_sta->pan_exist = true; in ex_btc8821a2ant_bt_info_notify()
4078 coex_sta->pan_exist = false; in ex_btc8821a2ant_bt_info_notify()
4080 coex_sta->a2dp_exist = true; in ex_btc8821a2ant_bt_info_notify()
4082 coex_sta->a2dp_exist = false; in ex_btc8821a2ant_bt_info_notify()
4084 coex_sta->hid_exist = true; in ex_btc8821a2ant_bt_info_notify()
4086 coex_sta->hid_exist = false; in ex_btc8821a2ant_bt_info_notify()
4088 coex_sta->sco_exist = true; in ex_btc8821a2ant_bt_info_notify()
4090 coex_sta->sco_exist = false; in ex_btc8821a2ant_bt_info_notify()
4092 if ((!coex_sta->hid_exist) && in ex_btc8821a2ant_bt_info_notify()
4093 (!coex_sta->c2h_bt_inquiry_page) && in ex_btc8821a2ant_bt_info_notify()
4094 (!coex_sta->sco_exist)) { in ex_btc8821a2ant_bt_info_notify()
4095 if (coex_sta->high_priority_tx + in ex_btc8821a2ant_bt_info_notify()
4096 coex_sta->high_priority_rx >= 160) in ex_btc8821a2ant_bt_info_notify()
4097 coex_sta->hid_exist = true; in ex_btc8821a2ant_bt_info_notify()
4104 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_IDLE; in ex_btc8821a2ant_bt_info_notify()
4106 "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4109 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_CON_IDLE; in ex_btc8821a2ant_bt_info_notify()
4111 "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4114 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_SCO_BUSY; in ex_btc8821a2ant_bt_info_notify()
4116 "[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4118 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_ACL_BUSY; in ex_btc8821a2ant_bt_info_notify()
4120 "[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4122 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_MAX; in ex_btc8821a2ant_bt_info_notify()
4124 "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4127 if ((coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_ACL_BUSY) || in ex_btc8821a2ant_bt_info_notify()
4128 (coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_SCO_BUSY) || in ex_btc8821a2ant_bt_info_notify()
4129 (coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY)) { in ex_btc8821a2ant_bt_info_notify()
4137 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy); in ex_btc8821a2ant_bt_info_notify()
4139 coex_dm->limited_dig = limited_dig; in ex_btc8821a2ant_bt_info_notify()
4140 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_LIMITED_DIG, &limited_dig); in ex_btc8821a2ant_bt_info_notify()
4147 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_halt_notify()
4159 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_pnp_notify()
4177 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_periodical()
4182 if (coex_sta->dis_ver_info_cnt <= 5) { in ex_btc8821a2ant_periodical()
4183 coex_sta->dis_ver_info_cnt += 1; in ex_btc8821a2ant_periodical()
4184 if (coex_sta->dis_ver_info_cnt == 3) { in ex_btc8821a2ant_periodical()
4195 if (btcoexist->auto_report_2ant) { in ex_btc8821a2ant_periodical()
4202 coex_dm->auto_tdma_adjust) in ex_btc8821a2ant_periodical()