Currently rtw_pci_shutdown() invokes chip->ops->shutdown() and immediately transitions the device to PCI_D3hot without powering off the MAC or disabling PCI interrupts when RTW_FLAG_POWERON is active. On RTL8723DE combo cards, leaving the MAC powered across a warm reset causes REG_APS_FSMCO polling (offset 0x5, mask 0x1) to time out with -EBUSY (-16) on the next boot. Power off the MAC under rtwdev->mutex and disable PCI interrupts before entering PCI_D3hot. Signed-off-by: Swapnil Shinde --- drivers/net/wireless/realtek/rtw88/pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index 66d2e5f51..b0bbb9397 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -1949,14 +1949,29 @@ void rtw_pci_shutdown(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct rtw_dev *rtwdev; + struct rtw_pci *rtwpci; const struct rtw_chip_info *chip; if (!hw) return; rtwdev = hw->priv; + rtwpci = (struct rtw_pci *)rtwdev->priv; chip = rtwdev->chip; + mutex_lock(&rtwdev->mutex); + if (test_bit(RTW_FLAG_POWERON, rtwdev->flags)) { + clear_bit(RTW_FLAG_RUNNING, rtwdev->flags); + clear_bit(RTW_FLAG_FW_RUNNING, rtwdev->flags); + rtw_power_off(rtwdev); + clear_bit(RTW_FLAG_POWERON, rtwdev->flags); + } else { + rtw_hci_link_ps(rtwdev, false); + } + mutex_unlock(&rtwdev->mutex); + + rtw_pci_disable_interrupt(rtwdev, rtwpci); + if (chip->ops->shutdown) chip->ops->shutdown(rtwdev); -- 2.56.0