All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance
@ 2020-11-11  2:20 pkshih
  2020-11-11  2:20 ` [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval pkshih
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:20 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ping-Ke Shih <pkshih@realtek.com>

This is second patchset of my total 32 coex patches, in which we fix and
update coex settings to enhance coex performance in field.

Ching-Te Ku (11):
  rtw88: coex: update TDMA settings for different beacon interval
  rtw88: coex: remove unnecessary feature/function
  rtw88: coex: add write scoreboard action when WLAN in critical
    procedure
  rtw88: coex: Add force flag for coexistence table function
  rtw88: coex: add the mechanism for RF4CE
  rtw88: coex: update the TDMA parameter when leave LPS
  rtw88: coex: Change antenna setting to enhance free-run performance
  rtw88: coex: fix BT performance drop during initial/power-on step
  rtw88: coex: remove write scan bit to scoreboard in scan and connect
    notify
  rtw88: coex: remove unnecessary WLAN slot extend
  rtw88: coex: change the decode method from firmware

 drivers/net/wireless/realtek/rtw88/coex.c     | 197 +++++++++++-------
 drivers/net/wireless/realtek/rtw88/mac80211.c |   7 +
 drivers/net/wireless/realtek/rtw88/main.h     |   1 +
 3 files changed, 129 insertions(+), 76 deletions(-)

-- 
2.21.0


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

* [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
@ 2020-11-11  2:20 ` pkshih
  2020-11-11  8:34   ` Kalle Valo
  2020-11-11  2:20 ` [PATCH 02/11] rtw88: coex: remove unnecessary feature/function pkshih
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: pkshih @ 2020-11-11  2:20 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Add considering for different WLAN beacon interval in coexistence
mechanism.
Because the WLAN beacon period may be not 100 ms, so it's necessary
to consider any beacon period and set timer according to the interval.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c     | 24 +++++++++++++++++--
 drivers/net/wireless/realtek/rtw88/mac80211.c |  7 ++++++
 drivers/net/wireless/realtek/rtw88/main.h     |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 61e91565cd7d..141aaa60c805 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -225,6 +225,7 @@ static void rtw_coex_tdma_timer_base(struct rtw_dev *rtwdev, u8 type)
 	struct rtw_coex *coex = &rtwdev->coex;
 	struct rtw_coex_stat *coex_stat = &coex->stat;
 	u8 para[2] = {0};
+	u16 tbtt_interval = coex_stat->wl_beacon_interval;
 
 	if (coex_stat->tdma_timer_base == type)
 		return;
@@ -233,10 +234,29 @@ static void rtw_coex_tdma_timer_base(struct rtw_dev *rtwdev, u8 type)
 
 	para[0] = COEX_H2C69_TDMA_SLOT;
 
-	if (type == 3) /* 4-slot  */
+	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], tbtt_interval = %d\n",
+		tbtt_interval);
+
+	if (type == 3) {			  /* 4-slot  */
 		para[1] = PARA1_H2C69_TDMA_4SLOT; /* 4-slot */
-	else /* 2-slot  */
+	} else if (tbtt_interval < 80 && tbtt_interval > 0) {
+		para[1] = (100 / tbtt_interval);
+
+		if (100 % tbtt_interval != 0)
+			para[1] = para[1] + 1;
+
+		para[1] = para[1] & 0x3f;
+	} else if (tbtt_interval >= 180) {
+		para[1] = (tbtt_interval / 100);
+
+		if (tbtt_interval % 100 <= 80)
+			para[1] = para[1] - 1;
+
+		para[1] = para[1] & 0x3f;
+		para[1] = para[1] | 0x80;
+	} else {
 		para[1] = PARA1_H2C69_TDMA_2SLOT;
+	}
 
 	rtw_fw_bt_wifi_control(rtwdev, para[0], &para[1]);
 
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index c69397719fdf..1f1b639cd124 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -351,6 +351,8 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
 {
 	struct rtw_dev *rtwdev = hw->priv;
 	struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
+	struct rtw_coex *coex = &rtwdev->coex;
+	struct rtw_coex_stat *coex_stat = &coex->stat;
 	u32 config = 0;
 
 	mutex_lock(&rtwdev->mutex);
@@ -381,6 +383,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
 		config |= PORT_SET_BSSID;
 	}
 
+	if (changed & BSS_CHANGED_BEACON_INT) {
+		if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_STATION)
+			coex_stat->wl_beacon_interval = conf->beacon_int;
+	}
+
 	if (changed & BSS_CHANGED_BEACON)
 		rtw_fw_download_rsvd_page(rtwdev);
 
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index a3a687a63734..3941aea51f9c 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1354,6 +1354,7 @@ struct rtw_coex_stat {
 	u8 bt_a2dp_bitpool;
 	u8 bt_iqk_state;
 
+	u16 wl_beacon_interval;
 	u8 wl_noisy_level;
 	u8 wl_fw_dbg_info[10];
 	u8 wl_fw_dbg_info_pre[10];
-- 
2.21.0


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

* [PATCH 02/11] rtw88: coex: remove unnecessary feature/function
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
  2020-11-11  2:20 ` [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval pkshih
@ 2020-11-11  2:20 ` pkshih
  2020-11-11  8:35   ` Kalle Valo
  2020-11-11  2:21 ` [PATCH 03/11] rtw88: coex: add write scoreboard action when WLAN in critical procedure pkshih
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: pkshih @ 2020-11-11  2:20 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

It is redundant to update WLAN RSSI, remove the update WLAN RSSI part.
Remove unused function.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 33 +++++++----------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 141aaa60c805..3a26453f4316 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -398,15 +398,16 @@ static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev)
 		coex_stat->bt_disabled = bt_disabled;
 		coex_stat->bt_ble_scan_type = 0;
 		coex_dm->cur_bt_lna_lvl = 0;
-	}
 
-	if (!coex_stat->bt_disabled) {
-		coex_stat->bt_reenable = true;
-		ieee80211_queue_delayed_work(rtwdev->hw,
-					     &coex->bt_reenable_work, 15 * HZ);
-	} else {
-		coex_stat->bt_mailbox_reply = false;
-		coex_stat->bt_reenable = false;
+		if (!coex_stat->bt_disabled) {
+			coex_stat->bt_reenable = true;
+			ieee80211_queue_delayed_work(rtwdev->hw,
+						     &coex->bt_reenable_work,
+						     15 * HZ);
+		} else {
+			coex_stat->bt_mailbox_reply = false;
+			coex_stat->bt_reenable = false;
+		}
 	}
 }
 
@@ -613,15 +614,6 @@ static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev)
 		coex_dm->bt_rssi_state[i] = rssi_state;
 	}
 
-	for (i = 0; i < COEX_RSSI_STEP; i++) {
-		rssi_state = coex_dm->wl_rssi_state[i];
-		rssi_step = chip->wl_rssi_step[i];
-		rssi = rtwdev->dm_info.min_rssi;
-		rssi_state = rtw_coex_next_rssi_state(rtwdev, rssi_state,
-						      rssi, rssi_step);
-		coex_dm->wl_rssi_state[i] = rssi_state;
-	}
-
 	if (coex_stat->bt_ble_scan_en &&
 	    coex_stat->cnt_bt[COEX_CNT_BT_INFOUPDATE] % 3 == 0) {
 		u8 scan_type;
@@ -992,7 +984,7 @@ static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase)
 	bool turn_on;
 	bool wl_busy = false;
 
-	if (tcase & TDMA_4SLOT)/* 4-slot (50ms) mode */
+	if (tcase & TDMA_4SLOT) /* 4-slot (50ms) mode */
 		rtw_coex_tdma_timer_base(rtwdev, 3);
 	else
 		rtw_coex_tdma_timer_base(rtwdev, 0);
@@ -2865,11 +2857,6 @@ void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
 
 void rtw_coex_wl_status_change_notify(struct rtw_dev *rtwdev, u32 type)
 {
-	struct rtw_coex *coex = &rtwdev->coex;
-
-	if (coex->stop_dm)
-		return;
-
 	rtw_coex_run_coex(rtwdev, COEX_RSN_WLSTATUS);
 }
 
-- 
2.21.0


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

* [PATCH 03/11] rtw88: coex: add write scoreboard action when WLAN in critical procedure
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
  2020-11-11  2:20 ` [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval pkshih
  2020-11-11  2:20 ` [PATCH 02/11] rtw88: coex: remove unnecessary feature/function pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 04/11] rtw88: coex: Add force flag for coexistence table function pkshih
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

When WLAN in critical procedure, such as connecting, scan and so on,
coexistence will notify BT by scoreboard.
While BT firmware received the scoreboard interrupt, it will adjust
BT page priority lower to avoid WLAN critical procedure suffering impact.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 3a26453f4316..5f4b13226080 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -461,6 +461,12 @@ static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason)
 		coex_dm->wl_rssi_state[i] = rssi_state;
 	}
 
+	if (coex_stat->wl_linkscan_proc || coex_stat->wl_hi_pri_task1 ||
+	    coex_stat->wl_hi_pri_task2 || coex_stat->wl_gl_busy)
+		rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, true);
+	else
+		rtw_coex_write_scbd(rtwdev, COEX_SCBD_SCAN, false);
+
 	switch (reason) {
 	case COEX_RSN_5GSCANSTART:
 	case COEX_RSN_5GSWITCHBAND:
-- 
2.21.0


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

* [PATCH 04/11] rtw88: coex: Add force flag for coexistence table function
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (2 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 03/11] rtw88: coex: add write scoreboard action when WLAN in critical procedure pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 05/11] rtw88: coex: add the mechanism for RF4CE pkshih
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Because sometimes hardware action may be unpredictable.
(Ex: after WLAN LPS...etc)
Add a check mechanism if the action is triggered by
some concerned case, it can force to write the table again.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 62 +++++++++++++----------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 5f4b13226080..961a9dafa969 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -852,9 +852,19 @@ static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state)
 	rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0300, state);
 }
 
-static void rtw_coex_set_table(struct rtw_dev *rtwdev, u32 table0, u32 table1)
+static void rtw_coex_set_table(struct rtw_dev *rtwdev, bool force, u32 table0,
+			       u32 table1)
 {
 #define DEF_BRK_TABLE_VAL 0xf0ffffff
+	struct rtw_coex *coex = &rtwdev->coex;
+	struct rtw_coex_dm *coex_dm = &coex->dm;
+
+	/* If last tdma is wl slot toggle, force write table*/
+	if (!force && coex_dm->reason != COEX_RSN_LPS) {
+		if (table0 == rtw_read32(rtwdev, REG_BT_COEX_TABLE0) &&
+		    table1 == rtw_read32(rtwdev, REG_BT_COEX_TABLE1))
+			return;
+	}
 	rtw_write32(rtwdev, REG_BT_COEX_TABLE0, table0);
 	rtw_write32(rtwdev, REG_BT_COEX_TABLE1, table1);
 	rtw_write32(rtwdev, REG_BT_COEX_BRK_TABLE, DEF_BRK_TABLE_VAL);
@@ -864,7 +874,7 @@ static void rtw_coex_set_table(struct rtw_dev *rtwdev, u32 table0, u32 table1)
 		table1);
 }
 
-static void rtw_coex_table(struct rtw_dev *rtwdev, u8 type)
+static void rtw_coex_table(struct rtw_dev *rtwdev, bool force, u8 type)
 {
 	struct rtw_coex *coex = &rtwdev->coex;
 	struct rtw_coex_dm *coex_dm = &coex->dm;
@@ -877,13 +887,13 @@ static void rtw_coex_table(struct rtw_dev *rtwdev, u8 type)
 
 	if (efuse->share_ant) {
 		if (type < chip->table_sant_num)
-			rtw_coex_set_table(rtwdev,
+			rtw_coex_set_table(rtwdev, force,
 					   chip->table_sant[type].bt,
 					   chip->table_sant[type].wl);
 	} else {
 		type = type - 100;
 		if (type < chip->table_nsant_num)
-			rtw_coex_set_table(rtwdev,
+			rtw_coex_set_table(rtwdev, force,
 					   chip->table_nsant[type].bt,
 					   chip->table_nsant[type].wl);
 	}
@@ -1332,7 +1342,7 @@ static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1376,7 +1386,7 @@ static void rtw_coex_action_freerun(struct rtw_dev *rtwdev)
 	else
 		rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[level]);
 
-	rtw_coex_table(rtwdev, 100);
+	rtw_coex_table(rtwdev, false, 100);
 	rtw_coex_tdma(rtwdev, false, 100);
 }
 
@@ -1401,7 +1411,7 @@ static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1426,7 +1436,7 @@ static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1457,7 +1467,7 @@ static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev)
 
 	if (table_case != 0xff && tdma_case != 0xff) {
 		rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G_FREERUN);
-		rtw_coex_table(rtwdev, table_case);
+		rtw_coex_table(rtwdev, false, table_case);
 		rtw_coex_tdma(rtwdev, false, tdma_case);
 		return;
 	}
@@ -1491,7 +1501,7 @@ static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev)
 		}
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1586,7 +1596,7 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev)
 	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], wifi hi(%d), bt page(%d)\n",
 		wl_hi_pri, coex_stat->bt_page);
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case | slot_type);
 }
 
@@ -1622,7 +1632,7 @@ static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev)
 		}
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1695,7 +1705,7 @@ static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev)
 		}
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1737,7 +1747,7 @@ static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev)
 			tdma_case = 113;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case | slot_type);
 }
 
@@ -1776,7 +1786,7 @@ static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev)
 		}
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1813,7 +1823,7 @@ static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev)
 			tdma_case = 119;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1857,7 +1867,7 @@ static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev)
 			tdma_case = 113;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case | slot_type);
 }
 
@@ -1895,7 +1905,7 @@ static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev)
 			tdma_case = 120;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1930,7 +1940,7 @@ static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev)
 			tdma_case = 119;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1964,7 +1974,7 @@ static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev)
 			tdma_case = 120;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -1991,7 +2001,7 @@ static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -2015,7 +2025,7 @@ static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -2044,7 +2054,7 @@ static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -2082,7 +2092,7 @@ static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev)
 		}
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case | slot_type);
 }
 
@@ -2106,7 +2116,7 @@ static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev)
 		tdma_case = 100;
 	}
 
-	rtw_coex_table(rtwdev, table_case);
+	rtw_coex_table(rtwdev, false, table_case);
 	rtw_coex_tdma(rtwdev, false, tdma_case);
 }
 
@@ -2338,7 +2348,7 @@ static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only)
 	}
 
 	/* PTA parameter */
-	rtw_coex_table(rtwdev, 0);
+	rtw_coex_table(rtwdev, false, 0);
 	rtw_coex_tdma(rtwdev, true, 0);
 	rtw_coex_query_bt_info(rtwdev);
 }
-- 
2.21.0


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

* [PATCH 05/11] rtw88: coex: add the mechanism for RF4CE
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (3 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 04/11] rtw88: coex: Add force flag for coexistence table function pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 06/11] rtw88: coex: update the TDMA parameter when leave LPS pkshih
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Add the related coexistence mechanism about RF4CE and WLAN connected
flag to decide control packet is whether higher or normal priority.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 33 ++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 961a9dafa969..ca44ŒÍø\b2b38 100644
--- a/drivers/net/wireless/realt8Il\bc4dc/coe|.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -1390,6 +1390,31 @@ static void rtw_coex_action_freerun(struct rtw_dev *rtwdev)
 	rtw_coex_tdma(rtwdev, false, 100);
 }
 
+static void rtw_coex_action_rf4ce(struct rtw_dev *rtwdev)
+{
+	struct rtw_efuse *efuse = &rtwdev->efuse;
+	struct rtw_chip_info *chip = rtwdev->chip;
+	u8 table_case, tdma_case;
+
+	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
+
+	rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G);
+	rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]);
+
+	if (efuse->share_ant) {
+		/* Shared-Ant */
+		table_case = 9;
+		tdma_case = 16;
+	} else {
+		/* Non-Shared-Ant */
+		table_case = 100;
+		tdma_case = 100;
+	}
+
+	rtw_coex_table(rtwdev, false, table_case);
+	rtw_coex_tdma(rtwdev, false, tdma_case);
+}
+
 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev)
 {
 	struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -2180,6 +2205,7 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason)
 	struct rtw_coex *coex = &rtwdev->coex;
 	struct rtw_coex_dm *coex_dm = &coex->dm;
 	struct rtw_coex_stat *coex_stat = &coex->stat;
+	bool rf4ce_en = false;
 
 	lockdep_assert_held(&rtwdev->mutex);
 
@@ -2235,7 +2261,12 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason)
 	coex_stat->wl_coex_mode = COEX_WLINK_2G1PORT;
 	rtw_coex_write_scbd(rtwdev, COEX_SCBD_FIX2M, false);
 	if (coex_stat->bt_disabled) {
-		rtw_coex_action_wl_only(rtwdev);
+		if (coex_stat->wl_connected && rf4ce_en)
+			rtw_coex_action_rf4ce(rtwdev);
+		else if (!coex_stat->wl_connected)
+			rtw_coex_action_wl_not_connected(rtwdev);
+		else
+			rtw_coex_action_wl_only(rtwdev);
 		goto exit;
 	}
 
-- 
2.21.0


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

* [PATCH 06/11] rtw88: coex: update the TDMA parameter when leave LPS
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (4 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 05/11] rtw88: coex: add the mechanism for RF4CE pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 07/11] rtw88: coex: Change antenna setting to enhance free-run performance pkshih
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

The updated parameter and original parameter all means TDMA-OFF.
The original setting write 0x8 to firmware, but it only works for
some old IC series.
To avoid the confusing, update a proper parameter.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index ca44c4dc2b38..aa95d617b86a 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -929,7 +929,7 @@ static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type,
 	case COEX_PS_LPS_OFF:
 		coex_stat->wl_force_lps_ctrl = true;
 		if (lps_mode)
