[PATCH 4/4] PCI/PM: Enable D3cold support for system suspend

From: Huang Ying
Date: Tue Jan 29 2013 - 01:27:00 EST


Device may need to be put in D3cold on some platforms, especially
because we treat ACPI_STATE_D3 as ACPI_STATE_D3_COLD now.

Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
---
drivers/pci/pci-driver.c | 5 +++++
drivers/pci/pci.c | 4 ----
2 files changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -579,6 +579,7 @@ static bool pci_has_legacy_pm_support(st
static int pci_pm_prepare(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct pci_dev *pci_dev = to_pci_dev(dev);
int error = 0;

/*
@@ -592,6 +593,10 @@ static int pci_pm_prepare(struct device
*/
pm_runtime_resume(dev);

+ if (!pci_dev->d3cold_allowed)
+ pci_dev->no_d3cold = true;
+ else
+ pci_dev->no_d3cold = false;
if (drv && drv->pm && drv->pm->prepare)
error = drv->pm->prepare(dev);

--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1798,10 +1798,6 @@ int pci_prepare_to_sleep(struct pci_dev
if (target_state == PCI_POWER_ERROR)
return -EIO;

- /* D3cold during system suspend/hibernate is not supported */
- if (target_state > PCI_D3hot)
- target_state = PCI_D3hot;
-
pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev));

error = pci_set_power_state(dev, target_state);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/