aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-02-17 17:41:07 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:20:45 -0500
commit9630bdd9b15d2f489c646d8bc04b60e53eb5ec78 (patch)
treeed99f729cb9142492e0cdf2f7d19f2f33069a3f4 /drivers/acpi/sleep.c
parentc39fae1416d59fd565606793f090cebe3720d50d (diff)
ACPI: Use GPE reference counting to support shared GPEs
ACPI GPEs may map to multiple devices. The current GPE interface only provides a mechanism for enabling and disabling GPEs, making it difficult to change the state of GPEs at runtime without extensive cooperation between devices. Add an API to allow devices to indicate whether or not they want their device's GPE to be enabled for both runtime and wakeup events. Remove the old GPE type handling entirely, which gets rid of various quirks, like the implicit disabling with GPE type setting. This requires a small amount of rework in order to ensure that non-wake GPEs are enabled by default to preserve existing behaviour. Based on patches from Matthew Garrett <mjg@redhat.com>. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r--drivers/acpi/sleep.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 79d33d908b5a..3bde594a9979 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -745,9 +745,18 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
745 return -ENODEV; 745 return -ENODEV;
746 } 746 }
747 747
748 error = enable ? 748 if (enable) {
749 acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : 749 error = acpi_enable_wakeup_device_power(adev,
750 acpi_disable_wakeup_device_power(adev); 750 acpi_target_sleep_state);
751 if (!error)
752 acpi_enable_gpe(adev->wakeup.gpe_device,
753 adev->wakeup.gpe_number,
754 ACPI_GPE_TYPE_WAKE);
755 } else {
756 acpi_disable_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number,
757 ACPI_GPE_TYPE_WAKE);
758 error = acpi_disable_wakeup_device_power(adev);
759 }
751 if (!error) 760 if (!error)
752 dev_info(dev, "wake-up capability %s by ACPI\n", 761 dev_info(dev, "wake-up capability %s by ACPI\n",
753 enable ? "enabled" : "disabled"); 762 enable ? "enabled" : "disabled");