aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r--drivers/pci/pci-acpi.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 1af4008182fd..b98106c110e7 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -283,7 +283,6 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = {
283 .is_manageable = acpi_pci_power_manageable, 283 .is_manageable = acpi_pci_power_manageable,
284 .set_state = acpi_pci_set_power_state, 284 .set_state = acpi_pci_set_power_state,
285 .choose_state = acpi_pci_choose_state, 285 .choose_state = acpi_pci_choose_state,
286 .can_wakeup = acpi_pci_can_wakeup,
287 .sleep_wake = acpi_pci_sleep_wake, 286 .sleep_wake = acpi_pci_sleep_wake,
288 .run_wake = acpi_pci_run_wake, 287 .run_wake = acpi_pci_run_wake,
289}; 288};
@@ -321,10 +320,39 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
321 return 0; 320 return 0;
322} 321}
323 322
323static void acpi_pci_wakeup_setup(struct device *dev)
324{
325 struct acpi_device *adev = acpi_dev_pm_get_node(dev);
326 struct pci_dev *pci_dev = to_pci_dev(dev);
327
328 if (!adev || !adev->wakeup.flags.valid)
329 return;
330
331 device_set_wakeup_capable(dev, true);
332 acpi_pci_sleep_wake(pci_dev, false);
333
334 pci_acpi_add_pm_notifier(adev, pci_dev);
335 if (adev->wakeup.flags.run_wake)
336 device_set_run_wake(dev, true);
337}
338
339static void acpi_pci_wakeup_cleanup(struct device *dev)
340{
341 struct acpi_device *adev = acpi_dev_pm_get_node(dev);
342
343 if (adev && adev->wakeup.flags.valid) {
344 device_set_wakeup_capable(dev, false);
345 device_set_run_wake(dev, false);
346 pci_acpi_remove_pm_notifier(adev);
347 }
348}
349
324static struct acpi_bus_type acpi_pci_bus = { 350static struct acpi_bus_type acpi_pci_bus = {
325 .bus = &pci_bus_type, 351 .bus = &pci_bus_type,
326 .find_device = acpi_pci_find_device, 352 .find_device = acpi_pci_find_device,
327 .find_bridge = acpi_pci_find_root_bridge, 353 .find_bridge = acpi_pci_find_root_bridge,
354 .setup = acpi_pci_wakeup_setup,
355 .cleanup = acpi_pci_wakeup_cleanup,
328}; 356};
329 357
330static int __init acpi_pci_init(void) 358static int __init acpi_pci_init(void)