mirror of
https://github.com/RinCat/RTL88x2BU-Linux-Driver.git
synced 2026-01-29 07:16:35 +00:00
Update to 5.13.1 from upstream
This commit is contained in:
@@ -28,9 +28,9 @@ static const char *const glbt_info_src_8822b_1ant[] = {
|
||||
"BT Info[bt scbd]"
|
||||
};
|
||||
|
||||
u32 glcoex_ver_date_8822b_1ant = 20191120;
|
||||
u32 glcoex_ver_8822b_1ant = 0x77;
|
||||
u32 glcoex_ver_btdesired_8822b_1ant = 0x75;
|
||||
u32 glcoex_ver_date_8822b_1ant = 20210316;
|
||||
u32 glcoex_ver_8822b_1ant = 0x18317b;
|
||||
u32 glcoex_ver_btdesired_8822b_1ant = 0x79;
|
||||
|
||||
#if 0
|
||||
static
|
||||
@@ -264,7 +264,8 @@ halbtc8822b1ant_ccklock_action(struct btc_coexist *btc)
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
u8 h2c_parameter[2] = {0};
|
||||
static u8 cnt;
|
||||
|
||||
boolean wifi_busy = FALSE;
|
||||
#if 0
|
||||
if (coex_sta->tdma_timer_base == 3) {
|
||||
if (!coex_sta->is_no_wl_5ms_extend) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -279,10 +280,22 @@ halbtc8822b1ant_ccklock_action(struct btc_coexist *btc)
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
|
||||
if (!coex_sta->gl_wifi_busy ||
|
||||
coex_sta->wl_iot_peer == BTC_IOT_PEER_CISCO) {
|
||||
cnt = 0;
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi is not busy or CISCO AP, return!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!coex_sta->is_no_wl_5ms_extend && coex_sta->force_lps_ctrl &&
|
||||
!coex_sta->cck_lock_ever) {
|
||||
if (coex_sta->wl_fw_dbg_info[7] <= 5)
|
||||
if (coex_sta->wl_fw_dbg_info[7] <= 5 && wifi_busy)
|
||||
cnt++;
|
||||
else
|
||||
cnt = 0;
|
||||
@@ -319,14 +332,13 @@ halbtc8822b1ant_ccklock_detect(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct coex_dm_8822b_1ant *coex_dm = &btc->coex_dm_8822b_1ant;
|
||||
struct btc_wifi_link_info_ext *link_info_ext = &btc->wifi_link_info_ext;
|
||||
struct wifi_link_info_8822b_1ant *link_info_ext =
|
||||
&btc->wifi_link_info_8822b_1ant;
|
||||
boolean is_cck_lock_rate = FALSE;
|
||||
|
||||
if (coex_dm->bt_status == BTC_BTSTATUS_INQ_PAGE ||
|
||||
coex_sta->is_setup_link) {
|
||||
coex_sta->cck_lock = FALSE;
|
||||
return;
|
||||
}
|
||||
coex_sta->is_setup_link)
|
||||
return;
|
||||
|
||||
if (coex_sta->wl_rx_rate <= BTC_CCK_2 ||
|
||||
coex_sta->wl_rts_rx_rate <= BTC_CCK_2)
|
||||
@@ -408,10 +420,6 @@ halbtc8822b1ant_set_tdma_timer_base(struct btc_coexist *btc, u8 type)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], %s() h2c_0x69 = 0x%x\n", __func__, h2c_para[1]);
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
/* no 5ms_wl_slot_extend for 4-slot mode */
|
||||
if (coex_sta->tdma_timer_base == 3)
|
||||
halbtc8822b1ant_ccklock_action(btc);
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_low_penalty_ra(struct btc_coexist *btc,
|
||||
@@ -531,13 +539,14 @@ static void halbtc8822b1ant_enable_gnt_to_gpio(struct btc_coexist *btc,
|
||||
}
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
static boolean halbtc8822b1ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
u32 reg_hp_txrx, reg_lp_txrx, u32tmp;
|
||||
struct coex_dm_8822b_1ant *coex_dm = &btc->coex_dm_8822b_1ant;
|
||||
u32 reg_hp_txrx, reg_lp_txrx, u32tmp, cnt_bt_all;
|
||||
u32 reg_hp_tx = 0, reg_hp_rx = 0, reg_lp_tx = 0, reg_lp_rx = 0;
|
||||
static u8 num_of_bt_counter_chk, cnt_autoslot_hang;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
static u32 cnt_bt_pre = 0;
|
||||
boolean is_run_coex = FALSE;
|
||||
|
||||
reg_hp_txrx = 0x770;
|
||||
reg_lp_txrx = 0x774;
|
||||
@@ -563,9 +572,35 @@ static void halbtc8822b1ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
/* reset counter */
|
||||
btc->btc_write_1byte(btc, 0x76e, 0xc);
|
||||
|
||||
if (coex_sta->under_lps || coex_sta->under_ips ||
|
||||
(coex_sta->high_priority_tx == 65535 &&
|
||||
coex_sta->high_priority_rx == 65535 &&
|
||||
coex_sta->low_priority_tx == 65535 &&
|
||||
coex_sta->low_priority_rx == 65535))
|
||||
coex_sta->bt_ctr_ok = FALSE;
|
||||
else
|
||||
coex_sta->bt_ctr_ok = TRUE;
|
||||
|
||||
if (!coex_sta->bt_ctr_ok)
|
||||
return FALSE;
|
||||
|
||||
if (coex_sta->low_priority_tx > 1150 &&
|
||||
!coex_sta->c2h_bt_inquiry_page)
|
||||
coex_sta->pop_event_cnt++;
|
||||
|
||||
cnt_bt_all = coex_sta->high_priority_tx +
|
||||
coex_sta->high_priority_rx +
|
||||
coex_sta->low_priority_tx +
|
||||
coex_sta->low_priority_rx;
|
||||
|
||||
if ((cnt_bt_pre > (cnt_bt_all + 50) ||
|
||||
cnt_bt_all > (cnt_bt_pre + 50)) &&
|
||||
coex_dm->bt_status == BT_8822B_1ANT_BSTATUS_NCON_IDLE)
|
||||
is_run_coex = TRUE;
|
||||
|
||||
cnt_bt_pre = cnt_bt_all;
|
||||
|
||||
return is_run_coex;
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_monitor_wifi_ctr(struct btc_coexist *btc)
|
||||
@@ -577,7 +612,6 @@ static void halbtc8822b1ant_monitor_wifi_ctr(struct btc_coexist *btc)
|
||||
u32 cnt_cck;
|
||||
static u8 cnt_ccklocking;
|
||||
u8 h2c_parameter[1] = {0};
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_SCAN, &wifi_scan);
|
||||
@@ -859,9 +893,17 @@ static void halbtc8822b1ant_update_wifi_link_info(struct btc_coexist *btc,
|
||||
struct btc_wifi_link_info wifi_link_info;
|
||||
struct coex_dm_8822b_1ant *coex_dm = &btc->coex_dm_8822b_1ant;
|
||||
u8 wifi_central_chnl = 0, num_of_wifi_link = 0;
|
||||
boolean isunder5G = FALSE, ismcc25g = FALSE, isp2pconnected = FALSE;
|
||||
u32 wifi_link_status = 0;
|
||||
boolean isunder5G = FALSE, ismcc25g = FALSE, isp2pconnected = FALSE;
|
||||
boolean wifi_connected = FALSE;
|
||||
boolean scan = FALSE, link = FALSE, roam = FALSE, under_4way = FALSE;
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_SCAN, &scan);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_LINK, &link);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_ROAM, &roam);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &under_4way);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_LW_PWR_STATE,
|
||||
&wifi_link_info_ext->is_32k);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_CONNECTED,
|
||||
&wifi_link_info_ext->is_connected);
|
||||
|
||||
@@ -959,6 +1001,20 @@ static void halbtc8822b1ant_update_wifi_link_info(struct btc_coexist *btc,
|
||||
|
||||
wifi_link_info_ext->num_of_active_port = num_of_wifi_link;
|
||||
wifi_link_info_ext->is_p2p_connected = isp2pconnected;
|
||||
|
||||
if (scan || link || roam || under_4way ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSCANSTART ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSWITCHBAND ||
|
||||
reason == BT_8822B_1ANT_RSN_2GCONSTART ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSPECIALPKT) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], scan = %d, link = %d, roam = %d 4way = %d!!!\n",
|
||||
scan, link, roam, under_4way);
|
||||
BTC_TRACE(trace_buf);
|
||||
coex_sta->is_wifi_linkscan_process = TRUE;
|
||||
} else {
|
||||
coex_sta->is_wifi_linkscan_process = FALSE;
|
||||
}
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi_link_info: link_mode=%d, STA_Ch=%d, P2P_Ch=%d, AnyClient_Join_Go=%d !\n",
|
||||
@@ -1188,6 +1244,7 @@ static void halbtc8822b1ant_update_bt_link_info(struct btc_coexist *btc)
|
||||
#if 1
|
||||
if (coex_sta->hid_busy_num == 0 &&
|
||||
coex_sta->hid_pair_cnt > 0 &&
|
||||
coex_sta->bt_ctr_ok &&
|
||||
coex_sta->low_priority_tx > 1500 &&
|
||||
coex_sta->low_priority_rx > 1500 &&
|
||||
!coex_sta->c2h_bt_inquiry_page)
|
||||
@@ -1390,11 +1447,16 @@ halbtc8822b1ant_update_wifi_ch_info(struct btc_coexist *btc, u8 type)
|
||||
}
|
||||
}
|
||||
|
||||
coex_dm->wifi_chnl_info[0] = h2c_parameter[0];
|
||||
coex_dm->wifi_chnl_info[1] = h2c_parameter[1];
|
||||
coex_dm->wifi_chnl_info[2] = h2c_parameter[2];
|
||||
/* Only send mailbox if ch info change */
|
||||
if (coex_dm->wifi_chnl_info[0] != h2c_parameter[0] &&
|
||||
coex_dm->wifi_chnl_info[1] != h2c_parameter[1] &&
|
||||
coex_dm->wifi_chnl_info[2] != h2c_parameter[2]) {
|
||||
|
||||
btc->btc_fill_h2c(btc, 0x66, 3, h2c_parameter);
|
||||
coex_dm->wifi_chnl_info[0] = h2c_parameter[0];
|
||||
coex_dm->wifi_chnl_info[1] = h2c_parameter[1];
|
||||
coex_dm->wifi_chnl_info[2] = h2c_parameter[2];
|
||||
btc->btc_fill_h2c(btc, 0x66, 3, h2c_parameter);
|
||||
}
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], para[0:2] = 0x%x 0x%x 0x%x\n", h2c_parameter[0],
|
||||
@@ -1651,6 +1713,7 @@ halbtc8822b1ant_set_gnt_wl(struct btc_coexist *btc, u8 state)
|
||||
static void halbtc8822b1ant_mimo_ps(struct btc_coexist *btc,
|
||||
boolean force_exec, u8 state)
|
||||
{
|
||||
#if 0
|
||||
static u8 pre_state;
|
||||
|
||||
if (!force_exec) {
|
||||
@@ -1665,6 +1728,7 @@ static void halbtc8822b1ant_mimo_ps(struct btc_coexist *btc,
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
btc->btc_set(btc, BTC_SET_MIMO_PS_MODE, &state);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_set_table(struct btc_coexist *btc,
|
||||
@@ -1862,6 +1926,16 @@ void halbtc8822b1ant_table(struct btc_coexist *btc, boolean force_exec, u8 type)
|
||||
0x5a5a5aaa, break_table,
|
||||
select_table);
|
||||
break;
|
||||
case 29:
|
||||
halbtc8822b1ant_set_table(btc, force_exec, 0xdaffdaff,
|
||||
0xdaffdaff, break_table,
|
||||
select_table);
|
||||
break;
|
||||
case 30:
|
||||
halbtc8822b1ant_set_table(btc, force_exec, 0x6a555a5a,
|
||||
0x5a5a5a5a, break_table,
|
||||
select_table);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2055,7 +2129,6 @@ void halbtc8822b1ant_set_tdma(struct btc_coexist *btc, u8 byte1,
|
||||
u8 h2c_parameter[5] = {0};
|
||||
u8 real_byte1 = byte1, real_byte5 = byte5;
|
||||
boolean ap_enable = FALSE, result = FALSE;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
u8 ps_type = BTC_PS_WIFI_NATIVE;
|
||||
|
||||
if (byte5 & BIT(2))
|
||||
@@ -2146,7 +2219,6 @@ halbtc8822b1ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct coex_dm_8822b_1ant *coex_dm = &btc->coex_dm_8822b_1ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
u8 type;
|
||||
|
||||
btc->btc_set_atomic(btc, &coex_dm->setting_tdma, TRUE);
|
||||
@@ -2154,7 +2226,7 @@ halbtc8822b1ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
/* tcase: bit0~7 --> tdma case index
|
||||
* bit8 --> for 4-slot (50ms) mode
|
||||
*/
|
||||
if (tcase & TDMA_4SLOT)/* 4-slot (50ms) mode */
|
||||
if (tcase & TDMA_4SLOT)/* 4-slot (50ms) mode */
|
||||
halbtc8822b1ant_set_tdma_timer_base(btc, 3);
|
||||
else
|
||||
halbtc8822b1ant_set_tdma_timer_base(btc, 0);
|
||||
@@ -2182,7 +2254,12 @@ halbtc8822b1ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
type);
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
halbtc8822b1ant_write_scbd(btc, BT_8822B_1ANT_SCBD_TDMA, TRUE);
|
||||
if (coex_sta->a2dp_exist && coex_sta->bt_inq_page_remain)
|
||||
halbtc8822b1ant_write_scbd(btc, BT_8822B_1ANT_SCBD_TDMA,
|
||||
FALSE);
|
||||
else
|
||||
halbtc8822b1ant_write_scbd(btc, BT_8822B_1ANT_SCBD_TDMA,
|
||||
TRUE);
|
||||
|
||||
/* enable TBTT nterrupt */
|
||||
btc->btc_write_1byte_bitmask(btc, 0x550, 0x8, 0x1);
|
||||
@@ -2277,7 +2354,7 @@ halbtc8822b1ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
0x10);
|
||||
break;
|
||||
case 25:
|
||||
halbtc8822b1ant_set_tdma(btc, 0x51, 0x3a, 0x3, 0x11,
|
||||
halbtc8822b1ant_set_tdma(btc, 0x51, 0x3a, 0x3, 0x10,
|
||||
0x50);
|
||||
break;
|
||||
case 26:
|
||||
@@ -2897,6 +2974,9 @@ static void halbtc8822b1ant_action_bt_whql_test(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 0);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
}
|
||||
@@ -2911,6 +2991,9 @@ static void halbtc8822b1ant_action_bt_relink(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
if (coex_sta->gl_wifi_busy) {
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 3);
|
||||
|
||||
@@ -2934,7 +3017,7 @@ static void halbtc8822b1ant_action_bt_idle(struct btc_coexist *btc)
|
||||
|
||||
wifi_rssi_state =
|
||||
halbtc8822b1ant_wifi_rssi_state(btc, &prewifi_rssi_state, 2,
|
||||
20, 0);
|
||||
32, 0);
|
||||
|
||||
halbtc8822b1ant_set_wl_tx_power(btc, NM_EXCU, 0xd8);
|
||||
halbtc8822b1ant_set_bt_tx_power(btc, NM_EXCU, 0);
|
||||
@@ -2984,6 +3067,9 @@ static void halbtc8822b1ant_action_bt_inquiry(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
|
||||
@@ -3032,17 +3118,35 @@ void halbtc8822b1ant_action_bt_sco_hid_busy(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
boolean wifi_busy = FALSE;
|
||||
boolean wifi_busy = FALSE, is_bt_ctr_hi = FALSE;
|
||||
|
||||
halbtc8822b1ant_set_wl_tx_power(btc, NM_EXCU, 0xd8);
|
||||
halbtc8822b1ant_set_bt_tx_power(btc, NM_EXCU, 0);
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
if (coex_sta->bt_ctr_ok &&
|
||||
(coex_sta->low_priority_rx + coex_sta->low_priority_tx > 360))
|
||||
is_bt_ctr_hi = TRUE;
|
||||
else
|
||||
is_bt_ctr_hi = FALSE;
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
|
||||
if (!wifi_busy)
|
||||
wifi_busy = coex_sta->gl_wifi_busy;
|
||||
#if 0
|
||||
if (coex_sta->cck_lock_ever) {
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_2GFREE;
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G_FREERUN);
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 29);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
if (bt_link_info->sco_exist) {
|
||||
if (coex_sta->is_bt_multi_link) {
|
||||
@@ -3059,9 +3163,8 @@ void halbtc8822b1ant_action_bt_sco_hid_busy(struct btc_coexist *btc)
|
||||
/* for HID exist */
|
||||
if (bt_link_info->hid_only &&
|
||||
(coex_sta->is_bt_multi_link ||
|
||||
(coex_sta->low_priority_rx +
|
||||
coex_sta->low_priority_tx > 360) ||
|
||||
bt_link_info->slave_role)) {
|
||||
is_bt_ctr_hi ||
|
||||
bt_link_info->slave_role)) {
|
||||
if (coex_sta->gl_wifi_busy &&
|
||||
(coex_sta->wl_rx_rate <= 3 ||
|
||||
coex_sta->wl_rts_rx_rate <= 3))
|
||||
@@ -3096,9 +3199,12 @@ static void halbtc8822b1ant_action_bt_acl_busy(struct btc_coexist *btc)
|
||||
boolean wifi_busy = FALSE, wifi_turbo = FALSE, ap_enable = FALSE;
|
||||
static u8 prewifi_rssi_state = BTC_RSSI_STATE_LOW;
|
||||
static u8 prewifi_rssi_state2 = BTC_RSSI_STATE_LOW;
|
||||
u32 wifi_bw = 1;
|
||||
u32 wifi_bw = 1, slot_type = 0;
|
||||
u8 wifi_rssi_state, wifi_rssi_state2, iot_peer = BTC_IOT_PEER_UNKNOWN;
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
btc->btc_get(btc, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
btc->btc_get(btc, BTC_GET_U1_AP_NUM, &coex_sta->scan_ap_num);
|
||||
@@ -3200,20 +3306,25 @@ static void halbtc8822b1ant_action_bt_acl_busy(struct btc_coexist *btc)
|
||||
7 | TDMA_4SLOT);
|
||||
} else if (bt_link_info->hid_exist &&
|
||||
bt_link_info->a2dp_exist) { /* HID + A2DP */
|
||||
|
||||
/*4-slot will not be applied when AP is CISCO*/
|
||||
if (coex_sta->wl_iot_peer != BTC_IOT_PEER_CISCO)
|
||||
slot_type = TDMA_4SLOT;
|
||||
|
||||
halbtc8822b1ant_table(btc, FC_EXCU, 1);
|
||||
|
||||
if (coex_sta->connect_ap_period_cnt > 0 || !wifi_busy) {
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, TRUE,
|
||||
26 | TDMA_4SLOT);
|
||||
26 | slot_type);
|
||||
} else if (coex_sta->bt_418_hid_exist ||
|
||||
coex_sta->bt_ble_hid_exist) {
|
||||
halbtc8822b1ant_wltoggle_table(btc, NM_EXCU, 3,
|
||||
0xaa, 0x5a, 0x5a, 0x5a);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, TRUE,
|
||||
39 | TDMA_4SLOT);
|
||||
39 | slot_type);
|
||||
} else {
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, TRUE,
|
||||
7 | TDMA_4SLOT);
|
||||
7 | slot_type);
|
||||
}
|
||||
/* PAN, HID+PAN */
|
||||
} else if ((bt_link_info->pan_only) ||
|
||||
@@ -3238,28 +3349,11 @@ static void halbtc8822b1ant_action_bt_acl_busy(struct btc_coexist *btc)
|
||||
|
||||
static void halbtc8822b1ant_action_bt_mr(struct btc_coexist *btc)
|
||||
{
|
||||
struct wifi_link_info_8822b_1ant *wifi_link_info_ext =
|
||||
&btc->wifi_link_info_8822b_1ant;
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G_FREERUN);
|
||||
|
||||
if (!wifi_link_info_ext->is_all_under_5g) {
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G_FREERUN);
|
||||
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 8);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
|
||||
/* Enter MIMO Power Save, 0:enable */
|
||||
halbtc8822b1ant_mimo_ps(btc, NM_EXCU, 0);
|
||||
} else {
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_5G);
|
||||
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 0);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
|
||||
/* No MIMO Power Save, 3:disable */
|
||||
halbtc8822b1ant_mimo_ps(btc, NM_EXCU, 3);
|
||||
}
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 8);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_action_rf4ce(struct btc_coexist *btc)
|
||||
@@ -3269,6 +3363,9 @@ static void halbtc8822b1ant_action_rf4ce(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 1);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, TRUE, 50);
|
||||
}
|
||||
@@ -3296,6 +3393,9 @@ static void halbtc8822b1ant_action_wifi_only(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_RF4CE_CONNECTED, &rf4ce_enabled);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
|
||||
|
||||
@@ -3319,7 +3419,6 @@ halbtc8822b1ant_action_wifi_native_lps(struct btc_coexist *btc)
|
||||
{
|
||||
struct wifi_link_info_8822b_1ant *wifi_link_info_ext =
|
||||
&btc->wifi_link_info_8822b_1ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
|
||||
if (wifi_link_info_ext->is_all_under_5g)
|
||||
return;
|
||||
@@ -3329,6 +3428,9 @@ halbtc8822b1ant_action_wifi_native_lps(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 21);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, FALSE, 8);
|
||||
}
|
||||
@@ -3342,8 +3444,11 @@ static void halbtc8822b1ant_action_wifi_linkscan(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
if (bt_link_info->pan_exist) {
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 1);
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 30);
|
||||
halbtc8822b1ant_tdma(btc, NM_EXCU, TRUE, 22);
|
||||
} else if (bt_link_info->a2dp_exist) {
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 1);
|
||||
@@ -3362,6 +3467,9 @@ halbtc8822b1ant_action_wifi_not_connected(struct btc_coexist *btc)
|
||||
halbtc8822b1ant_set_wl_rx_gain(btc, NM_EXCU, FALSE);
|
||||
halbtc8822b1ant_set_bt_rx_gain(btc, NM_EXCU, FALSE);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
/* tdma and coex table */
|
||||
halbtc8822b1ant_table(btc, NM_EXCU, 0);
|
||||
halbtc8822b1ant_tdma(btc, FC_EXCU, FALSE, 8);
|
||||
@@ -3379,7 +3487,8 @@ static void halbtc8822b1ant_action_wifi_connected(struct btc_coexist *btc)
|
||||
|
||||
if (coex_dm->bt_status == BT_8822B_1ANT_BSTATUS_ACL_BUSY ||
|
||||
coex_dm->bt_status == BT_8822B_1ANT_BSTATUS_ACL_SCO_BUSY) {
|
||||
if (bt_link_info->hid_only) /* HID only */
|
||||
if (bt_link_info->hid_only || bt_link_info->sco_exist)
|
||||
/* HID only or SCO*/
|
||||
halbtc8822b1ant_action_bt_sco_hid_busy(btc);
|
||||
else
|
||||
halbtc8822b1ant_action_bt_acl_busy(btc);
|
||||
@@ -3482,7 +3591,6 @@ static void
|
||||
halbtc8822b1ant_action_wifi_multiport2g(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
u32 traffic_dir;
|
||||
u8 ant_pase;
|
||||
|
||||
@@ -3499,8 +3607,7 @@ halbtc8822b1ant_action_wifi_multiport2g(struct btc_coexist *btc)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BT is disabled !!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_only(btc);
|
||||
} else if (coex_sta->is_setup_link ||
|
||||
coex_sta->bt_relink_downcount != 0) {
|
||||
@@ -3543,8 +3650,6 @@ halbtc8822b1ant_action_wifi_multiport2g(struct btc_coexist *btc)
|
||||
"[BTCoex], wifi_multiport2g, WL scan!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
halbtc8822b1ant_action_wifi_linkscan(btc);
|
||||
} else {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -3590,29 +3695,6 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct wifi_link_info_8822b_1ant *wifi_link_info_ext =
|
||||
&btc->wifi_link_info_8822b_1ant;
|
||||
boolean wifi_connected = FALSE, wifi_32k = false;
|
||||
boolean scan = FALSE, link = FALSE, roam = FALSE, under_4way = FALSE;
|
||||
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_SCAN, &scan);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_LINK, &link);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_ROAM, &roam);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &under_4way);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_LW_PWR_STATE, &wifi_32k);
|
||||
|
||||
if (scan || link || roam || under_4way ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSCANSTART ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSWITCHBAND ||
|
||||
reason == BT_8822B_1ANT_RSN_2GCONSTART ||
|
||||
reason == BT_8822B_1ANT_RSN_2GSPECIALPKT) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], scan = %d, link = %d, roam = %d 4way = %d!!!\n",
|
||||
scan, link, roam, under_4way);
|
||||
BTC_TRACE(trace_buf);
|
||||
coex_sta->is_wifi_linkscan_process = TRUE;
|
||||
} else {
|
||||
coex_sta->is_wifi_linkscan_process = FALSE;
|
||||
}
|
||||
|
||||
/* update wifi_link_info_ext variable */
|
||||
halbtc8822b1ant_update_wifi_link_info(btc, reason);
|
||||
@@ -3645,7 +3727,7 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
return;
|
||||
}
|
||||
|
||||
if (coex_sta->under_lps && wifi_32k) {
|
||||
if (coex_sta->under_lps && wifi_link_info_ext->is_32k) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], RunCoexistMechanism(), return for wifi is under LPS-32K !!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
@@ -3666,21 +3748,8 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
return;
|
||||
}
|
||||
|
||||
if (coex_sta->msft_mr_exist && wifi_connected) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], RunCoexistMechanism(), microsoft MR!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_BTMR;
|
||||
halbtc8822b1ant_action_bt_mr(btc);
|
||||
return;
|
||||
}
|
||||
|
||||
coex_sta->coex_run_cnt++;
|
||||
|
||||
/* No MIMO Power Save, 3:disable */
|
||||
halbtc8822b1ant_mimo_ps(btc, NM_EXCU, 3);
|
||||
|
||||
/* Pure-5G Coex Process */
|
||||
if (wifi_link_info_ext->is_all_under_5g) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -3689,10 +3758,20 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_5G;
|
||||
halbtc8822b1ant_action_wifi_under5g(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (wifi_link_info_ext->is_mcc_25g) { /* not iclude scan action */
|
||||
if (coex_sta->msft_mr_exist && wifi_link_info_ext->is_connected) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], RunCoexistMechanism(), microsoft MR!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_BTMR;
|
||||
halbtc8822b1ant_action_bt_mr(btc);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (wifi_link_info_ext->is_mcc_25g) { /* not include scan action */
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], WiFi is under mcc dual-band!!!\n");
|
||||
@@ -3700,7 +3779,7 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_25GMPORT;
|
||||
halbtc8822b1ant_action_wifi_multiport25g(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* if multi-port or P2PGO+Client_Join */
|
||||
@@ -3721,7 +3800,7 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
coex_sta->wl_coex_mode = BT_8822B_1ANT_WLINK_2GMPORT;
|
||||
|
||||
halbtc8822b1ant_action_wifi_multiport2g(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -3742,50 +3821,45 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BT is disabled !!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_only(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (coex_sta->under_lps && !coex_sta->force_lps_ctrl) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], RunCoexistMechanism(), wifi is under LPS !!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_native_lps(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (coex_sta->bt_whck_test) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BT is under WHCK TEST!!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_bt_whql_test(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (coex_sta->is_setup_link || coex_sta->bt_relink_downcount != 0) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BT is re-link !!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_bt_relink(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (coex_sta->c2h_bt_inquiry_page) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BT is under inquiry/page !!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_bt_inquiry(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((coex_dm->bt_status == BT_8822B_1ANT_BSTATUS_NCON_IDLE ||
|
||||
@@ -3795,34 +3869,41 @@ static void halbtc8822b1ant_run_coex(struct btc_coexist *btc, u8 reason)
|
||||
"############# [BTCoex], BT Is idle\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_action_bt_idle(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (coex_sta->is_wifi_linkscan_process) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi is under linkscan process!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_linkscan(btc);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (wifi_connected) {
|
||||
if (wifi_link_info_ext->is_connected) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi is under connected!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_connected(btc);
|
||||
goto exit;
|
||||
} else {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi is under not-connected!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b1ant_set_ant_path(btc, BTC_ANT_PATH_AUTO, NM_EXCU,
|
||||
BT_8822B_1ANT_PHASE_2G);
|
||||
|
||||
halbtc8822b1ant_action_wifi_not_connected(btc);
|
||||
goto exit;
|
||||
}
|
||||
exit:
|
||||
|
||||
/*MIMO Power Save-> 0:enable 3:disable*/
|
||||
if (coex_sta->wl_coex_mode == BT_8822B_1ANT_WLINK_BTMR ||
|
||||
coex_sta->wl_coex_mode == BT_8822B_1ANT_WLINK_2GFREE)
|
||||
halbtc8822b1ant_mimo_ps(btc, NM_EXCU, 1);
|
||||
else
|
||||
halbtc8822b1ant_mimo_ps(btc, NM_EXCU, 0);
|
||||
}
|
||||
|
||||
static void halbtc8822b1ant_init_coex_var(struct btc_coexist *btc)
|
||||
@@ -4447,12 +4528,13 @@ void ex_halbtc8822b1ant_display_coex_info(struct btc_coexist *btc)
|
||||
|
||||
ps_tdma_case = coex_dm->cur_ps_tdma;
|
||||
CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE,
|
||||
"\r\n %-35s = %02x %02x %02x %02x %02x (case-%d, %s)",
|
||||
"\r\n %-35s = %02x %02x %02x %02x %02x (case-%d, %s, Timer:%d)",
|
||||
"TDMA",
|
||||
coex_dm->ps_tdma_para[0], coex_dm->ps_tdma_para[1],
|
||||
coex_dm->ps_tdma_para[2], coex_dm->ps_tdma_para[3],
|
||||
coex_dm->ps_tdma_para[4], ps_tdma_case,
|
||||
(coex_dm->cur_ps_tdma_on ? "TDMA-On" : "TDMA-Off"));
|
||||
(coex_dm->cur_ps_tdma_on ? "On" : "Off"),
|
||||
coex_sta->tdma_timer_base);
|
||||
CL_PRINTF(cli_buf);
|
||||
|
||||
switch (coex_sta->wl_coex_mode) {
|
||||
@@ -5001,6 +5083,7 @@ void ex_halbtc8822b1ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
struct coex_dm_8822b_1ant *coex_dm = &btc->coex_dm_8822b_1ant;
|
||||
boolean wifi_under_b_mode = FALSE;
|
||||
u8 h2c_parameter[2] = {0};
|
||||
|
||||
if (btc->manual_control || btc->stop_coex_dm)
|
||||
return;
|
||||
@@ -5039,6 +5122,12 @@ void ex_halbtc8822b1ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
else
|
||||
btc->btc_write_1byte_bitmask(btc, 0x6cf, BIT(4), 0x1);
|
||||
|
||||
/*Leak-AP protection will reopen when connecting AP*/
|
||||
h2c_parameter[0] = 0xc;
|
||||
h2c_parameter[1] = 0x0;
|
||||
btc->btc_fill_h2c(btc, 0x69, 2, h2c_parameter);
|
||||
coex_sta->is_no_wl_5ms_extend = FALSE;
|
||||
|
||||
halbtc8822b1ant_run_coex(btc, BT_8822B_1ANT_RSN_2GMEDIA);
|
||||
} else {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -5054,7 +5143,7 @@ void ex_halbtc8822b1ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
|
||||
halbtc8822b1ant_run_coex(btc, BT_8822B_1ANT_RSN_MEDIADISCON);
|
||||
}
|
||||
|
||||
btc->btc_get(btc, BTC_GET_U1_IOT_PEER, &coex_sta->wl_iot_peer);
|
||||
halbtc8822b1ant_update_wifi_ch_info(btc, type);
|
||||
}
|
||||
|
||||
@@ -5218,6 +5307,14 @@ void ex_halbtc8822b1ant_bt_info_notify(struct btc_coexist *btc, u8 *tmp_buf,
|
||||
coex_sta->c2h_bt_inquiry_page =
|
||||
((coex_sta->bt_info_lb2 & BIT(2)) ? TRUE : FALSE);
|
||||
|
||||
if (coex_sta->bt_inq_page_pre != coex_sta->c2h_bt_inquiry_page) {
|
||||
coex_sta->bt_inq_page_pre = coex_sta->c2h_bt_inquiry_page;
|
||||
coex_sta->bt_inq_page_remain = TRUE;
|
||||
|
||||
if (!coex_sta->c2h_bt_inquiry_page)
|
||||
coex_sta->bt_inq_page_downcount = 2;
|
||||
}
|
||||
|
||||
if ((coex_sta->bt_info_lb2 & 0x49) == 0x49)
|
||||
coex_sta->a2dp_bit_pool = (coex_sta->bt_info_hb3 & 0x7f);
|
||||
else
|
||||
@@ -5241,6 +5338,7 @@ void ex_halbtc8822b1ant_bt_info_notify(struct btc_coexist *btc, u8 *tmp_buf,
|
||||
if (coex_sta->hid_pair_cnt > 0 && coex_sta->hid_busy_num >= 2) {
|
||||
coex_sta->bt_418_hid_exist = TRUE;
|
||||
} else if (coex_sta->hid_busy_num == 1 &&
|
||||
coex_sta->bt_ctr_ok &&
|
||||
(coex_sta->high_priority_rx + 100 <
|
||||
coex_sta->high_priority_tx) &&
|
||||
coex_sta->high_priority_rx < 100) {
|
||||
@@ -5548,7 +5646,8 @@ void ex_halbtc8822b1ant_coex_dm_reset(struct btc_coexist *btc)
|
||||
void ex_halbtc8822b1ant_periodical(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_1ant *coex_sta = &btc->coex_sta_8822b_1ant;
|
||||
boolean bt_relink_finish = FALSE, is_defreeze = FALSE;
|
||||
boolean bt_relink_finish = FALSE, is_defreeze = FALSE,
|
||||
bt_ctr_change = FALSE;
|
||||
static u8 freeze_cnt;
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -5558,7 +5657,7 @@ void ex_halbtc8822b1ant_periodical(struct btc_coexist *btc)
|
||||
if (!btc->auto_report)
|
||||
halbtc8822b1ant_query_bt_info(btc);
|
||||
|
||||
halbtc8822b1ant_monitor_bt_ctr(btc);
|
||||
bt_ctr_change = halbtc8822b1ant_monitor_bt_ctr(btc);
|
||||
halbtc8822b1ant_monitor_wifi_ctr(btc);
|
||||
halbtc8822b1ant_update_wifi_link_info(btc,
|
||||
BT_8822B_1ANT_RSN_PERIODICAL);
|
||||
@@ -5572,6 +5671,12 @@ void ex_halbtc8822b1ant_periodical(struct btc_coexist *btc)
|
||||
}
|
||||
}
|
||||
|
||||
if (coex_sta->bt_inq_page_downcount != 0) {
|
||||
coex_sta->bt_inq_page_downcount--;
|
||||
if (coex_sta->bt_relink_downcount == 0)
|
||||
coex_sta->bt_inq_page_remain = FALSE;
|
||||
}
|
||||
|
||||
if (coex_sta->freeze_coexrun_by_btinfo) {
|
||||
freeze_cnt++;
|
||||
|
||||
@@ -5621,7 +5726,7 @@ void ex_halbtc8822b1ant_periodical(struct btc_coexist *btc)
|
||||
}
|
||||
|
||||
if (halbtc8822b1ant_moniter_wifibt_status(btc) || bt_relink_finish ||
|
||||
coex_sta->is_set_ps_state_fail || is_defreeze)
|
||||
coex_sta->is_set_ps_state_fail || is_defreeze || bt_ctr_change)
|
||||
halbtc8822b1ant_run_coex(btc, BT_8822B_1ANT_RSN_PERIODICAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ enum bt_8822b_1ant_WL_LINK_MODE {
|
||||
BT_8822B_1ANT_WLINK_2GGO = 0x4,
|
||||
BT_8822B_1ANT_WLINK_2GGC = 0x5,
|
||||
BT_8822B_1ANT_WLINK_BTMR = 0x6,
|
||||
BT_8822B_1ANT_WLINK_2GFREE = 0x7,
|
||||
BT_8822B_1ANT_WLINK_MAX
|
||||
};
|
||||
|
||||
@@ -266,6 +267,7 @@ struct coex_sta_8822b_1ant {
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
boolean bt_ctr_ok;
|
||||
boolean is_hi_pri_rx_overhead;
|
||||
s8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
@@ -274,6 +276,8 @@ struct coex_sta_8822b_1ant {
|
||||
u32 bt_info_c2h_cnt[BT_8822B_1ANT_INFO_SRC_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean bt_inq_page_pre;
|
||||
boolean bt_inq_page_remain;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_high_pri_task1;
|
||||
@@ -351,6 +355,7 @@ struct coex_sta_8822b_1ant {
|
||||
u32 gnt_error_cnt;
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
u8 bt_inq_page_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
|
||||
u8 switch_band_notify_to;
|
||||
@@ -406,6 +411,7 @@ struct coex_sta_8822b_1ant {
|
||||
u8 tdma_timer_base;
|
||||
boolean wl_slot_toggle;
|
||||
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
|
||||
u8 wl_iot_peer;
|
||||
};
|
||||
|
||||
struct rfe_type_8822b_1ant {
|
||||
@@ -423,6 +429,7 @@ struct wifi_link_info_8822b_1ant {
|
||||
boolean is_mcc_25g;
|
||||
boolean is_p2p_connected;
|
||||
boolean is_connected;
|
||||
boolean is_32k;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
|
||||
@@ -28,9 +28,9 @@ static const char *const glbt_info_src_8822b_2ant[] = {
|
||||
"BT Info[bt scbd]"
|
||||
};
|
||||
|
||||
u32 glcoex_ver_date_8822b_2ant = 20191120;
|
||||
u32 glcoex_ver_8822b_2ant = 0x77;
|
||||
u32 glcoex_ver_btdesired_8822b_2ant = 0x75;
|
||||
u32 glcoex_ver_date_8822b_2ant = 20200302;
|
||||
u32 glcoex_ver_8822b_2ant = 0x7b;
|
||||
u32 glcoex_ver_btdesired_8822b_2ant = 0x79;
|
||||
|
||||
static u8 halbtc8822b2ant_bt_rssi_state(struct btc_coexist *btc,
|
||||
u8 *ppre_bt_rssi_state, u8 level_num,
|
||||
@@ -264,25 +264,22 @@ halbtc8822b2ant_ccklock_action(struct btc_coexist *btc)
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
u8 h2c_parameter[2] = {0};
|
||||
static u8 cnt;
|
||||
boolean wifi_busy = FALSE;
|
||||
|
||||
if (coex_sta->tdma_timer_base == 3) {
|
||||
if (!coex_sta->is_no_wl_5ms_extend) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], set h2c 0x69 opcode 12 to turn off 5ms WL slot extend!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
btc->btc_get(btc, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
|
||||
|
||||
h2c_parameter[0] = 0xc;
|
||||
h2c_parameter[1] = 0x1;
|
||||
btc->btc_fill_h2c(btc, 0x69, 2, h2c_parameter);
|
||||
coex_sta->is_no_wl_5ms_extend = TRUE;
|
||||
cnt = 0;
|
||||
}
|
||||
if (!coex_sta->gl_wifi_busy ||
|
||||
coex_sta->wl_iot_peer == BTC_IOT_PEER_CISCO) {
|
||||
cnt = 0;
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], wifi is not busy or CISCO AP, return!!\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!coex_sta->is_no_wl_5ms_extend && coex_sta->force_lps_ctrl &&
|
||||
!coex_sta->cck_lock_ever) {
|
||||
if (coex_sta->wl_fw_dbg_info[7] <= 5)
|
||||
if (coex_sta->wl_fw_dbg_info[7] <= 5 && wifi_busy)
|
||||
cnt++;
|
||||
else
|
||||
cnt = 0;
|
||||
@@ -319,14 +316,13 @@ halbtc8822b2ant_ccklock_detect(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
struct coex_dm_8822b_2ant *coex_dm = &btc->coex_dm_8822b_2ant;
|
||||
struct btc_wifi_link_info_ext *link_info_ext = &btc->wifi_link_info_ext;
|
||||
struct wifi_link_info_8822b_2ant *link_info_ext =
|
||||
&btc->wifi_link_info_8822b_2ant;
|
||||
boolean is_cck_lock_rate = FALSE;
|
||||
|
||||
if (coex_dm->bt_status == BTC_BTSTATUS_INQ_PAGE ||
|
||||
coex_sta->is_setup_link) {
|
||||
coex_sta->cck_lock = FALSE;
|
||||
return;
|
||||
}
|
||||
coex_sta->is_setup_link)
|
||||
return;
|
||||
|
||||
if (coex_sta->wl_rx_rate <= BTC_CCK_2 ||
|
||||
coex_sta->wl_rts_rx_rate <= BTC_CCK_2)
|
||||
@@ -408,10 +404,6 @@ halbtc8822b2ant_set_tdma_timer_base(struct btc_coexist *btc, u8 type)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], %s() h2c_0x69 = 0x%x\n", __func__, h2c_para[1]);
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
/* no 5ms_wl_slot_extend for 4-slot mode */
|
||||
if (coex_sta->tdma_timer_base == 3)
|
||||
halbtc8822b2ant_ccklock_action(btc);
|
||||
}
|
||||
|
||||
static void halbtc8822b2ant_coex_switch_thres(struct btc_coexist *btc,
|
||||
@@ -615,14 +607,14 @@ static void halbtc8822b2ant_enable_gnt_to_gpio(struct btc_coexist *btc,
|
||||
}
|
||||
}
|
||||
|
||||
static void halbtc8822b2ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
static boolean halbtc8822b2ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
u32 reg_hp_txrx, reg_lp_txrx, u32tmp;
|
||||
struct coex_dm_8822b_2ant *coex_dm = &btc->coex_dm_8822b_2ant;
|
||||
u32 reg_hp_txrx, reg_lp_txrx, u32tmp, cnt_bt_all;
|
||||
u32 reg_hp_tx = 0, reg_hp_rx = 0, reg_lp_tx = 0, reg_lp_rx = 0;
|
||||
static u8 num_of_bt_counter_chk, cnt_autoslot_hang;
|
||||
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
static u32 cnt_bt_pre = 0;
|
||||
boolean is_run_coex = FALSE;
|
||||
|
||||
reg_hp_txrx = 0x770;
|
||||
reg_lp_txrx = 0x774;
|
||||
@@ -640,9 +632,21 @@ static void halbtc8822b2ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
coex_sta->low_priority_tx = reg_lp_tx;
|
||||
coex_sta->low_priority_rx = reg_lp_rx;
|
||||
|
||||
if (coex_sta->under_lps || coex_sta->under_ips ||
|
||||
(coex_sta->high_priority_tx == 65535 &&
|
||||
coex_sta->high_priority_rx == 65535 &&
|
||||
coex_sta->low_priority_tx == 65535 &&
|
||||
coex_sta->low_priority_rx == 65535))
|
||||
coex_sta->bt_ctr_ok = FALSE;
|
||||
else
|
||||
coex_sta->bt_ctr_ok = TRUE;
|
||||
|
||||
/* reset counter */
|
||||
btc->btc_write_1byte(btc, 0x76e, 0xc);
|
||||
|
||||
if (!coex_sta->bt_ctr_ok)
|
||||
return FALSE;
|
||||
|
||||
if (coex_sta->low_priority_tx > 1050 &&
|
||||
!coex_sta->c2h_bt_inquiry_page)
|
||||
coex_sta->pop_event_cnt++;
|
||||
@@ -654,6 +658,20 @@ static void halbtc8822b2ant_monitor_bt_ctr(struct btc_coexist *btc)
|
||||
else
|
||||
coex_sta->is_esco_mode = TRUE;
|
||||
}
|
||||
|
||||
cnt_bt_all = coex_sta->high_priority_tx +
|
||||
coex_sta->high_priority_rx +
|
||||
coex_sta->low_priority_tx +
|
||||
coex_sta->low_priority_rx;
|
||||
|
||||
if ((cnt_bt_pre > (cnt_bt_all + 50) ||
|
||||
cnt_bt_all > (cnt_bt_pre + 50)) &&
|
||||
coex_dm->bt_status == BT_8822B_2ANT_BSTATUS_NCON_IDLE)
|
||||
is_run_coex = TRUE;
|
||||
|
||||
cnt_bt_pre = cnt_bt_all;
|
||||
|
||||
return is_run_coex;
|
||||
}
|
||||
|
||||
static void halbtc8822b2ant_monitor_wifi_ctr(struct btc_coexist *btc)
|
||||
@@ -666,7 +684,6 @@ static void halbtc8822b2ant_monitor_wifi_ctr(struct btc_coexist *btc)
|
||||
u32 cnt_cck;
|
||||
static u8 cnt_ccklocking;
|
||||
u8 h2c_parameter[1] = {0};
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
|
||||
#if 0
|
||||
/*send h2c to query WL FW dbg info */
|
||||
@@ -1464,11 +1481,16 @@ halbtc8822b2ant_update_wifi_ch_info(struct btc_coexist *btc, u8 type)
|
||||
}
|
||||
}
|
||||
|
||||
coex_dm->wifi_chnl_info[0] = h2c_parameter[0];
|
||||
coex_dm->wifi_chnl_info[1] = h2c_parameter[1];
|
||||
coex_dm->wifi_chnl_info[2] = h2c_parameter[2];
|
||||
/* Only send mailbox if ch info change */
|
||||
if (coex_dm->wifi_chnl_info[0] != h2c_parameter[0] &&
|
||||
coex_dm->wifi_chnl_info[1] != h2c_parameter[1] &&
|
||||
coex_dm->wifi_chnl_info[2] != h2c_parameter[2]) {
|
||||
|
||||
btc->btc_fill_h2c(btc, 0x66, 3, h2c_parameter);
|
||||
coex_dm->wifi_chnl_info[0] = h2c_parameter[0];
|
||||
coex_dm->wifi_chnl_info[1] = h2c_parameter[1];
|
||||
coex_dm->wifi_chnl_info[2] = h2c_parameter[2];
|
||||
btc->btc_fill_h2c(btc, 0x66, 3, h2c_parameter);
|
||||
}
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], para[0:2] = 0x%x 0x%x 0x%x\n", h2c_parameter[0],
|
||||
@@ -1584,12 +1606,13 @@ static void halbtc8822b2ant_set_wl_rx_gain(struct btc_coexist *btc,
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rx_gain_value_en); i++)
|
||||
btc->btc_write_4byte(btc, 0x81c, rx_gain_value_en[i]);
|
||||
|
||||
#if 0
|
||||
/* set Rx filter corner RCK offset */
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_A, 0xde, 0x2, 0x1);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_A, 0x1d, 0x3f, 0x3f);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_B, 0xde, 0x2, 0x1);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_B, 0x1d, 0x3f, 0x3f);
|
||||
#endif
|
||||
} else {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], BB Agc Table Off!\n");
|
||||
@@ -1597,12 +1620,13 @@ static void halbtc8822b2ant_set_wl_rx_gain(struct btc_coexist *btc,
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rx_gain_value_dis); i++)
|
||||
btc->btc_write_4byte(btc, 0x81c, rx_gain_value_dis[i]);
|
||||
|
||||
#if 0
|
||||
/* set Rx filter corner RCK offset */
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_A, 0x1d, 0x3f, 0x4);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_A, 0xde, 0x2, 0x0);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_B, 0x1d, 0x3f, 0x4);
|
||||
btc->btc_set_rf_reg(btc, BTC_RF_B, 0xde, 0x2, 0x0);
|
||||
#endif
|
||||
}
|
||||
|
||||
coex_dm->cur_agc_table_en = agc_table_en;
|
||||
@@ -1616,6 +1640,87 @@ static void halbtc8822b2ant_set_bt_rx_gain(struct btc_coexist *btc,
|
||||
halbtc8822b2ant_write_scbd(btc, BT_8822B_2ANT_SCBD_RXGAIN, rx_gain_en);
|
||||
}
|
||||
|
||||
static void
|
||||
halbtc8822b2ant_set_rf_para(struct btc_coexist *btc, boolean force_exec,
|
||||
u8 level)
|
||||
{
|
||||
struct btc_coex_sta *coex_sta = &btc->coex_sta;
|
||||
u8 tmp = 0;
|
||||
u32 traffic_dir;
|
||||
struct btc_rf_para rf_para;
|
||||
/* wl_tx_dec_power, bt_tx_dec_power, wl_rx_gain, bt_rx_lna_constrain */
|
||||
struct btc_rf_para rf_para_tx_8822b[] = {
|
||||
{0xc8, 0x00, FALSE, 1}, /* for normal */
|
||||
{0xc8, 0x00, FALSE, 1}, /* for WL-CPT */
|
||||
{0xc8, 0x00, TRUE, 1}, /* 2 for RCU SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 6 for RCU OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 10 for A2DP SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 14 for A2DP OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 18 for A2DP+RCU SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 22 for A2DP+RCU OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1} };
|
||||
|
||||
struct btc_rf_para rf_para_rx_8822b[] = {
|
||||
{0xc8, 0x00, FALSE, 1}, /* for normal */
|
||||
{0xc8, 0x00, FALSE, 1}, /* for WL-CPT */
|
||||
{0xc8, 0x00, TRUE, 1}, /* 2 for RCU SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 6 for RCU OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 10 for A2DP SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 14 for A2DP OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 18 for A2DP+RCU SDR */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1},
|
||||
{0xc8, 0x00, TRUE, 1}, /* 22 for A2DP+RCU OFC */
|
||||
{0xcc, 0xfa, TRUE, 1},
|
||||
{0xd0, 0xf7, TRUE, 1},
|
||||
{0xd4, 0xf3, TRUE, 1} };
|
||||
|
||||
btc->btc_get(btc, BTC_GET_U4_WIFI_TRAFFIC_DIR, &traffic_dir);
|
||||
|
||||
if (level > ARRAY_SIZE(rf_para_tx_8822b))
|
||||
level = ARRAY_SIZE(rf_para_tx_8822b) - 1;
|
||||
|
||||
if (traffic_dir == BTC_WIFI_TRAFFIC_TX)
|
||||
rf_para = rf_para_tx_8822b[level];
|
||||
else
|
||||
rf_para = rf_para_rx_8822b[level];
|
||||
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, rf_para.wl_pwr_dec_lvl);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, FC_EXCU, rf_para.bt_pwr_dec_lvl);
|
||||
halbtc8822b2ant_set_wl_rx_gain(btc, NM_EXCU, rf_para.wl_low_gain_en);
|
||||
halbtc8822b2ant_set_bt_rx_gain(btc, FC_EXCU, rf_para.bt_lna_lvl);
|
||||
}
|
||||
|
||||
static u32
|
||||
halbtc8822b2ant_wait_indirect_reg_ready(struct btc_coexist *btc)
|
||||
{
|
||||
@@ -2077,7 +2182,6 @@ static void halbtc8822b2ant_set_tdma(struct btc_coexist *btc, u8 byte1,
|
||||
u8 h2c_parameter[5] = {0};
|
||||
u8 real_byte1 = byte1, real_byte5 = byte5;
|
||||
boolean ap_enable = FALSE, result = FALSE;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
u8 ps_type = BTC_PS_WIFI_NATIVE;
|
||||
|
||||
if (byte5 & BIT(2))
|
||||
@@ -2168,7 +2272,6 @@ halbtc8822b2ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
struct coex_dm_8822b_2ant *coex_dm = &btc->coex_dm_8822b_2ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
u8 type;
|
||||
|
||||
btc->btc_set_atomic(btc, &coex_dm->setting_tdma, TRUE);
|
||||
@@ -2176,12 +2279,12 @@ halbtc8822b2ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
/* tcase: bit0~7 --> tdma case index
|
||||
* bit8 --> for 4-slot (50ms) mode
|
||||
*/
|
||||
if (tcase & TDMA_4SLOT)/* 4-slot (50ms) mode */
|
||||
if (tcase & TDMA_4SLOT)/* 4-slot (50ms) mode */
|
||||
halbtc8822b2ant_set_tdma_timer_base(btc, 3);
|
||||
else
|
||||
halbtc8822b2ant_set_tdma_timer_base(btc, 0);
|
||||
|
||||
type = tcase & 0xff;
|
||||
type = (u8)(tcase & 0xff);
|
||||
|
||||
/* To avoid TDMA H2C fail before Last LPS enter */
|
||||
if (!force_exec && coex_sta->coex_run_reason != BTC_RSN_LPS) {
|
||||
@@ -2204,7 +2307,12 @@ halbtc8822b2ant_tdma(struct btc_coexist *btc, boolean force_exec,
|
||||
type);
|
||||
BTC_TRACE(trace_buf);
|
||||
|
||||
halbtc8822b2ant_write_scbd(btc, BT_8822B_2ANT_SCBD_TDMA, TRUE);
|
||||
if (coex_sta->a2dp_exist && coex_sta->bt_inq_page_remain)
|
||||
halbtc8822b2ant_write_scbd(btc, BT_8822B_2ANT_SCBD_TDMA,
|
||||
FALSE);
|
||||
else
|
||||
halbtc8822b2ant_write_scbd(btc, BT_8822B_2ANT_SCBD_TDMA,
|
||||
TRUE);
|
||||
|
||||
/* enable TBTT nterrupt */
|
||||
btc->btc_write_1byte_bitmask(btc, 0x550, 0x8, 0x1);
|
||||
@@ -2841,13 +2949,15 @@ static u8 halbtc8822b2ant_action_algorithm(struct btc_coexist *btc)
|
||||
static void halbtc8822b2ant_action_freerun(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
static u8 pre_wifi_rssi_state1 = BTC_RSSI_STATE_LOW,
|
||||
pre_wifi_rssi_state2 = BTC_RSSI_STATE_LOW,
|
||||
pre_wifi_rssi_state3 = BTC_RSSI_STATE_LOW;
|
||||
u8 wifi_rssi_state1, wifi_rssi_state2, wifi_rssi_state3;
|
||||
static u8 pre_bt_rssi_state = BTC_RSSI_STATE_LOW;
|
||||
u8 bt_rssi_state, lna_lvl = 1;
|
||||
u8 bt_tx_offset = 0;
|
||||
u8 bt_tx_offset = 0, level, base = 0;
|
||||
u32 ap_cnt;
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], ************* freerunXXXX*************\n");
|
||||
@@ -2882,34 +2992,35 @@ static void halbtc8822b2ant_action_freerun(struct btc_coexist *btc)
|
||||
|
||||
halbtc8822b2ant_write_scbd(btc, BT_8822B_2ANT_SCBD_CQDDR, TRUE);
|
||||
|
||||
if (coex_sta->wl_noisy_level == 0)
|
||||
bt_tx_offset = 3;
|
||||
|
||||
/* keep WL/BT Tx/Rx for non 2G-1port case */
|
||||
if (coex_sta->wl_coex_mode != BT_8822B_2ANT_WLINK_2G1PORT)
|
||||
return;
|
||||
|
||||
/*avoid tdma off to write 0xc5b ,0xe5b */
|
||||
halbtc8822b2ant_set_bt_rx_gain(btc, FC_EXCU, TRUE);
|
||||
halbtc8822b2ant_set_wl_rx_gain(btc, NM_EXCU, TRUE);
|
||||
ap_cnt = coex_sta->scan_ap_num;
|
||||
|
||||
if (bt_link_info->hid_only)
|
||||
base = 2;
|
||||
else if (bt_link_info->a2dp_only)
|
||||
base = 10;
|
||||
else if (bt_link_info->hid_exist && bt_link_info->a2dp_exist)
|
||||
base = 18;
|
||||
|
||||
if (BTC_RSSI_HIGH(wifi_rssi_state1)) {
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, 0xc8);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, FC_EXCU,
|
||||
0x0 - bt_tx_offset);
|
||||
} else if (BTC_RSSI_HIGH(wifi_rssi_state2)) {
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, 0xcc);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, FC_EXCU,
|
||||
0xfa - bt_tx_offset);
|
||||
} else if (BTC_RSSI_HIGH(wifi_rssi_state3)) {
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, 0xd0);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, FC_EXCU, 0xf7
|
||||
- bt_tx_offset);
|
||||
} else {
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, 0xd4);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, FC_EXCU, 0xf3);
|
||||
}
|
||||
if (ap_cnt > 10) /* for office case */
|
||||
base = base + 4;
|
||||
|
||||
/* decrease more BT Tx power for clear case */
|
||||
if (BTC_RSSI_HIGH(wifi_rssi_state1))
|
||||
level = 0;
|
||||
else if (BTC_RSSI_HIGH(wifi_rssi_state2))
|
||||
level = 1;
|
||||
else if (BTC_RSSI_HIGH(wifi_rssi_state3))
|
||||
level = 2;
|
||||
else
|
||||
level = 3;
|
||||
|
||||
level = level + base;
|
||||
|
||||
halbtc8822b2ant_set_rf_para(btc, NM_EXCU, level);
|
||||
}
|
||||
|
||||
static void halbtc8822b2ant_action_coex_all_off(struct btc_coexist *btc)
|
||||
@@ -2943,7 +3054,6 @@ static void halbtc8822b2ant_action_bt_whql_test(struct btc_coexist *btc)
|
||||
static void halbtc8822b2ant_action_bt_relink(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
|
||||
halbtc8822b2ant_set_wl_tx_power(btc, NM_EXCU, 0xd8);
|
||||
halbtc8822b2ant_set_bt_tx_power(btc, NM_EXCU, 0);
|
||||
@@ -3354,7 +3464,6 @@ halbtc8822b2ant_action_wifi_native_lps(struct btc_coexist *btc)
|
||||
{
|
||||
struct wifi_link_info_8822b_2ant *wifi_link_info_ext =
|
||||
&btc->wifi_link_info_8822b_2ant;
|
||||
struct btc_bt_link_info *bt_link_info = &btc->bt_link_info;
|
||||
|
||||
if (wifi_link_info_ext->is_all_under_5g)
|
||||
return;
|
||||
@@ -3430,7 +3539,14 @@ static void halbtc8822b2ant_action_wifi_connected(struct btc_coexist *btc)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], Action 2-Ant, algorithm = HID.\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b2ant_action_hid(btc);
|
||||
if (halbtc8822b2ant_freerun_check(btc)) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], Action 2-Ant, algorithm = HID -> Freerun\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b2ant_action_freerun(btc);
|
||||
} else {
|
||||
halbtc8822b2ant_action_hid(btc);
|
||||
}
|
||||
break;
|
||||
case BT_8822B_2ANT_COEX_A2DP:
|
||||
if (halbtc8822b2ant_freerun_check(btc)) {
|
||||
@@ -3484,7 +3600,14 @@ static void halbtc8822b2ant_action_wifi_connected(struct btc_coexist *btc)
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b2ant_action_hid_a2dp(btc);
|
||||
if (halbtc8822b2ant_freerun_check(btc)) {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
"[BTCoex], Action 2-Ant, algorithm = HID -> Freerun\n");
|
||||
BTC_TRACE(trace_buf);
|
||||
halbtc8822b2ant_action_freerun(btc);
|
||||
} else {
|
||||
halbtc8822b2ant_action_hid_a2dp(btc);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -4470,12 +4593,13 @@ void ex_halbtc8822b2ant_display_coex_info(struct btc_coexist *btc)
|
||||
|
||||
ps_tdma_case = coex_dm->cur_ps_tdma;
|
||||
CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE,
|
||||
"\r\n %-35s = %02x %02x %02x %02x %02x (case-%d, %s)",
|
||||
"\r\n %-35s = %02x %02x %02x %02x %02x (case-%d, %s, Timer:%d)",
|
||||
"TDMA",
|
||||
coex_dm->ps_tdma_para[0], coex_dm->ps_tdma_para[1],
|
||||
coex_dm->ps_tdma_para[2], coex_dm->ps_tdma_para[3],
|
||||
coex_dm->ps_tdma_para[4], ps_tdma_case,
|
||||
(coex_dm->cur_ps_tdma_on ? "TDMA-On" : "TDMA-Off"));
|
||||
(coex_dm->cur_ps_tdma_on ? "On" : "Off"),
|
||||
coex_sta->tdma_timer_base);
|
||||
CL_PRINTF(cli_buf);
|
||||
|
||||
switch (coex_sta->wl_coex_mode) {
|
||||
@@ -4981,6 +5105,7 @@ void ex_halbtc8822b2ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
boolean wifi_under_b_mode = FALSE;
|
||||
u8 h2c_parameter[2] = {0};
|
||||
|
||||
if (btc->manual_control || btc->stop_coex_dm)
|
||||
return;
|
||||
@@ -5016,6 +5141,12 @@ void ex_halbtc8822b2ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
else
|
||||
btc->btc_write_1byte_bitmask(btc, 0x6cf, BIT(4), 0x1);
|
||||
|
||||
/*Leak-AP protection will reopen when connecting AP*/
|
||||
h2c_parameter[0] = 0xc;
|
||||
h2c_parameter[1] = 0x0;
|
||||
btc->btc_fill_h2c(btc, 0x69, 2, h2c_parameter);
|
||||
coex_sta->is_no_wl_5ms_extend = FALSE;
|
||||
|
||||
halbtc8822b2ant_run_coex(btc, BT_8822B_2ANT_RSN_2GMEDIA);
|
||||
} else {
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -5030,7 +5161,7 @@ void ex_halbtc8822b2ant_media_status_notify(struct btc_coexist *btc, u8 type)
|
||||
|
||||
halbtc8822b2ant_run_coex(btc, BT_8822B_2ANT_RSN_MEDIADISCON);
|
||||
}
|
||||
|
||||
btc->btc_get(btc, BTC_GET_U1_IOT_PEER, &coex_sta->wl_iot_peer);
|
||||
halbtc8822b2ant_update_wifi_ch_info(btc, type);
|
||||
}
|
||||
|
||||
@@ -5193,6 +5324,14 @@ void ex_halbtc8822b2ant_bt_info_notify(struct btc_coexist *btc, u8 *tmp_buf,
|
||||
coex_sta->c2h_bt_inquiry_page =
|
||||
((coex_sta->bt_info_lb2 & BIT(2)) ? TRUE : FALSE);
|
||||
|
||||
if (coex_sta->bt_inq_page_pre != coex_sta->c2h_bt_inquiry_page) {
|
||||
coex_sta->bt_inq_page_pre = coex_sta->c2h_bt_inquiry_page;
|
||||
coex_sta->bt_inq_page_remain = TRUE;
|
||||
|
||||
if (!coex_sta->c2h_bt_inquiry_page)
|
||||
coex_sta->bt_inq_page_downcount = 2;
|
||||
}
|
||||
|
||||
if ((coex_sta->bt_info_lb2 & 0x49) == 0x49)
|
||||
coex_sta->a2dp_bit_pool = (coex_sta->bt_info_hb3 & 0x7f);
|
||||
else
|
||||
@@ -5216,6 +5355,7 @@ void ex_halbtc8822b2ant_bt_info_notify(struct btc_coexist *btc, u8 *tmp_buf,
|
||||
if (coex_sta->hid_pair_cnt > 0 && coex_sta->hid_busy_num >= 2) {
|
||||
coex_sta->bt_418_hid_exist = TRUE;
|
||||
} else if (coex_sta->hid_busy_num == 1 &&
|
||||
coex_sta->bt_ctr_ok &&
|
||||
(coex_sta->high_priority_rx + 100 <
|
||||
coex_sta->high_priority_tx) &&
|
||||
coex_sta->high_priority_rx < 100) {
|
||||
@@ -5520,7 +5660,8 @@ void ex_halbtc8822b2ant_pnp_notify(struct btc_coexist *btc, u8 pnp_state)
|
||||
void ex_halbtc8822b2ant_periodical(struct btc_coexist *btc)
|
||||
{
|
||||
struct coex_sta_8822b_2ant *coex_sta = &btc->coex_sta_8822b_2ant;
|
||||
boolean bt_relink_finish = FALSE, is_defreeze = FALSE;
|
||||
boolean bt_relink_finish = FALSE, is_defreeze = FALSE,
|
||||
bt_ctr_change = FALSE;
|
||||
static u8 freeze_cnt;
|
||||
|
||||
BTC_SPRINTF(trace_buf, BT_TMP_BUF_SIZE,
|
||||
@@ -5530,7 +5671,7 @@ void ex_halbtc8822b2ant_periodical(struct btc_coexist *btc)
|
||||
if (!btc->auto_report)
|
||||
halbtc8822b2ant_query_bt_info(btc);
|
||||
|
||||
halbtc8822b2ant_monitor_bt_ctr(btc);
|
||||
bt_ctr_change = halbtc8822b2ant_monitor_bt_ctr(btc);
|
||||
halbtc8822b2ant_monitor_wifi_ctr(btc);
|
||||
halbtc8822b2ant_update_wifi_link_info(btc,
|
||||
BT_8822B_2ANT_RSN_PERIODICAL);
|
||||
@@ -5544,6 +5685,12 @@ void ex_halbtc8822b2ant_periodical(struct btc_coexist *btc)
|
||||
}
|
||||
}
|
||||
|
||||
if (coex_sta->bt_inq_page_downcount != 0) {
|
||||
coex_sta->bt_inq_page_downcount--;
|
||||
if (coex_sta->bt_relink_downcount == 0)
|
||||
coex_sta->bt_inq_page_remain = FALSE;
|
||||
}
|
||||
|
||||
if (coex_sta->freeze_coexrun_by_btinfo) {
|
||||
freeze_cnt++;
|
||||
|
||||
@@ -5589,7 +5736,7 @@ void ex_halbtc8822b2ant_periodical(struct btc_coexist *btc)
|
||||
}
|
||||
|
||||
if (halbtc8822b2ant_moniter_wifibt_status(btc) || bt_relink_finish ||
|
||||
coex_sta->is_set_ps_state_fail || is_defreeze)
|
||||
coex_sta->is_set_ps_state_fail || is_defreeze || bt_ctr_change)
|
||||
halbtc8822b2ant_run_coex(btc, BT_8822B_2ANT_RSN_PERIODICAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ struct coex_sta_8822b_2ant {
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
boolean bt_ctr_ok;
|
||||
boolean is_hi_pri_rx_overhead;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
@@ -281,6 +282,8 @@ struct coex_sta_8822b_2ant {
|
||||
u32 bt_info_c2h_cnt[BT_8822B_2ANT_INFO_SRC_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean bt_inq_page_pre;
|
||||
boolean bt_inq_page_remain;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
|
||||
u8 bt_info_lb2;
|
||||
@@ -365,6 +368,7 @@ struct coex_sta_8822b_2ant {
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
u8 bt_inq_page_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
|
||||
boolean is_esco_mode;
|
||||
@@ -421,6 +425,7 @@ struct coex_sta_8822b_2ant {
|
||||
u8 tdma_timer_base;
|
||||
boolean wl_slot_toggle;
|
||||
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
|
||||
u8 wl_iot_peer;
|
||||
};
|
||||
|
||||
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
|
||||
@@ -174,6 +174,37 @@ do {\
|
||||
#define BTC_ANT_WIFI_AT_CPL_MAIN 0
|
||||
#define BTC_ANT_WIFI_AT_CPL_AUX 1
|
||||
|
||||
/* for common code request */
|
||||
#define REG_LTE_IDR_COEX_CTRL 0x0038
|
||||
#define REG_SYS_SDIO_CTRL 0x0070
|
||||
#define REG_SYS_SDIO_CTRL3 0x0073
|
||||
/* #define REG_RETRY_LIMIT 0x042a */
|
||||
/* #define REG_DARFRC 0x0430 */
|
||||
#define REG_DARFRCH 0x0434
|
||||
#define REG_CCK_CHECK 0x0454
|
||||
#define REG_AMPDU_MAX_TIME_V1 0x0455
|
||||
#define REG_TX_HANG_CTRL 0x045E
|
||||
#define REG_LIFETIME_EN 0x0426
|
||||
#define REG_BT_COEX_TABLE0 0x06C0
|
||||
#define REG_BT_COEX_TABLE1 0x06C4
|
||||
#define REG_BT_COEX_BRK_TABLE 0x06C8
|
||||
#define REG_BT_COEX_TABLE_H 0x06CC
|
||||
#define REG_BT_ACT_STATISTICS 0x0770
|
||||
#define REG_BT_ACT_STATISTICS_1 0x0774
|
||||
#define REG_BT_STAT_CTRL 0x0778
|
||||
|
||||
#define BIT_EN_GNT_BT_AWAKE BIT(3)
|
||||
#define BIT_EN_BCN_FUNCTION BIT(3)
|
||||
#define BIT_EN_BCN_PKT_REL BIT(6)
|
||||
#define BIT_FEN_BB_GLB_RST BIT(1)
|
||||
#define BIT_FEN_BB_RSTB BIT(0)
|
||||
|
||||
#define TDMA_4SLOT BIT(8)
|
||||
|
||||
/* for 2T2R -> 2T1R coex MIMO-PS mechanism tranlation */
|
||||
#define BTC_2GTDD_MAX_TRY 3 /* the max retry count for 1R->2R */
|
||||
#define BTC_2GFDD_MAX_STAY 300 /* the max stay time at 1R if 2R try-able (unit: 2s) */
|
||||
|
||||
typedef enum _BTC_POWERSAVE_TYPE {
|
||||
BTC_PS_WIFI_NATIVE = 0, /* wifi original power save behavior */
|
||||
BTC_PS_LPS_ON = 1,
|
||||
@@ -212,6 +243,7 @@ typedef enum _BTC_CHIP_TYPE {
|
||||
BTC_CHIP_RTL8723D = 10,
|
||||
BTC_CHIP_RTL8703B = 11,
|
||||
BTC_CHIP_RTL8725A = 12,
|
||||
BTC_CHIP_RTL8723F = 13,
|
||||
BTC_CHIP_MAX
|
||||
} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE;
|
||||
|
||||
@@ -233,15 +265,14 @@ static const char *const glbt_info_src[] = {
|
||||
"BT Info[bt auto report]",
|
||||
};
|
||||
|
||||
#define TDMA_4SLOT BIT(8)
|
||||
#define BTC_INFO_FTP BIT(7)
|
||||
#define BTC_INFO_A2DP BIT(6)
|
||||
#define BTC_INFO_HID BIT(5)
|
||||
#define BTC_INFO_FTP BIT(7)
|
||||
#define BTC_INFO_A2DP BIT(6)
|
||||
#define BTC_INFO_HID BIT(5)
|
||||
#define BTC_INFO_SCO_BUSY BIT(4)
|
||||
#define BTC_INFO_ACL_BUSY BIT(3)
|
||||
#define BTC_INFO_INQ_PAGE BIT(2)
|
||||
#define BTC_INFO_SCO_ESCO BIT(1)
|
||||
#define BTC_INFO_CONNECTION BIT(0)
|
||||
#define BTC_INFO_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_BTINFO_LENGTH_MAX 10
|
||||
|
||||
@@ -253,9 +284,9 @@ enum btc_gnt_setup_state {
|
||||
};
|
||||
|
||||
enum btc_gnt_setup_state_2 {
|
||||
BTC_GNT_SW_LOW = 0x0,
|
||||
BTC_GNT_SW_HIGH = 0x1,
|
||||
BTC_GNT_HW_PTA = 0x2,
|
||||
BTC_GNT_HW_PTA = 0x0,
|
||||
BTC_GNT_SW_LOW = 0x1,
|
||||
BTC_GNT_SW_HIGH = 0x3,
|
||||
BTC_GNT_MAX
|
||||
};
|
||||
|
||||
@@ -379,6 +410,7 @@ enum btc_ext_ant_switch_type {
|
||||
BTC_SWITCH_NONE = 0x0,
|
||||
BTC_SWITCH_SPDT = 0x1,
|
||||
BTC_SWITCH_SP3T = 0x2,
|
||||
BTC_SWITCH_DPDT = 0x3,
|
||||
BTC_SWITCH_ANTMAX
|
||||
};
|
||||
|
||||
@@ -428,13 +460,19 @@ enum btc_wl2bt_scoreboard {
|
||||
BTC_SCBD_EXTFEM = BIT(8),
|
||||
BTC_SCBD_TDMA = BIT(9),
|
||||
BTC_SCBD_FIX2M = BIT(10),
|
||||
BTC_SCBD_ALL = 0xffff
|
||||
BTC_SCBD_MAILBOX_DBG = BIT(14),
|
||||
BTC_SCBD_ALL = 0xffff,
|
||||
BTC_SCBD_ALL_32BIT = 0xffffffff
|
||||
};
|
||||
|
||||
enum btc_bt2wl_scoreboard {
|
||||
BTC_SCBD_BT_ONOFF = BIT(1),
|
||||
BTC_SCBD_BT_LPS = BIT(7)
|
||||
};
|
||||
enum btc_scoreboard_bit_num {
|
||||
BTC_SCBD_16_BIT = BIT(0),
|
||||
BTC_SCBD_32_BIT = BIT(1)
|
||||
};
|
||||
|
||||
enum btc_runreason {
|
||||
BTC_RSN_2GSCANSTART = 0x0,
|
||||
@@ -457,6 +495,8 @@ enum btc_runreason {
|
||||
BTC_RSN_LPS = 0x11,
|
||||
BTC_RSN_TIMERUP = 0x12,
|
||||
BTC_RSN_WLSTATUS = 0x13,
|
||||
BTC_RSN_BTCNT = 0x14,
|
||||
BTC_RSN_RFK = 0x15,
|
||||
BTC_RSN_MAX
|
||||
};
|
||||
|
||||
@@ -481,6 +521,9 @@ static const char *const run_reason_string[] = {
|
||||
"LPSNotify",
|
||||
"TimerUp",
|
||||
"WL_STATUS_CHANGE",
|
||||
"BT_CNT_CHANGE",
|
||||
"WL_RFK",
|
||||
"Reason Max"
|
||||
};
|
||||
|
||||
enum btc_wl_link_mode {
|
||||
@@ -491,6 +534,7 @@ enum btc_wl_link_mode {
|
||||
BTC_WLINK_2GGO = 0x4,
|
||||
BTC_WLINK_2GGC = 0x5,
|
||||
BTC_WLINK_BTMR = 0x6,
|
||||
BTC_WLINK_2GFREE = 0x7,
|
||||
BTC_WLINK_MAX
|
||||
};
|
||||
|
||||
@@ -501,7 +545,9 @@ static const char *const coex_mode_string[] = {
|
||||
"5G",
|
||||
"2G-P2P-GO",
|
||||
"2G-P2P-GC",
|
||||
"BT-MR"
|
||||
"BT-MR",
|
||||
"2G1RFREE",
|
||||
"unknow"
|
||||
};
|
||||
|
||||
enum btc_bt_state_cnt {
|
||||
@@ -518,6 +564,7 @@ enum btc_bt_state_cnt {
|
||||
BTC_CNT_BT_INFOUPDATE = 0xa,
|
||||
BTC_CNT_BT_IQK = 0xb,
|
||||
BTC_CNT_BT_IQKFAIL = 0xc,
|
||||
BTC_CNT_BT_TRX = 0xd,
|
||||
BTC_CNT_BT_MAX
|
||||
};
|
||||
|
||||
@@ -534,8 +581,10 @@ enum btc_wl_state_cnt {
|
||||
BTC_CNT_WL_NOISY1 = 0x9,
|
||||
BTC_CNT_WL_NOISY2 = 0xa,
|
||||
BTC_CNT_WL_ACTIVEPORT = 0xb,
|
||||
BTC_CNT_WL_5MS_NOEXTEND = 0xc,
|
||||
BTC_CNT_WL_LEAKAP_NORX = 0xc,
|
||||
BTC_CNT_WL_FW_NOTIFY = 0xd,
|
||||
BTC_CNT_WL_2G_TDDTRY = 0xe,
|
||||
BTC_CNT_WL_2G_FDDSTAY = 0xf,
|
||||
BTC_CNT_WL_MAX
|
||||
};
|
||||
|
||||
@@ -562,6 +611,8 @@ enum btc_timer_cnt {
|
||||
BTC_TIMER_BT_RELINK = 0x7,
|
||||
BTC_TIMER_BT_REENABLE = 0x8,
|
||||
BTC_TIMER_BT_MULTILINK = 0x9,
|
||||
BTC_TIMER_BT_INQPAGE = 0xa,
|
||||
BTC_TIMER_BT_A2DP_ACT = 0xb,
|
||||
BTC_TIMER_MAX
|
||||
};
|
||||
|
||||
@@ -572,6 +623,8 @@ enum btc_wl_status_change {
|
||||
BTC_WLSTATUS_CHANGE_LINKINFO = 0x3,
|
||||
BTC_WLSTATUS_CHANGE_DIR = 0x4,
|
||||
BTC_WLSTATUS_CHANGE_NOISY = 0x5,
|
||||
BTC_WLSTATUS_CHANGE_BTCNT = 0x6,
|
||||
BTC_WLSTATUS_CHANGE_LOCKTRY = 0x7,
|
||||
BTC_WLSTATUS_CHANGE_MAX
|
||||
};
|
||||
|
||||
@@ -585,6 +638,7 @@ enum btc_commom_chip_setup {
|
||||
BTC_CSETUP_WL_TX_POWER = 0x6,
|
||||
BTC_CSETUP_WL_RX_GAIN = 0x7,
|
||||
BTC_CSETUP_WLAN_ACT_IPS = 0x8,
|
||||
BTC_CSETUP_BT_CTRL_ACT = 0x9,
|
||||
BTC_CSETUP_MAX
|
||||
};
|
||||
|
||||
@@ -618,6 +672,33 @@ enum btc_wl_priority_mask {
|
||||
BTC_WLPRI_MAX
|
||||
};
|
||||
|
||||
enum btc_ext_chip_id{
|
||||
BTC_EXT_CHIP_NONE,
|
||||
BTC_EXT_CHIP_RF4CE,
|
||||
BTC_EXT_CHIP_MAX
|
||||
};
|
||||
|
||||
enum btc_ext_chip_mode{
|
||||
BTC_EXTMODE_NORMAL,
|
||||
BTC_EXTMODE_VOICE,
|
||||
BTC_EXTMODE_MAX
|
||||
};
|
||||
|
||||
enum btc_wl_rfk_type {
|
||||
BTC_PWR_TRK = 0,
|
||||
BTC_IQK = 1,
|
||||
BTC_LCK = 2,
|
||||
BTC_DPK = 3,
|
||||
BTC_TXGAPK = 4,
|
||||
BTC_RFK_TYPE_MAX
|
||||
};
|
||||
|
||||
enum btc_wl_rfk_state {
|
||||
BTC_RFK_START = 0,
|
||||
BTC_RFK_END = 1,
|
||||
BTC_RFK_STATE_MAX
|
||||
};
|
||||
|
||||
struct btc_board_info {
|
||||
/* The following is some board information */
|
||||
u8 bt_chip_type;
|
||||
@@ -639,6 +720,7 @@ struct btc_board_info {
|
||||
u8 customerID;
|
||||
u8 customer_id;
|
||||
u8 ant_distance; /* WL-BT antenna space for non-shared antenna */
|
||||
u8 ext_chip_id;
|
||||
};
|
||||
|
||||
struct btc_coex_dm {
|
||||
@@ -661,10 +743,6 @@ struct btc_coex_dm {
|
||||
u8 bt_status;
|
||||
u8 wl_chnl_info[3];
|
||||
u8 cur_toggle_para[6];
|
||||
u8 cur_val0x6cc;
|
||||
u32 cur_val0x6c0;
|
||||
u32 cur_val0x6c4;
|
||||
u32 cur_val0x6c8;
|
||||
u32 cur_ant_pos_type;
|
||||
u32 cur_switch_status;
|
||||
u32 setting_tdma;
|
||||
@@ -673,15 +751,17 @@ struct btc_coex_dm {
|
||||
struct btc_coex_sta {
|
||||
boolean coex_freeze;
|
||||
boolean coex_freerun;
|
||||
boolean tdma_bt_autoslot;
|
||||
boolean rf4ce_en;
|
||||
boolean is_no_wl_5ms_extend;
|
||||
boolean force_freerun;
|
||||
boolean force_tdd;
|
||||
|
||||
boolean bt_disabled;
|
||||
boolean bt_disabled_pre;
|
||||
boolean bt_link_exist;
|
||||
boolean bt_whck_test;
|
||||
boolean bt_inq_page;
|
||||
boolean bt_inq_page_pre;
|
||||
boolean bt_inq_page_remain;
|
||||
boolean bt_inq;
|
||||
boolean bt_page;
|
||||
boolean bt_ble_voice;
|
||||
@@ -703,11 +783,14 @@ struct btc_coex_sta {
|
||||
boolean bt_ble_scan_en;
|
||||
boolean bt_slave;
|
||||
boolean bt_a2dp_active;
|
||||
boolean bt_a2dp_active_pre;
|
||||
boolean bt_a2dp_active_remain;
|
||||
boolean bt_slave_latency;
|
||||
boolean bt_init_scan;
|
||||
boolean bt_418_hid_exist;
|
||||
boolean bt_ble_hid_exist;
|
||||
boolean bt_mesh;
|
||||
boolean bt_ctr_ok;
|
||||
|
||||
boolean wl_under_lps;
|
||||
boolean wl_under_ips;
|
||||
@@ -723,7 +806,6 @@ struct btc_coex_sta {
|
||||
boolean wl_gl_busy_pre;
|
||||
boolean wl_linkscan_proc;
|
||||
boolean wl_mimo_ps;
|
||||
boolean wl_ps_state_fail;
|
||||
boolean wl_cck_dead_lock_ap;
|
||||
boolean wl_tx_limit_en;
|
||||
boolean wl_ampdu_limit_en;
|
||||
@@ -732,6 +814,9 @@ struct btc_coex_sta {
|
||||
boolean wl_pnp_wakeup;
|
||||
boolean wl_slot_toggle;
|
||||
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
|
||||
boolean wl_leak_ap; /* !is_no_wl_5ms_extend */
|
||||
boolean wl_blacklist_ap;
|
||||
boolean wl_rfk;
|
||||
|
||||
u8 coex_table_type;
|
||||
u8 coex_run_reason;
|
||||
@@ -759,6 +844,7 @@ struct btc_coex_sta {
|
||||
u8 bt_sut_pwr_lvl[4];
|
||||
u8 bt_golden_rx_shift[4];
|
||||
u8 bt_ext_autoslot_thres;
|
||||
u8 ext_chip_mode;
|
||||
|
||||
u8 wl_pnp_state_pre;
|
||||
u8 wl_noisy_level;
|
||||
@@ -773,18 +859,23 @@ struct btc_coex_sta {
|
||||
u8 wl_coex_mode;
|
||||
u8 wl_iot_peer;
|
||||
u8 wl_ra_thres;
|
||||
u8 wl_ampdulen_backup;
|
||||
u8 wl_ampdulen;
|
||||
u8 wl_rxagg_size;
|
||||
u8 wl_toggle_para[6];
|
||||
u8 wl_toggle_interval;
|
||||
|
||||
u16 score_board_BW;
|
||||
u16 score_board_WB;
|
||||
u32 score_board_WB;
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
u32 bt_reg_vendor_dac;
|
||||
u16 bt_reg_modem_a;
|
||||
u16 bt_reg_rf_2;
|
||||
u16 wl_txlimit_backup;
|
||||
u16 bt_reg_rf_9;
|
||||
u16 wl_txlimit;
|
||||
|
||||
u32 score_board_BW_32bit;
|
||||
u32 score_board_WB_32bit;
|
||||
u32 hi_pri_tx;
|
||||
u32 hi_pri_rx;
|
||||
u32 lo_pri_tx;
|
||||
@@ -793,8 +884,9 @@ struct btc_coex_sta {
|
||||
u32 bt_supported_version;
|
||||
u32 bt_ble_scan_para[3];
|
||||
u32 bt_a2dp_device_name;
|
||||
u32 wl_arfb1_backup;
|
||||
u32 wl_arfb2_backup;
|
||||
u32 bt_a2dp_flush_time;
|
||||
u32 wl_arfb1;
|
||||
u32 wl_arfb2;
|
||||
u32 wl_traffic_dir;
|
||||
u32 wl_bw;
|
||||
u32 cnt_bt_info_c2h[BTC_BTINFO_SRC_MAX];
|
||||
@@ -1031,6 +1123,7 @@ typedef enum _BTC_GET_TYPE {
|
||||
BTC_GET_U1_AP_NUM,
|
||||
BTC_GET_U1_ANT_TYPE,
|
||||
BTC_GET_U1_IOT_PEER,
|
||||
BTC_GET_BL_WIFI_BSSID,
|
||||
|
||||
/* type u2Byte */
|
||||
BTC_GET_U2_BEACON_PERIOD,
|
||||
@@ -1151,6 +1244,13 @@ typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION {
|
||||
BTC_STACK_OP_MAX
|
||||
} BTC_NOTIFY_TYPE_STACK_OPERATION, *PBTC_NOTIFY_TYPE_STACK_OPERATION;
|
||||
|
||||
typedef enum _BTC_LINK_CHANGE_TYPE{
|
||||
BTC_LINK_CHANGE_TYPE_NONE = 0x0,
|
||||
BTC_LINK_CHANGE_TYPE_ECSA_START = 0x1,
|
||||
BTC_LINK_CHANGE_TYPE_ECSA_DONE = 0x2,
|
||||
BTC_LINK_CHANGE_TYPE_MAX
|
||||
}BTC_LINK_CHANGE_TYPE,*PBTC_LINK_CHANGE_TYPE;
|
||||
|
||||
/* Bryant Add */
|
||||
typedef enum _BTC_ANTENNA_POS {
|
||||
BTC_ANTENNA_AT_MAIN_PORT = 0x1,
|
||||
@@ -1385,11 +1485,16 @@ typedef u4Byte
|
||||
IN PVOID pBtcContext,
|
||||
IN u2Byte reg_addr
|
||||
);
|
||||
typedef VOID
|
||||
typedef u2Byte
|
||||
(*BFP_BTC_R_SCBD)(
|
||||
IN PVOID pBtcContext,
|
||||
IN pu2Byte score_board_val
|
||||
);
|
||||
typedef u4Byte
|
||||
(*BFP_BTC_R_SCBD_32BIT)(
|
||||
IN PVOID pBtcContext,
|
||||
IN pu4Byte score_board_val
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W_SCBD)(
|
||||
IN PVOID pBtcContext,
|
||||
@@ -1397,6 +1502,12 @@ typedef VOID
|
||||
IN BOOLEAN state
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W_SCBD_32BIT)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte bitpos,
|
||||
IN BOOLEAN state
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W_LINDIRECT)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u2Byte reg_addr,
|
||||
@@ -1675,6 +1786,8 @@ struct btc_coexist {
|
||||
struct btc_coex_sta coex_sta;
|
||||
struct btc_rfe_type rfe_type;
|
||||
const struct btc_chip_para *chip_para;
|
||||
u8 wifi_black_bssid[6];
|
||||
u8 wifi_bssid[6];
|
||||
|
||||
#ifdef CONFIG_RF4CE_COEXIST
|
||||
struct btc_rf4ce_info rf4ce_info;
|
||||
@@ -1707,7 +1820,10 @@ struct btc_coexist {
|
||||
BFP_BTC_R_LINDIRECT btc_read_linderct;
|
||||
BFP_BTC_W_LINDIRECT btc_write_linderct;
|
||||
BFP_BTC_R_SCBD btc_read_scbd;
|
||||
BFP_BTC_R_SCBD_32BIT btc_read_scbd_32bit;
|
||||
BFP_BTC_W_SCBD btc_write_scbd;
|
||||
BFP_BTC_W_SCBD_32BIT btc_write_scbd_32bit;
|
||||
|
||||
/* read/write bb related */
|
||||
BFP_BTC_SET_BB_REG btc_set_bb_reg;
|
||||
BFP_BTC_GET_BB_REG btc_get_bb_reg;
|
||||
@@ -1813,7 +1929,10 @@ struct btc_chip_para {
|
||||
u32 para_ver_date;
|
||||
u32 para_ver;
|
||||
u32 bt_desired_ver;
|
||||
u32 wl_desired_ver;
|
||||
boolean scbd_support;
|
||||
u32 scbd_reg;
|
||||
u8 scbd_bit_num;
|
||||
boolean mailbox_support;
|
||||
boolean lte_indirect_access;
|
||||
boolean new_scbd10_def; /* TRUE: 1:fix 2M(8822c) */
|
||||
@@ -1957,6 +2076,13 @@ EXhalbtcoutsrc_WLStatusChangeNotify(
|
||||
IN u4Byte change_type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_WL_RFK_Notify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte path,
|
||||
IN u1Byte type,
|
||||
IN u1Byte state
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_CoexDmSwitch(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
|
||||
@@ -124,6 +124,11 @@ struct btc_coexist;
|
||||
#include "halbtc8822c.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8723F
|
||||
#include "halbtc8723fwifionly.h"
|
||||
#include "halbtc8723f.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8192F
|
||||
#include "halbtc8192f.h"
|
||||
#endif
|
||||
@@ -150,6 +155,10 @@ struct btc_coexist;
|
||||
#include "halbtc8822cwifionly.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8723F
|
||||
#include "halbtc8723fwifionly.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8814B
|
||||
#include "halbtc8814bwifionly.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user