All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
@ 2017-04-15 20:31 Larry Finger
  2017-04-15 20:31 ` [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only Larry Finger
                   ` (14 more replies)
  0 siblings, 15 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Larry Finger, Yan-Hsuan Chuang, Pkshih,
	Birming Chiu, Shaofu, Steven Ting

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

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>

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-20  7:26   ` [01/14] " Kalle Valo
  2017-04-15 20:31 ` [PATCH 02/14] rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi Larry Finger
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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 <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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/14] rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
  2017-04-15 20:31 ` [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 03/14] rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A Larry Finger
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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

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>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/14] rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
  2017-04-15 20:31 ` [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only Larry Finger
  2017-04-15 20:31 ` [PATCH 02/14] rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 04/14] rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state Larry Finger
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Let the wifi use main antenna to have higher power.

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>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/14] rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (2 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 03/14] rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 05/14] rtlwifi: btcoex: 21a 2ant: fix some coding style issues Larry Finger
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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

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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/14] rtlwifi: btcoex: 21a 2ant: fix some coding style issues
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (3 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 04/14] rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 06/14] rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size Larry Finger
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Fix some ident and naming for linux coding style.

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>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/14] rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (4 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 05/14] rtlwifi: btcoex: 21a 2ant: fix some coding style issues Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 07/14] rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast Larry Finger
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu, Steven Ting

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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

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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/14] rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (5 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 06/14] rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 08/14] rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status Larry Finger
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu, Steven Ting

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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 <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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/14] rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (6 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 07/14] rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 09/14] rtlwifi: btcoex: 21a 2ant: notify fw the number of APs Larry Finger
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu, Steven Ting

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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 <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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/14] rtlwifi: btcoex: 21a 2ant: notify fw the number of APs
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (7 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 08/14] rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 10/14] rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma Larry Finger
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu, Steven Ting

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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

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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/14] rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (8 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 09/14] rtlwifi: btcoex: 21a 2ant: notify fw the number of APs Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 11/14] rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold Larry Finger
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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 <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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/14] rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (9 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 10/14] rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 12/14] rtlwifi: btcoex: 21a 2ant: do not limit rx agg size Larry Finger
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Using macro to control the bt threshold.

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>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/14] rtlwifi: btcoex: 21a 2ant: do not limit rx agg size
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (10 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 11/14] rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:31 ` [PATCH 13/14] rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips Larry Finger
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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

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>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/14] rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (11 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 12/14] rtlwifi: btcoex: 21a 2ant: do not limit rx agg size Larry Finger
@ 2017-04-15 20:31 ` Larry Finger
  2017-04-15 20:32 ` [PATCH 14/14] rtlwifi: btcoex: 21a 2ant: wifi is linking action Larry Finger
  2017-04-20  4:59 ` [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Kalle Valo
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:31 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

If wifi is in power saving mode, do nothing.

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>
  ---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 14/14] rtlwifi: btcoex: 21a 2ant: wifi is linking action
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (12 preceding siblings ...)
  2017-04-15 20:31 ` [PATCH 13/14] rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips Larry Finger
