diff options
Diffstat (limited to 'drivers/acpi/sleep/main.c')
-rw-r--r-- | drivers/acpi/sleep/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 4addf8ad50ae..af7f4663deaa 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -468,6 +468,31 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
468 | *d_min_p = d_min; | 468 | *d_min_p = d_min; |
469 | return d_max; | 469 | return d_max; |
470 | } | 470 | } |
471 | |||
472 | /** | ||
473 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up | ||
474 | * capability of given device | ||
475 | * @dev: device to handle | ||
476 | * @enable: 'true' - enable, 'false' - disable the wake-up capability | ||
477 | */ | ||
478 | int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | ||
479 | { | ||
480 | acpi_handle handle; | ||
481 | struct acpi_device *adev; | ||
482 | |||
483 | if (!device_may_wakeup(dev)) | ||
484 | return -EINVAL; | ||
485 | |||
486 | handle = DEVICE_ACPI_HANDLE(dev); | ||
487 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | ||
488 | printk(KERN_DEBUG "ACPI handle has no context!\n"); | ||
489 | return -ENODEV; | ||
490 | } | ||
491 | |||
492 | return enable ? | ||
493 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : | ||
494 | acpi_disable_wakeup_device_power(adev); | ||
495 | } | ||
471 | #endif | 496 | #endif |
472 | 497 | ||
473 | static void acpi_power_off_prepare(void) | 498 | static void acpi_power_off_prepare(void) |