rtlwifi: btcoex: follow linux coding style
Fix a number of checkpatch.pl warnings. In addition, some variable and function names are shortened, and/or renamed to be more consistent. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Pkshih <pkshih@realtek.com> Cc: Birming Chiu <birming@realtek.com> Cc: Shaofu <shaofu@realtek.com> Cc: Steven Ting <steventing@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
27a31a60a4
commit
c6821613e6
File diff suppressed because it is too large
Load Diff
@ -116,7 +116,7 @@ struct coex_dm_8192e_2ant {
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retrylimit;
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_maxtime;
|
||||
|
||||
/* algorithm related */
|
||||
@ -125,18 +125,18 @@ struct coex_dm_8192e_2ant {
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u8 pre_sstype;
|
||||
u8 cur_sstype;
|
||||
u8 pre_ss_type;
|
||||
u8 cur_ss_type;
|
||||
|
||||
u32 prera_mask;
|
||||
u32 curra_mask;
|
||||
u8 curra_masktype;
|
||||
u8 pre_arfrtype;
|
||||
u8 cur_arfrtype;
|
||||
u8 pre_retrylimit_type;
|
||||
u8 cur_retrylimit_type;
|
||||
u8 pre_ampdutime_type;
|
||||
u8 cur_ampdutime_type;
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 cur_ra_mask_type;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8192e_2ant {
|
||||
|
@ -45,7 +45,7 @@ static struct coex_dm_8723b_1ant *coex_dm = &glcoex_dm_8723b_1ant;
|
||||
static struct coex_sta_8723b_1ant glcoex_sta_8723b_1ant;
|
||||
static struct coex_sta_8723b_1ant *coex_sta = &glcoex_sta_8723b_1ant;
|
||||
|
||||
static const char *const GLBtInfoSrc8723b1Ant[] = {
|
||||
static const char *const glbt_info_src_8723b_1ant[] = {
|
||||
"BT Info[wifi fw]",
|
||||
"BT Info[bt rsp]",
|
||||
"BT Info[bt auto report]",
|
||||
@ -67,7 +67,7 @@ static void halbtc8723b1ant_updatera_mask(struct btc_coexist *btcoexist,
|
||||
coex_dm->curra_mask = dis_rate_mask;
|
||||
|
||||
if (force_exec || (coex_dm->prera_mask != coex_dm->curra_mask))
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_UPDATE_ra_mask,
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_UPDATE_RAMASK,
|
||||
&coex_dm->curra_mask);
|
||||
|
||||
coex_dm->prera_mask = coex_dm->curra_mask;
|
||||
@ -144,15 +144,14 @@ static void halbtc8723b1ant_ampdu_maxtime(struct btc_coexist *btcoexist,
|
||||
coex_dm->cur_ampdu_time_type)) {
|
||||
switch (coex_dm->cur_ampdu_time_type) {
|
||||
case 0: /* normal mode */
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x456,
|
||||
coex_dm->backup_ampdu_max_time);
|
||||
break;
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x456,
|
||||
coex_dm->backup_ampdu_max_time);
|
||||
break;
|
||||
case 1: /* AMPDU timw = 0x38 * 32us */
|
||||
btcoexist->btc_write_1byte(btcoexist,
|
||||
0x456, 0x38);
|
||||
break;
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x456, 0x38);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +171,7 @@ static void halbtc8723b1ant_limited_tx(struct btc_coexist *btcoexist,
|
||||
halbtc8723b1ant_updatera_mask(btcoexist, force_exec,
|
||||
0x00000003);
|
||||
break;
|
||||
/* disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4*/
|
||||
/* disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4 */
|
||||
case 2:
|
||||
halbtc8723b1ant_updatera_mask(btcoexist, force_exec,
|
||||
0x0001f1f7);
|
||||
@ -244,7 +243,8 @@ static void halbtc8723b1ant_query_bt_info(struct btc_coexist *btcoexist)
|
||||
|
||||
coex_sta->c2h_bt_info_req_sent = true;
|
||||
|
||||
h2c_parameter[0] |= BIT0; /* trigger*/
|
||||
/* trigger */
|
||||
h2c_parameter[0] |= BIT0;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n",
|
||||
@ -343,11 +343,11 @@ static void btc8723b1ant_set_sw_pen_tx_rate_adapt(struct btc_coexist *btcoexist,
|
||||
|
||||
if (low_penalty_ra) {
|
||||
h2c_parameter[1] |= BIT0;
|
||||
/*normal rate except MCS7/6/5, OFDM54/48/36 */
|
||||
/* normal rate except MCS7/6/5, OFDM54/48/36 */
|
||||
h2c_parameter[2] = 0x00;
|
||||
h2c_parameter[3] = 0xf7; /*MCS7 or OFDM54 */
|
||||
h2c_parameter[4] = 0xf8; /*MCS6 or OFDM48 */
|
||||
h2c_parameter[5] = 0xf9; /*MCS5 or OFDM36 */
|
||||
h2c_parameter[3] = 0xf7; /* MCS7 or OFDM54 */
|
||||
h2c_parameter[4] = 0xf8; /* MCS6 or OFDM48 */
|
||||
h2c_parameter[5] = 0xf9; /* MCS5 or OFDM36 */
|
||||
}
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
@ -468,8 +468,9 @@ static void halbtc8723b1ant_coex_table_with_type(struct btc_coexist *btcoexist,
|
||||
}
|
||||
}
|
||||
|
||||
static void halbtc8723b1ant_SetFwIgnoreWlanAct(struct btc_coexist *btcoexist,
|
||||
bool enable)
|
||||
static void
|
||||
halbtc8723b1ant_set_fw_ignore_wlan_act(struct btc_coexist *btcoexist,
|
||||
bool enable)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
u8 h2c_parameter[1] = {0};
|
||||
@ -504,7 +505,7 @@ static void halbtc8723b1ant_ignore_wlan_act(struct btc_coexist *btcoexist,
|
||||
coex_dm->cur_ignore_wlan_act)
|
||||
return;
|
||||
}
|
||||
halbtc8723b1ant_SetFwIgnoreWlanAct(btcoexist, enable);
|
||||
halbtc8723b1ant_set_fw_ignore_wlan_act(btcoexist, enable);
|
||||
|
||||
coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act;
|
||||
}
|
||||
@ -566,9 +567,9 @@ static void halbtc8723b1ant_set_lps_rpwm(struct btc_coexist *btcoexist,
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_U1_RPWM_VAL, &rpwm);
|
||||
}
|
||||
|
||||
static void halbtc8723b1ant_LpsRpwm(struct btc_coexist *btcoexist,
|
||||
bool force_exec,
|
||||
u8 lps_val, u8 rpwm_val)
|
||||
static void halbtc8723b1ant_lps_rpwm(struct btc_coexist *btcoexist,
|
||||
bool force_exec,
|
||||
u8 lps_val, u8 rpwm_val)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
|
||||
@ -609,9 +610,9 @@ static void halbtc8723b1ant_sw_mechanism(struct btc_coexist *btcoexist,
|
||||
halbtc8723b1ant_low_penalty_ra(btcoexist, NORMAL_EXEC, low_penalty_ra);
|
||||
}
|
||||
|
||||
static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist,
|
||||
u8 ant_pos_type, bool init_hw_cfg,
|
||||
bool wifi_off)
|
||||
static void halbtc8723b1ant_set_ant_path(struct btc_coexist *btcoexist,
|
||||
u8 ant_pos_type, bool init_hw_cfg,
|
||||
bool wifi_off)
|
||||
{
|
||||
struct btc_board_info *board_info = &btcoexist->board_info;
|
||||
u32 fw_ver = 0, u32tmp = 0;
|
||||
@ -650,7 +651,7 @@ static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist,
|
||||
if (use_ext_switch) {
|
||||
if (init_hw_cfg) {
|
||||
/* 0x4c[23] = 0, 0x4c[24] = 1
|
||||
* Antenna control by WL/BT
|
||||
* Antenna control by WL/BT
|
||||
*/
|
||||
u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c);
|
||||
u32tmp &= ~BIT23;
|
||||
@ -659,35 +660,36 @@ static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist,
|
||||
|
||||
if (board_info->btdm_ant_pos ==
|
||||
BTC_ANTENNA_AT_MAIN_PORT) {
|
||||
/* Main Ant to BT for IPS case 0x4c[23] = 1 */
|
||||
/* Main Ant to BT for IPS case 0x4c[23] = 1 */
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist,
|
||||
0x64, 0x1,
|
||||
0x1);
|
||||
|
||||
/*tell firmware "no antenna inverse"*/
|
||||
/* tell firmware "no antenna inverse" */
|
||||
h2c_parameter[0] = 0;
|
||||
h2c_parameter[1] = 1; /*ext switch type*/
|
||||
btcoexist->btc_fill_h2c(btcoexist, 0x65, 2,
|
||||
h2c_parameter);
|
||||
} else {
|
||||
/*Aux Ant to BT for IPS case 0x4c[23] = 1 */
|
||||
/* Aux Ant to BT for IPS case 0x4c[23] = 1 */
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist,
|
||||
0x64, 0x1,
|
||||
0x0);
|
||||
|
||||
/*tell firmware "antenna inverse"*/
|
||||
/* tell firmware "antenna inverse" */
|
||||
h2c_parameter[0] = 1;
|
||||
h2c_parameter[1] = 1; /*ext switch type*/
|
||||
h2c_parameter[1] = 1; /* ext switch type */
|
||||
btcoexist->btc_fill_h2c(btcoexist, 0x65, 2,
|
||||
h2c_parameter);
|
||||
}
|
||||
}
|
||||
|
||||
/* fixed internal switch first*/
|
||||
/* fixed internal switch S1->WiFi, S0->BT*/
|
||||
/* fixed internal switch first
|
||||
* fixed internal switch S1->WiFi, S0->BT
|
||||
*/
|
||||
if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT)
|
||||
btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0);
|
||||
else/* fixed internal switch S0->WiFi, S1->BT*/
|
||||
else /* fixed internal switch S0->WiFi, S1->BT */
|
||||
btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280);
|
||||
|
||||
/* ext switch setting */
|
||||
@ -730,7 +732,7 @@ static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist,
|
||||
|
||||
} else {
|
||||
if (init_hw_cfg) {
|
||||
/* 0x4c[23] = 1, 0x4c[24] = 0 Antenna control by 0x64*/
|
||||
/* 0x4c[23] = 1, 0x4c[24] = 0 Antenna control by 0x64 */
|
||||
u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c);
|
||||
u32tmp |= BIT23;
|
||||
u32tmp &= ~BIT24;
|
||||
@ -738,41 +740,42 @@ static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist,
|
||||
|
||||
if (board_info->btdm_ant_pos ==
|
||||
BTC_ANTENNA_AT_MAIN_PORT) {
|
||||
/*Main Ant to WiFi for IPS case 0x4c[23] = 1*/
|
||||
/* Main Ant to WiFi for IPS case 0x4c[23] = 1 */
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist,
|
||||
0x64, 0x1,
|
||||
0x0);
|
||||
|
||||
/*tell firmware "no antenna inverse"*/
|
||||
/* tell firmware "no antenna inverse" */
|
||||
h2c_parameter[0] = 0;
|
||||
h2c_parameter[1] = 0; /*internal switch type*/
|
||||
h2c_parameter[1] = 0; /* internal switch type */
|
||||
btcoexist->btc_fill_h2c(btcoexist, 0x65, 2,
|
||||
h2c_parameter);
|
||||
} else {
|
||||
/*Aux Ant to BT for IPS case 0x4c[23] = 1*/
|
||||
/* Aux Ant to BT for IPS case 0x4c[23] = 1 */
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist,
|
||||
0x64, 0x1,
|
||||
0x1);
|
||||
|
||||
/*tell firmware "antenna inverse"*/
|
||||
/* tell firmware "antenna inverse" */
|
||||
h2c_parameter[0] = 1;
|
||||
h2c_parameter[1] = 0; /*internal switch type*/
|
||||
h2c_parameter[1] = 0; /* internal switch type */
|
||||
btcoexist->btc_fill_h2c(btcoexist, 0x65, 2,
|
||||
h2c_parameter);
|
||||
}
|
||||
}
|
||||
|
||||
/* fixed external switch first*/
|
||||
/*Main->WiFi, Aux->BT*/
|
||||
/* fixed external switch first
|
||||
* Main->WiFi, Aux->BT
|
||||
*/
|
||||
if (board_info->btdm_ant_pos ==
|
||||
BTC_ANTENNA_AT_MAIN_PORT)
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x92c,
|
||||
0x3, 0x1);
|
||||
else/*Main->BT, Aux->WiFi */
|
||||
else /* Main->BT, Aux->WiFi */
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x92c,
|
||||
0x3, 0x2);
|
||||
|
||||
/* internal switch setting*/
|
||||
/* internal switch setting */
|
||||
switch (ant_pos_type) {
|
||||
case BTC_ANT_PATH_WIFI:
|
||||
if (board_info->btdm_ant_pos ==
|
||||
@ -987,7 +990,7 @@ static void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist,
|
||||
halbtc8723b1ant_set_fw_ps_tdma(btcoexist, 0xd3, 0x12,
|
||||
0x3, 0x14, 0x50);
|
||||
break;
|
||||
/* SoftAP only with no sta associated,BT disable ,
|
||||
/* SoftAP only with no sta associated, BT disable,
|
||||
* TDMA mode for power saving
|
||||
* here softap mode screen off will cost 70-80mA for phone
|
||||
*/
|
||||
@ -998,24 +1001,29 @@ static void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist,
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case 8: /*PTA Control */
|
||||
case 8: /* PTA Control */
|
||||
halbtc8723b1ant_set_fw_ps_tdma(btcoexist, 0x8, 0x0,
|
||||
0x0, 0x0, 0x0);
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_PTA,
|
||||
false, false);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist,
|
||||
BTC_ANT_PATH_PTA,
|
||||
false, false);
|
||||
break;
|
||||
case 0:
|
||||
default: /*Software control, Antenna at BT side */
|
||||
default:
|
||||
/* Software control, Antenna at BT side */
|
||||
halbtc8723b1ant_set_fw_ps_tdma(btcoexist, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0);
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT,
|
||||
false, false);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist,
|
||||
BTC_ANT_PATH_BT,
|
||||
false, false);
|
||||
break;
|
||||
case 9: /*Software control, Antenna at WiFi side */
|
||||
case 9:
|
||||
/* Software control, Antenna at WiFi side */
|
||||
halbtc8723b1ant_set_fw_ps_tdma(btcoexist, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0);
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_WIFI,
|
||||
false, false);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist,
|
||||
BTC_ANT_PATH_WIFI,
|
||||
false, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1029,189 +1037,15 @@ static void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist,
|
||||
coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma;
|
||||
}
|
||||
|
||||
static void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist,
|
||||
u8 wifi_status)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
static s32 up, dn, m, n, wait_count;
|
||||
/* 0: no change, +1: increase WiFi duration,
|
||||
* -1: decrease WiFi duration
|
||||
*/
|
||||
s32 result;
|
||||
u8 retry_count = 0, bt_info_ext;
|
||||
bool wifi_busy = false;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], TdmaDurationAdjustForAcl()\n");
|
||||
|
||||
if (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY == wifi_status)
|
||||
wifi_busy = true;
|
||||
else
|
||||
wifi_busy = false;
|
||||
|
||||
if ((BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN ==
|
||||
wifi_status) ||
|
||||
(BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifi_status) ||
|
||||
(BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifi_status)) {
|
||||
if (coex_dm->cur_ps_tdma != 1 && coex_dm->cur_ps_tdma != 2 &&
|
||||
coex_dm->cur_ps_tdma != 3 && coex_dm->cur_ps_tdma != 9) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 9);
|
||||
coex_dm->tdma_adj_type = 9;
|
||||
|
||||
up = 0;
|
||||
dn = 0;
|
||||
m = 1;
|
||||
n = 3;
|
||||
result = 0;
|
||||
wait_count = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!coex_dm->auto_tdma_adjust) {
|
||||
coex_dm->auto_tdma_adjust = true;
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], first run TdmaDurationAdjust()!!\n");
|
||||
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 2);
|
||||
coex_dm->tdma_adj_type = 2;
|
||||
|
||||
up = 0;
|
||||
dn = 0;
|
||||
m = 1;
|
||||
n = 3;
|
||||
result = 0;
|
||||
wait_count = 0;
|
||||
} else {
|
||||
/*accquire the BT TRx retry count from BT_Info byte2 */
|
||||
retry_count = coex_sta->bt_retry_cnt;
|
||||
bt_info_ext = coex_sta->bt_info_ext;
|
||||
result = 0;
|
||||
wait_count++;
|
||||
/* no retry in the last 2-second duration */
|
||||
if (retry_count == 0) {
|
||||
up++;
|
||||
dn--;
|
||||
|
||||
if (dn <= 0)
|
||||
dn = 0;
|
||||
|
||||
if (up >= n) {
|
||||
wait_count = 0;
|
||||
n = 3;
|
||||
up = 0;
|
||||
dn = 0;
|
||||
result = 1;
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], Increase wifi duration!!\n");
|
||||
}
|
||||
} else if (retry_count <= 3) {
|
||||
up--;
|
||||
dn++;
|
||||
|
||||
if (up <= 0)
|
||||
up = 0;
|
||||
|
||||
if (dn == 2) {
|
||||
if (wait_count <= 2)
|
||||
m++;
|
||||
else
|
||||
m = 1;
|
||||
|
||||
if (m >= 20)
|
||||
m = 20;
|
||||
|
||||
n = 3 * m;
|
||||
up = 0;
|
||||
dn = 0;
|
||||
wait_count = 0;
|
||||
result = -1;
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], Decrease wifi duration for retryCounter<3!!\n");
|
||||
}
|
||||
} else {
|
||||
if (wait_count == 1)
|
||||
m++;
|
||||
else
|
||||
m = 1;
|
||||
|
||||
if (m >= 20)
|
||||
m = 20;
|
||||
|
||||
n = 3 * m;
|
||||
up = 0;
|
||||
dn = 0;
|
||||
wait_count = 0;
|
||||
result = -1;
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], Decrease wifi duration for retryCounter>3!!\n");
|
||||
}
|
||||
|
||||
if (result == -1) {
|
||||
if ((BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(bt_info_ext)) &&
|
||||
((coex_dm->cur_ps_tdma == 1) ||
|
||||
(coex_dm->cur_ps_tdma == 2))) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 9);
|
||||
coex_dm->tdma_adj_type = 9;
|
||||
} else if (coex_dm->cur_ps_tdma == 1) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 2);
|
||||
coex_dm->tdma_adj_type = 2;
|
||||
} else if (coex_dm->cur_ps_tdma == 2) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 9);
|
||||
coex_dm->tdma_adj_type = 9;
|
||||
} else if (coex_dm->cur_ps_tdma == 9) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 11);
|
||||
coex_dm->tdma_adj_type = 11;
|
||||
}
|
||||
} else if (result == 1) {
|
||||
if ((BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(bt_info_ext)) &&
|
||||
((coex_dm->cur_ps_tdma == 1) ||
|
||||
(coex_dm->cur_ps_tdma == 2))) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 9);
|
||||
coex_dm->tdma_adj_type = 9;
|
||||
} else if (coex_dm->cur_ps_tdma == 11) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 9);
|
||||
coex_dm->tdma_adj_type = 9;
|
||||
} else if (coex_dm->cur_ps_tdma == 9) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 2);
|
||||
coex_dm->tdma_adj_type = 2;
|
||||
} else if (coex_dm->cur_ps_tdma == 2) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 1);
|
||||
coex_dm->tdma_adj_type = 1;
|
||||
}
|
||||
} else { /*no change */
|
||||
/*if busy / idle change */
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex],********* TDMA(on, %d) ********\n",
|
||||
coex_dm->cur_ps_tdma);
|
||||
}
|
||||
|
||||
if (coex_dm->cur_ps_tdma != 1 && coex_dm->cur_ps_tdma != 2 &&
|
||||
coex_dm->cur_ps_tdma != 9 && coex_dm->cur_ps_tdma != 11) {
|
||||
/* recover to previous adjust type */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true,
|
||||
coex_dm->tdma_adj_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void btc8723b1ant_pstdmachkpwrsave(struct btc_coexist *btcoexist,
|
||||
bool new_ps_state)
|
||||
static void halbtc8723b1ant_ps_tdma_chk_pwr_save(struct btc_coexist *btcoexist,
|
||||
bool new_ps_state)
|
||||
{
|
||||
u8 lps_mode = 0x0;
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U1_LPS_MODE, &lps_mode);
|
||||
|
||||
if (lps_mode) { /* already under LPS state */
|
||||
if (lps_mode) {
|
||||
/* already under LPS state */
|
||||
if (new_ps_state) {
|
||||
/* keep state under LPS, do nothing. */
|
||||
} else {
|
||||
@ -1219,7 +1053,8 @@ static void btc8723b1ant_pstdmachkpwrsave(struct btc_coexist *btcoexist,
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
false, 0);
|
||||
}
|
||||
} else { /* NO PS state */
|
||||
} else {
|
||||
/* NO PS state */
|
||||
if (new_ps_state) {
|
||||
/* will enter LPS state, turn off psTdma first */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
@ -1245,18 +1080,18 @@ static void halbtc8723b1ant_power_save_state(struct btc_coexist *btcoexist,
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_NORMAL_LPS, NULL);
|
||||
break;
|
||||
case BTC_PS_LPS_ON:
|
||||
btc8723b1ant_pstdmachkpwrsave(btcoexist, true);
|
||||
halbtc8723b1ant_LpsRpwm(btcoexist, NORMAL_EXEC, lps_val,
|
||||
rpwm_val);
|
||||
/* when coex force to enter LPS, do not enter 32k low power. */
|
||||
halbtc8723b1ant_ps_tdma_chk_pwr_save(btcoexist, true);
|
||||
halbtc8723b1ant_lps_rpwm(btcoexist, NORMAL_EXEC, lps_val,
|
||||
rpwm_val);
|
||||
/* when coex force to enter LPS, do not enter 32k low power */
|
||||
low_pwr_disable = true;
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER,
|
||||
&low_pwr_disable);
|
||||
/* power save must executed before psTdma. */
|
||||
/* power save must executed before psTdma */
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL);
|
||||
break;
|
||||
case BTC_PS_LPS_OFF:
|
||||
btc8723b1ant_pstdmachkpwrsave(btcoexist, false);
|
||||
halbtc8723b1ant_ps_tdma_chk_pwr_save(btcoexist, false);
|
||||
btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL);
|
||||
break;
|
||||
default:
|
||||
@ -1330,11 +1165,11 @@ static void btc8723b1ant_act_bt_sco_hid_only_busy(struct btc_coexist *btcoexist,
|
||||
&wifi_connected);
|
||||
|
||||
/* tdma and coex table */
|
||||
|
||||
if (bt_link_info->sco_exist) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 5);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
|
||||
} else { /* HID */
|
||||
} else {
|
||||
/* HID */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 6);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 5);
|
||||
}
|
||||
@ -1347,18 +1182,18 @@ static void halbtc8723b1ant_action_wifi_connected_bt_acl_busy(
|
||||
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
|
||||
|
||||
|
||||
if (bt_link_info->hid_only) { /*HID */
|
||||
if (bt_link_info->hid_only) { /* HID */
|
||||
btc8723b1ant_act_bt_sco_hid_only_busy(btcoexist, wifi_status);
|
||||
coex_dm->auto_tdma_adjust = false;
|
||||
return;
|
||||
} else if (bt_link_info->a2dp_only) { /*A2DP */
|
||||
if (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE == wifi_status) {
|
||||
} else if (bt_link_info->a2dp_only) { /* A2DP */
|
||||
if (wifi_status == BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
false, 8);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 2);
|
||||
coex_dm->auto_tdma_adjust = false;
|
||||
} else { /*for low BT RSSI */
|
||||
} else { /* for low BT RSSI */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 11);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
@ -1366,18 +1201,18 @@ static void halbtc8723b1ant_action_wifi_connected_bt_acl_busy(
|
||||
coex_dm->auto_tdma_adjust = false;
|
||||
}
|
||||
} else if (bt_link_info->hid_exist &&
|
||||
bt_link_info->a2dp_exist) { /*HID+A2DP */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 14);
|
||||
bt_link_info->a2dp_exist) { /* HID + A2DP */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 14);
|
||||
coex_dm->auto_tdma_adjust = false;
|
||||
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 6);
|
||||
/*PAN(OPP,FTP), HID+PAN(OPP,FTP) */
|
||||
/* PAN(OPP,FTP), HID + PAN(OPP,FTP) */
|
||||
} else if (bt_link_info->pan_only ||
|
||||
(bt_link_info->hid_exist && bt_link_info->pan_exist)) {
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 3);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 6);
|
||||
coex_dm->auto_tdma_adjust = false;
|
||||
/*A2DP+PAN(OPP,FTP), HID+A2DP+PAN(OPP,FTP)*/
|
||||
/* A2DP + PAN(OPP,FTP), HID + A2DP + PAN(OPP,FTP) */
|
||||
} else if ((bt_link_info->a2dp_exist && bt_link_info->pan_exist) ||
|
||||
(bt_link_info->hid_exist && bt_link_info->a2dp_exist &&
|
||||
bt_link_info->pan_exist)) {
|
||||
@ -1402,57 +1237,59 @@ static void btc8723b1ant_action_wifi_not_conn(struct btc_coexist *btcoexist)
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
|
||||
}
|
||||
|
||||
static void btc8723b1ant_action_wifi_not_conn_scan(struct btc_coexist *btcoex)
|
||||
static void
|
||||
btc8723b1ant_action_wifi_not_conn_scan(struct btc_coexist *btcoexist)
|
||||
{
|
||||
struct btc_bt_link_info *bt_link_info = &btcoex->bt_link_info;
|
||||
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
|
||||
|
||||
halbtc8723b1ant_power_save_state(btcoex, BTC_PS_WIFI_NATIVE,
|
||||
halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
|
||||
0x0, 0x0);
|
||||
|
||||
/* tdma and coex table */
|
||||
if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) {
|
||||
if (bt_link_info->a2dp_exist && bt_link_info->pan_exist) {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC,
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 22);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex,
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 1);
|
||||
} else if (bt_link_info->pan_only) {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC,
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 20);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex,
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 2);
|
||||
} else {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC,
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 20);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex,
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 1);
|
||||
}
|
||||
} else if ((BT_8723B_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) ||
|
||||
(BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY ==
|
||||
coex_dm->bt_status)){
|
||||
btc8723b1ant_act_bt_sco_hid_only_busy(btcoex,
|
||||
btc8723b1ant_act_bt_sco_hid_only_busy(btcoexist,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN);
|
||||
} else {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC, false, 8);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex, NORMAL_EXEC, 2);
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc8723b1ant_act_wifi_not_conn_asso_auth(struct btc_coexist *btcoex)
|
||||
static void
|
||||
btc8723b1ant_act_wifi_not_conn_asso_auth(struct btc_coexist *btcoexist)
|
||||
{
|
||||
struct btc_bt_link_info *bt_link_info = &btcoex->bt_link_info;
|
||||
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
|
||||
|
||||
halbtc8723b1ant_power_save_state(btcoex, BTC_PS_WIFI_NATIVE,
|
||||
halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
|
||||
0x0, 0x0);
|
||||
|
||||
if ((BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ||
|
||||
(bt_link_info->sco_exist) || (bt_link_info->hid_only) ||
|
||||
(bt_link_info->a2dp_only) || (bt_link_info->pan_only)) {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC, false, 8);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex, NORMAL_EXEC, 7);
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
} else {
|
||||
halbtc8723b1ant_ps_tdma(btcoex, NORMAL_EXEC, true, 20);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoex, NORMAL_EXEC, 1);
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 20);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1663,13 +1500,12 @@ static void halbtc8723b1ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
|
||||
if (!bt_link_info->sco_exist && !bt_link_info->hid_exist) {
|
||||
halbtc8723b1ant_limited_tx(btcoexist, NORMAL_EXEC, 0, 0, 0, 0);
|
||||
} else {
|
||||
if (wifi_connected) {
|
||||
if (wifi_connected)
|
||||
halbtc8723b1ant_limited_tx(btcoexist,
|
||||
NORMAL_EXEC, 1, 1, 1, 1);
|
||||
} else {
|
||||
else
|
||||
halbtc8723b1ant_limited_tx(btcoexist, NORMAL_EXEC,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (bt_link_info->sco_exist) {
|
||||
@ -1784,22 +1620,19 @@ static void halbtc8723b1ant_init_hw_config(struct btc_coexist *btcoexist,
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x790, u8tmp);
|
||||
|
||||
/* Enable counter statistics */
|
||||
/*0x76e[3] =1, WLAN_Act control by PTA */
|
||||
/*0x76e[3] = 1, WLAN_Act control by PTA */
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x778, 0x1);
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
|
||||
|
||||
/*Antenna config */
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_PTA, true, false);
|
||||
/* Antenna config */
|
||||
halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_PTA, true, false);
|
||||
/* PTA parameter */
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
* work around function start with wa_halbtc8723b1ant_
|
||||
**************************************************************/
|
||||
/**************************************************************
|
||||
* extern function start with EXhalbtc8723b1ant_
|
||||
* extern function start with ex_halbtc8723b1ant_
|
||||
**************************************************************/
|
||||
|
||||
void ex_halbtc8723b1ant_init_hwconfig(struct btc_coexist *btcoexist)
|
||||
@ -1953,7 +1786,7 @@ void ex_halbtc8723b1ant_display_coex_info(struct btc_coexist *btcoexist)
|
||||
if (coex_sta->bt_info_c2h_cnt[i]) {
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
|
||||
"\r\n %-35s = %7ph(%d)",
|
||||
GLBtInfoSrc8723b1Ant[i],
|
||||
glbt_info_src_8723b_1ant[i],
|
||||
coex_sta->bt_info_c2h[i],
|
||||
coex_sta->bt_info_c2h_cnt[i]);
|
||||
}
|
||||
@ -2111,8 +1944,8 @@ void ex_halbtc8723b1ant_ips_notify(struct btc_coexist *btcoexist, u8 type)
|
||||
"[BTCoex], IPS ENTER notify\n");
|
||||
coex_sta->under_ips = true;
|
||||
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT,
|
||||
false, true);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_BT,
|
||||
false, true);
|
||||
/* set PTA control */
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
|
||||
halbtc8723b1ant_coex_table_with_type(btcoexist,
|
||||
@ -2187,14 +2020,17 @@ void ex_halbtc8723b1ant_scan_notify(struct btc_coexist *btcoexist, u8 type)
|
||||
if (BTC_SCAN_START == type) {
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], SCAN START notify\n");
|
||||
if (!wifi_connected) /* non-connected scan */
|
||||
if (!wifi_connected)
|
||||
/* non-connected scan */
|
||||
btc8723b1ant_action_wifi_not_conn_scan(btcoexist);
|
||||
else /* wifi is connected */
|
||||
else
|
||||
/* wifi is connected */
|
||||
btc8723b1ant_action_wifi_conn_scan(btcoexist);
|
||||
} else if (BTC_SCAN_FINISH == type) {
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], SCAN FINISH notify\n");
|
||||
if (!wifi_connected) /* non-connected scan */
|
||||
if (!wifi_connected)
|
||||
/* non-connected scan */
|
||||
btc8723b1ant_action_wifi_not_conn(btcoexist);
|
||||
else
|
||||
halbtc8723b1ant_action_wifi_connected(btcoexist);
|
||||
@ -2244,7 +2080,8 @@ void ex_halbtc8723b1ant_connect_notify(struct btc_coexist *btcoexist, u8 type)
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
|
||||
&wifi_connected);
|
||||
if (!wifi_connected) /* non-connected scan */
|
||||
if (!wifi_connected)
|
||||
/* non-connected scan */
|
||||
btc8723b1ant_action_wifi_not_conn(btcoexist);
|
||||
else
|
||||
halbtc8723b1ant_action_wifi_connected(btcoexist);
|
||||
@ -2433,7 +2270,8 @@ void ex_halbtc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
|
||||
coex_sta->a2dp_exist = false;
|
||||
coex_sta->hid_exist = false;
|
||||
coex_sta->sco_exist = false;
|
||||
} else { /* connection exists */
|
||||
} else {
|
||||
/* connection exists */
|
||||
coex_sta->bt_link_exist = true;
|
||||
if (bt_info & BT_INFO_8723B_1ANT_B_FTP)
|
||||
coex_sta->pan_exist = true;
|
||||
@ -2502,7 +2340,7 @@ void ex_halbtc8723b1ant_halt_notify(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->stop_coex_dm = true;
|
||||
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT, false, true);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_BT, false, true);
|
||||
|
||||
halbtc8723b1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
|
||||
|
||||
@ -2523,8 +2361,8 @@ void ex_halbtc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], Pnp notify to SLEEP\n");
|
||||
btcoexist->stop_coex_dm = true;
|
||||
halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT, false,
|
||||
true);
|
||||
halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_BT, false,
|
||||
true);
|
||||
halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
|
||||
0x0, 0x0);
|
||||
halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
|
||||
|
@ -676,15 +676,15 @@ static void btc8723b_set_penalty_txrate(struct btc_coexist *btcoexist,
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
u8 h2c_parameter[6] = {0};
|
||||
|
||||
h2c_parameter[0] = 0x6; /* opCode, 0x6= Retry_Penalty*/
|
||||
h2c_parameter[0] = 0x6; /* op_code, 0x6 = Retry_Penalty */
|
||||
|
||||
if (low_penalty_ra) {
|
||||
h2c_parameter[1] |= BIT0;
|
||||
/*normal rate except MCS7/6/5, OFDM54/48/36*/
|
||||
/* normal rate except MCS7/6/5, OFDM54/48/36 */
|
||||
h2c_parameter[2] = 0x00;
|
||||
h2c_parameter[3] = 0xf7; /*MCS7 or OFDM54*/
|
||||
h2c_parameter[4] = 0xf8; /*MCS6 or OFDM48*/
|
||||
h2c_parameter[5] = 0xf9; /*MCS5 or OFDM36*/
|
||||
h2c_parameter[3] = 0xf7; /* MCS7 or OFDM54 */
|
||||
h2c_parameter[4] = 0xf8; /* MCS6 or OFDM48 */
|
||||
h2c_parameter[5] = 0xf9; /* MCS5 or OFDM36 */
|
||||
}
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
@ -699,7 +699,6 @@ static void btc8723b2ant_low_penalty_ra(struct btc_coexist *btcoexist,
|
||||
{
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
|
||||
/*return; */
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], %s turn LowPenaltyRA = %s\n",
|
||||
(force_exec ? "force to" : ""), (low_penalty_ra ?
|
||||
@ -741,9 +740,9 @@ static void btc8723b2ant_set_sw_fulltime_dac_swing(struct btc_coexist *btcoex,
|
||||
btc8723b2ant_set_dac_swing_reg(btcoex, 0x18);
|
||||
}
|
||||
|
||||
static void btc8723b2ant_dac_swing(struct btc_coexist *btcoexist,
|
||||
bool force_exec, bool dac_swing_on,
|
||||
u32 dac_swing_lvl)
|
||||
void btc8723b2ant_dac_swing(struct btc_coexist *btcoexist,
|
||||
bool force_exec, bool dac_swing_on,
|
||||
u32 dac_swing_lvl)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = btcoexist->adapter;
|
||||
|
||||
@ -838,8 +837,8 @@ static void btc8723b2ant_coex_table(struct btc_coexist *btcoexist,
|
||||
coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc;
|
||||
}
|
||||
|
||||
static void btc8723b_coex_tbl_type(struct btc_coexist *btcoexist,
|
||||
bool force_exec, u8 type)
|
||||
static void btc8723b2ant_coex_table_with_type(struct btc_coexist *btcoexist,
|
||||
bool force_exec, u8 type)
|
||||
{
|
||||
switch (type) {
|
||||
case 0:
|
||||
@ -906,7 +905,7 @@ static void btc8723b2ant_set_fw_ignore_wlan_act(struct btc_coexist *btcoexist,
|
||||
u8 h2c_parameter[1] = {0};
|
||||
|
||||
if (enable)
|
||||
h2c_parameter[0] |= BIT0;/* function enable*/
|
||||
h2c_parameter[0] |= BIT0; /* function enable */
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63=0x%x\n",
|
||||
@ -967,9 +966,9 @@ static void btc8723b2ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, u8 byte1,
|
||||
btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter);
|
||||
}
|
||||
|
||||
static void btc8723b2ant_sw_mechanism1(struct btc_coexist *btcoexist,
|
||||
bool shrink_rx_lpf, bool low_penalty_ra,
|
||||
bool limited_dig, bool bt_lna_constrain)
|
||||
static void btc8723b2ant_sw_mechanism(struct btc_coexist *btcoexist,
|
||||
bool shrink_rx_lpf, bool low_penalty_ra,
|
||||
bool limited_dig, bool bt_lna_constrain)
|
||||
{
|
||||
btc8723b2ant_low_penalty_ra(btcoexist, NORMAL_EXEC, low_penalty_ra);
|
||||
}
|
||||
@ -1208,11 +1207,11 @@ static void btc8723b2ant_coex_alloff(struct btc_coexist *btcoexist)
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
|
||||
|
||||
/* sw all off */
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false, false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
|
||||
|
||||
/* hw all off */
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
|
||||
}
|
||||
|
||||
static void btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist)
|
||||
@ -1223,7 +1222,9 @@ static void btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist)
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, FORCE_EXEC, false);
|
||||
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false, false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
|
||||
|
||||
coex_sta->pop_event_cnt = 0;
|
||||
}
|
||||
|
||||
static void btc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist)
|
||||
@ -1237,22 +1238,16 @@ static void btc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist)
|
||||
&wifi_connected);
|
||||
|
||||
if (wifi_connected) {
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 3);
|
||||
} else {
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
}
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
|
||||
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false, false, false);
|
||||
|
||||
coex_dm->need_recover_0x948 = true;
|
||||
coex_dm->backup_0x948 = btcoexist->btc_read_2byte(btcoexist, 0x948);
|
||||
|
||||
btc8723b2ant_set_ant_path(btcoexist, BTC_ANT_WIFI_AT_AUX,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
|
||||
}
|
||||
|
||||
static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
|
||||
@ -1277,13 +1272,13 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff,
|
||||
0x0);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
|
||||
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false, false,
|
||||
false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false, false,
|
||||
false);
|
||||
|
||||
common = true;
|
||||
} else {
|
||||
@ -1299,15 +1294,16 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1,
|
||||
0xfffff, 0x0);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 0);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
|
||||
0xb);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC,
|
||||
false);
|
||||
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
|
||||
common = true;
|
||||
} else if (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE ==
|
||||
@ -1324,15 +1320,16 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1,
|
||||
0xfffff, 0x0);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 0);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
|
||||
0xb);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC,
|
||||
false);
|
||||
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
|
||||
common = true;
|
||||
} else {
|
||||
@ -1354,16 +1351,17 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A,
|
||||
0x1, 0xfffff, 0x0);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC,
|
||||
7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC,
|
||||
7);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC,
|
||||
true, 21);
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist,
|
||||
NORMAL_EXEC,
|
||||
0xb);
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false,
|
||||
false, false,
|
||||
false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false,
|
||||
false, false,
|
||||
false);
|
||||
common = true;
|
||||
}
|
||||
}
|
||||
@ -1542,8 +1540,11 @@ static void btc8723b2ant_tdma_duration_adjust(struct btc_coexist *btcoexist,
|
||||
"[BTCoex], max Interval = %d\n", max_interval);
|
||||
}
|
||||
|
||||
/*if current PsTdma not match with the recorded one (when scan, dhcp..),
|
||||
*then we have to adjust it back to the previous recorded one.
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"[BTCoex], max Interval = %d\n", max_interval);
|
||||
|
||||
/* if current PsTdma not match with the recorded one (scan, dhcp, ...),
|
||||
* then we have to adjust it back to the previous recorded one.
|
||||
*/
|
||||
if (coex_dm->cur_ps_tdma != coex_dm->tdma_adj_type) {
|
||||
bool scan = false, link = false, roam = false;
|
||||
@ -1579,33 +1580,34 @@ static void btc8723b2ant_action_sco(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
|
||||
/*for SCO quality at 11b/g mode*/
|
||||
if (BTC_WIFI_BW_LEGACY == wifi_bw)
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 2);
|
||||
else /*for SCO quality & wifi performance balance at 11n mode*/
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 8);
|
||||
/* for SCO quality at 11b/g mode */
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
|
||||
else
|
||||
/* for SCO quality & wifi performance balance at 11n mode */
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 8);
|
||||
|
||||
/*for voice quality */
|
||||
/* for voice quality */
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
|
||||
|
||||
/* sw mechanism */
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1625,10 +1627,13 @@ static void btc8723b2ant_action_hid(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
|
||||
if (BTC_WIFI_BW_LEGACY == wifi_bw) /*/for HID at 11b/g mode*/
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
else /*for HID quality & wifi performance balance at 11n mode*/
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 9);
|
||||
if (wifi_bw == BTC_WIFI_BW_LEGACY)
|
||||
/* for HID at 11b/g mode */
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
else
|
||||
/* for HID quality & wifi performance balance at 11n mode */
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 9);
|
||||
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
|
||||
@ -1640,25 +1645,25 @@ static void btc8723b2ant_action_hid(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*A2DP only / PAN(EDR) only/ A2DP+PAN(HS)*/
|
||||
/* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */
|
||||
static void btc8723b2ant_action_a2dp(struct btc_coexist *btcoexist)
|
||||
{
|
||||
u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
|
||||
@ -1680,17 +1685,17 @@ static void btc8723b2ant_action_a2dp(struct btc_coexist *btcoexist)
|
||||
0x0);
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
|
||||
/* sw mechanism */
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1699,7 +1704,7 @@ static void btc8723b2ant_action_a2dp(struct btc_coexist *btcoexist)
|
||||
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
|
||||
@ -1713,20 +1718,20 @@ static void btc8723b2ant_action_a2dp(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1743,30 +1748,29 @@ static void btc8723b2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist)
|
||||
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, false, true, 2);
|
||||
|
||||
/* sw mechanism */
|
||||
btcoexist->btc_get(btcoexist,
|
||||
BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1789,7 +1793,7 @@ static void btc8723b2ant_action_pan_edr(struct btc_coexist *btcoexist)
|
||||
else
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 10);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 10);
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
|
||||
@ -1802,25 +1806,25 @@ static void btc8723b2ant_action_pan_edr(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PAN(HS) only*/
|
||||
/* PAN(HS) only */
|
||||
static void btc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist)
|
||||
{
|
||||
u8 wifi_rssi_state;
|
||||
@ -1839,33 +1843,32 @@ static void btc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist)
|
||||
else
|
||||
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PAN(EDR)+A2DP*/
|
||||
/* PAN(EDR) + A2DP */
|
||||
static void btc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
|
||||
{
|
||||
u8 wifi_rssi_state, bt_rssi_state;
|
||||
@ -1888,7 +1891,7 @@ static void btc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 12);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 12);
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw)
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, false,
|
||||
true, 3);
|
||||
@ -1896,7 +1899,7 @@ static void btc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, false,
|
||||
false, 3);
|
||||
} else {
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, false, true, 3);
|
||||
}
|
||||
|
||||
@ -1904,20 +1907,20 @@ static void btc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, false,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1942,20 +1945,22 @@ static void btc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
|
||||
3);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 11);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 11);
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1,
|
||||
0xfffff, 0x780);
|
||||
} else {
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
|
||||
6);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist,
|
||||
NORMAL_EXEC, 7);
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1,
|
||||
0xfffff, 0x0);
|
||||
}
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, true, false, 2);
|
||||
} else {
|
||||
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 11);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 11);
|
||||
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff,
|
||||
0x0);
|
||||
btc8723b2ant_tdma_duration_adjust(btcoexist, true, true, 2);
|
||||
@ -1965,25 +1970,25 @@ static void btc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* HID+A2DP+PAN(EDR) */
|
||||
/* HID + A2DP + PAN(EDR) */
|
||||
static void btc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist)
|
||||
{
|
||||
u8 wifi_rssi_state, bt_rssi_state;
|
||||
@ -2004,7 +2009,7 @@ static void btc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
@ -2022,20 +2027,20 @@ static void btc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2055,7 +2060,7 @@ static void btc8723b2ant_action_hid_a2dp(struct btc_coexist *btcoexist)
|
||||
|
||||
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
|
||||
|
||||
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
|
||||
|
||||
if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
|
||||
@ -2067,20 +2072,20 @@ static void btc8723b2ant_action_hid_a2dp(struct btc_coexist *btcoexist)
|
||||
if (BTC_WIFI_BW_HT40 == wifi_bw) {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, true, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, true, true,
|
||||
false, false);
|
||||
}
|
||||
} else {
|
||||
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
|
||||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
} else {
|
||||
btc8723b2ant_sw_mechanism1(btcoexist, false, true,
|
||||
false, false);
|
||||
btc8723b2ant_sw_mechanism(btcoexist, false, true,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2209,10 +2214,7 @@ static void btc8723b2ant_wifioff_hwcfg(struct btc_coexist *btcoexist)
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* work around function start with wa_btc8723b2ant_
|
||||
*********************************************************************/
|
||||
/*********************************************************************
|
||||
* extern function start with EXbtc8723b2ant_
|
||||
* extern function start with ex_btc8723b2ant_
|
||||
*********************************************************************/
|
||||
void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
|
||||
{
|
||||
@ -2230,14 +2232,14 @@ void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
|
||||
u8tmp |= 0x5;
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x790, u8tmp);
|
||||
|
||||
/*Antenna config */
|
||||
/* Antenna config */
|
||||
btc8723b2ant_set_ant_path(btcoexist, BTC_ANT_WIFI_AT_MAIN,
|
||||
true, false);
|
||||
/* PTA parameter */
|
||||
btc8723b_coex_tbl_type(btcoexist, FORCE_EXEC, 0);
|
||||
btc8723b2ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0);
|
||||
|
||||
/* Enable counter statistics */
|
||||
/*0x76e[3] =1, WLAN_Act control by PTA*/
|
||||
/* 0x76e[3] = 1, WLAN_ACT controlled by PTA */
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
|
||||
btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
|
||||
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
|
||||
@ -2615,7 +2617,7 @@ void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
|
||||
coex_sta->bt_info_c2h[rsp_source][i] = tmpbuf[i];
|
||||
if (i == 1)
|
||||
bt_info = tmpbuf[i];
|
||||
if (i == length-1)
|
||||
if (i == length - 1)
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
"0x%02x]\n", tmpbuf[i]);
|
||||
else
|
||||
@ -2630,7 +2632,7 @@ void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
|
||||
}
|
||||
|
||||
if (BT_INFO_SRC_8723B_2ANT_WIFI_FW != rsp_source) {
|
||||
coex_sta->bt_retry_cnt = /* [3:0]*/
|
||||
coex_sta->bt_retry_cnt =
|
||||
coex_sta->bt_info_c2h[rsp_source][2] & 0xf;
|
||||
|
||||
coex_sta->bt_rssi =
|
||||
@ -2640,7 +2642,7 @@ void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
|
||||
coex_sta->bt_info_c2h[rsp_source][4];
|
||||
|
||||
/* Here we need to resend some wifi info to BT
|
||||
because bt is reset and loss of the info.
|
||||
* because BT is reset and loss of the info.
|
||||
*/
|
||||
if ((coex_sta->bt_info_ext & BIT1)) {
|
||||
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
|
||||
@ -2675,20 +2677,21 @@ void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check BIT2 first ==> check if bt is under inquiry or page scan*/
|
||||
/* check BIT2 first ==> check if bt is under inquiry or page scan */
|
||||
if (bt_info & BT_INFO_8723B_2ANT_B_INQ_PAGE)
|
||||
coex_sta->c2h_bt_inquiry_page = true;
|
||||
else
|
||||
coex_sta->c2h_bt_inquiry_page = false;
|
||||
|
||||
/* set link exist status*/
|
||||
if (!(bt_info & BT_INFO_8723B_2ANT_B_CONNECTION)) {
|
||||
/* set link exist status */
|
||||
coex_sta->bt_link_exist = false;
|
||||
coex_sta->pan_exist = false;
|
||||
coex_sta->a2dp_exist = false;
|
||||
coex_sta->hid_exist = false;
|
||||
coex_sta->sco_exist = false;
|
||||
} else { /* connection exists */
|
||||
} else {
|
||||
/* connection exists */
|
||||
coex_sta->bt_link_exist = true;
|
||||
if (bt_info & BT_INFO_8723B_2ANT_B_FTP)
|
||||
coex_sta->pan_exist = true;
|
||||
|
@ -148,6 +148,7 @@ struct coex_sta_8723b_2ant {
|
||||
bool c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
};
|
||||
|
||||
/*********************************************************************
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -146,7 +146,7 @@ struct coex_sta_8821a_1ant {
|
||||
bool hid_exist;
|
||||
bool pan_exist;
|
||||
|
||||
bool under_Lps;
|
||||
bool under_lps;
|
||||
bool under_ips;
|
||||
u32 special_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -466,7 +466,7 @@ static bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf)
|
||||
case BTC_SET_ACT_DISABLE_LOW_POWER:
|
||||
halbtc_disable_low_power();
|
||||
break;
|
||||
case BTC_SET_ACT_UPDATE_ra_mask:
|
||||
case BTC_SET_ACT_UPDATE_RAMASK:
|
||||
btcoexist->bt_info.ra_mask = *u32_tmp;
|
||||
break;
|
||||
case BTC_SET_ACT_SEND_MIMO_PS:
|
||||
|
@ -275,7 +275,7 @@ enum btc_set_type {
|
||||
BTC_SET_ACT_NORMAL_LPS,
|
||||
BTC_SET_ACT_INC_FORCE_EXEC_PWR_CMD_CNT,
|
||||
BTC_SET_ACT_DISABLE_LOW_POWER,
|
||||
BTC_SET_ACT_UPDATE_ra_mask,
|
||||
BTC_SET_ACT_UPDATE_RAMASK,
|
||||
BTC_SET_ACT_SEND_MIMO_PS,
|
||||
/* BT Coex related */
|
||||
BTC_SET_ACT_CTRL_BT_INFO,
|
||||
|
Loading…
Reference in New Issue
Block a user