aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-02-17 17:44:09 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:21:02 -0500
commitb67ea76172d4b1922c4b3c46c8ea8e9fec1ff38c (patch)
treec2f51811376060b3b59ac43243a182b94a48be9b /drivers/acpi/pci_root.c
parent3f0be67188c60ebf1b5d00354b44b4b24f5af313 (diff)
PCI / ACPI / PM: Platform support for PCI PME wake-up
Although the majority of PCI devices can generate PMEs that in principle may be used to wake up devices suspended at run time, platform support is generally necessary to convert PMEs into wake-up events that can be delivered to the kernel. If ACPI is used for this purpose, PME signals generated by a PCI device will trigger the ACPI GPE associated with the device to generate an ACPI wake-up event that we can set up a handler for, provided that everything is configured correctly. Unfortunately, the subset of PCI devices that have GPEs associated with them is quite limited. The devices without dedicated GPEs have to rely on the GPEs associated with other devices (in the majority of cases their upstream bridges and, possibly, the root bridge) to generate ACPI wake-up events in response to PME signals from them. Add ACPI platform support for PCI PME wake-up: o Add a framework making is possible to use ACPI system notify handlers for run-time PM. o Add new PCI platform callback ->run_wake() to struct pci_platform_pm_ops allowing us to enable/disable the platform to generate wake-up events for given device. Implemet this callback for the ACPI platform. o Define ACPI wake-up handlers for PCI devices and PCI root buses and make the PCI-ACPI binding code register wake-up notifiers for all PCI devices present in the ACPI tables. o Add function pci_dev_run_wake() which can be used by PCI drivers to check if given device is capable of generating wake-up events at run time. Developed in cooperation with Matthew Garrett <mjg@redhat.com>. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 64f55b6db73c..9cd8bedb1e5a 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -30,6 +30,7 @@
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/pm.h> 32#include <linux/pm.h>
33#include <linux/pm_runtime.h>
33#include <linux/pci.h> 34#include <linux/pci.h>
34#include <linux/pci-acpi.h> 35#include <linux/pci-acpi.h>
35#include <linux/acpi.h> 36#include <linux/acpi.h>
@@ -528,6 +529,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
528 if (flags != base_flags) 529 if (flags != base_flags)
529 acpi_pci_osc_support(root, flags); 530 acpi_pci_osc_support(root, flags);
530 531
532 pci_acpi_add_bus_pm_notifier(device, root->bus);
533 if (device->wakeup.flags.run_wake)
534 device_set_run_wake(root->bus->bridge, true);
535
531 return 0; 536 return 0;
532 537
533end: 538end:
@@ -549,6 +554,9 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
549{ 554{
550 struct acpi_pci_root *root = acpi_driver_data(device); 555 struct acpi_pci_root *root = acpi_driver_data(device);
551 556
557 device_set_run_wake(root->bus->bridge, false);
558 pci_acpi_remove_bus_pm_notifier(device);
559
552 kfree(root); 560 kfree(root);
553 return 0; 561 return 0;
554} 562}