2017-04-15 20:32:06

by Larry Finger

[permalink] [raw]
Subject: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

These patches are the second set of patches for file
btcoexist/halbtc8821a2ant.c.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
Cc: Steven Ting <[email protected]>

Yan-Hsuan Chuang (14):
rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is
sco_only
rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi
rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A
rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state
rtlwifi: btcoex: 21a 2ant: fix some coding style issues
rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx
agg size
rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast
rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network
status
rtlwifi: btcoex: 21a 2ant: notify fw the number of APs
rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set
tdma
rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold
rtlwifi: btcoex: 21a 2ant: do not limit rx agg size
rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips
rtlwifi: btcoex: 21a 2ant: wifi is linking action

.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 487 +++++++++++----------
1 file changed, 264 insertions(+), 223 deletions(-)

--
2.12.0


2017-04-15 20:32:11

by Larry Finger

[permalink] [raw]
Subject: [PATCH 05/14] rtlwifi: btcoex: 21a 2ant: fix some coding style issues

From: Yan-Hsuan Chuang <[email protected]>

Fix some ident and naming for linux coding style.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 62c3556e83b5..bbce0cbe2e9a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3512,8 +3512,7 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
return;
}

- btcoexist->btc_get(btcoexist,
- BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
+ btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);

if (wifi_under_5g) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
@@ -3629,15 +3628,15 @@ void ex_btc8821a2ant_init_hwconfig(struct btc_coexist *btcoexist)
u1tmp |= 0x5;
btcoexist->btc_write_1byte(btcoexist, 0x790, u1tmp);

- /*Antenna config */
+ /* Antenna config */
btc8821a2ant_set_ant_path(btcoexist, BTC_ANT_WIFI_AT_MAIN, true, false);

/* PTA parameter */
btc8821a2ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0);

/* Enable counter statistics */
- /*0x76e[3] = 1, WLAN_Act control by PTA*/
- btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
+ /* 0x76e[3] = 1, WLAN_Act control by PTA */
+ btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4);
btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
}
--
2.12.0

2017-04-15 20:32:12

by Larry Finger

[permalink] [raw]
Subject: [PATCH 07/14] rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast

From: Yan-Hsuan Chuang <[email protected]>

For p2p/miracast, the wifi may have multiple ports for different roles.
Under this, we need extra settings for turning off the tdma and proper
coex table parameters.

We monnitor the number of links on a port to determine if it is for
p2p/miracast or not.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
Cc: Steven Ting <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 9df5b4c195ff..4471bd66a2e5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3495,11 +3495,31 @@ static void btc8821a2ant_action_hid_a2dp(struct btc_coexist *btcoexist)
}
}

+static void btc8821a2ant_action_wifi_multi_port(struct btc_coexist *btcoexist)
+{
+ btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
+
+ /* sw all off */
+ btc8821a2ant_sw_mechanism1(btcoexist, false, false, false, false);
+ btc8821a2ant_sw_mechanism2(btcoexist, false, false, false, 0x18);
+
+ /* hw all off */
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
+
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
+}
+
static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
+ struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
bool wifi_under_5g = false;
u8 algorithm = 0;
+ u32 num_of_wifi_link = 0;
+ u32 wifi_link_status = 0;
+ bool miracast_plus_bt = false;

if (btcoexist->manual_control) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
@@ -3525,6 +3545,33 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
return;
}

+ /* for P2P */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
+ &wifi_link_status);
+ num_of_wifi_link = wifi_link_status >> 16;
+
+ if ((num_of_wifi_link >= 2) ||
+ (wifi_link_status & WIFI_P2P_GO_CONNECTED)) {
+ RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+ "############# [BTCoex], Multi-Port num_of_wifi_link = %d, wifi_link_status = 0x%x\n",
+ num_of_wifi_link, wifi_link_status);
+
+ if (bt_link_info->bt_link_exist)
+ miracast_plus_bt = true;
+ else
+ miracast_plus_bt = false;
+
+ btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT,
+ &miracast_plus_bt);
+ btc8821a2ant_action_wifi_multi_port(btcoexist);
+
+ return;
+ }
+
+ miracast_plus_bt = false;
+ btcoexist->btc_set(btcoexist, BTC_SET_BL_MIRACAST_PLUS_BT,
+ &miracast_plus_bt);
+
coex_dm->cur_algorithm = algorithm;
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], Algorithm = %d\n", coex_dm->cur_algorithm);
--
2.12.0