@ 2017-04-15 20:32 ` Larry Finger
  2017-04-20  4:59 ` [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Kalle Valo
  14 siblings, 0 replies; 21+ messages in thread
From: Larry Finger @ 2017-04-15 20:32 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

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 <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>
---
 .../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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
  2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
                   ` (13 preceding siblings ...)
  2017-04-15 20:32 ` [PATCH 14/14] rtlwifi: btcoex: 21a 2ant: wifi is linking action Larry Finger
@ 2017-04-20  4:59 ` Kalle Valo
  2017-04-20 18:54   ` Larry Finger
  14 siblings, 1 reply; 21+ messages in thread
From: Kalle Valo @ 2017-04-20  4:59 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, Yan-Hsuan Chuang, Pkshih, Birming Chiu, Shaofu,
	Steven Ting

Larry Finger <Larry.Finger@lwfinger.net> writes:

> These patches are the second set of patches for file
> btcoexist/halbtc8821a2ant.c.
>
> 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>

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only
  2017-04-15 20:31 ` [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only Larry Finger
@ 2017-04-20  7:26   ` Kalle Valo
  0 siblings, 0 replies; 21+ messages in thread
From: Kalle Valo @ 2017-04-20  7:26 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, Yan-Hsuan Chuang, Larry Finger, Pkshih,
	Birming Chiu, Shaofu

Larry Finger <Larry.Finger@lwfinger.net> wrote:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
> 
> 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 <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>

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
  2017-04-20  4:59 ` [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Kalle Valo
@ 2017-04-20 18:54   ` Larry Finger
  2017-04-21  6:55     ` Kalle Valo
  0 siblings, 1 reply; 21+ messages in thread
From: Larry Finger @ 2017-04-20 18:54 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, Yan-Hsuan Chuang, Pkshih, Birming Chiu, Shaofu,
	Steven Ting

On 04/19/2017 11:59 PM, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
>
>> These patches are the second set of patches for file
>> btcoexist/halbtc8821a2ant.c.
>>
>> 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>
>
> 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
  2017-04-20 18:54   ` Larry Finger
@ 2017-04-21  6:55     ` Kalle Valo
  2017-04-21 14:40       ` Larry Finger
  0 siblings, 1 reply; 21+ messages in thread
From: Kalle Valo @ 2017-04-21  6:55 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, Yan-Hsuan Chuang, Pkshih, Birming Chiu, Shaofu,
	Steven Ting

Larry Finger <Larry.Finger@lwfinger.net> writes:

> On 04/19/2017 11:59 PM, Kalle Valo wrote:
>> Larry Finger <Larry.Finger@lwfinger.net> writes:
>>
>>> These patches are the second set of patches for file
>>> btcoexist/halbtc8821a2ant.c.
>>>
>>> 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>
>>
>> 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
  2017-04-21  6:55     ` Kalle Valo
@ 2017-04-21 14:40       ` Larry Finger
  2017-04-24 11:26         ` Kalle Valo
  0 siblings, 1 reply; 21+ messages in thread
From: Larry Finger @ 2017-04-21 14:40 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, Yan-Hsuan Chuang, Pkshih, Birming Chiu, Shaofu,
	Steven Ting

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant
  2017-04-21 14:40       ` Larry Finger
@ 2017-04-24 11:26         ` Kalle Valo
  0 siblings, 0 replies; 21+ messages in thread
From: Kalle Valo @ 2017-04-24 11:26 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, Yan-Hsuan Chuang, Pkshih, Birming Chiu, Shaofu,
	Steven Ting

Larry Finger <Larry.Finger@lwfinger.net> 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-04-24 11:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-15 20:31 [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Larry Finger
2017-04-15 20:31 ` [PATCH 01/14] rtlwifi: btcoex: 21a 2ant: turn on sw dac swing and check if is sco_only Larry Finger
2017-04-20  7:26   ` [01/14] " Kalle Valo
2017-04-15 20:31 ` [PATCH 02/14] rtlwifi: btcoex: 21a 2ant: add threshold to examine bt rssi Larry Finger
2017-04-15 20:31 ` [PATCH 03/14] rtlwifi: btcoex: 21a 2ant: force wifi to use RF path A Larry Finger
2017-04-15 20:31 ` [PATCH 04/14] rtlwifi: btcoex: 21a 2ant: more combinations of wifi/bt rssi state Larry Finger
2017-04-15 20:31 ` [PATCH 05/14] rtlwifi: btcoex: 21a 2ant: fix some coding style issues Larry Finger
2017-04-15 20:31 ` [PATCH 06/14] rtlwifi: btcoex: 21a 2ant: set tdma based on rssi state amd limit rx agg size Larry Finger
2017-04-15 20:31 ` [PATCH 07/14] rtlwifi: btcoex: 21a 2ant: add multiport action for p2p/miracast Larry Finger
2017-04-15 20:31 ` [PATCH 08/14] rtlwifi: btcoex: 21a 2ant: monitor extra wifi rssi to examine network status Larry Finger
2017-04-15 20:31 ` [PATCH 09/14] rtlwifi: btcoex: 21a 2ant: notify fw the number of APs Larry Finger
2017-04-15 20:31 ` [PATCH 10/14] rtlwifi: btcoex: 21a 2ant: dec bt power according to bt rssi and set tdma Larry Finger
2017-04-15 20:31 ` [PATCH 11/14] rtlwifi: btcoex: 21a 2ant: macro for bt rssi threshold Larry Finger
2017-04-15 20:31 ` [PATCH 12/14] rtlwifi: btcoex: 21a 2ant: do not limit rx agg size Larry Finger
2017-04-15 20:31 ` [PATCH 13/14] rtlwifi: btcoex: 21a 2ant: just return when wifi is under ips Larry Finger
2017-04-15 20:32 ` [PATCH 14/14] rtlwifi: btcoex: 21a 2ant: wifi is linking action Larry Finger
2017-04-20  4:59 ` [PATCH 00/14] rtlwifi: btcoex: Second set of changes for rtl8821ae 2ant Kalle Valo
2017-04-20 18:54   ` Larry Finger
2017-04-21  6:55     ` Kalle Valo
2017-04-21 14:40       ` Larry Finger
2017-04-24 11:26         ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.