public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Jiajia Liu <liujia6264@gmail•com>
To: Felix Fietkau <nbd@nbd•name>,
	Lorenzo Bianconi <lorenzo@kernel•org>,
	Ryder Lee <ryder.lee@mediatek•com>,
	Shayne Chen <shayne.chen@mediatek•com>,
	Sean Wang <sean.wang@mediatek•com>,
	Matthias Brugger <matthias.bgg@gmail•com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora•com>
Cc: linux-wireless@vger•kernel.org, linux-kernel@vger•kernel.org,
	linux-arm-kernel@lists•infradead.org,
	linux-mediatek@lists•infradead.org,
	Jiajia Liu <liujiajia@kylinos•cn>
Subject: [PATCH] wifi: mt76: transform aspm_conf for pci_disable_link_state
Date: Tue,  2 Jun 2026 13:43:49 +0800	[thread overview]
Message-ID: <20260602054349.42429-1-liujia6264@gmail.com> (raw)

From: Jiajia Liu <liujiajia@kylinos•cn>

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>
---
 drivers/net/wireless/mediatek/mt76/pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/pci.c b/drivers/net/wireless/mediatek/mt76/pci.c
index 833923ab2483..11fe62aa8113 100644
--- a/drivers/net/wireless/mediatek/mt76/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/pci.c
@@ -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;
 	}
-- 
2.53.0



                 reply	other threads:[~2026-06-02  5:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260602054349.42429-1-liujia6264@gmail.com \
    --to=liujia6264@gmail$(echo .)com \
    --cc=angelogioacchino.delregno@collabora$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mediatek@lists$(echo .)infradead.org \
    --cc=linux-wireless@vger$(echo .)kernel.org \
    --cc=liujiajia@kylinos$(echo .)cn \
    --cc=lorenzo@kernel$(echo .)org \
    --cc=matthias.bgg@gmail$(echo .)com \
    --cc=nbd@nbd$(echo .)name \
    --cc=ryder.lee@mediatek$(echo .)com \
    --cc=sean.wang@mediatek$(echo .)com \
    --cc=shayne.chen@mediatek$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox