Skip to contentSkip to conversation

wifi: rtw89: RTL8852BE: Fix the shutdown issue

PATCH Superseded Zenm Chen 3 participants 7 messages Mar 11, 2025 – Mar 13, 2025 Stable branch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zenm Chen

author
#0 lore raw

cover wifi: rtw89: RTL8852BE: Fix the 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.48.1
author
#1 lore raw

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

---
 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..658ab61e3 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.48.1
maintainer
#2 lore raw

Re: [PATCH 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.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:  1b950ee5b56cc 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   |
maintainer
#3 lore raw

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

In reply to Zenm Chen
Quoted 4 lines · Zenm Chen

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

[ Upstream commit 9e1aff437a560cd72cb6a60ee33fe162b0afdaf1 ]

Quoted 8 lines

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: minor fix to make it apply on 6.6.y ]

That was not "minor" changes, as your diff looks like:

Quoted 6 lines
---
 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(+)

But the original was:

 drivers/net/wireless/realtek/rtw89/core.c   |    2 ++
 drivers/net/wireless/realtek/rtw89/core.h   |    6 ++++++
 drivers/net/wireless/realtek/rtw89/pci.c    |    2 ++
 drivers/net/wireless/realtek/rtw89/pci.h    |   12 ++++++++++++
 drivers/net/wireless/realtek/rtw89/pci_be.c |   18 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw89/reg.h    |    9 +++++++++
 6 files changed, 49 insertions(+)

That is a big difference.

Please either backport the whole thing, or document exactly what you changed here. Otherwise this looks like a totally new patch and we can't take that for obvious reasons.

thanks,

greg k-h

author
#4 lore raw

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

Quoted 32 lines · Zenm Chen
Quoted 4 lines

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

[ Upstream commit 9e1aff437a560cd72cb6a60ee33fe162b0afdaf1 ]

Quoted 8 lines

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: minor fix to make it apply on 6.6.y ]

That was not "minor" changes, as your diff looks like:

Quoted 6 lines
---
 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(+)

But the original was:

 drivers/net/wireless/realtek/rtw89/core.c   |    2 ++
 drivers/net/wireless/realtek/rtw89/core.h   |    6 ++++++
 drivers/net/wireless/realtek/rtw89/pci.c    |    2 ++
 drivers/net/wireless/realtek/rtw89/pci.h    |   12 ++++++++++++
 drivers/net/wireless/realtek/rtw89/pci_be.c |   18 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw89/reg.h    |    9 +++++++++
 6 files changed, 49 insertions(+)
Quoted 5 lines

That is a big difference.

Please either backport the whole thing, or document exactly what you changed here. Otherwise this looks like a totally new patch and we can't take that for obvious reasons.

Hi Greg,

Sorry about that, I will explain more clearly about the changes in v2, please drop this patch series, thanks!

Quoted 4 lines

thanks,

greg k-h

author
#5 lore raw

PATCH 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: minor fix to make it apply on 6.6.y ]
---
 drivers/net/wireless/realtek/rtw89/pci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw89/pci.c +2 -0
index 658ab61e3..1edbe202a 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.48.1
maintainer
#6 lore raw

Re: [PATCH 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.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:  17fff42da3e65 wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit

---

Results of testing on various branches:

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