2017-04-21 06:55:30

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

Larry Finger <[email protected]> writes:

> On 04/19/2017 11:59 PM, Kalle Valo wrote:
>> Larry Finger <[email protected]> writes:
>>
>>> These patches are the second set of patches for file
>>> btcoexist/halbtc8821a2ant.c.
>>>
>>> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
>>> Signed-off-by: Larry Finger <[email protected]>
>>> Cc: Pkshih <[email protected]>
>>> Cc: Birming Chiu <[email protected]>
>>> Cc: Shaofu <[email protected]>
>>> Cc: Steven Ting <[email protected]>
>>
>> BTW, please try to limit the amount of patches you send. I haven't
>> counted how many rtlwifi patches there are from the last week but it's
>> just too much, even if they are in smaller sets like this one. Reviewing
>> them is just too tedious when you see that you have something like 50
>> more still to go.
>>
>> If you send two sets with reasonable size[1] per week I don't have any
>> problems. But if you send five such sets per week I will get annoyed :)
>> So try to strect the submission a bit to stay below ~30 patches per week
>> limit, please.
>>
>> So I'm not sure if I'm able to apply all of pending rtlwifi patches
>> before the merge window opens, but I'll try.
>>
>> [1] a reasonable size is around a dozen patches per set
>
> Kalle,
>
> Sorry about the heavy load. I received the patches from Realtek late
> in the 4.12 cycle, and I was trying to make the deadline.

Yeah, I guessed it was something like that.

> Please drop the following sets of patches:
>
> [PATCH 00/10] rtlwifi: btcoex: Third set of changes for rtl8821ae 2ant
> [PATCH 00/13] rtlwifi: btcoex: Second set of 21a 1ant changes
> [PATCH 00/27] rtlwifi: btcoex: Changes for 23b 1ant
> [PATCH 0/2] rtlwifi: btcoex: Two more patches

Ok, I dropped these now from patchwork.

But what should I do with this one:

rtlwifi: rtl8821ae: setup 8812ae RFE according to device type
https://patchwork.kernel.org/patch/9683395/

> I believe that is all of the sets that have not yet been merged.

Correct, they were in deferred state as I didn't have time to review
them earlier this week.

> We will fix the issue of the conditionals that you asked about in a
> second E-mail. That is the one that my Chinese Colleagues ask about in
> Chinese.
>
> These will be resubmitted for the 4.13 cycle in smaller sets and no
> more than two sets per week.

That sounds good, thanks! And if we get lucky and Linus doesn't open the
merge window on Sunday we will have one more week to get the patches
applied to 4.12.

--
Kalle Valo

2017-04-21 15:52:26

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

On 04/21/2017 01:55 AM, Kalle Valo wrote:
> But what should I do with this one:
>
> rtlwifi: rtl8821ae: setup 8812ae RFE according to device type
> https://patchwork.kernel.org/patch/9683395/

Please apply that one. It should not conflict due to dropping the others.

Thanks,

Larry

2017-04-15 20:32:12

by Larry Finger

[permalink] [raw]
Subject: [PATCH 06/14] rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size

From: Yan-Hsuan Chuang <[email protected]>

Monitor the rssi state to set the tdma and limit rx aggregation size to
fit the bt profiling.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
Cc: Steven Ting <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 51 ++++++++++------------
1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index bbce0cbe2e9a..9df5b4c195ff 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2875,33 +2875,40 @@ static void btc8821a2ant_action_a2dp(struct btc_coexist *btcoexist)

static void btc8821a2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist)
{
- u8 wifi_rssi_state, bt_rssi_state, bt_info_ext;
+ u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
u32 wifi_bw;

- bt_info_ext = coex_sta->bt_info_ext;
wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
+ BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);
+
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
+ btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

if (BTC_RSSI_HIGH(bt_rssi_state))
btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
else
btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);

- btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (BTC_RSSI_HIGH(wifi_rssi_state1) && BTC_RSSI_HIGH(bt_rssi_state)) {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);
+ } else {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 13);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_LPS_ON, 0x50,
+ 0x4);
+ }

- if (wifi_bw == BTC_WIFI_BW_HT40) {
- /* fw mechanism */
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 2);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 1);
- }
+ btc8821a2ant_tdma_duration_adjust(btcoexist, false, true, 2);