-			rtw_fw_coex_tdma_type(rtwdev, 0x8, 0, 0, 0, 0);
+			rtw_fw_coex_tdma_type(rtwdev, 0, 0, 0, 0, 0);
 
 		rtw_leave_lps(rtwdev);
 		rtw_dbg(rtwdev, RTW_DBG_COEX,
-- 
2.21.0


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

* [PATCH 07/11] rtw88: coex: Change antenna setting to enhance free-run performance
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (5 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 06/11] rtw88: coex: update the TDMA parameter when leave LPS pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step pkshih
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

While the mechanism goes to 2G_free_run or WL5G_BT2G,
set BT to hardware PTA mode to get a more efficiently performance.

Add a flag to indicate antenna switch is supported or not so
that the IC serials which has different antenna structure can
set antenna correctly.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index aa95d617b86a..8c7216245557 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -1062,6 +1062,7 @@ static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase)
 {
 	struct rtw_coex *coex = &rtwdev->coex;
 	struct rtw_coex_stat *coex_stat = &coex->stat;
+	struct rtw_coex_rfe *coex_rfe = &coex->rfe;
 	struct rtw_coex_dm *coex_dm = &coex->dm;
 	u8 ctrl_type = COEX_SWITCH_CTRL_MAX;
 	u8 pos_type = COEX_SWITCH_TO_MAX;
@@ -1157,8 +1158,8 @@ static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase)
 		rtw_dbg(rtwdev, RTW_DBG_COEX,
 			"[BTCoex], %s() - PHASE_5G_RUNTIME\n", __func__);
 
-		/* set GNT_BT to PTA */
-		rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH);
+		/* set GNT_BT to HW PTA */
+		rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA);
 
 		/* set GNT_WL to SW high */
 		rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH);
@@ -1173,8 +1174,8 @@ static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase)
 		rtw_dbg(rtwdev, RTW_DBG_COEX,
 			"[BTCoex], %s() - PHASE_2G_FREERUN\n", __func__);
 
-		/* set GNT_BT to SW high */
-		rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_SW_HIGH);
+		/* set GNT_BT to HW PTA */
+		rtw_coex_set_gnt_bt(rtwdev, COEX_GNT_SET_HW_PTA);
 
 		/* Set GNT_WL to SW high */
 		rtw_coex_set_gnt_wl(rtwdev, COEX_GNT_SET_SW_HIGH);
@@ -1205,7 +1206,8 @@ static void rtw_coex_set_ant_path(struct rtw_dev *rtwdev, bool force, u8 phase)
 		return;
 	}
 
-	if (ctrl_type < COEX_SWITCH_CTRL_MAX && pos_type < COEX_SWITCH_TO_MAX)
+	if (ctrl_type < COEX_SWITCH_CTRL_MAX && pos_type < COEX_SWITCH_TO_MAX &&
+	    coex_rfe->ant_switch_exist)
 		rtw_coex_set_ant_switch(rtwdev, ctrl_type, pos_type);
 }
 
-- 
2.21.0


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

* [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (6 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 07/11] rtw88: coex: Change antenna setting to enhance free-run performance pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  8:37   ` Kalle Valo
  2020-11-11  2:21 ` [PATCH 09/11] rtw88: coex: remove write scan bit to scoreboard in scan and connect notify pkshih
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Force set the coexistence to BT high priority during
WLAN initial/power-on step. Since the duration the related setting
may be not ready yet.

The score board is not related to scan when initialing, remove the scan
parameter.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coTÔÈ\b b/drivers/net/wireless/realtek/rtw88/coex.c8Il\bex.cc7216245557..6ec3f45a64c1 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -2369,19 +2369,19 @@ static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only)
 			__func__);
 	} else if (wifi_only) {
 		rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_WONLY);
-		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN,
+		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF,
 				    true);
 		coex->stop_dm = true;
 	} else {
 		rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_INIT);
-		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN,
+		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF,
 				    true);
 		coex->stop_dm = false;
 		coex->freeze = true;
 	}
 
 	/* PTA parameter */
-	rtw_coex_table(rtwdev, false, 0);
+	rtw_coex_table(rtwdev, true, 1);
 	rtw_coex_tdma(rtwdev, true, 0);
 	rtw_coex_query_bt_info(rtwdev);
 }
@@ -2389,6 +2389,7 @@ static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only)
 void rtw_coex_power_on_setting(struct rtw_dev *rtwdev)
 {
 	struct rtw_coex *coex = &rtwdev->coex;
+	u8 table_case = 1;
 
 	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
 
@@ -2405,6 +2406,7 @@ void rtw_coex_power_on_setting(struct rtw_dev *rtwdev)
 	/* set antenna path to BT */
 	rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_POWERON);
 
+	rtw_coex_table(rtwdev, true, table_case);
 	/* red x issue */
 	rtw_write8(rtwdev, 0xff1a, 0x0);
 }
-- 
2.21.0


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

* [PATCH 09/11] rtw88: coex: remove write scan bit to scoreboard in scan and connect notify
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (7 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 10/11] rtw88: coex: remove unnecessary WLAN slot extend pkshih
  2020-11-11  2:21 ` [PATCH 11/11] rtw88: coex: change the decode method from firmware pkshih
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Remove some action which were writing scan bit to scoreboard,
since these behaviors are redundant.
It is already done in WLAN info notify.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 6ec3f45a64c1..aef77c377a5b 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -2489,10 +2489,7 @@ void rtw_coex_scan_notify(struct rtw_dev *rtwdev, u8 type)
 		return;
 
 	coex->freeze = false;
-
-	if (type != COEX_SCAN_FINISH)
-		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN |
-				    COEX_SCBD_ONOFF, true);
+	rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true);
 
 	if (type == COEX_SCAN_START_5G) {
 		rtw_dbg(rtwdev, RTW_DBG_COEX,
@@ -2549,8 +2546,7 @@ void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type)
 	if (coex->manual_control || coex->stop_dm)
 		return;
 
-	rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_SCAN |
-			    COEX_SCBD_ONOFF, true);
+	rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE | COEX_SCBD_ONOFF, true);
 
 	if (type == COEX_ASSOCIATE_5G_START) {
 		rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): 5G start\n",
-- 
2.21.0


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

* [PATCH 10/11] rtw88: coex: remove unnecessary WLAN slot extend
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (8 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 09/11] rtw88: coex: remove write scan bit to scoreboard in scan and connect notify pkshih
@ 2020-11-11  2:21 ` pkshih
  2020-11-11  2:21 ` [PATCH 11/11] rtw88: coex: change the decode method from firmware pkshih
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Remove extend 5 ms related operation at WLAN media status notify.
The mechanism should be enable only while DUT connect to a AP that it
doesn't follow our power save control or its rate is decreasing unusually
sensitive. So we extend a extra slot to save the transmission rate.

The original logic will always extend WLAN slot.
It will lead to BT slot always decrease 5 ms.

Remove write scoreboard action at WLAN media status notify.
It has already done in WLAN info notify.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index aef77c377a5b..95e5ff5abae5 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -2593,8 +2593,6 @@ void rtw_coex_connect_notify(struct rtw_dev *rtwdev, u8 type)
 void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type)
 {
 	struct rtw_coex *coex = &rtwdev->coex;
-	struct rtw_coex_stat *coex_stat = &coex->stat;
-	u8 para[6] = {0};
 
 	if (coex->manual_control || coex->stop_dm)
 		return;
@@ -2616,15 +2614,8 @@ void rtw_coex_media_status_notify(struct rtw_dev *rtwdev, u8 type)
 
 		/* Set CCK Rx high Pri */
 		rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 1);
-
-		/* always enable 5ms extend if connect */
-		para[0] = COEX_H2C69_WL_LEAKAP;
-		para[1] = PARA1_H2C69_EN_5MS; /* enable 5ms extend */
-		rtw_fw_bt_wifi_control(rtwdev, para[0], &para[1]);
-		coex_stat->wl_slot_extend = true;
 		rtw_coex_run_coex(rtwdev, COEX_RSN_2GMEDIA);
 	} else {
-		rtw_coex_write_scbd(rtwdev, COEX_SCBD_ACTIVE, false);
 		rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s(): disconnect!!\n",
 			__func__);
 		rtw_coex_set_wl_pri_mask(rtwdev, COEX_WLPRI_RX_CCK, 0);
-- 
2.21.0


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

* [PATCH 11/11] rtw88: coex: change the decode method from firmware
  2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
                   ` (9 preceding siblings ...)
  2020-11-11  2:21 ` [PATCH 10/11] rtw88: coex: remove unnecessary WLAN slot extend pkshih
@ 2020-11-11  2:21 ` pkshih
  10 siblings, 0 replies; 18+ messages in thread
From: pkshih @ 2020-11-11  2:21 UTC (permalink / raw)
  To: kvalo, tony0620emma; +Cc: linux-wireless

From: Ching-Te Ku <ku920601@realtek.com>

Fix sometimes FW information will be parsed as wrong value,
do a correction of sign bit to show the correct information.
(Ex, Value should be 20, but it shows 236.)

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 95e5ff5abae5..36b446133cd2 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -2883,7 +2883,7 @@ void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
 		if (buf[i] >= val)
 			coex_stat->wl_fw_dbg_info[i] = buf[i] - val;
 		else
-			coex_stat->wl_fw_dbg_info[i] = val - buf[i];
+			coex_stat->wl_fw_dbg_info[i] = 255 - val + buf[i];
 
 		coex_stat->wl_fw_dbg_info_pre[i] = buf[i];
 	}
-- 
2.21.0


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

* Re: [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval
  2020-11-11  2:20 ` [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval pkshih
@ 2020-11-11  8:34   ` Kalle Valo
  2020-11-12  2:23     ` Pkshih
  0 siblings, 1 reply; 18+ messages in thread
From: Kalle Valo @ 2020-11-11  8:34 UTC (permalink / raw)
  To: pkshih; +Cc: tony0620emma, linux-wireless

<pkshih@realtek.com> writes:

> From: Ching-Te Ku <ku920601@realtek.com>
>
> Add considering for different WLAN beacon interval in coexistence
> mechanism.
> Because the WLAN beacon period may be not 100 ms, so it's necessary
> to consider any beacon period and set timer according to the interval.
>
> Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

[...]

> +	} else if (tbtt_interval < 80 && tbtt_interval > 0) {
> +		para[1] = (100 / tbtt_interval);
> +
> +		if (100 % tbtt_interval != 0)
> +			para[1] = para[1] + 1;
> +
> +		para[1] = para[1] & 0x3f;
> +	} else if (tbtt_interval >= 180) {
> +		para[1] = (tbtt_interval / 100);
> +
> +		if (tbtt_interval % 100 <= 80)
> +			para[1] = para[1] - 1;
> +
> +		para[1] = para[1] & 0x3f;
> +		para[1] = para[1] | 0x80;

Magic numbers 0x3f and 0x80, GENMASK() & FIELD_PREP() is the modern way
to handle bitmasks like these. And there's also the operator '|='

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH 02/11] rtw88: coex: remove unnecessary feature/function
  2020-11-11  2:20 ` [PATCH 02/11] rtw88: coex: remove unnecessary feature/function pkshih
@ 2020-11-11  8:35   ` Kalle Valo
  2020-11-12  2:25     ` Pkshih
  0 siblings, 1 reply; 18+ messages in thread
From: Kalle Valo @ 2020-11-11  8:35 UTC (permalink / raw)
  To: pkshih; +Cc: tony0620emma, linux-wireless

<pkshih@realtek.com> writes:

> From: Ching-Te Ku <ku920601@realtek.com>
>
> It is redundant to update WLAN RSSI, remove the update WLAN RSSI part.
> Remove unused function.

Why is it redundant? The "Why?" is the most important part of the commit
log.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step
  2020-11-11  2:21 ` [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step pkshih
@ 2020-11-11  8:37   ` Kalle Valo
  2020-11-12  2:24     ` Pkshih
  0 siblings, 1 reply; 18+ messages in thread
From: Kalle Valo @ 2020-11-11  8:37 UTC (permalink / raw)
  To: pkshih; +Cc: tony0620emma, linux-wireless

<pkshih@realtek.com> writes:

> From: Ching-Te Ku <ku920601@realtek.com>
>
> Force set the coexistence to BT high priority during
> WLAN initial/power-on step. Since the duration the related setting
> may be not ready yet.
>
> The score board is not related to scan when initialing, remove the scan
> parameter.
>
> Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
>  drivers/net/wireless/realtek/rtw88/coex.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/coTÔÈ\b b/drivers/net/wireless/realtek/rtw88/coex.c8Il\bex.cc7216245557..6ec3f45a64c1 100644

Something is wrong here, the new lines are replaced with '^H' control
character.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* RE: [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval
  2020-11-11  8:34   ` Kalle Valo
@ 2020-11-12  2:23     ` Pkshih
  0 siblings, 0 replies; 18+ messages in thread
From: Pkshih @ 2020-11-12  2:23 UTC (permalink / raw)
  To: Kalle Valo; +Cc: tony0620emma, linux-wireless



> -----Original Message-----
> From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On
> Behalf Of Kalle Valo
> Sent: Wednesday, November 11, 2020 4:34 PM
> To: Pkshih
> Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval
> 
> <pkshih@realtek.com> writes:
> 
> > From: Ching-Te Ku <ku920601@realtek.com>
> >
> > Add considering for different WLAN beacon interval in coexistence
> > mechanism.
> > Because the WLAN beacon period may be not 100 ms, so it's necessary
> > to consider any beacon period and set timer according to the interval.
> >
> > Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> [...]
> 
> > +	} else if (tbtt_interval < 80 && tbtt_interval > 0) {
> > +		para[1] = (100 / tbtt_interval);
> > +
> > +		if (100 % tbtt_interval != 0)
> > +			para[1] = para[1] + 1;
> > +
> > +		para[1] = para[1] & 0x3f;
> > +	} else if (tbtt_interval >= 180) {
> > +		para[1] = (tbtt_interval / 100);
> > +
> > +		if (tbtt_interval % 100 <= 80)
> > +			para[1] = para[1] - 1;
> > +
> > +		para[1] = para[1] & 0x3f;
> > +		para[1] = para[1] | 0x80;
> 
> Magic numbers 0x3f and 0x80, GENMASK() & FIELD_PREP() is the modern way
> to handle bitmasks like these. And there's also the operator '|='
> 

I'll give proper names and use suggested macros it in v2. Thank you.

---
Ping-Ke



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

* RE: [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step
  2020-11-11  8:37   ` Kalle Valo
@ 2020-11-12  2:24     ` Pkshih
  0 siblings, 0 replies; 18+ messages in thread
From: Pkshih @ 2020-11-12  2:24 UTC (permalink / raw)
  To: Kalle Valo; +Cc: tony0620emma, linux-wireless



> -----Original Message-----
> From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On
> Behalf Of Kalle Valo
> Sent: Wednesday, November 11, 2020 4:38 PM
> To: Pkshih
> Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step
> 
> <pkshih@realtek.com> writes:
> 
> > From: Ching-Te Ku <ku920601@realtek.com>
> >
> > Force set the coexistence to BT high priority during
> > WLAN initial/power-on step. Since the duration the related setting
> > may be not ready yet.
> >
> > The score board is not related to scan when initialing, remove the scan
> > parameter.
> >
> > Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> > ---
> >  drivers/net/wireless/realtek/rtw88/coex.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw88/coTÔÈ\b
> b/drivers/net/wireless/realtek/rtw88/coex.c8Il\bex.cc7216245557..6ec3f45a64c1 100644
> 
> Something is wrong here, the new lines are replaced with '^H' control
> character.
> 

I don't know why it goes wrong, my patch source looks ok. 
I'll pay attention to this patch while sending v2.

---
Ping-Ke


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

* RE: [PATCH 02/11] rtw88: coex: remove unnecessary feature/function
  2020-11-11  8:35   ` Kalle Valo
@ 2020-11-12  2:25     ` Pkshih
  0 siblings, 0 replies; 18+ messages in thread
From: Pkshih @ 2020-11-12  2:25 UTC (permalink / raw)
  To: Kalle Valo; +Cc: tony0620emma, linux-wireless



> -----Original Message-----
> From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On
> Behalf Of Kalle Valo
> Sent: Wednesday, November 11, 2020 4:36 PM
> To: Pkshih
> Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH 02/11] rtw88: coex: remove unnecessary feature/function
> 
> <pkshih@realtek.com> writes:
> 
> > From: Ching-Te Ku <ku920601@realtek.com>
> >
> > It is redundant to update WLAN RSSI, remove the update WLAN RSSI part.
> > Remove unused function.
> 
> Why is it redundant? The "Why?" is the most important part of the commit
> log.
> 

Will describe "why' in v2. Thanks.

---
Ping-Ke





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

end of thread, other threads:[~2020-11-12  5:40 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11  2:20 [PATCH 00/11] rtw88: coex: fix and update settings to enhance coex performance pkshih
2020-11-11  2:20 ` [PATCH 01/11] rtw88: coex: update TDMA settings for different beacon interval pkshih
2020-11-11  8:34   ` Kalle Valo
2020-11-12  2:23     ` Pkshih
2020-11-11  2:20 ` [PATCH 02/11] rtw88: coex: remove unnecessary feature/function pkshih
2020-11-11  8:35   ` Kalle Valo
2020-11-12  2:25     ` Pkshih
2020-11-11  2:21 ` [PATCH 03/11] rtw88: coex: add write scoreboard action when WLAN in critical procedure pkshih
2020-11-11  2:21 ` [PATCH 04/11] rtw88: coex: Add force flag for coexistence table function pkshih
2020-11-11  2:21 ` [PATCH 05/11] rtw88: coex: add the mechanism for RF4CE pkshih
2020-11-11  2:21 ` [PATCH 06/11] rtw88: coex: update the TDMA parameter when leave LPS pkshih
2020-11-11  2:21 ` [PATCH 07/11] rtw88: coex: Change antenna setting to enhance free-run performance pkshih
2020-11-11  2:21 ` [PATCH 08/11] rtw88: coex: fix BT performance drop during initial/power-on step pkshih
2020-11-11  8:37   ` Kalle Valo
2020-11-12  2:24     ` Pkshih
2020-11-11  2:21 ` [PATCH 09/11] rtw88: coex: remove write scan bit to scoreboard in scan and connect notify pkshih
2020-11-11  2:21 ` [PATCH 10/11] rtw88: coex: remove unnecessary WLAN slot extend pkshih
2020-11-11  2:21 ` [PATCH 11/11] rtw88: coex: change the decode method from firmware pkshih

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.