Lines Matching +full:bt +full:- +full:sco
1 // SPDX-License-Identifier: GPL-2.0
7 * This file is for RTL8821A Co-exist mechanism
29 "BT Info[wifi fw]",
30 "BT Info[bt rsp]",
31 "BT Info[bt auto report]",
46 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_bt_rssi_state()
48 u8 bt_rssi_state = coex_sta->pre_bt_rssi_state; in btc8821a1ant_bt_rssi_state()
50 bt_rssi = coex_sta->bt_rssi; in btc8821a1ant_bt_rssi_state()
53 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8821a1ant_bt_rssi_state()
54 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8821a1ant_bt_rssi_state()
59 "[BTCoex], BT Rssi state switch to High\n"); in btc8821a1ant_bt_rssi_state()
63 "[BTCoex], BT Rssi state stay at Low\n"); in btc8821a1ant_bt_rssi_state()
69 "[BTCoex], BT Rssi state switch to Low\n"); in btc8821a1ant_bt_rssi_state()
73 "[BTCoex], BT Rssi state stay at High\n"); in btc8821a1ant_bt_rssi_state()
79 "[BTCoex], BT Rssi thresh error!!\n"); in btc8821a1ant_bt_rssi_state()
80 return coex_sta->pre_bt_rssi_state; in btc8821a1ant_bt_rssi_state()
83 if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || in btc8821a1ant_bt_rssi_state()
84 (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { in btc8821a1ant_bt_rssi_state()
89 "[BTCoex], BT Rssi state switch to Medium\n"); in btc8821a1ant_bt_rssi_state()
93 "[BTCoex], BT Rssi state stay at Low\n"); in btc8821a1ant_bt_rssi_state()
95 } else if ((coex_sta->pre_bt_rssi_state == in btc8821a1ant_bt_rssi_state()
97 (coex_sta->pre_bt_rssi_state == in btc8821a1ant_bt_rssi_state()
103 "[BTCoex], BT Rssi state switch to High\n"); in btc8821a1ant_bt_rssi_state()
107 "[BTCoex], BT Rssi state switch to Low\n"); in btc8821a1ant_bt_rssi_state()
111 "[BTCoex], BT Rssi state stay at Medium\n"); in btc8821a1ant_bt_rssi_state()
117 "[BTCoex], BT Rssi state switch to Medium\n"); in btc8821a1ant_bt_rssi_state()
121 "[BTCoex], BT Rssi state stay at High\n"); in btc8821a1ant_bt_rssi_state()
125 coex_sta->pre_bt_rssi_state = bt_rssi_state; in btc8821a1ant_bt_rssi_state()
134 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_wifi_rssi_state()
136 u8 wifi_rssi_state = coex_sta->pre_wifi_rssi_state[index]; in btc8821a1ant_wifi_rssi_state()
138 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in btc8821a1ant_wifi_rssi_state()
141 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
143 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
170 return coex_sta->pre_wifi_rssi_state[index]; in btc8821a1ant_wifi_rssi_state()
173 if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
175 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
187 } else if ((coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
189 (coex_sta->pre_wifi_rssi_state[index] == in btc8821a1ant_wifi_rssi_state()
217 coex_sta->pre_wifi_rssi_state[index] = wifi_rssi_state; in btc8821a1ant_wifi_rssi_state()
225 coex_dm->cur_ra_mask = dis_rate_mask; in btc8821a1ant_update_ra_mask()
228 (coex_dm->pre_ra_mask != coex_dm->cur_ra_mask)) { in btc8821a1ant_update_ra_mask()
229 btcoexist->btc_set(btcoexist, BTC_SET_ACT_UPDATE_RAMASK, in btc8821a1ant_update_ra_mask()
230 &coex_dm->cur_ra_mask); in btc8821a1ant_update_ra_mask()
232 coex_dm->pre_ra_mask = coex_dm->cur_ra_mask; in btc8821a1ant_update_ra_mask()
240 coex_dm->cur_arfr_type = type; in btc8821a1ant_auto_rate_fb_retry()
243 (coex_dm->pre_arfr_type != coex_dm->cur_arfr_type)) { in btc8821a1ant_auto_rate_fb_retry()
244 switch (coex_dm->cur_arfr_type) { in btc8821a1ant_auto_rate_fb_retry()
246 btcoexist->btc_write_4byte(btcoexist, 0x430, in btc8821a1ant_auto_rate_fb_retry()
247 coex_dm->backup_arfr_cnt1); in btc8821a1ant_auto_rate_fb_retry()
248 btcoexist->btc_write_4byte(btcoexist, 0x434, in btc8821a1ant_auto_rate_fb_retry()
249 coex_dm->backup_arfr_cnt2); in btc8821a1ant_auto_rate_fb_retry()
252 btcoexist->btc_get(btcoexist, in btc8821a1ant_auto_rate_fb_retry()
256 btcoexist->btc_write_4byte(btcoexist, 0x430, in btc8821a1ant_auto_rate_fb_retry()
258 btcoexist->btc_write_4byte(btcoexist, 0x434, in btc8821a1ant_auto_rate_fb_retry()
261 btcoexist->btc_write_4byte(btcoexist, 0x430, in btc8821a1ant_auto_rate_fb_retry()
263 btcoexist->btc_write_4byte(btcoexist, 0x434, in btc8821a1ant_auto_rate_fb_retry()
272 coex_dm->pre_arfr_type = coex_dm->cur_arfr_type; in btc8821a1ant_auto_rate_fb_retry()
278 coex_dm->cur_retry_limit_type = type; in btc8821a1ant_retry_limit()
281 (coex_dm->pre_retry_limit_type != coex_dm->cur_retry_limit_type)) { in btc8821a1ant_retry_limit()
282 switch (coex_dm->cur_retry_limit_type) { in btc8821a1ant_retry_limit()
284 btcoexist->btc_write_2byte(btcoexist, 0x42a, in btc8821a1ant_retry_limit()
285 coex_dm->backup_retry_limit); in btc8821a1ant_retry_limit()
288 btcoexist->btc_write_2byte(btcoexist, 0x42a, 0x0808); in btc8821a1ant_retry_limit()
294 coex_dm->pre_retry_limit_type = coex_dm->cur_retry_limit_type; in btc8821a1ant_retry_limit()
300 coex_dm->cur_ampdu_time_type = type; in btc8821a1ant_ampdu_max_time()
303 (coex_dm->pre_ampdu_time_type != coex_dm->cur_ampdu_time_type)) { in btc8821a1ant_ampdu_max_time()
304 switch (coex_dm->cur_ampdu_time_type) { in btc8821a1ant_ampdu_max_time()
306 btcoexist->btc_write_1byte(btcoexist, 0x456, in btc8821a1ant_ampdu_max_time()
307 coex_dm->backup_ampdu_max_time); in btc8821a1ant_ampdu_max_time()
310 btcoexist->btc_write_1byte(btcoexist, 0x456, 0x38); in btc8821a1ant_ampdu_max_time()
317 coex_dm->pre_ampdu_time_type = coex_dm->cur_ampdu_time_type; in btc8821a1ant_ampdu_max_time()
355 btcoexist->btc_set(btcoexist, in btc8821a1ant_limited_rx()
357 /* decide BT control aggregation buf size or not */ in btc8821a1ant_limited_rx()
358 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, in btc8821a1ant_limited_rx()
360 /* aggregation buf size, only work when BT control Rx agg size */ in btc8821a1ant_limited_rx()
361 btcoexist->btc_set(btcoexist, BTC_SET_U1_AGG_BUF_SIZE, &rx_agg_size); in btc8821a1ant_limited_rx()
363 btcoexist->btc_set(btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); in btc8821a1ant_limited_rx()
374 u4_tmp = btcoexist->btc_read_4byte(btcoexist, reg_hp_tx_rx); in btc8821a1ant_monitor_bt_ctr()
378 u4_tmp = btcoexist->btc_read_4byte(btcoexist, reg_lp_tx_rx); in btc8821a1ant_monitor_bt_ctr()
382 coex_sta->high_priority_tx = reg_hp_tx; in btc8821a1ant_monitor_bt_ctr()
383 coex_sta->high_priority_rx = reg_hp_rx; in btc8821a1ant_monitor_bt_ctr()
384 coex_sta->low_priority_tx = reg_lp_tx; in btc8821a1ant_monitor_bt_ctr()
385 coex_sta->low_priority_rx = reg_lp_rx; in btc8821a1ant_monitor_bt_ctr()
388 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); in btc8821a1ant_monitor_bt_ctr()
393 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_query_bt_info()
396 coex_sta->c2h_bt_info_req_sent = true; in btc8821a1ant_query_bt_info()
401 "[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n", in btc8821a1ant_query_bt_info()
404 btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); in btc8821a1ant_query_bt_info()
409 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_update_bt_link_info()
412 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a1ant_update_bt_link_info()
414 bt_link_info->bt_link_exist = coex_sta->bt_link_exist; in btc8821a1ant_update_bt_link_info()
415 bt_link_info->sco_exist = coex_sta->sco_exist; in btc8821a1ant_update_bt_link_info()
416 bt_link_info->a2dp_exist = coex_sta->a2dp_exist; in btc8821a1ant_update_bt_link_info()
417 bt_link_info->pan_exist = coex_sta->pan_exist; in btc8821a1ant_update_bt_link_info()
418 bt_link_info->hid_exist = coex_sta->hid_exist; in btc8821a1ant_update_bt_link_info()
422 bt_link_info->pan_exist = true; in btc8821a1ant_update_bt_link_info()
423 bt_link_info->bt_link_exist = true; in btc8821a1ant_update_bt_link_info()
426 /* check if Sco only */ in btc8821a1ant_update_bt_link_info()
427 if (bt_link_info->sco_exist && in btc8821a1ant_update_bt_link_info()
428 !bt_link_info->a2dp_exist && in btc8821a1ant_update_bt_link_info()
429 !bt_link_info->pan_exist && in btc8821a1ant_update_bt_link_info()
430 !bt_link_info->hid_exist) in btc8821a1ant_update_bt_link_info()
431 bt_link_info->sco_only = true; in btc8821a1ant_update_bt_link_info()
433 bt_link_info->sco_only = false; in btc8821a1ant_update_bt_link_info()
436 if (!bt_link_info->sco_exist && in btc8821a1ant_update_bt_link_info()
437 bt_link_info->a2dp_exist && in btc8821a1ant_update_bt_link_info()
438 !bt_link_info->pan_exist && in btc8821a1ant_update_bt_link_info()
439 !bt_link_info->hid_exist) in btc8821a1ant_update_bt_link_info()
440 bt_link_info->a2dp_only = true; in btc8821a1ant_update_bt_link_info()
442 bt_link_info->a2dp_only = false; in btc8821a1ant_update_bt_link_info()
445 if (!bt_link_info->sco_exist && in btc8821a1ant_update_bt_link_info()
446 !bt_link_info->a2dp_exist && in btc8821a1ant_update_bt_link_info()
447 bt_link_info->pan_exist && in btc8821a1ant_update_bt_link_info()
448 !bt_link_info->hid_exist) in btc8821a1ant_update_bt_link_info()
449 bt_link_info->pan_only = true; in btc8821a1ant_update_bt_link_info()
451 bt_link_info->pan_only = false; in btc8821a1ant_update_bt_link_info()
454 if (!bt_link_info->sco_exist && in btc8821a1ant_update_bt_link_info()
455 !bt_link_info->a2dp_exist && in btc8821a1ant_update_bt_link_info()
456 !bt_link_info->pan_exist && in btc8821a1ant_update_bt_link_info()
457 bt_link_info->hid_exist) in btc8821a1ant_update_bt_link_info()
458 bt_link_info->hid_only = true; in btc8821a1ant_update_bt_link_info()
460 bt_link_info->hid_only = false; in btc8821a1ant_update_bt_link_info()
465 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_action_algorithm()
466 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_action_algorithm()
471 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a1ant_action_algorithm()
473 if (!bt_link_info->bt_link_exist) { in btc8821a1ant_action_algorithm()
475 "[BTCoex], No BT link exists!!!\n"); in btc8821a1ant_action_algorithm()
479 if (bt_link_info->sco_exist) in btc8821a1ant_action_algorithm()
481 if (bt_link_info->hid_exist) in btc8821a1ant_action_algorithm()
483 if (bt_link_info->pan_exist) in btc8821a1ant_action_algorithm()
485 if (bt_link_info->a2dp_exist) in btc8821a1ant_action_algorithm()
489 if (bt_link_info->sco_exist) { in btc8821a1ant_action_algorithm()
491 "[BTCoex], BT Profile = SCO only\n"); in btc8821a1ant_action_algorithm()
494 if (bt_link_info->hid_exist) { in btc8821a1ant_action_algorithm()
496 "[BTCoex], BT Profile = HID only\n"); in btc8821a1ant_action_algorithm()
498 } else if (bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
500 "[BTCoex], BT Profile = A2DP only\n"); in btc8821a1ant_action_algorithm()
502 } else if (bt_link_info->pan_exist) { in btc8821a1ant_action_algorithm()
506 "[BTCoex], BT Profile = PAN(HS) only\n"); in btc8821a1ant_action_algorithm()
511 "[BTCoex], BT Profile = PAN(EDR) only\n"); in btc8821a1ant_action_algorithm()
517 if (bt_link_info->sco_exist) { in btc8821a1ant_action_algorithm()
518 if (bt_link_info->hid_exist) { in btc8821a1ant_action_algorithm()
520 "[BTCoex], BT Profile = SCO + HID\n"); in btc8821a1ant_action_algorithm()
522 } else if (bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
524 "[BTCoex], BT Profile = SCO + A2DP ==> SCO\n"); in btc8821a1ant_action_algorithm()
526 } else if (bt_link_info->pan_exist) { in btc8821a1ant_action_algorithm()
530 "[BTCoex], BT Profile = SCO + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
535 "[BTCoex], BT Profile = SCO + PAN(EDR)\n"); in btc8821a1ant_action_algorithm()
540 if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
541 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
543 "[BTCoex], BT Profile = HID + A2DP\n"); in btc8821a1ant_action_algorithm()
545 } else if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
546 bt_link_info->pan_exist) { in btc8821a1ant_action_algorithm()
550 "[BTCoex], BT Profile = HID + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
555 "[BTCoex], BT Profile = HID + PAN(EDR)\n"); in btc8821a1ant_action_algorithm()
558 } else if (bt_link_info->pan_exist && in btc8821a1ant_action_algorithm()
559 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
563 "[BTCoex], BT Profile = A2DP + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
568 "[BTCoex], BT Profile = A2DP + PAN(EDR)\n"); in btc8821a1ant_action_algorithm()
574 if (bt_link_info->sco_exist) { in btc8821a1ant_action_algorithm()
575 if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
576 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
578 "[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n"); in btc8821a1ant_action_algorithm()
580 } else if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
581 bt_link_info->pan_exist) { in btc8821a1ant_action_algorithm()
585 "[BTCoex], BT Profile = SCO + HID + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
590 "[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n"); in btc8821a1ant_action_algorithm()
593 } else if (bt_link_info->pan_exist && in btc8821a1ant_action_algorithm()
594 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
598 "[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
603 "[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n"); in btc8821a1ant_action_algorithm()
608 if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
609 bt_link_info->pan_exist && in btc8821a1ant_action_algorithm()
610 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
614 "[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
619 "[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n"); in btc8821a1ant_action_algorithm()
625 if (bt_link_info->sco_exist) { in btc8821a1ant_action_algorithm()
626 if (bt_link_info->hid_exist && in btc8821a1ant_action_algorithm()
627 bt_link_info->pan_exist && in btc8821a1ant_action_algorithm()
628 bt_link_info->a2dp_exist) { in btc8821a1ant_action_algorithm()
632 "[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n"); in btc8821a1ant_action_algorithm()
637 "[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"); in btc8821a1ant_action_algorithm()
649 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_set_sw_penalty_tx_rate()
664 "[BTCoex], set WiFi Low-Penalty Retry: %s", in btc8821a1ant_set_sw_penalty_tx_rate()
667 btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); in btc8821a1ant_set_sw_penalty_tx_rate()
673 coex_dm->cur_low_penalty_ra = low_penalty_ra; in btc8821a1ant_low_penalty_ra()
676 if (coex_dm->pre_low_penalty_ra == coex_dm->cur_low_penalty_ra) in btc8821a1ant_low_penalty_ra()
680 coex_dm->cur_low_penalty_ra); in btc8821a1ant_low_penalty_ra()
682 coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; in btc8821a1ant_low_penalty_ra()
689 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_set_coex_table()
693 btcoexist->btc_write_4byte(btcoexist, 0x6c0, val0x6c0); in btc8821a1ant_set_coex_table()
697 btcoexist->btc_write_4byte(btcoexist, 0x6c4, val0x6c4); in btc8821a1ant_set_coex_table()
701 btcoexist->btc_write_4byte(btcoexist, 0x6c8, val0x6c8); in btc8821a1ant_set_coex_table()
705 btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); in btc8821a1ant_set_coex_table()
712 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_coex_table()
718 coex_dm->cur_val_0x6c0 = val0x6c0; in btc8821a1ant_coex_table()
719 coex_dm->cur_val_0x6c4 = val0x6c4; in btc8821a1ant_coex_table()
720 coex_dm->cur_val_0x6c8 = val0x6c8; in btc8821a1ant_coex_table()
721 coex_dm->cur_val_0x6cc = val0x6cc; in btc8821a1ant_coex_table()
724 if ((coex_dm->pre_val_0x6c0 == coex_dm->cur_val_0x6c0) && in btc8821a1ant_coex_table()
725 (coex_dm->pre_val_0x6c4 == coex_dm->cur_val_0x6c4) && in btc8821a1ant_coex_table()
726 (coex_dm->pre_val_0x6c8 == coex_dm->cur_val_0x6c8) && in btc8821a1ant_coex_table()
727 (coex_dm->pre_val_0x6cc == coex_dm->cur_val_0x6cc)) in btc8821a1ant_coex_table()
733 coex_dm->pre_val_0x6c0 = coex_dm->cur_val_0x6c0; in btc8821a1ant_coex_table()
734 coex_dm->pre_val_0x6c4 = coex_dm->cur_val_0x6c4; in btc8821a1ant_coex_table()
735 coex_dm->pre_val_0x6c8 = coex_dm->cur_val_0x6c8; in btc8821a1ant_coex_table()
736 coex_dm->pre_val_0x6cc = coex_dm->cur_val_0x6cc; in btc8821a1ant_coex_table()
783 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_set_fw_ignore_wlan_act()
790 "[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63 = 0x%x\n", in btc8821a1ant_set_fw_ignore_wlan_act()
793 btcoexist->btc_fill_h2c(btcoexist, 0x63, 1, h2c_parameter); in btc8821a1ant_set_fw_ignore_wlan_act()
799 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_ignore_wlan_act()
804 coex_dm->cur_ignore_wlan_act = enable; in btc8821a1ant_ignore_wlan_act()
809 coex_dm->pre_ignore_wlan_act, in btc8821a1ant_ignore_wlan_act()
810 coex_dm->cur_ignore_wlan_act); in btc8821a1ant_ignore_wlan_act()
812 if (coex_dm->pre_ignore_wlan_act == in btc8821a1ant_ignore_wlan_act()
813 coex_dm->cur_ignore_wlan_act) in btc8821a1ant_ignore_wlan_act()
818 coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; in btc8821a1ant_ignore_wlan_act()
824 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_set_fw_ps_tdma()
829 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, in btc8821a1ant_set_fw_ps_tdma()
850 coex_dm->ps_tdma_para[0] = real_byte1; in btc8821a1ant_set_fw_ps_tdma()
851 coex_dm->ps_tdma_para[1] = byte2; in btc8821a1ant_set_fw_ps_tdma()
852 coex_dm->ps_tdma_para[2] = byte3; in btc8821a1ant_set_fw_ps_tdma()
853 coex_dm->ps_tdma_para[3] = byte4; in btc8821a1ant_set_fw_ps_tdma()
854 coex_dm->ps_tdma_para[4] = real_byte5; in btc8821a1ant_set_fw_ps_tdma()
857 "[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n", in btc8821a1ant_set_fw_ps_tdma()
863 btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); in btc8821a1ant_set_fw_ps_tdma()
872 btcoexist->btc_set(btcoexist, BTC_SET_U1_LPS_VAL, &lps); in btc8821a1ant_set_lps_rpwm()
873 btcoexist->btc_set(btcoexist, BTC_SET_U1_RPWM_VAL, &rpwm); in btc8821a1ant_set_lps_rpwm()
879 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_lps_rpwm()
884 coex_dm->cur_lps = lps_val; in btc8821a1ant_lps_rpwm()
885 coex_dm->cur_rpwm = rpwm_val; in btc8821a1ant_lps_rpwm()
889 "[BTCoex], LPS-RxBeaconMode = 0x%x, LPS-RPWM = 0x%x!!\n", in btc8821a1ant_lps_rpwm()
890 coex_dm->cur_lps, coex_dm->cur_rpwm); in btc8821a1ant_lps_rpwm()
892 if ((coex_dm->pre_lps == coex_dm->cur_lps) && in btc8821a1ant_lps_rpwm()
893 (coex_dm->pre_rpwm == coex_dm->cur_rpwm)) { in btc8821a1ant_lps_rpwm()
895 "[BTCoex], LPS-RPWM_Last = 0x%x, LPS-RPWM_Now = 0x%x!!\n", in btc8821a1ant_lps_rpwm()
896 coex_dm->pre_rpwm, coex_dm->cur_rpwm); in btc8821a1ant_lps_rpwm()
903 coex_dm->pre_lps = coex_dm->cur_lps; in btc8821a1ant_lps_rpwm()
904 coex_dm->pre_rpwm = coex_dm->cur_rpwm; in btc8821a1ant_lps_rpwm()
910 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_sw_mechanism()
922 struct btc_board_info *board_info = &btcoexist->board_info; in btc8821a1ant_set_ant_path()
927 /* 0x4c[23] = 0, 0x4c[24] = 1 Antenna control by WL/BT */ in btc8821a1ant_set_ant_path()
928 u4_tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); in btc8821a1ant_set_ant_path()
931 btcoexist->btc_write_4byte(btcoexist, 0x4c, u4_tmp); in btc8821a1ant_set_ant_path()
933 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x975, 0x3, 0x3); in btc8821a1ant_set_ant_path()
934 btcoexist->btc_write_1byte(btcoexist, 0xcb4, 0x77); in btc8821a1ant_set_ant_path()
936 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) { in btc8821a1ant_set_ant_path()
942 btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, in btc8821a1ant_set_ant_path()
950 btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, in btc8821a1ant_set_ant_path()
955 * by BT_RFE_CTRL BT Vendor 0xac = 0xf002 in btc8821a1ant_set_ant_path()
957 u4_tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); in btc8821a1ant_set_ant_path()
960 btcoexist->btc_write_4byte(btcoexist, 0x4c, u4_tmp); in btc8821a1ant_set_ant_path()
963 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x3); in btc8821a1ant_set_ant_path()
966 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x0); in btc8821a1ant_set_ant_path()
972 btcoexist->btc_write_1byte(btcoexist, 0xcb4, 0x77); in btc8821a1ant_set_ant_path()
973 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) in btc8821a1ant_set_ant_path()
974 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
977 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
981 btcoexist->btc_write_1byte(btcoexist, 0xcb4, 0x77); in btc8821a1ant_set_ant_path()
982 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) in btc8821a1ant_set_ant_path()
983 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
986 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
991 btcoexist->btc_write_1byte(btcoexist, 0xcb4, 0x66); in btc8821a1ant_set_ant_path()
992 if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) in btc8821a1ant_set_ant_path()
993 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
996 btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcb7, in btc8821a1ant_set_ant_path()
1005 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_ps_tdma()
1008 coex_dm->cur_ps_tdma_on = turn_on; in btc8821a1ant_ps_tdma()
1009 coex_dm->cur_ps_tdma = type; in btc8821a1ant_ps_tdma()
1012 if (coex_dm->cur_ps_tdma_on) { in btc8821a1ant_ps_tdma()
1015 coex_dm->cur_ps_tdma); in btc8821a1ant_ps_tdma()
1019 coex_dm->cur_ps_tdma); in btc8821a1ant_ps_tdma()
1021 if ((coex_dm->pre_ps_tdma_on == coex_dm->cur_ps_tdma_on) && in btc8821a1ant_ps_tdma()
1022 (coex_dm->pre_ps_tdma == coex_dm->cur_ps_tdma)) in btc8821a1ant_ps_tdma()
1180 /* SoftAP only with no sta associated, BT disable, TDMA in btc8821a1ant_ps_tdma()
1183 * here softap mode screen off will cost 70-80mA for in btc8821a1ant_ps_tdma()
1214 /* Software control, Antenna at BT side */ in btc8821a1ant_ps_tdma()
1237 btcoexist->btc_set(btcoexist, in btc8821a1ant_ps_tdma()
1241 coex_dm->pre_ps_tdma_on = coex_dm->cur_ps_tdma_on; in btc8821a1ant_ps_tdma()
1242 coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; in btc8821a1ant_ps_tdma()
1247 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_is_common_action()
1250 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a1ant_is_common_action()
1252 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a1ant_is_common_action()
1256 coex_dm->bt_status) { in btc8821a1ant_is_common_action()
1258 "[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n"); in btc8821a1ant_is_common_action()
1264 coex_dm->bt_status)) { in btc8821a1ant_is_common_action()
1266 "[BTCoex], Wifi connected + BT non connected-idle!!\n"); in btc8821a1ant_is_common_action()
1272 coex_dm->bt_status)) { in btc8821a1ant_is_common_action()
1274 "[BTCoex], Wifi non connected-idle + BT connected-idle!!\n"); in btc8821a1ant_is_common_action()
1280 coex_dm->bt_status)) { in btc8821a1ant_is_common_action()
1282 "[BTCoex], Wifi connected + BT connected-idle!!\n"); in btc8821a1ant_is_common_action()
1288 coex_dm->bt_status)) { in btc8821a1ant_is_common_action()
1290 "[BTCoex], Wifi non connected-idle + BT Busy!!\n"); in btc8821a1ant_is_common_action()
1297 "[BTCoex], Wifi Connected-Busy + BT Busy!!\n"); in btc8821a1ant_is_common_action()
1300 "[BTCoex], Wifi Connected-Idle + BT Busy!!\n"); in btc8821a1ant_is_common_action()
1314 btcoex->btc_get(btcoex, BTC_GET_U1_LPS_MODE, &lps_mode); in btc8821a1ant_ps_tdma_check_for_pwr_save()
1344 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a1ant_power_save_state()
1346 btcoexist->btc_set(btcoexist, BTC_SET_ACT_NORMAL_LPS, NULL); in btc8821a1ant_power_save_state()
1355 btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER, in btc8821a1ant_power_save_state()
1358 btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); in btc8821a1ant_power_save_state()
1362 btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); in btc8821a1ant_power_save_state()
1390 /* SCO only or SCO+PAN(HS) */
1447 * Non-Software Coex Mechanism start
1453 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_action_wifi_multi_port()
1457 if (coex_dm->bt_status == BT_8821A_1ANT_BT_STATUS_ACL_BUSY) { in btc8821a1ant_action_wifi_multi_port()
1458 if (bt_link_info->a2dp_exist) { in btc8821a1ant_action_wifi_multi_port()
1462 } else if (bt_link_info->a2dp_exist && in btc8821a1ant_action_wifi_multi_port()
1463 bt_link_info->pan_exist) { in btc8821a1ant_action_wifi_multi_port()
1472 } else if ((coex_dm->bt_status == BT_8821A_1ANT_BT_STATUS_SCO_BUSY) || in btc8821a1ant_action_wifi_multi_port()
1474 coex_dm->bt_status)) { in btc8821a1ant_action_wifi_multi_port()
1487 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_action_wifi_not_connected_asso_auth()
1493 if ((bt_link_info->sco_exist) || (bt_link_info->hid_exist)) { in btc8821a1ant_action_wifi_not_connected_asso_auth()
1496 } else if ((bt_link_info->a2dp_exist) || (bt_link_info->pan_exist)) { in btc8821a1ant_action_wifi_not_connected_asso_auth()
1514 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_action_bt_inquiry()
1519 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a1ant_action_bt_inquiry()
1521 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, in btc8821a1ant_action_bt_inquiry()
1523 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a1ant_action_bt_inquiry()
1524 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy); in btc8821a1ant_action_bt_inquiry()
1526 if (!wifi_connected && !coex_sta->wifi_is_high_pri_task) { in btc8821a1ant_action_bt_inquiry()
1531 } else if ((bt_link_info->sco_exist) || (bt_link_info->a2dp_exist) || in btc8821a1ant_action_bt_inquiry()
1532 (bt_link_info->hid_only)) { in btc8821a1ant_action_bt_inquiry()
1533 /* SCO/HID-only busy */ in btc8821a1ant_action_bt_inquiry()
1538 } else if ((bt_link_info->a2dp_exist) && (bt_link_info->hid_exist)) { in btc8821a1ant_action_bt_inquiry()
1545 } else if ((bt_link_info->pan_exist) || (wifi_busy)) { in btc8821a1ant_action_bt_inquiry()
1573 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1577 if (bt_link_info->hid_only) { in btc8821a1ant_act_wifi_con_bt_acl_busy()
1581 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1583 } else if (bt_link_info->a2dp_only) { in btc8821a1ant_act_wifi_con_bt_acl_busy()
1589 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1596 /* for low BT RSSI */ in btc8821a1ant_act_wifi_con_bt_acl_busy()
1600 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1602 } else if (bt_link_info->hid_exist && bt_link_info->a2dp_exist) { in btc8821a1ant_act_wifi_con_bt_acl_busy()
1603 /* HID+A2DP (no need to consider BT RSSI) */ in btc8821a1ant_act_wifi_con_bt_acl_busy()
1606 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1609 } else if ((bt_link_info->pan_only) || in btc8821a1ant_act_wifi_con_bt_acl_busy()
1610 (bt_link_info->hid_exist && bt_link_info->pan_exist)) { in btc8821a1ant_act_wifi_con_bt_acl_busy()
1614 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1615 } else if (((bt_link_info->a2dp_exist) && (bt_link_info->pan_exist)) || in btc8821a1ant_act_wifi_con_bt_acl_busy()
1616 (bt_link_info->hid_exist && bt_link_info->a2dp_exist && in btc8821a1ant_act_wifi_con_bt_acl_busy()
1617 bt_link_info->pan_exist)) { in btc8821a1ant_act_wifi_con_bt_acl_busy()
1621 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1625 coex_dm->auto_tdma_adjust = false; in btc8821a1ant_act_wifi_con_bt_acl_busy()
1642 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_act_wifi_not_conn_scan()
1647 if (coex_dm->bt_status == BT_8821A_1ANT_BT_STATUS_ACL_BUSY) { in btc8821a1ant_act_wifi_not_conn_scan()
1648 if (bt_link_info->a2dp_exist) { in btc8821a1ant_act_wifi_not_conn_scan()
1652 } else if (bt_link_info->a2dp_exist && in btc8821a1ant_act_wifi_not_conn_scan()
1653 bt_link_info->pan_exist) { in btc8821a1ant_act_wifi_not_conn_scan()
1662 } else if ((coex_dm->bt_status == BT_8821A_1ANT_BT_STATUS_SCO_BUSY) || in btc8821a1ant_act_wifi_not_conn_scan()
1664 coex_dm->bt_status)) { in btc8821a1ant_act_wifi_not_conn_scan()
1676 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_action_wifi_connected_scan()
1683 if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) { in btc8821a1ant_action_wifi_connected_scan()
1684 if (bt_link_info->a2dp_exist) { in btc8821a1ant_action_wifi_connected_scan()
1693 } else if ((coex_dm->bt_status == BT_8821A_1ANT_BT_STATUS_SCO_BUSY) || in btc8821a1ant_action_wifi_connected_scan()
1694 (coex_dm->bt_status == in btc8821a1ant_action_wifi_connected_scan()
1706 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_act_wifi_conn_sp_pkt()
1712 if ((bt_link_info->sco_exist) || (bt_link_info->hid_exist) || in btc8821a1ant_act_wifi_conn_sp_pkt()
1713 (bt_link_info->a2dp_exist)) { in btc8821a1ant_act_wifi_conn_sp_pkt()
1718 if ((bt_link_info->hid_exist) && (bt_link_info->a2dp_exist)) { in btc8821a1ant_act_wifi_conn_sp_pkt()
1721 } else if (bt_link_info->pan_exist) { in btc8821a1ant_act_wifi_conn_sp_pkt()
1732 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_action_wifi_connected()
1741 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, in btc8821a1ant_action_wifi_connected()
1750 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a1ant_action_wifi_connected()
1751 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a1ant_action_wifi_connected()
1752 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a1ant_action_wifi_connected()
1765 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, in btc8821a1ant_action_wifi_connected()
1767 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); in btc8821a1ant_action_wifi_connected()
1769 coex_dm->bt_status && !ap_enable && in btc8821a1ant_action_wifi_connected()
1770 !btcoexist->bt_link_info.hid_only) { in btc8821a1ant_action_wifi_connected()
1771 if (!wifi_busy && btcoexist->bt_link_info.a2dp_only) in btc8821a1ant_action_wifi_connected()
1786 if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) { in btc8821a1ant_action_wifi_connected()
1790 coex_dm->bt_status) || in btc8821a1ant_action_wifi_connected()
1792 coex_dm->bt_status)) { in btc8821a1ant_action_wifi_connected()
1801 if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) { in btc8821a1ant_action_wifi_connected()
1805 coex_dm->bt_status) || in btc8821a1ant_action_wifi_connected()
1807 coex_dm->bt_status)) { in btc8821a1ant_action_wifi_connected()
1820 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_run_sw_coex_mech()
1824 coex_dm->cur_algorithm = algorithm; in btc8821a1ant_run_sw_coex_mech()
1827 switch (coex_dm->cur_algorithm) { in btc8821a1ant_run_sw_coex_mech()
1830 "[BTCoex], Action algorithm = SCO\n"); in btc8821a1ant_run_sw_coex_mech()
1884 coex_dm->pre_algorithm = coex_dm->cur_algorithm; in btc8821a1ant_run_sw_coex_mech()
1890 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_run_coexist_mechanism()
1891 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in btc8821a1ant_run_coexist_mechanism()
1903 if (btcoexist->manual_control) { in btc8821a1ant_run_coexist_mechanism()
1909 if (btcoexist->stop_coex_dm) { in btc8821a1ant_run_coexist_mechanism()
1915 if (coex_sta->under_ips) { in btc8821a1ant_run_coexist_mechanism()
1921 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in btc8821a1ant_run_coexist_mechanism()
1929 if ((BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) || in btc8821a1ant_run_coexist_mechanism()
1930 (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || in btc8821a1ant_run_coexist_mechanism()
1931 (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status)) in btc8821a1ant_run_coexist_mechanism()
1934 btcoexist->btc_set(btcoexist, BTC_SET_BL_INC_SCAN_DEV_NUM, in btc8821a1ant_run_coexist_mechanism()
1937 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in btc8821a1ant_run_coexist_mechanism()
1940 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in btc8821a1ant_run_coexist_mechanism()
1952 if (!bt_link_info->sco_exist && !bt_link_info->hid_exist) { in btc8821a1ant_run_coexist_mechanism()
1967 if (bt_link_info->sco_exist) { in btc8821a1ant_run_coexist_mechanism()
1970 } else if (bt_link_info->hid_exist) { in btc8821a1ant_run_coexist_mechanism()
1973 } else if (bt_link_info->a2dp_exist || bt_link_info->pan_exist) { in btc8821a1ant_run_coexist_mechanism()
1982 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in btc8821a1ant_run_coexist_mechanism()
1983 if (coex_sta->c2h_bt_inquiry_page) { in btc8821a1ant_run_coexist_mechanism()
1995 "[BTCoex], wifi is non connected-idle !!!\n"); in btc8821a1ant_run_coexist_mechanism()
1997 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in btc8821a1ant_run_coexist_mechanism()
1998 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in btc8821a1ant_run_coexist_mechanism()
1999 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in btc8821a1ant_run_coexist_mechanism()
2029 struct rtl_priv *rtlpriv = btcoexist->adapter; in btc8821a1ant_init_hw_config()
2040 coex_dm->backup_arfr_cnt1 = btcoexist->btc_read_4byte(btcoexist, in btc8821a1ant_init_hw_config()
2042 coex_dm->backup_arfr_cnt2 = btcoexist->btc_read_4byte(btcoexist, in btc8821a1ant_init_hw_config()
2044 coex_dm->backup_retry_limit = in btc8821a1ant_init_hw_config()
2045 btcoexist->btc_read_2byte(btcoexist, 0x42a); in btc8821a1ant_init_hw_config()
2046 coex_dm->backup_ampdu_max_time = in btc8821a1ant_init_hw_config()
2047 btcoexist->btc_read_1byte(btcoexist, 0x456); in btc8821a1ant_init_hw_config()
2051 u1_tmp = btcoexist->btc_read_1byte(btcoexist, 0x790); in btc8821a1ant_init_hw_config()
2054 btcoexist->btc_write_1byte(btcoexist, 0x790, u1_tmp); in btc8821a1ant_init_hw_config()
2056 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in btc8821a1ant_init_hw_config()
2071 btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); in btc8821a1ant_init_hw_config()
2072 btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3); in btc8821a1ant_init_hw_config()
2073 btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1); in btc8821a1ant_init_hw_config()
2082 btcoexist->auto_report_1ant = true; in ex_btc8821a1ant_init_hwconfig()
2087 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_init_coex_dm()
2092 btcoexist->stop_coex_dm = false; in ex_btc8821a1ant_init_coex_dm()
2102 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a1ant_display_coex_info()
2103 struct btc_stack_info *stack_info = &btcoexist->stack_info; in ex_btc8821a1ant_display_coex_info()
2104 struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; in ex_btc8821a1ant_display_coex_info()
2115 seq_puts(m, "\n ============[BT Coexist info]============"); in ex_btc8821a1ant_display_coex_info()
2117 if (btcoexist->manual_control) { in ex_btc8821a1ant_display_coex_info()
2121 if (btcoexist->stop_coex_dm) { in ex_btc8821a1ant_display_coex_info()
2126 seq_printf(m, "\n %-35s = %d/ %d/ %d", in ex_btc8821a1ant_display_coex_info()
2128 board_info->pg_ant_num, in ex_btc8821a1ant_display_coex_info()
2129 board_info->btdm_ant_num, in ex_btc8821a1ant_display_coex_info()
2130 board_info->btdm_ant_pos); in ex_btc8821a1ant_display_coex_info()
2132 seq_printf(m, "\n %-35s = %s / %d", "BT stack/ hci ext ver", in ex_btc8821a1ant_display_coex_info()
2133 ((stack_info->profile_notified) ? "Yes" : "No"), in ex_btc8821a1ant_display_coex_info()
2134 stack_info->hci_version); in ex_btc8821a1ant_display_coex_info()
2136 btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, in ex_btc8821a1ant_display_coex_info()
2138 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in ex_btc8821a1ant_display_coex_info()
2139 seq_printf(m, "\n %-35s = %d_%x/ 0x%x/ 0x%x(%d)", in ex_btc8821a1ant_display_coex_info()
2146 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, in ex_btc8821a1ant_display_coex_info()
2148 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL, in ex_btc8821a1ant_display_coex_info()
2150 btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, in ex_btc8821a1ant_display_coex_info()
2152 seq_printf(m, "\n %-35s = %d / %d(%d)", in ex_btc8821a1ant_display_coex_info()
2156 seq_printf(m, "\n %-35s = %3ph ", in ex_btc8821a1ant_display_coex_info()
2157 "H2C Wifi inform bt chnl Info", in ex_btc8821a1ant_display_coex_info()
2158 coex_dm->wifi_chnl_info); in ex_btc8821a1ant_display_coex_info()
2160 btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); in ex_btc8821a1ant_display_coex_info()
2161 btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi); in ex_btc8821a1ant_display_coex_info()
2162 seq_printf(m, "\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", in ex_btc8821a1ant_display_coex_info()
2165 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); in ex_btc8821a1ant_display_coex_info()
2166 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); in ex_btc8821a1ant_display_coex_info()
2167 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); in ex_btc8821a1ant_display_coex_info()
2168 seq_printf(m, "\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan", in ex_btc8821a1ant_display_coex_info()
2171 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, in ex_btc8821a1ant_display_coex_info()
2173 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, in ex_btc8821a1ant_display_coex_info()
2175 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, in ex_btc8821a1ant_display_coex_info()
2177 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, in ex_btc8821a1ant_display_coex_info()
2179 seq_printf(m, "\n %-35s = %s / %s/ %s ", "Wifi status", in ex_btc8821a1ant_display_coex_info()
2186 seq_printf(m, "\n %-35s = [%s/ %d/ %d] ", in ex_btc8821a1ant_display_coex_info()
2187 "BT [status/ rssi/ retryCnt]", in ex_btc8821a1ant_display_coex_info()
2188 ((coex_sta->bt_disabled) ? ("disabled") : in ex_btc8821a1ant_display_coex_info()
2189 ((coex_sta->c2h_bt_inquiry_page) ? ("inquiry/page scan") : in ex_btc8821a1ant_display_coex_info()
2191 coex_dm->bt_status) ? in ex_btc8821a1ant_display_coex_info()
2192 "non-connected idle" : in ex_btc8821a1ant_display_coex_info()
2194 coex_dm->bt_status) ? in ex_btc8821a1ant_display_coex_info()
2195 "connected-idle" : "busy")))), in ex_btc8821a1ant_display_coex_info()
2196 coex_sta->bt_rssi, coex_sta->bt_retry_cnt); in ex_btc8821a1ant_display_coex_info()
2198 seq_printf(m, "\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", in ex_btc8821a1ant_display_coex_info()
2199 bt_link_info->sco_exist, in ex_btc8821a1ant_display_coex_info()
2200 bt_link_info->hid_exist, in ex_btc8821a1ant_display_coex_info()
2201 bt_link_info->pan_exist, in ex_btc8821a1ant_display_coex_info()
2202 bt_link_info->a2dp_exist); in ex_btc8821a1ant_display_coex_info()
2203 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO, m); in ex_btc8821a1ant_display_coex_info()
2205 bt_info_ext = coex_sta->bt_info_ext; in ex_btc8821a1ant_display_coex_info()
2206 seq_printf(m, "\n %-35s = %s", in ex_btc8821a1ant_display_coex_info()
2207 "BT Info A2DP rate", in ex_btc8821a1ant_display_coex_info()
2212 if (coex_sta->bt_info_c2h_cnt[i]) { in ex_btc8821a1ant_display_coex_info()
2213 seq_printf(m, "\n %-35s = %7ph(%d)", in ex_btc8821a1ant_display_coex_info()
2215 coex_sta->bt_info_c2h[i], in ex_btc8821a1ant_display_coex_info()
2216 coex_sta->bt_info_c2h_cnt[i]); in ex_btc8821a1ant_display_coex_info()
2219 seq_printf(m, "\n %-35s = %s/%s, (0x%x/0x%x)", in ex_btc8821a1ant_display_coex_info()
2221 ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")), in ex_btc8821a1ant_display_coex_info()
2222 ((coex_sta->under_lps ? "LPS ON" : "LPS OFF")), in ex_btc8821a1ant_display_coex_info()
2223 btcoexist->bt_info.lps_val, in ex_btc8821a1ant_display_coex_info()
2224 btcoexist->bt_info.rpwm_val); in ex_btc8821a1ant_display_coex_info()
2225 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD, m); in ex_btc8821a1ant_display_coex_info()
2227 if (!btcoexist->manual_control) { in ex_btc8821a1ant_display_coex_info()
2229 seq_printf(m, "\n %-35s", in ex_btc8821a1ant_display_coex_info()
2232 seq_printf(m, "\n %-35s = %d", "SM[LowPenaltyRA]", in ex_btc8821a1ant_display_coex_info()
2233 coex_dm->cur_low_penalty_ra); in ex_btc8821a1ant_display_coex_info()
2235 seq_printf(m, "\n %-35s = %s/ %s/ %d ", in ex_btc8821a1ant_display_coex_info()
2237 (btcoexist->bt_info.reject_agg_pkt ? "Yes" : "No"), in ex_btc8821a1ant_display_coex_info()
2238 (btcoexist->bt_info.bt_ctrl_buf_size ? "Yes" : "No"), in ex_btc8821a1ant_display_coex_info()
2239 btcoexist->bt_info.agg_buf_size); in ex_btc8821a1ant_display_coex_info()
2240 seq_printf(m, "\n %-35s = 0x%x ", "Rate Mask", in ex_btc8821a1ant_display_coex_info()
2241 btcoexist->bt_info.ra_mask); in ex_btc8821a1ant_display_coex_info()
2244 seq_printf(m, "\n %-35s", in ex_btc8821a1ant_display_coex_info()
2247 ps_tdma_case = coex_dm->cur_ps_tdma; in ex_btc8821a1ant_display_coex_info()
2248 seq_printf(m, "\n %-35s = %5ph case-%d (auto:%d)", in ex_btc8821a1ant_display_coex_info()
2250 coex_dm->ps_tdma_para, in ex_btc8821a1ant_display_coex_info()
2252 coex_dm->auto_tdma_adjust); in ex_btc8821a1ant_display_coex_info()
2254 seq_printf(m, "\n %-35s = 0x%x ", in ex_btc8821a1ant_display_coex_info()
2256 coex_dm->error_condition); in ex_btc8821a1ant_display_coex_info()
2258 seq_printf(m, "\n %-35s = %d ", "IgnWlanAct", in ex_btc8821a1ant_display_coex_info()
2259 coex_dm->cur_ignore_wlan_act); in ex_btc8821a1ant_display_coex_info()
2263 seq_printf(m, "\n %-35s", "============[Hw setting]============"); in ex_btc8821a1ant_display_coex_info()
2265 seq_printf(m, "\n %-35s = 0x%x/0x%x/0x%x/0x%x", in ex_btc8821a1ant_display_coex_info()
2267 coex_dm->backup_arfr_cnt1, in ex_btc8821a1ant_display_coex_info()
2268 coex_dm->backup_arfr_cnt2, in ex_btc8821a1ant_display_coex_info()
2269 coex_dm->backup_retry_limit, in ex_btc8821a1ant_display_coex_info()
2270 coex_dm->backup_ampdu_max_time); in ex_btc8821a1ant_display_coex_info()
2272 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x430); in ex_btc8821a1ant_display_coex_info()
2273 u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x434); in ex_btc8821a1ant_display_coex_info()
2274 u2_tmp[0] = btcoexist->btc_read_2byte(btcoexist, 0x42a); in ex_btc8821a1ant_display_coex_info()
2275 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x456); in ex_btc8821a1ant_display_coex_info()
2276 seq_printf(m, "\n %-35s = 0x%x/0x%x/0x%x/0x%x", in ex_btc8821a1ant_display_coex_info()
2280 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778); in ex_btc8821a1ant_display_coex_info()
2281 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc58); in ex_btc8821a1ant_display_coex_info()
2282 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", "0x778/ 0xc58[29:25]", in ex_btc8821a1ant_display_coex_info()
2285 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db); in ex_btc8821a1ant_display_coex_info()
2286 seq_printf(m, "\n %-35s = 0x%x", "0x8db[6:5]", in ex_btc8821a1ant_display_coex_info()
2289 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x975); in ex_btc8821a1ant_display_coex_info()
2290 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4); in ex_btc8821a1ant_display_coex_info()
2291 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a1ant_display_coex_info()
2297 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40); in ex_btc8821a1ant_display_coex_info()
2298 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c); in ex_btc8821a1ant_display_coex_info()
2299 u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x64); in ex_btc8821a1ant_display_coex_info()
2300 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x", in ex_btc8821a1ant_display_coex_info()
2305 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550); in ex_btc8821a1ant_display_coex_info()
2306 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522); in ex_btc8821a1ant_display_coex_info()
2307 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", in ex_btc8821a1ant_display_coex_info()
2310 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50); in ex_btc8821a1ant_display_coex_info()
2311 seq_printf(m, "\n %-35s = 0x%x", "0xc50(dig)", in ex_btc8821a1ant_display_coex_info()
2314 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48); in ex_btc8821a1ant_display_coex_info()
2315 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5d); in ex_btc8821a1ant_display_coex_info()
2316 u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c); in ex_btc8821a1ant_display_coex_info()
2317 seq_printf(m, "\n %-35s = 0x%x/ 0x%x", "OFDM-FA/ CCK-FA", in ex_btc8821a1ant_display_coex_info()
2320 u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0); in ex_btc8821a1ant_display_coex_info()
2321 u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4); in ex_btc8821a1ant_display_coex_info()
2322 u4_tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8); in ex_btc8821a1ant_display_coex_info()
2323 u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x6cc); in ex_btc8821a1ant_display_coex_info()
2324 seq_printf(m, "\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", in ex_btc8821a1ant_display_coex_info()
2328 seq_printf(m, "\n %-35s = %d/ %d", "0x770(high-pri rx/tx)", in ex_btc8821a1ant_display_coex_info()
2329 coex_sta->high_priority_rx, coex_sta->high_priority_tx); in ex_btc8821a1ant_display_coex_info()
2330 seq_printf(m, "\n %-35s = %d/ %d", "0x774(low-pri rx/tx)", in ex_btc8821a1ant_display_coex_info()
2331 coex_sta->low_priority_rx, coex_sta->low_priority_tx); in ex_btc8821a1ant_display_coex_info()
2332 if (btcoexist->auto_report_1ant) in ex_btc8821a1ant_display_coex_info()
2334 btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS, m); in ex_btc8821a1ant_display_coex_info()
2339 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_ips_notify()
2342 if (btcoexist->manual_control || btcoexist->stop_coex_dm) in ex_btc8821a1ant_ips_notify()
2344 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_ips_notify()
2355 coex_sta->under_ips = true; in ex_btc8821a1ant_ips_notify()
2365 coex_sta->under_ips = false; in ex_btc8821a1ant_ips_notify()
2375 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_lps_notify()
2377 if (btcoexist->manual_control || btcoexist->stop_coex_dm) in ex_btc8821a1ant_lps_notify()
2383 coex_sta->under_lps = true; in ex_btc8821a1ant_lps_notify()
2387 coex_sta->under_lps = false; in ex_btc8821a1ant_lps_notify()
2393 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_scan_notify()
2401 if (btcoexist->manual_control || btcoexist->stop_coex_dm) in ex_btc8821a1ant_scan_notify()
2403 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_scan_notify()
2412 coex_sta->wifi_is_high_pri_task = true; in ex_btc8821a1ant_scan_notify()
2419 coex_sta->wifi_is_high_pri_task = false; in ex_btc8821a1ant_scan_notify()
2424 if (coex_sta->bt_disabled) in ex_btc8821a1ant_scan_notify()
2427 btcoexist->btc_get(btcoexist, in ex_btc8821a1ant_scan_notify()
2429 btcoexist->btc_get(btcoexist, in ex_btc8821a1ant_scan_notify()
2434 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in ex_btc8821a1ant_scan_notify()
2445 if (coex_sta->c2h_bt_inquiry_page) { in ex_btc8821a1ant_scan_notify()
2457 /* non-connected scan */ in ex_btc8821a1ant_scan_notify()
2467 /* non-connected scan */ in ex_btc8821a1ant_scan_notify()
2477 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_connect_notify()
2485 if (btcoexist->manual_control || btcoexist->stop_coex_dm || in ex_btc8821a1ant_connect_notify()
2486 coex_sta->bt_disabled) in ex_btc8821a1ant_connect_notify()
2488 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_connect_notify()
2497 coex_sta->wifi_is_high_pri_task = true; in ex_btc8821a1ant_connect_notify()
2500 coex_dm->arp_cnt = 0; in ex_btc8821a1ant_connect_notify()
2502 coex_sta->wifi_is_high_pri_task = false; in ex_btc8821a1ant_connect_notify()
2505 coex_dm->arp_cnt = 0; in ex_btc8821a1ant_connect_notify()
2508 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in ex_btc8821a1ant_connect_notify()
2519 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in ex_btc8821a1ant_connect_notify()
2520 if (coex_sta->c2h_bt_inquiry_page) { in ex_btc8821a1ant_connect_notify()
2536 btcoexist->btc_get(btcoexist, in ex_btc8821a1ant_connect_notify()
2539 /* non-connected scan */ in ex_btc8821a1ant_connect_notify()
2550 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_media_status_notify()
2556 if (btcoexist->manual_control || btcoexist->stop_coex_dm || in ex_btc8821a1ant_media_status_notify()
2557 coex_sta->bt_disabled) in ex_btc8821a1ant_media_status_notify()
2559 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_media_status_notify()
2573 coex_dm->arp_cnt = 0; in ex_btc8821a1ant_media_status_notify()
2576 /* only 2.4G we need to inform bt the chnl mask */ in ex_btc8821a1ant_media_status_notify()
2577 btcoexist->btc_get(btcoexist, in ex_btc8821a1ant_media_status_notify()
2584 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); in ex_btc8821a1ant_media_status_notify()
2591 coex_dm->wifi_chnl_info[0] = h2c_parameter[0]; in ex_btc8821a1ant_media_status_notify()
2592 coex_dm->wifi_chnl_info[1] = h2c_parameter[1]; in ex_btc8821a1ant_media_status_notify()
2593 coex_dm->wifi_chnl_info[2] = h2c_parameter[2]; in ex_btc8821a1ant_media_status_notify()
2601 btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter); in ex_btc8821a1ant_media_status_notify()
2607 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_special_packet_notify()
2615 if (btcoexist->manual_control || btcoexist->stop_coex_dm || in ex_btc8821a1ant_special_packet_notify()
2616 coex_sta->bt_disabled) in ex_btc8821a1ant_special_packet_notify()
2619 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_special_packet_notify()
2629 coex_sta->wifi_is_high_pri_task = true; in ex_btc8821a1ant_special_packet_notify()
2639 coex_sta->wifi_is_high_pri_task = false; in ex_btc8821a1ant_special_packet_notify()
2645 coex_sta->special_pkt_period_cnt = 0; in ex_btc8821a1ant_special_packet_notify()
2647 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS, in ex_btc8821a1ant_special_packet_notify()
2658 btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); in ex_btc8821a1ant_special_packet_notify()
2659 if (coex_sta->c2h_bt_inquiry_page) { in ex_btc8821a1ant_special_packet_notify()
2670 coex_dm->arp_cnt++; in ex_btc8821a1ant_special_packet_notify()
2673 coex_dm->arp_cnt); in ex_btc8821a1ant_special_packet_notify()
2674 if (coex_dm->arp_cnt >= 10) in ex_btc8821a1ant_special_packet_notify()
2690 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_bt_info_notify()
2698 coex_sta->c2h_bt_info_req_sent = false; in ex_btc8821a1ant_bt_info_notify()
2700 btcoexist->btc_get(btcoexist, in ex_btc8821a1ant_bt_info_notify()
2706 coex_sta->bt_info_c2h_cnt[rsp_source]++; in ex_btc8821a1ant_bt_info_notify()
2709 "[BTCoex], Bt info[%d], length = %d, hex data = [", in ex_btc8821a1ant_bt_info_notify()
2712 coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i]; in ex_btc8821a1ant_bt_info_notify()
2715 if (i == length - 1) { in ex_btc8821a1ant_bt_info_notify()
2726 coex_sta->bt_retry_cnt = in ex_btc8821a1ant_bt_info_notify()
2727 coex_sta->bt_info_c2h[rsp_source][2] & 0xf; in ex_btc8821a1ant_bt_info_notify()
2729 coex_sta->bt_rssi = in ex_btc8821a1ant_bt_info_notify()
2730 coex_sta->bt_info_c2h[rsp_source][3] * 2 + 10; in ex_btc8821a1ant_bt_info_notify()
2732 coex_sta->bt_info_ext = coex_sta->bt_info_c2h[rsp_source][4]; in ex_btc8821a1ant_bt_info_notify()
2734 coex_sta->bt_tx_rx_mask = in ex_btc8821a1ant_bt_info_notify()
2735 (coex_sta->bt_info_c2h[rsp_source][2] & 0x40); in ex_btc8821a1ant_bt_info_notify()
2736 btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TX_RX_MASK, in ex_btc8821a1ant_bt_info_notify()
2737 &coex_sta->bt_tx_rx_mask); in ex_btc8821a1ant_bt_info_notify()
2738 if (!coex_sta->bt_tx_rx_mask) { in ex_btc8821a1ant_bt_info_notify()
2739 /* BT into is responded by BT FW and BT RF REG 0x3C != in ex_btc8821a1ant_bt_info_notify()
2740 * 0x15 => Need to switch BT TRx Mask in ex_btc8821a1ant_bt_info_notify()
2743 "[BTCoex], Switch BT TRx Mask since BT RF REG 0x3C != 0x15\n"); in ex_btc8821a1ant_bt_info_notify()
2744 btcoexist->btc_set_bt_reg(btcoexist, BTC_BT_REG_RF, in ex_btc8821a1ant_bt_info_notify()
2748 /* Here we need to resend some wifi info to BT in ex_btc8821a1ant_bt_info_notify()
2749 * because bt is reset and lost the info in ex_btc8821a1ant_bt_info_notify()
2751 if (coex_sta->bt_info_ext & BIT1) { in ex_btc8821a1ant_bt_info_notify()
2753 "[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"); in ex_btc8821a1ant_bt_info_notify()
2754 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, in ex_btc8821a1ant_bt_info_notify()
2765 if ((coex_sta->bt_info_ext & BIT3) && !wifi_under_5g) { in ex_btc8821a1ant_bt_info_notify()
2766 if (!btcoexist->manual_control && in ex_btc8821a1ant_bt_info_notify()
2767 !btcoexist->stop_coex_dm) { in ex_btc8821a1ant_bt_info_notify()
2769 "[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"); in ex_btc8821a1ant_bt_info_notify()
2777 /* check BIT2 first ==> check if bt is under inquiry or page scan */ in ex_btc8821a1ant_bt_info_notify()
2779 coex_sta->c2h_bt_inquiry_page = true; in ex_btc8821a1ant_bt_info_notify()
2781 coex_sta->c2h_bt_inquiry_page = false; in ex_btc8821a1ant_bt_info_notify()
2785 coex_sta->bt_link_exist = false; in ex_btc8821a1ant_bt_info_notify()
2786 coex_sta->pan_exist = false; in ex_btc8821a1ant_bt_info_notify()
2787 coex_sta->a2dp_exist = false; in ex_btc8821a1ant_bt_info_notify()
2788 coex_sta->hid_exist = false; in ex_btc8821a1ant_bt_info_notify()
2789 coex_sta->sco_exist = false; in ex_btc8821a1ant_bt_info_notify()
2792 coex_sta->bt_link_exist = true; in ex_btc8821a1ant_bt_info_notify()
2794 coex_sta->pan_exist = true; in ex_btc8821a1ant_bt_info_notify()
2796 coex_sta->pan_exist = false; in ex_btc8821a1ant_bt_info_notify()
2798 coex_sta->a2dp_exist = true; in ex_btc8821a1ant_bt_info_notify()
2800 coex_sta->a2dp_exist = false; in ex_btc8821a1ant_bt_info_notify()
2802 coex_sta->hid_exist = true; in ex_btc8821a1ant_bt_info_notify()
2804 coex_sta->hid_exist = false; in ex_btc8821a1ant_bt_info_notify()
2806 coex_sta->sco_exist = true; in ex_btc8821a1ant_bt_info_notify()
2808 coex_sta->sco_exist = false; in ex_btc8821a1ant_bt_info_notify()
2813 /* mask profile bit for connect-ilde identification in ex_btc8821a1ant_bt_info_notify()
2814 * (for CSR case: A2DP idle --> 0x41) in ex_btc8821a1ant_bt_info_notify()
2819 coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE; in ex_btc8821a1ant_bt_info_notify()
2821 "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"); in ex_btc8821a1ant_bt_info_notify()
2824 coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE; in ex_btc8821a1ant_bt_info_notify()
2826 "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"); in ex_btc8821a1ant_bt_info_notify()
2829 coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_SCO_BUSY; in ex_btc8821a1ant_bt_info_notify()
2831 "[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"); in ex_btc8821a1ant_bt_info_notify()
2833 if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY != coex_dm->bt_status) in ex_btc8821a1ant_bt_info_notify()
2834 coex_dm->auto_tdma_adjust = false; in ex_btc8821a1ant_bt_info_notify()
2835 coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_ACL_BUSY; in ex_btc8821a1ant_bt_info_notify()
2837 "[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"); in ex_btc8821a1ant_bt_info_notify()
2839 coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_MAX; in ex_btc8821a1ant_bt_info_notify()
2841 "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"); in ex_btc8821a1ant_bt_info_notify()
2844 if ((BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) || in ex_btc8821a1ant_bt_info_notify()
2845 (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || in ex_btc8821a1ant_bt_info_notify()
2846 (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status)) in ex_btc8821a1ant_bt_info_notify()
2850 btcoexist->btc_set(btcoexist, in ex_btc8821a1ant_bt_info_notify()
2858 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_halt_notify()
2863 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_halt_notify()
2872 btcoexist->stop_coex_dm = true; in ex_btc8821a1ant_halt_notify()
2885 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_pnp_notify()
2888 btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); in ex_btc8821a1ant_pnp_notify()
2902 /* BT should clear UnderIPS/UnderLPS state to avoid mismatch in ex_btc8821a1ant_pnp_notify()
2905 coex_sta->under_ips = false; in ex_btc8821a1ant_pnp_notify()
2906 coex_sta->under_lps = false; in ex_btc8821a1ant_pnp_notify()
2907 btcoexist->stop_coex_dm = true; in ex_btc8821a1ant_pnp_notify()
2917 btcoexist->stop_coex_dm = false; in ex_btc8821a1ant_pnp_notify()
2926 struct rtl_priv *rtlpriv = btcoexist->adapter; in ex_btc8821a1ant_periodical()
2929 struct btc_board_info *board_info = &btcoexist->board_info; in ex_btc8821a1ant_periodical()
2930 struct btc_stack_info *stack_info = &btcoexist->stack_info; in ex_btc8821a1ant_periodical()
2941 board_info->pg_ant_num, in ex_btc8821a1ant_periodical()
2942 board_info->btdm_ant_num, in ex_btc8821a1ant_periodical()
2943 board_info->btdm_ant_pos); in ex_btc8821a1ant_periodical()
2945 "[BTCoex], BT stack/ hci ext ver = %s / %d\n", in ex_btc8821a1ant_periodical()
2946 stack_info->profile_notified ? "Yes" : "No", in ex_btc8821a1ant_periodical()
2947 stack_info->hci_version); in ex_btc8821a1ant_periodical()
2948 btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, in ex_btc8821a1ant_periodical()
2950 btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); in ex_btc8821a1ant_periodical()
2961 if (!btcoexist->auto_report_1ant) { in ex_btc8821a1ant_periodical()
2965 coex_sta->special_pkt_period_cnt++; in ex_btc8821a1ant_periodical()