- /* sw mechanism */
+ /* sw mechanism */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, false,
@@ -2915,18 +2922,6 @@ static void btc8821a2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist)
false, 0x18);
}
} else {
- /* fw mechanism */
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 2);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 1);
- }
-
- /* sw mechanism */
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, false,
--
2.12.0

2017-04-15 20:32:14

by Larry Finger

[permalink] [raw]
Subject: [PATCH 09/14] rtlwifi: btcoex: 21a 2ant: notify fw the number of APs

From: Yan-Hsuan Chuang <[email protected]>

Use h2c to tell the firmware if the number of AP is more than 10 or
not.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
Cc: Steven Ting <[email protected]>
---
.../net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index b93a4f7ce17a..9e152117730c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3982,6 +3982,7 @@ void ex_btc8821a2ant_media_status_notify(struct btc_coexist *btcoexist,
u8 h2c_parameter[3] = {0};
u32 wifi_bw;
u8 wifi_central_chnl;
+ u8 ap_num = 0;

if (BTC_MEDIA_CONNECT == type) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
@@ -3999,10 +4000,15 @@ void ex_btc8821a2ant_media_status_notify(struct btc_coexist *btcoexist,
h2c_parameter[0] = 0x1;
h2c_parameter[1] = wifi_central_chnl;
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
- if (BTC_WIFI_BW_HT40 == wifi_bw)
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
h2c_parameter[2] = 0x30;
- else
+ } else {
h2c_parameter[2] = 0x20;
+ if (ap_num < 10)
+ h2c_parameter[2] = 0x30;
+ else
+ h2c_parameter[2] = 0x20;
+ }
}

coex_dm->wifi_chnl_info[0] = h2c_parameter[0];
--
2.12.0

2017-04-15 20:32:15

by Larry Finger

[permalink] [raw]
Subject: [PATCH 10/14] rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma

From: Yan-Hsuan Chuang <[email protected]>

Check the bt rssi first and decrease it if the bt rssi is too high.
Then set the tdma and coex table.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 140 +++++++--------------
1 file changed, 48 insertions(+), 92 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 9e152117730c..626b73fd97a5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3009,28 +3009,31 @@ static void btc8821a2ant_action_pan_edr(struct btc_coexist *btcoexist)
/* PAN(HS) only */
static void btc8821a2ant_action_pan_hs(struct btc_coexist *btcoexist)
{
- u8 wifi_rssi_state, bt_rssi_state;
+ u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
u32 wifi_bw;

wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
+ BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);
+
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);

btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

- btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (BTC_RSSI_HIGH(bt_rssi_state))
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
+ else
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);

- if (BTC_WIFI_BW_HT40 == wifi_bw) {
- /* fw mechanism */
- if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, true);
- } else {
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
- }
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);

- /* sw mechanism */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, false,
@@ -3044,22 +3047,6 @@ static void btc8821a2ant_action_pan_hs(struct btc_coexist *btcoexist)
false, 0x18);
}
} else {
- /* fw mechanism */
- if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, true);
- } else {
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
- }
-
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
- } else {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
- }
-
- /* sw mechanism */
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, false,
@@ -3078,12 +3065,18 @@ static void btc8821a2ant_action_pan_hs(struct btc_coexist *btcoexist)
/* PAN(EDR)+A2DP */
static void btc8821a2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
{
- u8 wifi_rssi_state, bt_rssi_state, bt_info_ext;
- u32 wifi_bw;
+ u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
+ u32 wifi_bw;

- bt_info_ext = coex_sta->bt_info_ext;
wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
+ BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);
+
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);

btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

@@ -3092,44 +3085,32 @@ static void btc8821a2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
else
btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);

+ if (BTC_RSSI_HIGH(wifi_rssi_state1) && BTC_RSSI_HIGH(bt_rssi_state))
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);
+ else
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_LPS_ON, 0x50,
+ 0x4);
+
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);

- if (wifi_bw == BTC_WIFI_BW_LEGACY) {
- /* for HID at 11b/g mode */
- btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC, 0x55ff55ff,
- 0x5afa5afa, 0xffff, 0x3);
+ if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
+ (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 12);
+
+ if (wifi_bw == BTC_WIFI_BW_HT40)
+ btc8821a2ant_tdma_duration_adjust(btcoexist, false,
+ true, 3);
+ else
+ btc8821a2ant_tdma_duration_adjust(btcoexist, false,
+ false, 3);
} else {
- /* for HID quality & wifi performance balance at 11n mode */
- btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC, 0x55ff55ff,
- 0x5afa5afa, 0xffff, 0x3);
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 13);
+ btc8821a2ant_tdma_duration_adjust(btcoexist, false, true, 3);
}

