diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e6ce262b5d44..6d85289f1c12 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -677,9 +677,8 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | |||
677 | device->wakeup.resources.count = package->package.count - 2; | 677 | device->wakeup.resources.count = package->package.count - 2; |
678 | for (i = 0; i < device->wakeup.resources.count; i++) { | 678 | for (i = 0; i < device->wakeup.resources.count; i++) { |
679 | element = &(package->package.elements[i + 2]); | 679 | element = &(package->package.elements[i + 2]); |
680 | if (element->type != ACPI_TYPE_ANY) { | 680 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) |
681 | return AE_BAD_DATA; | 681 | return AE_BAD_DATA; |
682 | } | ||
683 | 682 | ||
684 | device->wakeup.resources.handles[i] = element->reference.handle; | 683 | device->wakeup.resources.handles[i] = element->reference.handle; |
685 | } | 684 | } |
@@ -692,6 +691,9 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
692 | acpi_status status = 0; | 691 | acpi_status status = 0; |
693 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
694 | union acpi_object *package = NULL; | 693 | union acpi_object *package = NULL; |
694 | union acpi_object in_arg[3]; | ||
695 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
696 | acpi_status psw_status = AE_OK; | ||
695 | 697 | ||
696 | struct acpi_device_id button_device_ids[] = { | 698 | struct acpi_device_id button_device_ids[] = { |
697 | {"PNP0C0D", 0}, | 699 | {"PNP0C0D", 0}, |
@@ -700,7 +702,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
700 | {"", 0}, | 702 | {"", 0}, |
701 | }; | 703 | }; |
702 | 704 | ||
703 | |||
704 | /* _PRW */ | 705 | /* _PRW */ |
705 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 706 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
706 | if (ACPI_FAILURE(status)) { | 707 | if (ACPI_FAILURE(status)) { |
@@ -718,6 +719,45 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
718 | kfree(buffer.pointer); | 719 | kfree(buffer.pointer); |
719 | 720 | ||
720 | device->wakeup.flags.valid = 1; | 721 | device->wakeup.flags.valid = 1; |
722 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | ||
723 | * system for the ACPI device with the _PRW object. | ||
724 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | ||
725 | * So it is necessary to call _DSW object first. Only when it is not | ||
726 | * present will the _PSW object used. | ||
727 | */ | ||
728 | /* | ||
729 | * Three agruments are needed for the _DSW object. | ||
730 | * Argument 0: enable/disable the wake capabilities | ||
731 | * When _DSW object is called to disable the wake capabilities, maybe | ||
732 | * the first argument is filled. The value of the other two agruments | ||
733 | * is meaningless. | ||
734 | */ | ||
735 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
736 | in_arg[0].integer.value = 0; | ||
737 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
738 | in_arg[1].integer.value = 0; | ||
739 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
740 | in_arg[2].integer.value = 0; | ||
741 | psw_status = acpi_evaluate_object(device->handle, "_DSW", | ||
742 | &arg_list, NULL); | ||
743 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
744 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); | ||
745 | /* | ||
746 | * When the _DSW object is not present, OSPM will call _PSW object. | ||
747 | */ | ||
748 | if (psw_status == AE_NOT_FOUND) { | ||
749 | /* | ||
750 | * Only one agruments is required for the _PSW object. | ||
751 | * agrument 0: enable/disable the wake capabilities | ||
752 | */ | ||
753 | arg_list.count = 1; | ||
754 | in_arg[0].integer.value = 0; | ||
755 | psw_status = acpi_evaluate_object(device->handle, "_PSW", | ||
756 | &arg_list, NULL); | ||
757 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " | ||
759 | "evaluate _PSW\n")); | ||
760 | } | ||
721 | /* Power button, Lid switch always enable wakeup */ | 761 | /* Power button, Lid switch always enable wakeup */ |
722 | if (!acpi_match_device_ids(device, button_device_ids)) | 762 | if (!acpi_match_device_ids(device, button_device_ids)) |
723 | device->wakeup.flags.run_wake = 1; | 763 | device->wakeup.flags.run_wake = 1; |
@@ -882,10 +922,7 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
882 | static int | 922 | static int |
883 | acpi_video_bus_match(struct acpi_device *device) | 923 | acpi_video_bus_match(struct acpi_device *device) |
884 | { | 924 | { |
885 | acpi_handle h_dummy1; | 925 | acpi_handle h_dummy; |
886 | acpi_handle h_dummy2; | ||
887 | acpi_handle h_dummy3; | ||
888 | |||
889 | 926 | ||
890 | if (!device) | 927 | if (!device) |
891 | return -EINVAL; | 928 | return -EINVAL; |
@@ -895,18 +932,18 @@ acpi_video_bus_match(struct acpi_device *device) | |||
895 | */ | 932 | */ |
896 | 933 | ||
897 | /* Does this device able to support video switching ? */ | 934 | /* Does this device able to support video switching ? */ |
898 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && | 935 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && |
899 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) | 936 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) |
900 | return 0; | 937 | return 0; |
901 | 938 | ||
902 | /* Does this device able to retrieve a video ROM ? */ | 939 | /* Does this device able to retrieve a video ROM ? */ |
903 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) | 940 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) |
904 | return 0; | 941 | return 0; |
905 | 942 | ||
906 | /* Does this device able to configure which video head to be POSTed ? */ | 943 | /* Does this device able to configure which video head to be POSTed ? */ |
907 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && | 944 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && |
908 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && | 945 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && |
909 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) | 946 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) |
910 | return 0; | 947 | return 0; |
911 | 948 | ||
912 | return -ENODEV; | 949 | return -ENODEV; |