Skip to content

Commit 336ba96

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3
On Meteor Lake, the GNA, IPU, and VPU devices are booted in D0 power state and will block the SoC from going into the deepest Package C-state if a driver is not present. Put each device in D3hot if no driver is found. Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230409192535.914540-1-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 8d99129 commit 336ba96

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

  • drivers/platform/x86/intel/pmc

drivers/platform/x86/intel/pmc/mtl.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
*/
1010

11+
#include <linux/pci.h>
1112
#include "core.h"
1213

1314
const struct pmc_reg_map mtl_reg_map = {
@@ -45,8 +46,38 @@ void mtl_core_configure(struct pmc_dev *pmcdev)
4546
pmc_core_send_ltr_ignore(pmcdev, 3);
4647
}
4748

49+
#define MTL_GNA_PCI_DEV 0x7e4c
50+
#define MTL_IPU_PCI_DEV 0x7d19
51+
#define MTL_VPU_PCI_DEV 0x7d1d
52+
static void mtl_set_device_d3(unsigned int device)
53+
{
54+
struct pci_dev *pcidev;
55+
56+
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
57+
if (pcidev) {
58+
if (!device_trylock(&pcidev->dev)) {
59+
pci_dev_put(pcidev);
60+
return;
61+
}
62+
if (!pcidev->dev.driver) {
63+
dev_info(&pcidev->dev, "Setting to D3hot\n");
64+
pci_set_power_state(pcidev, PCI_D3hot);
65+
}
66+
device_unlock(&pcidev->dev);
67+
pci_dev_put(pcidev);
68+
}
69+
}
70+
4871
void mtl_core_init(struct pmc_dev *pmcdev)
4972
{
5073
pmcdev->map = &mtl_reg_map;
5174
pmcdev->core_configure = mtl_core_configure;
75+
76+
/*
77+
* Set power state of select devices that do not have drivers to D3
78+
* so that they do not block Package C entry.
79+
*/
80+
mtl_set_device_d3(MTL_GNA_PCI_DEV);
81+
mtl_set_device_d3(MTL_IPU_PCI_DEV);
82+
mtl_set_device_d3(MTL_VPU_PCI_DEV);
5283
}

0 commit comments

Comments
 (0)