- if (BTC_WIFI_BW_HT40 == wifi_bw) {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, false, 3);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, false, 3);
- }
- } else {
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, true, 3);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, true, 3);
- }
- }
-
- /* sw mechanism */
+ /* sw mechanism */
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, false,
@@ -3141,33 +3122,8 @@ static void btc8821a2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
false, false);
btc8821a2ant_sw_mechanism2(btcoexist, false, false,
false, 0x18);
- };
- } else {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, false, 3);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, false, 3);
- }
- } else {
- if (bt_info_ext&BIT0) {
- /* a2dp basic rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, true, 3);
- } else {
- /* a2dp edr rate */
- btc8821a2ant_tdma_duration_adjust(btcoexist,
- false, true, 3);
- }
}
-
- /* sw mechanism */
+ } else {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, false,
--
2.12.0

2017-04-15 20:32:17

by Larry Finger

[permalink] [raw]
Subject: [PATCH 12/14] rtlwifi: btcoex: 21a 2ant: do not limit rx agg size

From: Yan-Hsuan Chuang <[email protected]>

For bt profiling, we do not need to limit the rx agg size.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 5a8e4b80006b..22cb8aa8208d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3148,7 +3148,6 @@ static void btc8821a2ant_action_pan_edr_hid(struct btc_coexist *btcoexist)
bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

- btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

if (BTC_RSSI_HIGH(bt_rssi_state))
--
2.12.0

2017-04-15 20:32:09

by Larry Finger

[permalink] [raw]
Subject: [PATCH 03/14] rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A

From: Yan-Hsuan Chuang <[email protected]>

Let the wifi use main antenna to have higher power.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index b880bc2eaf85..8437f1b6c108 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2714,6 +2714,8 @@ static void btc8821a2ant_action_hid(struct btc_coexist *btcoexist)
bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

--
2.12.0

2017-04-15 20:32:10

by Larry Finger

[permalink] [raw]
Subject: [PATCH 04/14] rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state

From: Yan-Hsuan Chuang <[email protected]>

For bt a2dp, we need to check more rssi state combinations to have
better voice quality.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 97 +++++++++++++++-------
1 file changed, 65 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 8437f1b6c108..62c3556e83b5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2771,36 +2771,80 @@ static void btc8821a2ant_action_hid(struct btc_coexist *btcoexist)
/* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */
static void btc8821a2ant_action_a2dp(struct btc_coexist *btcoexist)
{
- u8 wifi_rssi_state, bt_rssi_state;
+ u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
+ u8 ap_num = 0;
u32 wifi_bw;

- wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2,
- 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
+ wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
+ BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

- /* fw dac swing is called in btc8821a2ant_tdma_duration_adjust()
- * btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
- */
+ if ((ap_num >= 10) && BTC_RSSI_HIGH(wifi_rssi_state1) &&
+ BTC_RSSI_HIGH(bt_rssi_state)) {
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);

- if (BTC_RSSI_HIGH(bt_rssi_state))
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, true);
- else
- btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff,
+ 0x0);
+ btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false,
+ 0x8);
+ btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);

- btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);

- if (BTC_WIFI_BW_HT40 == wifi_bw) {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- false, 1);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 23);
+
+ /* sw mechanism */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
+ btc8821a2ant_sw_mechanism1(btcoexist, true, false,
+ false, false);
+ btc8821a2ant_sw_mechanism2(btcoexist, true, false,
+ true, 0x6);
} else {
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 1);
+ btc8821a2ant_sw_mechanism1(btcoexist, false, false,
+ false, false);
+ btc8821a2ant_sw_mechanism2(btcoexist, true, false,
+ true, 0x6);
}
+ return;
+ }

