diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-20 20:17:42 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-23 16:13:54 -0500 |
commit | bac2a909a096c9110525c18cbb8ce73c660d5f71 (patch) | |
tree | 59bd2a6efea9c9cb4cca404f35ae94c67f0dd988 /drivers/pci/pci-acpi.c | |
parent | ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff) |
PCI / PM: Avoid resuming PCI devices during system suspend
Commit f25c0ae2b4c4 (ACPI / PM: Avoid resuming devices in ACPI PM
domain during system suspend) modified the ACPI PM domain's system
suspend callbacks to allow devices attached to it to be left in the
runtime-suspended state during system suspend so as to optimize
the suspend process.
This was based on the general mechanism introduced by commit
aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended
devices unnecessarily).
Extend that approach to PCI devices by modifying the PCI bus type's
->prepare callback to return 1 for devices that are runtime-suspended
when it is being executed and that are in a suitable power state and
need not be resumed going forward.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 3542150fc8a3..489063987325 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -501,12 +501,29 @@ static int acpi_pci_run_wake(struct pci_dev *dev, bool enable) | |||
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | static bool acpi_pci_need_resume(struct pci_dev *dev) | ||
505 | { | ||
506 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); | ||
507 | |||
508 | if (!adev || !acpi_device_power_manageable(adev)) | ||
509 | return false; | ||
510 | |||
511 | if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count) | ||
512 | return true; | ||
513 | |||
514 | if (acpi_target_system_state() == ACPI_STATE_S0) | ||
515 | return false; | ||
516 | |||
517 | return !!adev->power.flags.dsw_present; | ||
518 | } | ||
519 | |||
504 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { | 520 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { |
505 | .is_manageable = acpi_pci_power_manageable, | 521 | .is_manageable = acpi_pci_power_manageable, |
506 | .set_state = acpi_pci_set_power_state, | 522 | .set_state = acpi_pci_set_power_state, |
507 | .choose_state = acpi_pci_choose_state, | 523 | .choose_state = acpi_pci_choose_state, |
508 | .sleep_wake = acpi_pci_sleep_wake, | 524 | .sleep_wake = acpi_pci_sleep_wake, |
509 | .run_wake = acpi_pci_run_wake, | 525 | .run_wake = acpi_pci_run_wake, |
526 | .need_resume = acpi_pci_need_resume, | ||
510 | }; | 527 | }; |
511 | 528 | ||
512 | void acpi_pci_add_bus(struct pci_bus *bus) | 529 | void acpi_pci_add_bus(struct pci_bus *bus) |