diff options
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r-- | drivers/acpi/sleep.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index ca191ff97844..00fa664d5fd8 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/suspend.h> | 17 | #include <linux/suspend.h> |
18 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
19 | #include <linux/acpi.h> | 19 | #include <linux/acpi.h> |
20 | #include <linux/pm_runtime.h> | ||
20 | 21 | ||
21 | #include <asm/io.h> | 22 | #include <asm/io.h> |
22 | 23 | ||
@@ -730,6 +731,40 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
730 | 731 | ||
731 | #ifdef CONFIG_PM_SLEEP | 732 | #ifdef CONFIG_PM_SLEEP |
732 | /** | 733 | /** |
734 | * acpi_pm_device_run_wake - Enable/disable wake-up for given device. | ||
735 | * @phys_dev: Device to enable/disable the platform to wake-up the system for. | ||
736 | * @enable: Whether enable or disable the wake-up functionality. | ||
737 | * | ||
738 | * Find the ACPI device object corresponding to @pci_dev and try to | ||
739 | * enable/disable the GPE associated with it. | ||
740 | */ | ||
741 | int acpi_pm_device_run_wake(struct device *phys_dev, bool enable) | ||
742 | { | ||
743 | struct acpi_device *dev; | ||
744 | acpi_handle handle; | ||
745 | |||
746 | if (!device_run_wake(phys_dev)) | ||
747 | return -EINVAL; | ||
748 | |||
749 | handle = DEVICE_ACPI_HANDLE(phys_dev); | ||
750 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev))) { | ||
751 | dev_dbg(phys_dev, "ACPI handle has no context in %s!\n", | ||
752 | __func__); | ||
753 | return -ENODEV; | ||
754 | } | ||
755 | |||
756 | if (enable) { | ||
757 | acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0); | ||
758 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number); | ||
759 | } else { | ||
760 | acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number); | ||
761 | acpi_disable_wakeup_device_power(dev); | ||
762 | } | ||
763 | |||
764 | return 0; | ||
765 | } | ||
766 | |||
767 | /** | ||
733 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up | 768 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up |
734 | * capability of given device | 769 | * capability of given device |
735 | * @dev: device to handle | 770 | * @dev: device to handle |