Skip to contentSkip to conversation

wifi: rtw88: 8821c: disable deep LPS on PCIe devices

PATCH In review Paolo Lazzaroni 3 participants 5 messages Sep 18 – Sep 23 1 message not in the archive Realtek wireless driver (rtw88)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 wifi: rtw88: 8821c: disable deep LPS on PCIe devices

On RTL8821CE PCIe adapters, entering 32kHz low-power clock deep sleep (LPS_DEEP_MODE_LCLK) causes recurrent PCIe completion timeouts, "firmware failed to leave lps state", "failed to send h2c command", and hard system freezes when transitioning out of low power states with PCIe ASPM enabled.

To work around this, a DMI quirk list (rtw_pci_quirks[]) was introduced and has grown across HP, ASUS, Dell, and Lenovo machines. However, DMI matching is unsustainable: minor sub-model variances (such as ASUS FA506II vs FA506IH) or unlisted models (such as ASUS VivoBook X515JA, Bmax Y14, or modern Alder Lake-N mini PCs) leave users experiencing bus lockups or firmware drops unless they manually turn off power saving via iw.

Examination of official OEM Windows driver INF files for RTL8821CE (HP and ASUS netrtwlane.inf) reveals that vendor drivers explicitly disable deep power saving (WoWLANPSMode = 0, bLPS_PG_En = 0) and enable firmware PCIe recovery, while keeping standard PCIe ASPM enabled. Furthermore, other chips in rtw88 (RTL8723DE, RTL8812AE, RTL8821AE) already set lps_deep_mode_supported = 0 by default.

Conservatively disable LPS_DEEP_MODE_LCLK specifically for RTL8821C on PCIe interfaces in rtw_update_lps_deep_mode(). Standard 802.11 LPS power saving and PCIe ASPM remain functional, preventing system lockups and firmware failures without affecting SDIO or USB variants.

---
 drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +8 -0
index 0f23498b5..5bd854223 100644
@@ -1360,6 +1360,14 @@ static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev,
 	    !fw->feature)
 		return LPS_DEEP_MODE_NONE;
 
+	/* RTL8821CE PCIe devices fail to wake up from 32kHz LCLK deep sleep
+	 * in time for PCIe completion deadlines, leading to PCIe bus freeze
+	 * and communication timeouts.
+	 */
+	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE &&
+	    chip->id == RTW_CHIP_TYPE_8821C)
+		return LPS_DEEP_MODE_NONE;
+
 	if ((chip->lps_deep_mode_supported & BIT(LPS_DEEP_MODE_PG)) &&
 	    rtw_fw_feature_check(fw, FW_FEATURE_PG))
 		return LPS_DEEP_MODE_PG;
Signature · 1 line
2.43.0
#2 lore raw
Quoted 14 lines · Paolo Lazzaroni

On RTL8821CE PCIe adapters, entering 32kHz low-power clock deep sleep (LPS_DEEP_MODE_LCLK) causes recurrent PCIe completion timeouts, "firmware failed to leave lps state", "failed to send h2c command", and hard system freezes when transitioning out of low power states with PCIe ASPM enabled.

To work around this, a DMI quirk list (rtw_pci_quirks[]) was introduced and has grown across HP, ASUS, Dell, and Lenovo machines. However, DMI matching is unsustainable: minor sub-model variances (such as ASUS FA506II vs FA506IH) or unlisted models (such as ASUS VivoBook X515JA, Bmax Y14, or modern Alder Lake-N mini PCs) leave users experiencing bus lockups or firmware drops unless they manually turn off power saving via iw.

Quoted 3 lines

Examination of official OEM Windows driver INF files for RTL8821CE (HP and ASUS netrtwlane.inf) reveals that vendor drivers explicitly disable deep power saving (WoWLANPSMode = 0, bLPS_PG_En = 0) and enable

Disabling LPS_PG doesn't mean disabling LCLK, I think.

Quoted 3 lines

firmware PCIe recovery, while keeping standard PCIe ASPM enabled. Furthermore, other chips in rtw88 (RTL8723DE, RTL8812AE, RTL8821AE) already set lps_deep_mode_supported = 0 by default.

What those other chips are doing is not relevant. RTL8812AE and RTL8821AE are not officially supported in rtw88. (Not yet?) lps_deep_mode_supported is zero in rtw8812a.c and rtw8821a.c because rtw88_usb doesn't implement deep PS and I didn't research which modes they could support if deep PS was implemented for USB.

Quoted 16 lines

Conservatively disable LPS_DEEP_MODE_LCLK specifically for RTL8821C on PCIe interfaces in rtw_update_lps_deep_mode(). Standard 802.11 LPS power saving and PCIe ASPM remain functional, preventing system lockups and firmware failures without affecting SDIO or USB variants.

