diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3e009674f333..7491a52ad97a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -741,19 +741,39 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | |||
741 | return AE_OK; | 741 | return AE_OK; |
742 | } | 742 | } |
743 | 743 | ||
744 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | 744 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
745 | { | 745 | { |
746 | acpi_status status = 0; | ||
747 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
748 | union acpi_object *package = NULL; | ||
749 | int psw_error; | ||
750 | |||
751 | struct acpi_device_id button_device_ids[] = { | 746 | struct acpi_device_id button_device_ids[] = { |
752 | {"PNP0C0D", 0}, | 747 | {"PNP0C0D", 0}, |
753 | {"PNP0C0C", 0}, | 748 | {"PNP0C0C", 0}, |
754 | {"PNP0C0E", 0}, | 749 | {"PNP0C0E", 0}, |
755 | {"", 0}, | 750 | {"", 0}, |
756 | }; | 751 | }; |
752 | acpi_status status; | ||
753 | acpi_event_status event_status; | ||
754 | |||
755 | device->wakeup.run_wake_count = 0; | ||
756 | |||
757 | /* Power button, Lid switch always enable wakeup */ | ||
758 | if (!acpi_match_device_ids(device, button_device_ids)) { | ||
759 | device->wakeup.flags.run_wake = 1; | ||
760 | device->wakeup.flags.always_enabled = 1; | ||
761 | return; | ||
762 | } | ||
763 | |||
764 | status = acpi_get_gpe_status(NULL, device->wakeup.gpe_number, | ||
765 | ACPI_NOT_ISR, &event_status); | ||
766 | if (status == AE_OK) | ||
767 | device->wakeup.flags.run_wake = | ||
768 | !!(event_status & ACPI_EVENT_FLAG_HANDLE); | ||
769 | } | ||
770 | |||
771 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | ||
772 | { | ||
773 | acpi_status status = 0; | ||
774 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
775 | union acpi_object *package = NULL; | ||
776 | int psw_error; | ||
757 | 777 | ||
758 | /* _PRW */ | 778 | /* _PRW */ |
759 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 779 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
@@ -773,6 +793,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
773 | 793 | ||
774 | device->wakeup.flags.valid = 1; | 794 | device->wakeup.flags.valid = 1; |
775 | device->wakeup.prepare_count = 0; | 795 | device->wakeup.prepare_count = 0; |
796 | acpi_bus_set_run_wake_flags(device); | ||
776 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | 797 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping |
777 | * system for the ACPI device with the _PRW object. | 798 | * system for the ACPI device with the _PRW object. |
778 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | 799 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. |
@@ -784,10 +805,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
784 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 805 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
785 | "error in _DSW or _PSW evaluation\n")); | 806 | "error in _DSW or _PSW evaluation\n")); |
786 | 807 | ||
787 | /* Power button, Lid switch always enable wakeup */ | ||
788 | if (!acpi_match_device_ids(device, button_device_ids)) | ||
789 | device->wakeup.flags.run_wake = 1; | ||
790 | |||
791 | end: | 808 | end: |
792 | if (ACPI_FAILURE(status)) | 809 | if (ACPI_FAILURE(status)) |
793 | device->flags.wake_capable = 0; | 810 | device->flags.wake_capable = 0; |