aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorLee, Chun-Yi <jlee@suse.com>2012-03-19 05:37:33 -0400
committerMatthew Garrett <mjg@redhat.com>2012-03-26 15:05:28 -0400
commit996d23ba36a0e505744a047d2138e189c64c6619 (patch)
tree2a19dfdb60bb33f9b7115223f87d9dec638f5119 /drivers/platform
parent34b6cfabd760d3a2784f0ae649eb5e390e0e53cc (diff)
acer-wmi: fix out of input parameter size when set
The input parameter of set device status is different with get device status. There have volume value element for set status but don't need for get action. On Acer TravelMate 4750 creates field on volume value element even doesn't use it in DSDT. So, add this patch for separate input paramter between set device status with get status. Tested on Acer TravelMate 4750 Cc: Carlos Corbacho <carlos@strangeworlds.co.uk> Cc: Matthew Garrett <mjg@redhat.com> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Corentin Chary <corentincj@iksaif.net> Cc: Thomas Renninger <trenn@suse.de> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/acer-wmi.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index cb7e841582d9..c31664438e76 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -159,7 +159,14 @@ struct lm_return_value {
159 u16 reserved; 159 u16 reserved;
160} __attribute__((packed)); 160} __attribute__((packed));
161 161
162struct wmid3_gds_input_param { /* Get Device Status input parameter */ 162struct wmid3_gds_set_input_param { /* Set Device Status input parameter */
163 u8 function_num; /* Function Number */
164 u8 hotkey_number; /* Hotkey Number */
165 u16 devices; /* Set Device */
166 u8 volume_value; /* Volume Value */
167} __attribute__((packed));
168
169struct wmid3_gds_get_input_param { /* Get Device Status input parameter */
163 u8 function_num; /* Function Number */ 170 u8 function_num; /* Function Number */
164 u8 hotkey_number; /* Hotkey Number */ 171 u8 hotkey_number; /* Hotkey Number */
165 u16 devices; /* Get Device */ 172 u16 devices; /* Get Device */
@@ -922,13 +929,13 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device)
922 struct wmid3_gds_return_value return_value; 929 struct wmid3_gds_return_value return_value;
923 acpi_status status; 930 acpi_status status;
924 union acpi_object *obj; 931 union acpi_object *obj;
925 struct wmid3_gds_input_param params = { 932 struct wmid3_gds_get_input_param params = {
926 .function_num = 0x1, 933 .function_num = 0x1,
927 .hotkey_number = commun_fn_key_number, 934 .hotkey_number = commun_fn_key_number,
928 .devices = device, 935 .devices = device,
929 }; 936 };
930 struct acpi_buffer input = { 937 struct acpi_buffer input = {
931 sizeof(struct wmid3_gds_input_param), 938 sizeof(struct wmid3_gds_get_input_param),
932 &params 939 &params
933 }; 940 };
934 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 941 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -991,19 +998,28 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device)
991 acpi_status status; 998 acpi_status status;
992 union acpi_object *obj; 999 union acpi_object *obj;
993 u16 devices; 1000 u16 devices;
994 struct wmid3_gds_input_param params = { 1001 struct wmid3_gds_get_input_param get_params = {
995 .function_num = 0x1, 1002 .function_num = 0x1,
996 .hotkey_number = commun_fn_key_number, 1003 .hotkey_number = commun_fn_key_number,
997 .devices = commun_func_bitmap, 1004 .devices = commun_func_bitmap,
998 }; 1005 };
999 struct acpi_buffer input = { 1006 struct acpi_buffer get_input = {
1000 sizeof(struct wmid3_gds_input_param), 1007 sizeof(struct wmid3_gds_get_input_param),
1001 &params 1008 &get_params
1009 };
1010 struct wmid3_gds_set_input_param set_params = {
1011 .function_num = 0x2,
1012 .hotkey_number = commun_fn_key_number,
1013 .devices = commun_func_bitmap,
1014 };
1015 struct acpi_buffer set_input = {
1016 sizeof(struct wmid3_gds_set_input_param),
1017 &set_params
1002 }; 1018 };
1003 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 1019 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
1004 struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL }; 1020 struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
1005 1021
1006 status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output); 1022 status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &get_input, &output);
1007 if (ACPI_FAILURE(status)) 1023 if (ACPI_FAILURE(status))
1008 return status; 1024 return status;
1009 1025
@@ -1032,11 +1048,9 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device)
1032 } 1048 }
1033 1049
1034 devices = return_value.devices; 1050 devices = return_value.devices;
1035 params.function_num = 0x2; 1051 set_params.devices = (value) ? (devices | device) : (devices & ~device);
1036 params.hotkey_number = commun_fn_key_number;
1037 params.devices = (value) ? (devices | device) : (devices & ~device);
1038 1052
1039 status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2); 1053 status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &set_input, &output2);
1040 if (ACPI_FAILURE(status)) 1054 if (ACPI_FAILURE(status))
1041 return status; 1055 return status;
1042 1056