]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: transform aspm_conf for pci_disable_link_state
authorJiajia Liu <liujiajia@kylinos.cn>
Tue, 2 Jun 2026 05:43:49 +0000 (13:43 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jun 2026 10:15:22 +0000 (10:15 +0000)
commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") changed
PCIE_LINK_STATE_L0S (1) to (BIT(0) | BIT(1)). PCI_EXP_LNKCTL_ASPM_L0S (1)
and PCI_EXP_LNKCTL_ASPM_L1 (2) are no longer matched with
PCIE_LINK_STATE_L0S (3) and PCIE_LINK_STATE_L1 (4).

On the platform enabling ASPM L0s and L1, mt76_pci_disable_aspm is not able
to disable L1. Fix this by transforming aspm_conf to pcie link state.

Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
Link: https://patch.msgid.link/20260602054349.42429-1-liujia6264@gmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/pci.c

index 833923ab2483615d3f96e65abc5c91efe3618c85..11fe62aa81136b13653e2da44436121087066100 100644 (file)
@@ -30,8 +30,14 @@ void mt76_pci_disable_aspm(struct pci_dev *pdev)
 
        if (IS_ENABLED(CONFIG_PCIEASPM)) {
                int err;
+               int state = 0;
 
-               err = pci_disable_link_state(pdev, aspm_conf);
+               if (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S)
+                       state |= PCIE_LINK_STATE_L0S;
+               if (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1)
+                       state |= PCIE_LINK_STATE_L1;
+
+               err = pci_disable_link_state(pdev, state);
                if (!err)
                        return;
        }