---
 drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +0 -0
index 0f23498b5..5bd854223 100644

drivers/net/wireless/realtek/rtw88/main.c static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, · line 1364

Quoted 5 lines
drivers/net/wireless/realtek/rtw88/main.c +2 -0
@@ -1360,6 +1360,14 @@ static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev,
 	    !fw->feature)
 		return LPS_DEEP_MODE_NONE;
 
+	/* RTL8821CE PCIe devices fail to wake up from 32kHz LCLK deep sleep
+	 * in time for PCIe completion deadlines, leading to PCIe bus freeze

Completion timeout is already disabled for this chip.

drivers/net/wireless/realtek/rtw88/main.c static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, · line 1373

Quoted 9 lines
drivers/net/wireless/realtek/rtw88/main.c +6 -0
+	 * and communication timeouts.
+	 */
+	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE &&
+	    chip->id == RTW_CHIP_TYPE_8821C)
+		return LPS_DEEP_MODE_NONE;
+
 	if ((chip->lps_deep_mode_supported & BIT(LPS_DEEP_MODE_PG)) &&
 	    rtw_fw_feature_check(fw, FW_FEATURE_PG))
 		return LPS_DEEP_MODE_PG;

However, I'm not saying it's necessarily wrong to disable deep PS for this chip completely. I'm just objecting to your LLM's conclusions.

maintainer
#3 lore raw
Quoted 15 lines · Bitterblue Smith
Quoted 14 lines · Paolo Lazzaroni

On RTL8821CE PCIe adapters, entering 32kHz low-power clock deep sleep (LPS_DEEP_MODE_LCLK) causes recurrent PCIe completion timeouts, "firmware failed to leave lps state", "failed to send h2c command", and hard system freezes when transitioning out of low power states with PCIe ASPM enabled.

To work around this, a DMI quirk list (rtw_pci_quirks[]) was introduced and has grown across HP, ASUS, Dell, and Lenovo machines. However, DMI matching is unsustainable: minor sub-model variances (such as ASUS FA506II vs FA506IH) or unlisted models (such as ASUS VivoBook X515JA, Bmax Y14, or modern Alder Lake-N mini PCs) leave users experiencing bus lockups or firmware drops unless they manually turn off power saving via iw.

Quoted 5 lines
Quoted 3 lines

Examination of official OEM Windows driver INF files for RTL8821CE (HP and ASUS netrtwlane.inf) reveals that vendor drivers explicitly disable deep power saving (WoWLANPSMode = 0, bLPS_PG_En = 0) and enable

Disabling LPS_PG doesn't mean disabling LCLK, I think.

Indeed. bLPS_PG_En should be LPS_DEEP_MODE_PG which 8821c's .lps_deep_mode_supported doesn't declare this.

Quoted 30 lines
Quoted 4 lines

firmware PCIe recovery, while keeping standard PCIe ASPM enabled. Furthermore, other chips in rtw88 (RTL8723DE, RTL8812AE, RTL8821AE) already set lps_deep_mode_supported = 0 by default.

What those other chips are doing is not relevant. RTL8812AE and RTL8821AE are not officially supported in rtw88. (Not yet?) lps_deep_mode_supported is zero in rtw8812a.c and rtw8821a.c because rtw88_usb doesn't implement deep PS and I didn't research which modes they could support if deep PS was implemented for USB.

Quoted 19 lines

Conservatively disable LPS_DEEP_MODE_LCLK specifically for RTL8821C on PCIe interfaces in rtw_update_lps_deep_mode(). Standard 802.11 LPS power saving and PCIe ASPM remain functional, preventing system lockups and firmware failures without affecting SDIO or USB variants.

---
 drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +0 -0
index 0f23498b5..5bd854223 100644
@@ -1360,6 +1360,14 @@ static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev,
          !fw->feature)
              return LPS_DEEP_MODE_NONE;
 
Quoted 1 line

drivers/net/wireless/realtek/rtw88/main.c static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, · line 1363

Quoted 1 line
drivers/net/wireless/realtek/rtw88/main.c +1 -0
+     /* RTL8821CE PCIe devices fail to wake up from 32kHz LCLK deep sleep

First line of block comment should be empty.

Quoted 14 lines

drivers/net/wireless/realtek/rtw88/main.c static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, · line 1364

Quoted 1 line
drivers/net/wireless/realtek/rtw88/main.c +1 -0
+      * in time for PCIe completion deadlines, leading to PCIe bus freeze

Completion timeout is already disabled for this chip.

drivers/net/wireless/realtek/rtw88/main.c static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, · line 1373

Quoted 9 lines
drivers/net/wireless/realtek/rtw88/main.c +6 -0
+      * and communication timeouts.
+      */
+     if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE &&
+         chip->id == RTW_CHIP_TYPE_8821C)
+             return LPS_DEEP_MODE_NONE;
+
      if ((chip->lps_deep_mode_supported & BIT(LPS_DEEP_MODE_PG)) &&
          rtw_fw_feature_check(fw, FW_FEATURE_PG))
              return LPS_DEEP_MODE_PG;
Quoted 2 lines

However, I'm not saying it's necessarily wrong to disable deep PS for this chip completely. I'm just objecting to your LLM's conclusions.

I'll consult internally to see if we disable deep PS entirely for this chip.

My question is that are you 100% sure this can resolve the problem you encountered?

Ping-Ke

#4 lore raw
Quoted 1 line · Bitterblue Smith

Disabling LPS_PG doesn't mean disabling LCLK, I think.

Quoted 2 lines · Ping-Ke Shih

Indeed. bLPS_PG_En should be LPS_DEEP_MODE_PG which 8821c's .lps_deep_mode_supported doesn't declare this.

Ah, got it. Sorry, my mistake.

Quoted 1 line

First line of block comment should be empty.

Will fix this style in the next revision.

Quoted 5 lines

I'll consult internally to see if we disable deep PS entirely for this chip.

My question is that are you 100% sure this can resolve the problem you encountered?

To be transparent: on my HP 15-da0xxx (subsystem 103c:831a), I was originally using module parameters (disable_lps_deep=y and disable_aspm=y) while debugging the antenna issue.

After your question, I tested my laptop with upstream default settings (disable_lps_deep=n, disable_aspm=n, power_save=on). Using ftrace on rtw_power_mode_change over a 1-hour test, the card entered and left 32kHz LCLK deep sleep hundreds of times without any freeze or firmware error. So on my specific HP laptop, deep LPS actually works fine.

I proposed this patch and added the reporters in Cc (Gabriel, Rahul, Mihail, Ata) because multiple platforms (HP, ASUS TUF, Lenovo, Dell) keep hitting hard freezes with 8821CE PCIe, and adding DMI quirks one by one is hard to maintain.

So I can't be 100% sure for their hardware without their confirmation. We hope someone in Cc can join the discussion and test this patch to see if it definitively fixes their freeze, which would also help anyone who might encounter this problem in the future.

Thank you for consulting internally at Realtek. I will hold off on v2 until your internal feedback.

Paolo

maintainer
#5 lore raw
Quoted 23 lines · Paolo Lazzaroni
Quoted 1 line · Bitterblue Smith

Disabling LPS_PG doesn't mean disabling LCLK, I think.

Quoted 2 lines · Ping-Ke Shih

Indeed. bLPS_PG_En should be LPS_DEEP_MODE_PG which 8821c's .lps_deep_mode_supported doesn't declare this.

Ah, got it. Sorry, my mistake.

Quoted 1 line

First line of block comment should be empty.

Will fix this style in the next revision.

Quoted 5 lines

I'll consult internally to see if we disable deep PS entirely for this chip.

My question is that are you 100% sure this can resolve the problem you encountered?

To be transparent: on my HP 15-da0xxx (subsystem 103c:831a), I was originally using module parameters (disable_lps_deep=y and disable_aspm=y) while debugging the antenna issue.

Quoted 5 lines

After your question, I tested my laptop with upstream default settings (disable_lps_deep=n, disable_aspm=n, power_save=on). Using ftrace on rtw_power_mode_change over a 1-hour test, the card entered and left 32kHz LCLK deep sleep hundreds of times without any freeze or firmware error. So on my specific HP laptop, deep LPS actually works fine.

That is the case in our side. I don't see the error. But laptop is different from yours though.

Quoted 5 lines

I proposed this patch and added the reporters in Cc (Gabriel, Rahul, Mihail, Ata) because multiple platforms (HP, ASUS TUF, Lenovo, Dell) keep hitting hard freezes with 8821CE PCIe, and adding DMI quirks one by one is hard to maintain.

I knew DMI quirks is little hard to maintain, so an alternative way is to use module parameters (disable_lps_deep=y and disable_aspm=y).

By our measurement, the power consumption without deep PS increases about 16mA (3.3V) for RTL8821CE. The value is not very large, but if platforms can enter the mode, it is still good.

Quoted 8 lines

So I can't be 100% sure for their hardware without their confirmation. We hope someone in Cc can join the discussion and test this patch to see if it definitively fixes their freeze, which would also help anyone who might encounter this problem in the future.

Thank you for consulting internally at Realtek. I will hold off on v2 until your internal feedback.

The affected power consumption is listed above.

Ping-Ke