[PATCH AUTOSEL 6.19-6.1] wifi: rtw89: pci: restore LDO setting after device resume

Sasha Levin
2026-02-14T21:26:04Z

From: Dian-Syuan Yang <dian_syuan0116@realtek.com>

[ Upstream commit af1e82232b988f8fc6d635c60609765e49221a64 ]

The LDO (Low Dropout Regulator) setting is missing after suspend/resume
in some platforms, and it will cause card loss. Therefore, reconfigure
this setting to avoid it.

Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260127085036.44060-6-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

### 3. CLASSIFICATION

This is a **suspend/resume bug fix** for a WiFi driver. The
`rtw89_pci_hci_ldo()` function is called during initial PCI setup (line
3065) but was missing from the resume path. After suspend/resume, the
LDO regulator configuration is lost, causing the WiFi card to disappear
entirely ("card loss").

The function `rtw89_pci_hci_ldo()` configures LDO-related bits in
`R_AX_SYS_SDIO_CTRL` for RTL8852A/885xB chips and RTL8852C chips. This
is a hardware register configuration that must be restored after power
cycling (suspend/resume).

### 4. SCOPE AND RISK ASSESSMENT

- **Change size**: 1 line added — minimal
- **Files touched**: 1 file (`drivers/net/wireless/realtek/rtw89/pci.c`)
- **Risk**: Extremely low — this calls an existing function that is
already called during normal initialization. It's simply calling it
again in the resume path to restore hardware state.
- **Subsystem**: WiFi driver (rtw89 — Realtek WiFi)

### 5. USER IMPACT

- **Who is affected**: Users with Realtek RTW89 WiFi adapters (RTL8852A,
RTL885xB, RTL8852C) who use suspend/resume
- **Severity**: HIGH — "card loss" means the WiFi card completely stops
working after resume, requiring a reboot
- **Real-world impact**: Laptop users who suspend their machines
regularly will lose WiFi functionality every time they resume

### 6. STABILITY

- The fix is from Realtek engineers (Dian-Syuan Yang, Ping-Ke Shih) who
maintain this driver
- It calls an existing, well-tested function — no new code paths are
introduced
- The pattern is well-established: many PCI drivers need to restore
register settings after resume

### 7. DEPENDENCY CHECK

The function `rtw89_pci_hci_ldo()` already exists in the codebase. The
`rtw89_pci_l2_hci_ldo()` call was already in the resume path. This
single-line addition has no dependencies on other commits.

### Summary

This is a textbook stable backport candidate:
- **Fixes a real bug**: WiFi card loss after suspend/resume
- **Obviously correct**: Restores hardware register configuration that
was present during init but missing during resume
- **Small and contained**: Single line addition calling an existing
function
- **No new features**: Just restoring existing hardware configuration
- **Low risk**: Calls well-tested existing code
- **High impact**: Affects laptop users who use suspend/resume with
these WiFi chips
- **From the hardware vendor**: Written by Realtek engineers who
understand the hardware

**YES**

drivers/net/wireless/realtek/rtw89/pci.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index b8135cf15d13c..fb4469a76bc03 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -4605,6 +4605,7 @@ static int __maybe_unused rtw89_pci_resume(struct device *dev)
rtw89_write32_clr(rtwdev, R_AX_PCIE_PS_CTRL_V1,
B_AX_SEL_REQ_ENTR_L1);
}
+ rtw89_pci_hci_ldo(rtwdev);
rtw89_pci_l2_hci_ldo(rtwdev);

rtw89_pci_basic_cfg(rtwdev, true);
--
2.51.0