aboutsummaryrefslogtreecommitdiff
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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 9d6fc8e6285..f7904ff2ace 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -315,6 +315,25 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
}
return PCI_POWER_ERROR;
}
+
+static int acpi_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ struct acpi_device *adev;
+ int status;
+
+ if (!device_can_wakeup(dev))
+ return -EINVAL;
+
+ if (is_on && !device_may_wakeup(dev))
+ return -EINVAL;
+
+ status = acpi_bus_get_device(DEVICE_ACPI_HANDLE(dev), &adev);
+ if (status < 0)
+ return status;
+
+ adev->wakeup.state.enabled = !!is_on;
+ return 0;
+}
#endif
static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
@@ -399,6 +418,7 @@ static int __init acpi_pci_init(void)
return 0;
#ifdef CONFIG_ACPI_SLEEP
platform_pci_choose_state = acpi_pci_choose_state;
+ platform_enable_wakeup = acpi_platform_enable_wakeup;
#endif
platform_pci_set_power_state = acpi_pci_set_power_state;
return 0;