From: Manivannan Sadhasivam <[email protected]>

It is not recommended to enable/disable the ASPM states on the back of the
PCI core directly using the LNKCTL register. It will break the PCI core's
knowledge about the device ASPM states. So use the APIs exposed by the PCI
core to enable/disable ASPM states.

Signed-off-by: Manivannan Sadhasivam <[email protected]>
---
 drivers/net/wireless/ath/ath11k/pci.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/pci.c 
b/drivers/net/wireless/ath/ath11k/pci.c
index 
78444f8ea15356f1f4c90a496efd52780499bfb2..cec399765e04104ddcfcee5003c209e14c7d4ca0
 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -19,6 +19,8 @@
 #include "pcic.h"
 #include "qmi.h"
 
+#include "../ath.h"
+
 #define ATH11K_PCI_BAR_NUM             0
 #define ATH11K_PCI_DMA_MASK            36
 #define ATH11K_PCI_COHERENT_DMA_MASK   32
@@ -597,8 +599,7 @@ static void ath11k_pci_aspm_disable(struct ath11k_pci 
*ab_pci)
                   u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1));
 
        /* disable L0s and L1 */
-       pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL,
-                                  PCI_EXP_LNKCTL_ASPMC);
+       pci_disable_link_state(ab_pci->pdev, PCIE_LINK_STATE_L0S | 
PCIE_LINK_STATE_L1);
 
        set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags);
 }
@@ -606,10 +607,7 @@ static void ath11k_pci_aspm_disable(struct ath11k_pci 
*ab_pci)
 static void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci)
 {
        if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags))
-               pcie_capability_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL,
-                                                  PCI_EXP_LNKCTL_ASPMC,
-                                                  ab_pci->link_ctl &
-                                                  PCI_EXP_LNKCTL_ASPMC);
+               pci_enable_link_state(ab_pci->pdev, 
ath_pci_aspm_state(ab_pci->link_ctl));
 }
 
 #ifdef CONFIG_DEV_COREDUMP

-- 
2.45.2



Reply via email to