Skip to contentSkip to conversation

wifi: rtw89: RTL8852BE: Fix a shutdown issue

PATCH In review Zenm Chen 2 participants 5 messages Apr 15, 2025 Stable branch

lore
Share & tools
lore

Zenm Chen

author
#0 lore raw

v2 cover wifi: rtw89: RTL8852BE: Fix a shutdown issue

This patch series addresses a shutdown issue reported in [1].

This problem has been fixed on kernel 6.12 and later, kernel 6.6 is the last kernel these upstream patches should go to because the Realtek RTL8852BE chip supported by kernel since v6.2 is the only chip known to have this problem.

[1] https://github.com/lwfinger/rtw89/issues/372

Zenm Chen (2):
wifi: rtw89: pci: add pre_deinit to be called after probe complete
wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit

 drivers/net/wireless/realtek/rtw89/core.c |  2 ++
 drivers/net/wireless/realtek/rtw89/core.h |  6 ++++++
 drivers/net/wireless/realtek/rtw89/pci.c  | 10 ++++++++++
 3 files changed, 18 insertions(+)
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH v2 1/2 wifi: rtw89: pci: add pre_deinit to be called after probe complete

From: Ping-Ke Shih <[email protected]>

[ Upstream commit 9e1aff437a560cd72cb6a60ee33fe162b0afdaf1 ]

At probe stage, we only do partial initialization to enable ability to download firmware and read capabilities. After that, we use this pre_deinit to disable HCI to save power.

[ Zenm: The rtw89 driver in recent kernel versions supports both Wi-Fi 6/6E
and Wi-Fi 7, however the rtw89 driver in kernel 6.6 supports Wi-Fi 6/6E only, so remove the unnecessary code for Wi-Fi 7 from the upstream patch to make it apply on 6.6.y. ]

---
v2:
- Add a comment explaining why this patch differs from the upstream one.

---
 drivers/net/wireless/realtek/rtw89/core.c | 2 ++
 drivers/net/wireless/realtek/rtw89/core.h | 6 ++++++
 drivers/net/wireless/realtek/rtw89/pci.c  | 8 ++++++++
 3 files changed, 16 insertions(+)
drivers/net/wireless/realtek/rtw89/core.c +2 -0
index 535393eca..d1d8fd812 100644
@@ -3807,6 +3807,8 @@ static int rtw89_chip_efuse_info_setup(struct rtw89_dev *rtwdev)
 	rtw89_core_setup_phycap(rtwdev);
 	rtw89_core_setup_rfe_parms(rtwdev);
 
+	rtw89_hci_mac_pre_deinit(rtwdev);
+
 	rtw89_mac_pwr_off(rtwdev);
 
 	return 0;
drivers/net/wireless/realtek/rtw89/core.h +6 -0
index ee6ae2a0c..16aad0f83 100644
@@ -2989,6 +2989,7 @@ struct rtw89_hci_ops {
 	void (*write32)(struct rtw89_dev *rtwdev, u32 addr, u32 data);
 
 	int (*mac_pre_init)(struct rtw89_dev *rtwdev);
+	int (*mac_pre_deinit)(struct rtw89_dev *rtwdev);
 	int (*mac_post_init)(struct rtw89_dev *rtwdev);
 	int (*deinit)(struct rtw89_dev *rtwdev);
 
@@ -4515,6 +4516,11 @@ static inline void rtw89_hci_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch)
 	return rtwdev->hci.ops->tx_kick_off(rtwdev, txch);
 }
 
+static inline int rtw89_hci_mac_pre_deinit(struct rtw89_dev *rtwdev)
+{
+	return rtwdev->hci.ops->mac_pre_deinit(rtwdev);
+}
+
 static inline void rtw89_hci_flush_queues(struct rtw89_dev *rtwdev, u32 queues,
 					  bool drop)
 {
drivers/net/wireless/realtek/rtw89/pci.c +8 -0
index 98af64444..7787159dd 100644
@@ -2568,6 +2568,13 @@ static int rtw89_pci_ops_mac_pre_init(struct rtw89_dev *rtwdev)
 	return 0;
 }
 
+static int rtw89_pci_ops_mac_pre_deinit(struct rtw89_dev *rtwdev)
+{
+	rtw89_pci_power_wake(rtwdev, false);
+
+	return 0;
+}
+
 int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en)
 {
 	u32 val;
@@ -3812,6 +3819,7 @@ static const struct rtw89_hci_ops rtw89_pci_ops = {
 	.write32	= rtw89_pci_ops_write32,
 
 	.mac_pre_init	= rtw89_pci_ops_mac_pre_init,
+	.mac_pre_deinit = rtw89_pci_ops_mac_pre_deinit,
 	.mac_post_init	= rtw89_pci_ops_mac_post_init,
 	.deinit		= rtw89_pci_ops_deinit,
 
Signature · 1 line
2.49.0
maintainer
#2 lore raw

Re: [PATCH v2 6.6.y 1/2] wifi: rtw89: pci: add pre_deinit to be called after probe complete

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 9e1aff437a560cd72cb6a60ee33fe162b0afdaf1

WARNING: Author mismatch between patch and upstream commit:
Backport author: Zenm Chen<[email protected]> Commit author: Ping-Ke Shih<[email protected]>

Status in newer kernel trees:

6.14.y | Present (exact SHA1)
6.13.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---

1:  9e1aff437a560 < -:  ------------- wifi: rtw89: pci: add pre_deinit to be called after probe complete
-:  ------------- > 1:  f754c56267b24 wifi: rtw89: pci: add pre_deinit to be called after probe complete

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
author
#3 lore raw

PATCH v2 2/2 wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit

In reply to Zenm Chen

From: Ping-Ke Shih <[email protected]>

[ Upstream commit 9c1df813e08832c3836c254bc8a2f83ff22dbc06 ]

The PCIE wake bit is to control PCIE wake signal to host. When PCIE is going down, clear this bit to prevent waking up host unexpectedly.

[ Zenm: The rtw89 driver in recent kernel versions supports both Wi-Fi 6/6E
and Wi-Fi 7, however the rtw89 driver in kernel 6.6 supports Wi-Fi 6/6E only, so remove the unnecessary code for Wi-Fi 7 from the upstream patch to make it apply on 6.6.y. ]

---
v2:
- Add a comment explaining why this patch differs from the upstream one.

---
 drivers/net/wireless/realtek/rtw89/pci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw89/pci.c +2 -0
index 7787159dd..30cc6e03c 100644
@@ -2482,6 +2482,8 @@ static int rtw89_pci_ops_deinit(struct rtw89_dev *rtwdev)
 {
 	const struct rtw89_pci_info *info = rtwdev->pci_info;
 
+	rtw89_pci_power_wake(rtwdev, false);
+
 	if (rtwdev->chip->chip_id == RTL8852A) {
 		/* ltr sw trigger */
 		rtw89_write32_set(rtwdev, R_AX_LTR_CTRL_0, B_AX_APP_LTR_IDLE);
Signature · 1 line
2.49.0
maintainer
#4 lore raw

Re: [PATCH v2 6.6.y 2/2] wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 9c1df813e08832c3836c254bc8a2f83ff22dbc06

WARNING: Author mismatch between patch and upstream commit:
Backport author: Zenm Chen<[email protected]> Commit author: Ping-Ke Shih<[email protected]>

Status in newer kernel trees:

6.14.y | Present (exact SHA1)
6.13.y | Present (different SHA1: bf1aaf8eb546)
6.12.y | Present (different SHA1: e5aeac73ab04)

Note: The patch differs from the upstream commit:
---

1:  9c1df813e0883 < -:  ------------- wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit
-:  ------------- > 1:  ecfa2677556ed wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |