[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200930082455.25613-2-kai.heng.feng@canonical.com>
Date: Wed, 30 Sep 2020 16:24:54 +0800
From: Kai-Heng Feng <kai.heng.feng@...onical.com>
To: bhelgaas@...gle.com, jonathan.derrick@...el.com
Cc: Kai-Heng Feng <kai.heng.feng@...onical.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 2/2] PCI: vmd: Enable ASPM for mobile platforms
BIOS may not be able to program ASPM for links behind VMD, prevent Intel
SoC from entering deeper power saving state.
So enable ASPM for links behind VMD to increase battery life.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
---
drivers/pci/controller/vmd.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index f69ef8c89f72..058fdef9c566 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -417,6 +417,22 @@ static int vmd_find_free_domain(void)
return domain + 1;
}
+static const struct pci_device_id vmd_mobile_bridge_tbl[] = {
+ { PCI_VDEVICE(INTEL, 0x9a09) },
+ { PCI_VDEVICE(INTEL, 0xa0b0) },
+ { PCI_VDEVICE(INTEL, 0xa0bc) },
+ { }
+};
+
+static int vmd_enable_aspm(struct device *dev, void *data)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL);
+
+ return 0;
+}
+
static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
{
struct pci_sysdata *sd = &vmd->sysdata;
@@ -603,8 +619,12 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
* and will fail pcie_bus_configure_settings() early. It can instead be
* run on each of the real root ports.
*/
- list_for_each_entry(child, &vmd->bus->children, node)
+ list_for_each_entry(child, &vmd->bus->children, node) {
+ if (pci_match_id(vmd_mobile_bridge_tbl, child->self))
+ device_for_each_child(&child->self->dev, NULL, vmd_enable_aspm);
+
pcie_bus_configure_settings(child);
+ }
pci_bus_add_devices(vmd->bus);
--
2.17.1
Powered by blists - more mailing lists