]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: pci: consolidate PCI basic configurations for probe and resume
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 25 Sep 2024 01:38:58 +0000 (09:38 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 1 Oct 2024 12:56:12 +0000 (20:56 +0800)
The PCI settings aren't always persistent after chip suspends, so
reconfigure the settings after chip resumes. Since most of these settings
are the same, consolidate them into a function to avoid missing somewhere.

Fix the missing case of 8922AE resume flow.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240925013901.9835-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/pci.c
drivers/net/wireless/realtek/rtw89/pci.h
drivers/net/wireless/realtek/rtw89/pci_be.c

index 02afeb3acce469927a08bf81d45dd2c638345c06..5733192cf3803f55cdffe7e2961f2fafedac7890 100644 (file)
@@ -4188,6 +4188,17 @@ static void rtw89_pci_l2_hci_ldo(struct rtw89_dev *rtwdev)
                                    RTW89_PCIE_BIT_CFG_RST_MSTATE);
 }
 
+void rtw89_pci_basic_cfg(struct rtw89_dev *rtwdev, bool resume)
+{
+       if (resume)
+               rtw89_pci_cfg_dac(rtwdev);
+
+       rtw89_pci_disable_eq(rtwdev);
+       rtw89_pci_filter_out(rtwdev);
+       rtw89_pci_link_cfg(rtwdev);
+       rtw89_pci_l1ss_cfg(rtwdev);
+}
+
 static int __maybe_unused rtw89_pci_resume(struct device *dev)
 {
        struct ieee80211_hw *hw = dev_get_drvdata(dev);
@@ -4209,11 +4220,8 @@ static int __maybe_unused rtw89_pci_resume(struct device *dev)
                                  B_AX_SEL_REQ_ENTR_L1);
        }
        rtw89_pci_l2_hci_ldo(rtwdev);
-       rtw89_pci_disable_eq(rtwdev);
-       rtw89_pci_cfg_dac(rtwdev);
-       rtw89_pci_filter_out(rtwdev);
-       rtw89_pci_link_cfg(rtwdev);
-       rtw89_pci_l1ss_cfg(rtwdev);
+
+       rtw89_pci_basic_cfg(rtwdev, true);
 
        return 0;
 }
@@ -4345,10 +4353,7 @@ int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto err_clear_resource;
        }
 
-       rtw89_pci_disable_eq(rtwdev);
-       rtw89_pci_filter_out(rtwdev);
-       rtw89_pci_link_cfg(rtwdev);
-       rtw89_pci_l1ss_cfg(rtwdev);
+       rtw89_pci_basic_cfg(rtwdev, false);
 
        ret = rtw89_core_napi_init(rtwdev);
        if (ret) {
index 48c3ab735db2a707490718610d69ad130370eec9..f101bd932f628afa1e97102832f7c2cef75cbc42 100644 (file)
@@ -1600,6 +1600,7 @@ struct pci_device_id;
 
 int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id);
 void rtw89_pci_remove(struct pci_dev *pdev);
+void rtw89_pci_basic_cfg(struct rtw89_dev *rtwdev, bool resume);
 void rtw89_pci_ops_reset(struct rtw89_dev *rtwdev);
 int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en);
 int rtw89_pci_ltr_set_v1(struct rtw89_dev *rtwdev, bool en);
index 7cc32822296528387af769b8d9cbba564502a6ce..c1415a7b18fffa9b0a876d09557a8b13b0fe1b44 100644 (file)
@@ -584,6 +584,8 @@ static int __maybe_unused rtw89_pci_resume_be(struct device *dev)
        rtw89_write32_set(rtwdev, R_BE_SER_PL1_CTRL, B_BE_PL1_SER_PL1_EN);
        rtw89_write32_set(rtwdev, R_BE_REG_PL1_MASK, B_BE_SER_PM_MASTER_IMR);
 
+       rtw89_pci_basic_cfg(rtwdev, true);
+
        return 0;
 }