diff mbox series

[1/5] wifi: rtw89: coex: Add LPS protocol radio state for RTL8852B

Message ID 20230314020617.28193-2-pkshih@realtek.com
State New
Headers show
Series wifi: rtw89: coex: complete first coexistence features for 8852b | expand

Commit Message

Ping-Ke Shih March 14, 2023, 2:06 a.m. UTC
From: Ching-Te Ku <ku920601@realtek.com>

This LPS state will not turn off RF, and it can still do some basic
traffic, only RTL8852B has the state. Coexistence need let Bluetooth
know WiFi is still alive to prevent some Bluetooth performance issue.

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

Comments

Kalle Valo April 3, 2023, 1:36 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Ching-Te Ku <ku920601@realtek.com>
> 
> This LPS state will not turn off RF, and it can still do some basic
> traffic, only RTL8852B has the state. Coexistence need let Bluetooth
> know WiFi is still alive to prevent some Bluetooth performance issue.
> 
> Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

5 patches applied to wireless-next.git, thanks.

70a13e5f00e9 wifi: rtw89: coex: Add LPS protocol radio state for RTL8852B
829b3a8b212a wifi: rtw89: coex: Not to enable firmware report when WiFi is power saving
20595db3c068 wifi: rtw89: coex: Update RTL8852B LNA2 hardware parameter
d7904ca8a040 wifi: rtw89: coex: Add report control v5 variation
7527251f7766 wifi: rtw89: coex: Update Wi-Fi Bluetooth coexistence version to 7.0.1
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index 3dbd4ee14c70d..bd06388ea211e 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -5728,6 +5728,11 @@  void rtw89_btc_ntfy_radio_state(struct rtw89_dev *rtwdev, enum btc_rfctrl rf_sta
 		wl->status.map.lps = BTC_LPS_RF_OFF;
 		wl->status.map.busy = 0;
 		break;
+	case BTC_RFCTRL_LPS_WL_ON: /* LPS-Protocol (RFon) */
+		wl->status.map.rf_off = 0;
+		wl->status.map.lps = BTC_LPS_RF_ON;
+		wl->status.map.busy = 0;
+		break;
 	case BTC_RFCTRL_WL_ON:
 	default:
 		wl->status.map.rf_off = 0;
@@ -5745,6 +5750,9 @@  void rtw89_btc_ntfy_radio_state(struct rtw89_dev *rtwdev, enum btc_rfctrl rf_sta
 		rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_ALL, false);
 		if (rf_state == BTC_RFCTRL_WL_OFF)
 			_write_scbd(rtwdev, BTC_WSCB_ALL, false);
+		else if (rf_state == BTC_RFCTRL_LPS_WL_ON &&
+			 wl->status.map.lps_pre != BTC_LPS_OFF)
+			_update_bt_scbd(rtwdev, true);
 	}
 
 	btc->dm.cnt_dm[BTC_DCNT_BTCNT_HANG] = 0;
@@ -5755,7 +5763,7 @@  void rtw89_btc_ntfy_radio_state(struct rtw89_dev *rtwdev, enum btc_rfctrl rf_sta
 		btc->dm.tdma_instant_excute = 0;
 
 	_run_coex(rtwdev, BTC_RSN_NTFY_RADIO_STATE);
-
+	btc->dm.tdma_instant_excute = 0;
 	wl->status.map.rf_off_pre = wl->status.map.rf_off;
 	wl->status.map.lps_pre = wl->status.map.lps;
 }
diff --git a/drivers/net/wireless/realtek/rtw89/coex.h b/drivers/net/wireless/realtek/rtw89/coex.h
index 38cc53a505c36..f16421cb30efb 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.h
+++ b/drivers/net/wireless/realtek/rtw89/coex.h
@@ -131,6 +131,7 @@  enum btc_role_state {
 enum btc_rfctrl {
 	BTC_RFCTRL_WL_OFF,
 	BTC_RFCTRL_WL_ON,
+	BTC_RFCTRL_LPS_WL_ON,
 	BTC_RFCTRL_FW_CTRL,
 	BTC_RFCTRL_MAX
 };