Lines Matching +full:wifi +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0
7 * This file is for RTL8821A Co-exist mechanism
11 * 2012/11/14 Cosa Revise for 8821A 2Ant out sourcing.
28 "BT Info[wifi fw]",
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()
51 if (level_num == 2) { 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()
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()
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()
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()
142 if (level_num == 2) { 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()
151 "[BTCoex], wifi RSSI state switch to High\n"); in btc8821a2ant_wifi_rssi_state()
155 "[BTCoex], wifi RSSI state stay at Low\n"); in btc8821a2ant_wifi_rssi_state()
161 "[BTCoex], wifi RSSI state switch to Low\n"); in btc8821a2ant_wifi_rssi_state()
165 "[BTCoex], wifi RSSI state stay at High\n"); in btc8821a2ant_wifi_rssi_state()
171 "[BTCoex], wifi RSSI thresh error!!\n"); 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()
184 "[BTCoex], wifi RSSI state switch to Medium\n"); in btc8821a2ant_wifi_rssi_state()
188 "[BTCoex], wifi RSSI state stay at Low\n"); 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()
198 "[BTCoex], wifi RSSI state switch to High\n"); in btc8821a2ant_wifi_rssi_state()
202 "[BTCoex], wifi RSSI state switch to Low\n"); in btc8821a2ant_wifi_rssi_state()
206 "[BTCoex], wifi RSSI state stay at Medium\n"); in btc8821a2ant_wifi_rssi_state()
212 "[BTCoex], wifi RSSI state switch to Medium\n"); in btc8821a2ant_wifi_rssi_state()
216 "[BTCoex], wifi RSSI state stay at High\n"); 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()
238 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_CTRL_AGG_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()
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()
370 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 3, 2, 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()
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()
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()
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()
482 } else if (num_of_diff_profile == 2) { 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()
488 } else if (bt_link_info->a2dp_exist) { in btc8821a2ant_action_algorithm()
492 } else if (bt_link_info->pan_exist) { 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()
549 } else if (bt_link_info->hid_exist && in btc8821a2ant_action_algorithm()
550 bt_link_info->pan_exist) { 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()
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()
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()
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()
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()
713 h2c_parameter[2] = 0x00; 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()
892 case 2: in btc8821a2ant_coex_table_with_type()
964 struct rtl_priv *rtlpriv = btcoex->adapter; 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()
1038 h2c_parameter[2] = byte3; 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()
1052 h2c_parameter[2] << 16 | 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()
1080 u8 h2c_parameter[2] = {0}; 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()
1128 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_ps_tdma()
1130 bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 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()
1166 case 2: 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()
1457 btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_bt_inquiry()
1458 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_bt_inquiry()
1461 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_bt_inquiry()
1463 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_action_bt_inquiry()
1465 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a2ant_action_bt_inquiry()
1468 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_action_bt_inquiry()
1469 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_action_bt_inquiry()
1470 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_action_bt_inquiry()
1476 "[BTCoex], Wifi link process + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1481 "[BTCoex], Wifi connected + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1486 "[BTCoex], Wifi no-link + BT Inq/Page!!\n"); in btc8821a2ant_action_bt_inquiry()
1500 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_wifi_link_process()
1509 u8tmpa = btcoexist->btc_read_1byte(btcoexist, 0x765); in btc8821a2ant_action_wifi_link_process()
1510 u8tmpb = btcoexist->btc_read_1byte(btcoexist, 0x76e); in btc8821a2ant_action_wifi_link_process()
1518 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_action_wifi_idle_process()
1523 btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_wifi_idle_process()
1524 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_wifi_idle_process()
1525 BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES - 20, 0); in btc8821a2ant_action_wifi_idle_process()
1527 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_wifi_idle_process()
1529 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num); in btc8821a2ant_action_wifi_idle_process()
1532 if (BTC_RSSI_HIGH(wifi_rssi_state1) && (coex_sta->hid_exist) && in btc8821a2ant_action_wifi_idle_process()
1533 (coex_sta->a2dp_exist)) { in btc8821a2ant_action_wifi_idle_process()
1535 "[BTCoex], Wifi idle process for BT HID+A2DP exist!!\n"); in btc8821a2ant_action_wifi_idle_process()
1552 } else if (coex_sta->pan_exist) { in btc8821a2ant_action_wifi_idle_process()
1554 "[BTCoex], Wifi idle process for BT PAN exist!!\n"); in btc8821a2ant_action_wifi_idle_process()
1578 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_is_common_action()
1583 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a2ant_is_common_action()
1584 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a2ant_is_common_action()
1586 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a2ant_is_common_action()
1590 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a2ant_is_common_action()
1596 "[BTCoex], Wifi non-connected idle!!\n"); in btc8821a2ant_is_common_action()
1598 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8821a2ant_is_common_action()
1615 coex_dm->bt_status) { in btc8821a2ant_is_common_action()
1617 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1624 "[BTCoex], Wifi connected + BT non connected-idle!!\n"); in btc8821a2ant_is_common_action()
1626 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8821a2ant_is_common_action()
1645 coex_dm->bt_status) { in btc8821a2ant_is_common_action()
1647 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1654 "[BTCoex], Wifi connected + BT connected-idle!!\n"); in btc8821a2ant_is_common_action()
1658 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, in btc8821a2ant_is_common_action()
1677 btcoexist->btc_set(btcoexist, in btc8821a2ant_is_common_action()
1683 "[BTCoex], Wifi Connected-Busy + BT Busy!!\n"); in btc8821a2ant_is_common_action()
1687 "[BTCoex], Wifi Connected-Idle + BT Busy!!\n"); in btc8821a2ant_is_common_action()
1701 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_tdma_duration_adjust()
1704 * +1: increase WiFi duration in btc8821a2ant_tdma_duration_adjust()
1705 * -1: decrease WiFi duration in btc8821a2ant_tdma_duration_adjust()
1713 if (coex_dm->auto_tdma_adjust) { in btc8821a2ant_tdma_duration_adjust()
1714 coex_dm->auto_tdma_adjust = false; in btc8821a2ant_tdma_duration_adjust()
1722 coex_dm->ps_tdma_du_adj_type = 13; in btc8821a2ant_tdma_duration_adjust()
1723 } else if (max_interval == 2) { in btc8821a2ant_tdma_duration_adjust()
1726 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
1730 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
1734 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
1740 coex_dm->ps_tdma_du_adj_type = 9; in btc8821a2ant_tdma_duration_adjust()
1741 } else if (max_interval == 2) { in btc8821a2ant_tdma_duration_adjust()
1744 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
1748 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
1752 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
1760 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1761 } else if (max_interval == 2) { in btc8821a2ant_tdma_duration_adjust()
1764 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
1768 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
1772 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
1778 coex_dm->ps_tdma_du_adj_type = 1; in btc8821a2ant_tdma_duration_adjust()
1779 } else if (max_interval == 2) { in btc8821a2ant_tdma_duration_adjust()
1781 NORMAL_EXEC, true, 2); in btc8821a2ant_tdma_duration_adjust()
1782 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
1786 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
1790 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
1803 retry_count = coex_sta->bt_retry_cnt; in btc8821a2ant_tdma_duration_adjust()
1813 /* no retry in the last 2-second duration */ in btc8821a2ant_tdma_duration_adjust()
1815 dn--; in btc8821a2ant_tdma_duration_adjust()
1821 /* if (retry count == 0) for 2*n seconds, in btc8821a2ant_tdma_duration_adjust()
1822 * make WiFi duration wider in btc8821a2ant_tdma_duration_adjust()
1830 "[BTCoex], Increase wifi duration!!\n"); in btc8821a2ant_tdma_duration_adjust()
1833 /* <=3 retry in the last 2-second duration */ in btc8821a2ant_tdma_duration_adjust()
1834 up--; in btc8821a2ant_tdma_duration_adjust()
1840 if (dn == 2) { in btc8821a2ant_tdma_duration_adjust()
1841 /* if retry count < 3 for 2*2 seconds, in btc8821a2ant_tdma_duration_adjust()
1842 * shrink wifi duration in btc8821a2ant_tdma_duration_adjust()
1844 if (wait_count <= 2) in btc8821a2ant_tdma_duration_adjust()
1849 * recheck if adjust WiFi duration. in btc8821a2ant_tdma_duration_adjust()
1858 result = -1; in btc8821a2ant_tdma_duration_adjust()
1860 "[BTCoex], Decrease wifi duration for retryCounter<3!!\n"); in btc8821a2ant_tdma_duration_adjust()
1864 * shrink WiFi duration in btc8821a2ant_tdma_duration_adjust()
1871 * recheck if adjust WiFi duration. in btc8821a2ant_tdma_duration_adjust()
1880 result = -1; in btc8821a2ant_tdma_duration_adjust()
1882 "[BTCoex], Decrease wifi duration for retryCounter>3!!\n"); in btc8821a2ant_tdma_duration_adjust()
1890 if (coex_dm->cur_ps_tdma == 71) { in btc8821a2ant_tdma_duration_adjust()
1893 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1894 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
1897 coex_dm->ps_tdma_du_adj_type = 5; in btc8821a2ant_tdma_duration_adjust()
1898 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
1901 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
1902 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
1905 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
1906 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
1909 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
1911 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
1914 coex_dm->ps_tdma_du_adj_type = 13; in btc8821a2ant_tdma_duration_adjust()
1915 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
1918 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
1919 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
1922 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
1923 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
1926 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
1929 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
1930 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
1934 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1936 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
1940 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1942 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
1946 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1948 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
1952 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1954 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
1958 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1960 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
1964 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1968 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
1972 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1974 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
1978 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1980 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
1984 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1986 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
1990 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1992 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
1996 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
1998 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2002 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2007 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2010 coex_dm->ps_tdma_du_adj_type = 71; in btc8821a2ant_tdma_duration_adjust()
2011 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2013 NORMAL_EXEC, true, 2); in btc8821a2ant_tdma_duration_adjust()
2014 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
2015 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2018 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2019 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2022 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2024 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2027 coex_dm->ps_tdma_du_adj_type = 9; in btc8821a2ant_tdma_duration_adjust()
2028 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2031 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2032 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2035 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2036 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2039 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2042 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2043 if (coex_dm->cur_ps_tdma == 71) { in btc8821a2ant_tdma_duration_adjust()
2047 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2049 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2052 true, 2); in btc8821a2ant_tdma_duration_adjust()
2053 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2054 2; in btc8821a2ant_tdma_duration_adjust()
2055 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2059 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2061 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2065 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2067 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2071 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2073 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2077 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2079 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2083 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2087 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2091 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2093 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2096 true, 2); in btc8821a2ant_tdma_duration_adjust()
2097 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2098 2; in btc8821a2ant_tdma_duration_adjust()
2099 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2103 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2105 } else if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2109 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2111 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2115 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2117 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2121 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2123 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2127 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2132 } else if (max_interval == 2) { in btc8821a2ant_tdma_duration_adjust()
2134 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2137 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
2138 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2141 coex_dm->ps_tdma_du_adj_type = 6; in btc8821a2ant_tdma_duration_adjust()
2142 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2145 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2146 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2149 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
2151 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2154 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
2155 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2158 coex_dm->ps_tdma_du_adj_type = 14; in btc8821a2ant_tdma_duration_adjust()
2159 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2162 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2163 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2166 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
2168 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2169 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2173 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2175 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2179 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2181 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2185 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2187 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2191 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2193 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2197 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2199 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2203 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2207 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2211 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2213 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2217 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2219 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2223 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2225 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2229 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2231 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2235 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2237 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2241 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2246 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2248 NORMAL_EXEC, true, 2); in btc8821a2ant_tdma_duration_adjust()
2249 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
2250 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2252 NORMAL_EXEC, true, 2); in btc8821a2ant_tdma_duration_adjust()
2253 coex_dm->ps_tdma_du_adj_type = 2; in btc8821a2ant_tdma_duration_adjust()
2254 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2257 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2258 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2261 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2263 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2266 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2267 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2270 coex_dm->ps_tdma_du_adj_type = 10; in btc8821a2ant_tdma_duration_adjust()
2271 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2274 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2275 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2278 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2280 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2281 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2284 true, 2); in btc8821a2ant_tdma_duration_adjust()
2285 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2286 2; in btc8821a2ant_tdma_duration_adjust()
2287 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2291 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2293 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2297 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2299 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2303 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2305 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2309 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2311 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2315 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2319 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2323 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2325 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2328 true, 2); in btc8821a2ant_tdma_duration_adjust()
2329 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2330 2; in btc8821a2ant_tdma_duration_adjust()
2331 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2334 true, 2); in btc8821a2ant_tdma_duration_adjust()
2335 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2336 2; in btc8821a2ant_tdma_duration_adjust()
2337 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2341 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2343 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2347 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2349 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2353 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2360 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2363 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2364 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2367 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2368 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2371 coex_dm->ps_tdma_du_adj_type = 7; in btc8821a2ant_tdma_duration_adjust()
2372 } else if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2375 coex_dm->ps_tdma_du_adj_type = 8; in btc8821a2ant_tdma_duration_adjust()
2377 if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2380 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2381 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2384 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2385 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2388 coex_dm->ps_tdma_du_adj_type = 15; in btc8821a2ant_tdma_duration_adjust()
2389 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2392 coex_dm->ps_tdma_du_adj_type = 16; in btc8821a2ant_tdma_duration_adjust()
2394 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2395 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2399 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2401 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2405 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2407 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2411 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2413 } else if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2417 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2419 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2423 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2425 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2429 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2433 if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2437 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2439 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2443 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2445 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2449 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2451 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2455 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2457 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2461 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2463 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2467 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2472 if (coex_dm->cur_ps_tdma == 5) { in btc8821a2ant_tdma_duration_adjust()
2475 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2476 } else if (coex_dm->cur_ps_tdma == 6) { in btc8821a2ant_tdma_duration_adjust()
2479 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2480 } else if (coex_dm->cur_ps_tdma == 7) { in btc8821a2ant_tdma_duration_adjust()
2483 coex_dm->ps_tdma_du_adj_type = 3; in btc8821a2ant_tdma_duration_adjust()
2484 } else if (coex_dm->cur_ps_tdma == 8) { in btc8821a2ant_tdma_duration_adjust()
2487 coex_dm->ps_tdma_du_adj_type = 4; in btc8821a2ant_tdma_duration_adjust()
2489 if (coex_dm->cur_ps_tdma == 13) { in btc8821a2ant_tdma_duration_adjust()
2492 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2493 } else if (coex_dm->cur_ps_tdma == 14) { in btc8821a2ant_tdma_duration_adjust()
2496 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2497 } else if (coex_dm->cur_ps_tdma == 15) { in btc8821a2ant_tdma_duration_adjust()
2500 coex_dm->ps_tdma_du_adj_type = 11; in btc8821a2ant_tdma_duration_adjust()
2501 } else if (coex_dm->cur_ps_tdma == 16) { in btc8821a2ant_tdma_duration_adjust()
2504 coex_dm->ps_tdma_du_adj_type = 12; in btc8821a2ant_tdma_duration_adjust()
2506 if (result == -1) { in btc8821a2ant_tdma_duration_adjust()
2507 if (coex_dm->cur_ps_tdma == 1) { in btc8821a2ant_tdma_duration_adjust()
2511 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2513 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2517 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2519 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2523 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2525 } else if (coex_dm->cur_ps_tdma == 9) { in btc8821a2ant_tdma_duration_adjust()
2529 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2531 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2535 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2537 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2541 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2545 if (coex_dm->cur_ps_tdma == 4) { in btc8821a2ant_tdma_duration_adjust()
2549 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2551 } else if (coex_dm->cur_ps_tdma == 3) { in btc8821a2ant_tdma_duration_adjust()
2555 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2557 } else if (coex_dm->cur_ps_tdma == 2) { in btc8821a2ant_tdma_duration_adjust()
2561 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2563 } else if (coex_dm->cur_ps_tdma == 12) { in btc8821a2ant_tdma_duration_adjust()
2567 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2569 } else if (coex_dm->cur_ps_tdma == 11) { in btc8821a2ant_tdma_duration_adjust()
2573 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2575 } else if (coex_dm->cur_ps_tdma == 10) { in btc8821a2ant_tdma_duration_adjust()
2579 coex_dm->ps_tdma_du_adj_type = in btc8821a2ant_tdma_duration_adjust()
2591 if (coex_dm->cur_ps_tdma != coex_dm->ps_tdma_du_adj_type) { in btc8821a2ant_tdma_duration_adjust()
2596 coex_dm->cur_ps_tdma, coex_dm->ps_tdma_du_adj_type); in btc8821a2ant_tdma_duration_adjust()
2598 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_tdma_duration_adjust()
2599 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_tdma_duration_adjust()
2600 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_tdma_duration_adjust()
2604 coex_dm->ps_tdma_du_adj_type); in btc8821a2ant_tdma_duration_adjust()
2615 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_action_sco()
2619 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_sco()
2620 bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0); in btc8821a2ant_action_sco()
2622 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_sco()
2632 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_sco()
2636 btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_sco()
2638 /* for SCO quality & wifi performance balance at 11n mode */ in btc8821a2ant_action_sco()
2643 if (bt_link_info->sco_only) in btc8821a2ant_action_sco()
2691 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_hid()
2693 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_hid()
2695 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_hid()
2705 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_hid()
2711 /* for HID quality & wifi performance balance at 11n mode */ in btc8821a2ant_action_hid()
2712 btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_hid()
2756 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_a2dp()
2757 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_a2dp()
2760 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_a2dp()
2767 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, in btc8821a2ant_action_a2dp()
2772 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_a2dp()
2781 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp()
2796 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_a2dp()
2802 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_a2dp()
2824 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp()
2859 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_a2dp_pan_hs()
2860 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_a2dp_pan_hs()
2863 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_a2dp_pan_hs()
2865 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_a2dp_pan_hs()
2871 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_a2dp_pan_hs()
2885 btc8821a2ant_tdma_duration_adjust(btcoexist, false, true, 2); in btc8821a2ant_action_a2dp_pan_hs()
2888 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_a2dp_pan_hs()
2923 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_pan_edr()
2924 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_pan_edr()
2927 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_pan_edr()
2929 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_edr()
2957 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr()
2993 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_pan_hs()
2994 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_pan_hs()
2997 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_pan_hs()
2999 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_hs()
3005 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_pan_hs()
3013 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_hs()
3049 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_pan_edr_a2dp()
3050 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_pan_edr_a2dp()
3053 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_pan_edr_a2dp()
3055 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_pan_edr_a2dp()
3062 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_pan_edr_a2dp()
3073 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr_a2dp()
3125 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_pan_edr_hid()
3127 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_action_pan_edr_hid()
3136 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_pan_edr_hid()
3143 /* for HID quality & wifi performance balance at 11n mode */ in btc8821a2ant_action_pan_edr_hid()
3204 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_act_hid_a2dp_pan_edr()
3205 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_act_hid_a2dp_pan_edr()
3208 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0); in btc8821a2ant_act_hid_a2dp_pan_edr()
3210 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_act_hid_a2dp_pan_edr()
3216 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_act_hid_a2dp_pan_edr()
3230 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_act_hid_a2dp_pan_edr()
3280 wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0); in btc8821a2ant_action_hid_a2dp()
3281 wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2, in btc8821a2ant_action_hid_a2dp()
3286 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); in btc8821a2ant_action_hid_a2dp()
3291 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in btc8821a2ant_action_hid_a2dp()
3294 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_hid_a2dp()
3296 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_hid_a2dp()
3302 btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, in btc8821a2ant_action_hid_a2dp()
3309 NORMAL_EXEC, 2); in btc8821a2ant_action_hid_a2dp()
3311 btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2); in btc8821a2ant_action_hid_a2dp()
3382 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a2ant_run_coexist_mechanism()
3383 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a2ant_run_coexist_mechanism()
3391 if (btcoexist->manual_control) { in btc8821a2ant_run_coexist_mechanism()
3397 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in btc8821a2ant_run_coexist_mechanism()
3406 if (coex_sta->under_ips) { in btc8821a2ant_run_coexist_mechanism()
3408 "[BTCoex], wifi is under IPS !!!\n"); in btc8821a2ant_run_coexist_mechanism()
3413 if (coex_sta->c2h_bt_inquiry_page && in btc8821a2ant_run_coexist_mechanism()
3421 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a2ant_run_coexist_mechanism()
3422 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a2ant_run_coexist_mechanism()
3423 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a2ant_run_coexist_mechanism()
3427 "[BTCoex], WiFi is under Link Process !!\n"); in btc8821a2ant_run_coexist_mechanism()
3433 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in btc8821a2ant_run_coexist_mechanism()
3437 if ((num_of_wifi_link >= 2) || in btc8821a2ant_run_coexist_mechanism()
3440 "############# [BTCoex], Multi-Port num_of_wifi_link = %d, wifi_link_status = 0x%x\n", in btc8821a2ant_run_coexist_mechanism()
3443 if (bt_link_info->bt_link_exist) in btc8821a2ant_run_coexist_mechanism()
3448 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8821a2ant_run_coexist_mechanism()
3456 btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT, in btc8821a2ant_run_coexist_mechanism()
3459 coex_dm->cur_algorithm = algorithm; in btc8821a2ant_run_coexist_mechanism()
3461 "[BTCoex], Algorithm = %d\n", coex_dm->cur_algorithm); in btc8821a2ant_run_coexist_mechanism()
3465 "[BTCoex], Action 2-Ant common\n"); in btc8821a2ant_run_coexist_mechanism()
3466 coex_dm->auto_tdma_adjust = true; in btc8821a2ant_run_coexist_mechanism()
3468 if (coex_dm->cur_algorithm != coex_dm->pre_algorithm) { in btc8821a2ant_run_coexist_mechanism()
3471 coex_dm->pre_algorithm, in btc8821a2ant_run_coexist_mechanism()
3472 coex_dm->cur_algorithm); in btc8821a2ant_run_coexist_mechanism()
3473 coex_dm->auto_tdma_adjust = false; in btc8821a2ant_run_coexist_mechanism()
3475 switch (coex_dm->cur_algorithm) { in btc8821a2ant_run_coexist_mechanism()
3478 "[BTCoex], Action 2-Ant, algorithm = SCO\n"); in btc8821a2ant_run_coexist_mechanism()
3483 "[BTCoex], Action 2-Ant, algorithm = HID\n"); in btc8821a2ant_run_coexist_mechanism()
3488 "[BTCoex], Action 2-Ant, algorithm = A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3493 "[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS)\n"); in btc8821a2ant_run_coexist_mechanism()
3498 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)\n"); in btc8821a2ant_run_coexist_mechanism()
3503 "[BTCoex], Action 2-Ant, algorithm = HS mode\n"); in btc8821a2ant_run_coexist_mechanism()
3508 "[BTCoex], Action 2-Ant, algorithm = PAN+A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3513 "[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID\n"); in btc8821a2ant_run_coexist_mechanism()
3518 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN\n"); in btc8821a2ant_run_coexist_mechanism()
3523 "[BTCoex], Action 2-Ant, algorithm = HID+A2DP\n"); in btc8821a2ant_run_coexist_mechanism()
3528 "[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"); in btc8821a2ant_run_coexist_mechanism()
3532 coex_dm->pre_algorithm = coex_dm->cur_algorithm; in btc8821a2ant_run_coexist_mechanism()
3538 u8 h2c_parameter[2] = {0}; in btc8821a2ant_wifi_off_hw_cfg()
3542 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in btc8821a2ant_wifi_off_hw_cfg()
3544 /* WiFi goto standby while GNT_BT 0-->1 */ in btc8821a2ant_wifi_off_hw_cfg()
3545 btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); in btc8821a2ant_wifi_off_hw_cfg()
3546 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in btc8821a2ant_wifi_off_hw_cfg()
3550 btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, h2c_parameter); in btc8821a2ant_wifi_off_hw_cfg()
3552 btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18); in btc8821a2ant_wifi_off_hw_cfg()
3561 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_init_hwconfig()
3565 "[BTCoex], 2Ant Init HW Config!!\n"); in ex_btc8821a2ant_init_hwconfig()
3568 coex_dm->bt_rf0x1e_backup = in ex_btc8821a2ant_init_hwconfig()
3569 btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff); in ex_btc8821a2ant_init_hwconfig()
3572 u1tmp = btcoexist->btc_read_1byte(btcoexist, 0x790); in ex_btc8821a2ant_init_hwconfig()
3575 btcoexist->btc_write_1byte(btcoexist, 0x790, u1tmp); in ex_btc8821a2ant_init_hwconfig()
3579 coex_sta->dis_ver_info_cnt = 0; in ex_btc8821a2ant_init_hwconfig()
3586 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); in ex_btc8821a2ant_init_hwconfig()
3587 btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3); in ex_btc8821a2ant_init_hwconfig()
3588 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1); in ex_btc8821a2ant_init_hwconfig()
3593 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a2ant_pre_load_firmware()
3594 u8 u8tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ in ex_btc8821a2ant_pre_load_firmware()
3604 * NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and in ex_btc8821a2ant_pre_load_firmware()
3607 if (btcoexist->chip_interface == BTC_INTF_USB) { in ex_btc8821a2ant_pre_load_firmware()
3610 btcoexist->btc_write_local_reg_1byte(btcoexist, 0xfe08, u8tmp); in ex_btc8821a2ant_pre_load_firmware()
3613 if (board_info->single_ant_path == 0) { in ex_btc8821a2ant_pre_load_firmware()
3614 } else if (board_info->single_ant_path == 1) { in ex_btc8821a2ant_pre_load_firmware()
3619 if (btcoexist->chip_interface == BTC_INTF_PCI) in ex_btc8821a2ant_pre_load_firmware()
3620 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x384, in ex_btc8821a2ant_pre_load_firmware()
3622 else if (btcoexist->chip_interface == BTC_INTF_SDIO) in ex_btc8821a2ant_pre_load_firmware()
3623 btcoexist->btc_write_local_reg_1byte(btcoexist, 0x60, in ex_btc8821a2ant_pre_load_firmware()
3630 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_init_coex_dm()
3641 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a2ant_display_coex_info()
3642 struct btc_stack_info *stack_info = &btcoexist->stack_info; in ex_btc8821a2ant_display_coex_info()
3654 seq_printf(m, "\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", in ex_btc8821a2ant_display_coex_info()
3655 board_info->pg_ant_num, board_info->btdm_ant_num); in ex_btc8821a2ant_display_coex_info()
3657 if (btcoexist->manual_control) { in ex_btc8821a2ant_display_coex_info()
3658 seq_printf(m, "\n %-35s", "[Action Manual control]!!"); in ex_btc8821a2ant_display_coex_info()
3661 seq_printf(m, "\n %-35s = %s / %d", "BT stack/ hci ext ver", in ex_btc8821a2ant_display_coex_info()
3662 ((stack_info->profile_notified) ? "Yes" : "No"), in ex_btc8821a2ant_display_coex_info()
3663 stack_info->hci_version); in ex_btc8821a2ant_display_coex_info()
3665 btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver); in ex_btc8821a2ant_display_coex_info()
3666 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in ex_btc8821a2ant_display_coex_info()
3667 seq_printf(m, "\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)", in ex_btc8821a2ant_display_coex_info()
3672 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3674 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3676 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3678 seq_printf(m, "\n %-35s = %d / %d(%d)", in ex_btc8821a2ant_display_coex_info()
3682 seq_printf(m, "\n %-35s = %3ph ", in ex_btc8821a2ant_display_coex_info()
3683 "H2C Wifi inform bt chnl Info", in ex_btc8821a2ant_display_coex_info()
3684 coex_dm->wifi_chnl_info); in ex_btc8821a2ant_display_coex_info()
3686 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in ex_btc8821a2ant_display_coex_info()
3687 btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi); in ex_btc8821a2ant_display_coex_info()
3688 seq_printf(m, "\n %-35s = %ld/ %ld", "Wifi rssi/ HS rssi", in ex_btc8821a2ant_display_coex_info()
3691 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in ex_btc8821a2ant_display_coex_info()
3692 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in ex_btc8821a2ant_display_coex_info()
3693 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in ex_btc8821a2ant_display_coex_info()
3694 seq_printf(m, "\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan", in ex_btc8821a2ant_display_coex_info()
3697 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3699 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3701 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3703 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_display_coex_info()
3705 seq_printf(m, "\n %-35s = %s / %s/ %s ", "Wifi status", in ex_btc8821a2ant_display_coex_info()
3713 if (stack_info->profile_notified) { in ex_btc8821a2ant_display_coex_info()
3714 seq_printf(m, "\n %-35s = %d / %d / %d / %d", in ex_btc8821a2ant_display_coex_info()
3716 stack_info->sco_exist, stack_info->hid_exist, in ex_btc8821a2ant_display_coex_info()
3717 stack_info->pan_exist, stack_info->a2dp_exist); in ex_btc8821a2ant_display_coex_info()
3719 btcoexist->btc_disp_dbg_msg(btcoexist, in ex_btc8821a2ant_display_coex_info()
3724 bt_info_ext = coex_sta->bt_info_ext; in ex_btc8821a2ant_display_coex_info()
3725 seq_printf(m, "\n %-35s = %s", "BT Info A2DP rate", in ex_btc8821a2ant_display_coex_info()
3729 if (coex_sta->bt_info_c2h_cnt[i]) { in ex_btc8821a2ant_display_coex_info()
3730 seq_printf(m, "\n %-35s = %7ph(%d)", in ex_btc8821a2ant_display_coex_info()
3732 coex_sta->bt_info_c2h[i], in ex_btc8821a2ant_display_coex_info()
3733 coex_sta->bt_info_c2h_cnt[i]); in ex_btc8821a2ant_display_coex_info()
3737 seq_printf(m, "\n %-35s = %s/%s", in ex_btc8821a2ant_display_coex_info()
3739 ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")), in ex_btc8821a2ant_display_coex_info()
3740 ((coex_sta->under_lps ? "LPS ON" : "LPS OFF"))); in ex_btc8821a2ant_display_coex_info()
3741 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD, m); in ex_btc8821a2ant_display_coex_info()
3744 seq_printf(m, "\n %-35s", in ex_btc8821a2ant_display_coex_info()
3746 seq_printf(m, "\n %-35s = %d/ %d/ %d(0x%x) ", in ex_btc8821a2ant_display_coex_info()
3748 coex_dm->cur_agc_table_en, coex_dm->cur_adc_back_off, in ex_btc8821a2ant_display_coex_info()
3749 coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl); in ex_btc8821a2ant_display_coex_info()
3752 seq_printf(m, "\n %-35s", in ex_btc8821a2ant_display_coex_info()
3755 if (!btcoexist->manual_control) { in ex_btc8821a2ant_display_coex_info()
3756 ps_tdma_case = coex_dm->cur_ps_tdma; in ex_btc8821a2ant_display_coex_info()
3757 seq_printf(m, "\n %-35s = %5ph case-%d", in ex_btc8821a2ant_display_coex_info()
3759 coex_dm->ps_tdma_para, ps_tdma_case); in ex_btc8821a2ant_display_coex_info()
3761 seq_printf(m, "\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", in ex_btc8821a2ant_display_coex_info()
3762 coex_dm->cur_dec_bt_pwr_lvl, in ex_btc8821a2ant_display_coex_info()
3763 coex_dm->cur_ignore_wlan_act); in ex_btc8821a2ant_display_coex_info()
3767 seq_printf(m, "\n %-35s", "============[Hw setting]============"); in ex_btc8821a2ant_display_coex_info()
3769 seq_printf(m, "\n %-35s = 0x%x", "RF-A, 0x1e initVal", in ex_btc8821a2ant_display_coex_info()
3770 coex_dm->bt_rf0x1e_backup); in ex_btc8821a2ant_display_coex_info()
3772 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778); in ex_btc8821a2ant_display_coex_info()
3773 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x6cc); in ex_btc8821a2ant_display_coex_info()
3774 seq_printf(m, "\n %-35s = 0x%x/ 0x%x ", in ex_btc8821a2ant_display_coex_info()
3778 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db); in ex_btc8821a2ant_display_coex_info()
3779 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xc5b); in ex_btc8821a2ant_display_coex_info()
3780 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3784 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4); in ex_btc8821a2ant_display_coex_info()
3785 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3789 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40); in ex_btc8821a2ant_display_coex_info()
3790 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c); in ex_btc8821a2ant_display_coex_info()
3791 u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x974); in ex_btc8821a2ant_display_coex_info()
3792 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3796 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550); in ex_btc8821a2ant_display_coex_info()
3797 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522); in ex_btc8821a2ant_display_coex_info()
3798 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3802 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50); in ex_btc8821a2ant_display_coex_info()
3803 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa0a); in ex_btc8821a2ant_display_coex_info()
3804 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3805 "0xc50(DIG)/0xa0a(CCK-TH)", in ex_btc8821a2ant_display_coex_info()
3808 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48); in ex_btc8821a2ant_display_coex_info()
3809 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5b); in ex_btc8821a2ant_display_coex_info()
3810 u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c); in ex_btc8821a2ant_display_coex_info()
3811 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3812 "OFDM-FA/ CCK-FA", in ex_btc8821a2ant_display_coex_info()
3815 u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0); in ex_btc8821a2ant_display_coex_info()
3816 u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4); in ex_btc8821a2ant_display_coex_info()
3817 u4tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8); in ex_btc8821a2ant_display_coex_info()
3818 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a2ant_display_coex_info()
3820 u4tmp[0], u4tmp[1], u4tmp[2]); in ex_btc8821a2ant_display_coex_info()
3822 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8821a2ant_display_coex_info()
3823 "0x770 (hi-pri Rx/Tx)", in ex_btc8821a2ant_display_coex_info()
3824 coex_sta->high_priority_rx, coex_sta->high_priority_tx); in ex_btc8821a2ant_display_coex_info()
3825 seq_printf(m, "\n %-35s = %d/ %d", in ex_btc8821a2ant_display_coex_info()
3826 "0x774(low-pri Rx/Tx)", in ex_btc8821a2ant_display_coex_info()
3827 coex_sta->low_priority_rx, coex_sta->low_priority_tx); in ex_btc8821a2ant_display_coex_info()
3830 u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x41b); in ex_btc8821a2ant_display_coex_info()
3831 seq_printf(m, "\n %-35s = 0x%x", in ex_btc8821a2ant_display_coex_info()
3835 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS, m); in ex_btc8821a2ant_display_coex_info()
3840 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_ips_notify()
3845 coex_sta->under_ips = true; in ex_btc8821a2ant_ips_notify()
3852 coex_sta->under_ips = false; in ex_btc8821a2ant_ips_notify()
3861 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_lps_notify()
3866 coex_sta->under_lps = true; in ex_btc8821a2ant_lps_notify()
3870 coex_sta->under_lps = false; in ex_btc8821a2ant_lps_notify()
3876 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_scan_notify()
3889 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_connect_notify()
3903 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_media_status_notify()
3918 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, in ex_btc8821a2ant_media_status_notify()
3924 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in ex_btc8821a2ant_media_status_notify()
3926 h2c_parameter[2] = 0x30; in ex_btc8821a2ant_media_status_notify()
3928 h2c_parameter[2] = 0x20; in ex_btc8821a2ant_media_status_notify()
3930 h2c_parameter[2] = 0x30; in ex_btc8821a2ant_media_status_notify()
3932 h2c_parameter[2] = 0x20; in ex_btc8821a2ant_media_status_notify()
3936 coex_dm->wifi_chnl_info[0] = h2c_parameter[0]; in ex_btc8821a2ant_media_status_notify()
3937 coex_dm->wifi_chnl_info[1] = h2c_parameter[1]; in ex_btc8821a2ant_media_status_notify()
3938 coex_dm->wifi_chnl_info[2] = h2c_parameter[2]; in ex_btc8821a2ant_media_status_notify()
3944 h2c_parameter[2]); in ex_btc8821a2ant_media_status_notify()
3946 btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter); in ex_btc8821a2ant_media_status_notify()
3952 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_special_packet_notify()
3963 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_bt_info_notify()
3969 coex_sta->c2h_bt_info_req_sent = false; in ex_btc8821a2ant_bt_info_notify()
3970 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a2ant_bt_info_notify()
3971 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in ex_btc8821a2ant_bt_info_notify()
3977 coex_sta->bt_info_c2h_cnt[rsp_source]++; in ex_btc8821a2ant_bt_info_notify()
3983 coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i]; in ex_btc8821a2ant_bt_info_notify()
3986 if (i == length - 1) { in ex_btc8821a2ant_bt_info_notify()
3995 if (btcoexist->manual_control) { in ex_btc8821a2ant_bt_info_notify()
4003 coex_sta->bt_retry_cnt = in ex_btc8821a2ant_bt_info_notify()
4004 coex_sta->bt_info_c2h[rsp_source][2]&0xf; in ex_btc8821a2ant_bt_info_notify()
4006 coex_sta->bt_rssi = in ex_btc8821a2ant_bt_info_notify()
4007 coex_sta->bt_info_c2h[rsp_source][3] * 2 + 10; in ex_btc8821a2ant_bt_info_notify()
4009 coex_sta->bt_info_ext = coex_sta->bt_info_c2h[rsp_source][4]; in ex_btc8821a2ant_bt_info_notify()
4011 coex_sta->bt_tx_rx_mask = in ex_btc8821a2ant_bt_info_notify()
4012 (coex_sta->bt_info_c2h[rsp_source][2] & 0x40); in ex_btc8821a2ant_bt_info_notify()
4013 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TX_RX_MASK, in ex_btc8821a2ant_bt_info_notify()
4014 &coex_sta->bt_tx_rx_mask); in ex_btc8821a2ant_bt_info_notify()
4015 if (coex_sta->bt_tx_rx_mask) { in ex_btc8821a2ant_bt_info_notify()
4021 btcoexist->btc_set_bt_reg(btcoexist, BTC_BT_REG_RF, in ex_btc8821a2ant_bt_info_notify()
4025 /* Here we need to resend some wifi info to BT in ex_btc8821a2ant_bt_info_notify()
4028 if ((coex_sta->bt_info_ext & BIT1)) { in ex_btc8821a2ant_bt_info_notify()
4029 btcoexist->btc_get(btcoexist, in ex_btc8821a2ant_bt_info_notify()
4041 if (!btcoexist->manual_control && !wifi_under_5g) { in ex_btc8821a2ant_bt_info_notify()
4044 coex_sta->bt_info_ext); in ex_btc8821a2ant_bt_info_notify()
4045 if ((coex_sta->bt_info_ext & BIT(3))) { in ex_btc8821a2ant_bt_info_notify()
4077 coex_sta->c2h_bt_inquiry_page = true; in ex_btc8821a2ant_bt_info_notify()
4079 coex_sta->c2h_bt_inquiry_page = false; in ex_btc8821a2ant_bt_info_notify()
4083 coex_sta->bt_link_exist = false; in ex_btc8821a2ant_bt_info_notify()
4084 coex_sta->pan_exist = false; in ex_btc8821a2ant_bt_info_notify()
4085 coex_sta->a2dp_exist = false; in ex_btc8821a2ant_bt_info_notify()
4086 coex_sta->hid_exist = false; in ex_btc8821a2ant_bt_info_notify()
4087 coex_sta->sco_exist = false; in ex_btc8821a2ant_bt_info_notify()
4089 coex_sta->bt_link_exist = true; in ex_btc8821a2ant_bt_info_notify()
4091 coex_sta->pan_exist = true; in ex_btc8821a2ant_bt_info_notify()
4093 coex_sta->pan_exist = false; in ex_btc8821a2ant_bt_info_notify()
4095 coex_sta->a2dp_exist = true; in ex_btc8821a2ant_bt_info_notify()
4097 coex_sta->a2dp_exist = false; in ex_btc8821a2ant_bt_info_notify()
4099 coex_sta->hid_exist = true; in ex_btc8821a2ant_bt_info_notify()
4101 coex_sta->hid_exist = false; in ex_btc8821a2ant_bt_info_notify()
4103 coex_sta->sco_exist = true; in ex_btc8821a2ant_bt_info_notify()
4105 coex_sta->sco_exist = false; in ex_btc8821a2ant_bt_info_notify()
4107 if ((!coex_sta->hid_exist) && in ex_btc8821a2ant_bt_info_notify()
4108 (!coex_sta->c2h_bt_inquiry_page) && in ex_btc8821a2ant_bt_info_notify()
4109 (!coex_sta->sco_exist)) { in ex_btc8821a2ant_bt_info_notify()
4110 if (coex_sta->high_priority_tx + in ex_btc8821a2ant_bt_info_notify()
4111 coex_sta->high_priority_rx >= 160) in ex_btc8821a2ant_bt_info_notify()
4112 coex_sta->hid_exist = true; in ex_btc8821a2ant_bt_info_notify()
4119 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_IDLE; in ex_btc8821a2ant_bt_info_notify()
4121 "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4124 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_CON_IDLE; in ex_btc8821a2ant_bt_info_notify()
4126 "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4129 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_SCO_BUSY; in ex_btc8821a2ant_bt_info_notify()
4133 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_ACL_BUSY; in ex_btc8821a2ant_bt_info_notify()
4137 coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_MAX; in ex_btc8821a2ant_bt_info_notify()
4139 "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"); in ex_btc8821a2ant_bt_info_notify()
4142 if ((coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_ACL_BUSY) || in ex_btc8821a2ant_bt_info_notify()
4143 (coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_SCO_BUSY) || in ex_btc8821a2ant_bt_info_notify()
4144 (coex_dm->bt_status == BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY)) { in ex_btc8821a2ant_bt_info_notify()
4152 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy); in ex_btc8821a2ant_bt_info_notify()
4154 coex_dm->limited_dig = limited_dig; in ex_btc8821a2ant_bt_info_notify()
4155 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_LIMITED_DIG, &limited_dig); in ex_btc8821a2ant_bt_info_notify()
4162 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_halt_notify()
4174 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_pnp_notify()
4192 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a2ant_periodical()
4197 if (coex_sta->dis_ver_info_cnt <= 5) { in ex_btc8821a2ant_periodical()
4198 coex_sta->dis_ver_info_cnt += 1; in ex_btc8821a2ant_periodical()
4199 if (coex_sta->dis_ver_info_cnt == 3) { in ex_btc8821a2ant_periodical()
4210 if (btcoexist->auto_report_2ant) { in ex_btc8821a2ant_periodical()
4217 coex_dm->auto_tdma_adjust) in ex_btc8821a2ant_periodical()