lkml.org 
[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] PCI: vmd: Enable ASPM for mobile platforms
Date
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@canonical.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
\
 
 \ /
  Last update: 2020-09-30 10:26    [W:0.164 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site