- /* sw mechanism */
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+ btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
+
+ btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
+
+ if (BTC_RSSI_HIGH(bt_rssi_state))
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
+ else
+ btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
+
+ if (BTC_RSSI_HIGH(wifi_rssi_state1) && BTC_RSSI_HIGH(bt_rssi_state)) {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);
+ } else {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 13);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_LPS_ON, 0x50,
+ 0x4);
+ }
+
+ if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
+ (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 23);
+ } else {
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 23);
+ }
+
+ /* sw mechanism */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, false,
@@ -2814,17 +2858,6 @@ static void btc8821a2ant_action_a2dp(struct btc_coexist *btcoexist)
false, 0x18);
}
} else {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- false, 1);
- } else {
- btc8821a2ant_tdma_duration_adjust(btcoexist, false,
- true, 1);
- }
-
- /* sw mechanism */
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, false,
--
2.12.0

2017-04-15 20:32:13

by Larry Finger

[permalink] [raw]
Subject: [PATCH 08/14] rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status

From: Yan-Hsuan Chuang <[email protected]>

Here we monitor one more wifi rssi to check the status of the network
and set the coex table instead of the legacy way.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
Cc: Steven Ting <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 51 +++++++++-------------
1 file changed, 21 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 4471bd66a2e5..b93a4f7ce17a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2939,11 +2939,18 @@ static void btc8821a2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist)

static void btc8821a2ant_action_pan_edr(struct btc_coexist *btcoexist)
{
- u8 wifi_rssi_state, bt_rssi_state;
+ u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
u32 wifi_bw;

wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
+ BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);
+
+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
+ btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);

btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);

@@ -2952,30 +2959,25 @@ static void btc8821a2ant_action_pan_edr(struct btc_coexist *btcoexist)
else
btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);

- btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
-
- if (BTC_WIFI_BW_LEGACY == wifi_bw) {
- /* for HID at 11b/g mode */
- btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC, 0x55ff55ff,
- 0x5aff5aff, 0xffff, 0x3);
+ if (BTC_RSSI_HIGH(wifi_rssi_state1) && BTC_RSSI_HIGH(bt_rssi_state)) {
+ btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 10);
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+ 0x0, 0x0);
} else {
btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 13);
btc8821a2ant_power_save_state(btcoexist, BTC_PS_LPS_ON, 0x50,
0x4);
}

- if (BTC_WIFI_BW_HT40 == wifi_bw) {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- true, 1);
- } else {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- true, 5);
- }
+ if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
+ (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 26);
+ else
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 26);

- /* sw mechanism */
+ /* sw mechanism */
+ btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, false,
@@ -2989,17 +2991,6 @@ static void btc8821a2ant_action_pan_edr(struct btc_coexist *btcoexist)
false, 0x18);
}
} else {
- /* fw mechanism */
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- true, 1);
- } else {
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- true, 5);
- }
-
- /* sw mechanism */
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, false,
--
2.12.0

2017-04-15 20:32:08

by Larry Finger

[permalink] [raw]
Subject: [PATCH 02/14] rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi

From: Yan-Hsuan Chuang <[email protected]>

The threshold is used to adjust the base line for the rssi state.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 7b5dbc62906e..b880bc2eaf85 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2711,7 +2711,8 @@ static void btc8821a2ant_action_hid(struct btc_coexist *btcoexist)
u32 wifi_bw;

wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
--
2.12.0

2017-04-15 20:32:07

by Larry Finger

[permalink] [raw]
Subject: [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only

From: Yan-Hsuan Chuang <[email protected]>

Use software dac swing and double check if it is sco_only to set the
tdma for voice quality.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
.../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 55 ++++++++++------------
1 file changed, 24 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 0ef83727fdf4..7b5dbc62906e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -2634,13 +2634,15 @@ static void btc8821a2ant_tdma_duration_adjust(struct btc_coexist *btcoexist,
/* SCO only or SCO+PAN(HS)*/
static void btc8821a2ant_action_sco(struct btc_coexist *btcoexist)
{
+ struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
u8 wifi_rssi_state, bt_rssi_state;
u32 wifi_bw;

- wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2,
- 15, 0);
+ wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);

+ btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
+
btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 4);

@@ -2656,58 +2658,49 @@ static void btc8821a2ant_action_sco(struct btc_coexist *btcoexist)
btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
} else {
/* for SCO quality & wifi performance balance at 11n mode */
- btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC,
- 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3);
- }
-
- if (wifi_bw == BTC_WIFI_BW_HT40) {
-
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- /* for voice quality */
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- false, 0);
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
+ btc8821a2ant_coex_table_with_type(btcoexist,
+ NORMAL_EXEC, 8);
} else {
- /* for voice quality */
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC,
- false, 0);
+ if (bt_link_info->sco_only)
+ btc8821a2ant_coex_table_with_type(
+ btcoexist, NORMAL_EXEC, 17);
+ else
+ btc8821a2ant_coex_table_with_type(
+ btcoexist, NORMAL_EXEC, 12);
}
+ }

- /* sw mechanism */
+ btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+ /* for voice quality */
+ btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
+
+ /* sw mechanism */
+ if (wifi_bw == BTC_WIFI_BW_HT40) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, true, true,
false, false);
btc8821a2ant_sw_mechanism2(btcoexist, true, false,
- false, 0x18);
+ true, 0x18);
} else {
btc8821a2ant_sw_mechanism1(btcoexist, true, true,
false, false);
btc8821a2ant_sw_mechanism2(btcoexist, false, false,
- false, 0x18);
+ true, 0x18);
}
} else {
- if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- /* for voice quality */
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
- } else {
- /* for voice quality */
- btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
- }
-
- /* sw mechanism */
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8821a2ant_sw_mechanism1(btcoexist, false, true,
false, false);
btc8821a2ant_sw_mechanism2(btcoexist, true, false,
- false, 0x18);
+ true, 0x18);
} else {
btc8821a2ant_sw_mechanism1(btcoexist, false, true,
false, false);
btc8821a2ant_sw_mechanism2(btcoexist, false, false,
- false, 0x18);
+ true, 0x18);
}
}
}
--
2.12.0

2017-04-15 20:32:19

by Larry Finger

[permalink] [raw]
Subject: [PATCH 14/14] rtlwifi: btcoex: 21a 2ant: wifi is linking action

From: Yan-Hsuan Chuang <[email protected]>

When wifi is under scanning/linking/roaming, do not run the reset of the
coex mechanism because these activities are important for wifi, just run
the linking process and return.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
.../net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 0aa36247e402..841b4a83ab70 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3467,6 +3467,7 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
u32 num_of_wifi_link = 0;
u32 wifi_link_status = 0;
bool miracast_plus_bt = false;
+ bool scan = false, link = false, roam = false;

if (btcoexist->manual_control) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
@@ -3498,6 +3499,17 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
return;
}

+ btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
+ btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
+ btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
+
+ if (scan || link || roam) {
+ RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+ "[BTCoex], WiFi is under Link Process !!\n");
+ btc8821a2ant_action_wifi_link_process(btcoexist);
+ return;
+ }
+
/* for P2P */
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
&wifi_link_status);
--
2.12.0

2017-04-24 11:26:12

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

Larry Finger <[email protected]> writes:

> On 04/21/2017 01:55 AM, Kalle Valo wrote:
>> But what should I do with this one:
>>
>> rtlwifi: rtl8821ae: setup 8812ae RFE according to device type
>> https://patchwork.kernel.org/patch/9683395/
>
> Please apply that one. It should not conflict due to dropping the others.

Ok, I'll take that one.

--
Kalle Valo

2017-04-20 18:54:24

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

On 04/19/2017 11:59 PM, Kalle Valo wrote:
> Larry Finger <[email protected]> writes:
>
>> These patches are the second set of patches for file
>> btcoexist/halbtc8821a2ant.c.
>>
>> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
>> Signed-off-by: Larry Finger <[email protected]>
>> Cc: Pkshih <[email protected]>
>> Cc: Birming Chiu <[email protected]>
>> Cc: Shaofu <[email protected]>
>> Cc: Steven Ting <[email protected]>
>
> BTW, please try to limit the amount of patches you send. I haven't
> counted how many rtlwifi patches there are from the last week but it's
> just too much, even if they are in smaller sets like this one. Reviewing
> them is just too tedious when you see that you have something like 50
> more still to go.
>
> If you send two sets with reasonable size[1] per week I don't have any
> problems. But if you send five such sets per week I will get annoyed :)
> So try to strect the submission a bit to stay below ~30 patches per week
> limit, please.
>
> So I'm not sure if I'm able to apply all of pending rtlwifi patches
> before the merge window opens, but I'll try.
>
> [1] a reasonable size is around a dozen patches per set

Kalle,

Sorry about the heavy load. I received the patches from Realtek late in the 4.12
cycle, and I was trying to make the deadline.

Please drop the following sets of patches:

[PATCH 00/10] rtlwifi: btcoex: Third set of changes for rtl8821ae 2ant
[PATCH 00/13] rtlwifi: btcoex: Second set of 21a 1ant changes
[PATCH 00/27] rtlwifi: btcoex: Changes for 23b 1ant
[PATCH 0/2] rtlwifi: btcoex: Two more patches

I believe that is all of the sets that have not yet been merged. We will fix the
issue of the conditionals that you asked about in a second E-mail. That is the
one that my Chinese Colleagues ask about in Chinese.

These will be resubmitted for the 4.13 cycle in smaller sets and no more than
two sets per week.

Thanks for all your efforts,

Larry

2017-04-20 04:59:24

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant

Larry Finger <[email protected]> writes:

> These patches are the second set of patches for file
> btcoexist/halbtc8821a2ant.c.
>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> Signed-off-by: Larry Finger <[email protected]>
> Cc: Pkshih <[email protected]>
> Cc: Birming Chiu <[email protected]>
> Cc: Shaofu <[email protected]>
> Cc: Steven Ting <[email protected]>

BTW, please try to limit the amount of patches you send. I haven't
counted how many rtlwifi patches there are from the last week but it's
just too much, even if they are in smaller sets like this one. Reviewing
them is just too tedious when you see that you have something like 50
more still to go.

If you send two sets with reasonable size[1] per week I don't have any
problems. But if you send five such sets per week I will get annoyed :)
So try to strect the submission a bit to stay below ~30 patches per week
limit, please.

So I'm not sure if I'm able to apply all of pending rtlwifi patches
before the merge window opens, but I'll try.

[1] a reasonable size is around a dozen patches per set

--
Kalle Valo

2017-04-15 20:32:18

by Larry Finger

[permalink] [raw]
Subject: [PATCH 13/14] rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips

From: Yan-Hsuan Chuang <[email protected]>

If wifi is in power saving mode, do nothing.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 6 ++++++
1 file changed, 6 insertions(+)
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 22cb8aa8208d..0aa36247e402 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3483,6 +3483,12 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
return;
}

+ if (coex_sta->under_ips) {
+ RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+ "[BTCoex], wifi is under IPS !!!\n");
+ return;
+ }
+
algorithm = btc8821a2ant_action_algorithm(btcoexist);
if (coex_sta->c2h_bt_inquiry_page &&
(BT_8821A_2ANT_COEX_ALGO_PANHS != algorithm)) {
--
2.12.0

2017-04-20 07:26:38

by Kalle Valo

[permalink] [raw]
Subject: Re: [01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only

Larry Finger <[email protected]> wrote:
> From: Yan-Hsuan Chuang <[email protected]>
>
> Use software dac swing and double check if it is sco_only to set the
> tdma for voice quality.
>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> Signed-off-by: Larry Finger <[email protected]>
> Cc: Pkshih <[email protected]>
> Cc: Birming Chiu <[email protected]>
> Cc: Shaofu <[email protected]>

14 patches applied to wireless-drivers-next.git, thanks.

1a2534930e9e rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only
124e50ff6582 rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi
10c2e1cc15e4 rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A
70a8adef7108 rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state
f0557cf062c7 rtlwifi: btcoex: 21a 2ant: fix some coding style issues
137cc90f094a rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size
0fcad45bdbf7 rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast
a4162ea71b39 rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status
f76184d02457 rtlwifi: btcoex: 21a 2ant: notify fw the number of APs
c129bc843b62 rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma
97632f8c0a93 rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold
63a7e8109b2c rtlwifi: btcoex: 21a 2ant: do not limit rx agg size
67cbe62a27dc rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips
f9558f5fc86b rtlwifi: btcoex: 21a 2ant: wifi is linking action

--
https://patchwork.kernel.org/patch/9682441/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2017-04-15 20:32:16

by Larry Finger

[permalink] [raw]
Subject: [PATCH 11/14] rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold

From: Yan-Hsuan Chuang <[email protected]>

Using macro to control the bt threshold.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Pkshih <[email protected]>
Cc: Birming Chiu <[email protected]>
Cc: Shaofu <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 626b73fd97a5..5a8e4b80006b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3145,7 +3145,8 @@ static void btc8821a2ant_action_pan_edr_hid(struct btc_coexist *btcoexist)
u32 wifi_bw;

wifi_rssi_state = btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
- bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist, 2, 35, 0);
+ bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
+ 2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

btc8821a2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8821a2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
--
2.12.0