diff options
author | Lin Ming <ming.m.lin@intel.com> | 2012-03-27 03:43:25 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-03-30 02:21:18 -0400 |
commit | b24e5098853653554baf6ec975b9e855f3d6e5c0 (patch) | |
tree | be93ad39b826c64907bb48dceea034db5b91fc24 /drivers/acpi/sleep.c | |
parent | 0090def6c37c8ea29508a435e581f2ef26fea10f (diff) |
ACPI, PCI: Move acpi_dev_run_wake() to ACPI core
acpi_dev_run_wake() is a generic function which can be used by
other subsystem too. Rename it to acpi_pm_device_run_wake, to be
consistent with acpi_pm_device_sleep_wake.
Then move it to ACPI core.
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
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 |