aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/acer-wmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/acer-wmi.c')
-rw-r--r--drivers/platform/x86/acer-wmi.c60
1 files changed, 36 insertions, 24 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 06f4eb7ab87e..afed7018a2b5 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -125,8 +125,11 @@ static const struct key_entry acer_wmi_keymap[] = {
125 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, 125 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} },
126 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ 126 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
127 {KE_IGNORE, 0x81, {KEY_SLEEP} }, 127 {KE_IGNORE, 0x81, {KEY_SLEEP} },
128 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */ 128 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
129 {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
130 {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
129 {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} }, 131 {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
132 {KE_KEY, 0x85, {KEY_TOUCHPAD_TOGGLE} },
130 {KE_END, 0} 133 {KE_END, 0}
131}; 134};
132 135
@@ -147,6 +150,7 @@ struct event_return_value {
147#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ 150#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */
148#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */ 151#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */
149#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ 152#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */
153#define ACER_WMID3_GDS_TOUCHPAD (1<<1) /* Touchpad */
150 154
151struct lm_input_params { 155struct lm_input_params {
152 u8 function_num; /* Function Number */ 156 u8 function_num; /* Function Number */
@@ -875,7 +879,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
875 struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) }; 879 struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) };
876 struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; 880 struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL };
877 union acpi_object *obj; 881 union acpi_object *obj;
878 u32 tmp; 882 u32 tmp = 0;
879 acpi_status status; 883 acpi_status status;
880 884
881 status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result); 885 status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
@@ -884,14 +888,14 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
884 return status; 888 return status;
885 889
886 obj = (union acpi_object *) result.pointer; 890 obj = (union acpi_object *) result.pointer;
887 if (obj && obj->type == ACPI_TYPE_BUFFER && 891 if (obj) {
888 (obj->buffer.length == sizeof(u32) || 892 if (obj->type == ACPI_TYPE_BUFFER &&
889 obj->buffer.length == sizeof(u64))) { 893 (obj->buffer.length == sizeof(u32) ||
890 tmp = *((u32 *) obj->buffer.pointer); 894 obj->buffer.length == sizeof(u64))) {
891 } else if (obj->type == ACPI_TYPE_INTEGER) { 895 tmp = *((u32 *) obj->buffer.pointer);
892 tmp = (u32) obj->integer.value; 896 } else if (obj->type == ACPI_TYPE_INTEGER) {
893 } else { 897 tmp = (u32) obj->integer.value;
894 tmp = 0; 898 }
895 } 899 }
896 900
897 if (out) 901 if (out)
@@ -1193,12 +1197,14 @@ static acpi_status WMID_set_capabilities(void)
1193 return status; 1197 return status;
1194 1198
1195 obj = (union acpi_object *) out.pointer; 1199 obj = (union acpi_object *) out.pointer;
1196 if (obj && obj->type == ACPI_TYPE_BUFFER && 1200 if (obj) {
1197 (obj->buffer.length == sizeof(u32) || 1201 if (obj->type == ACPI_TYPE_BUFFER &&
1198 obj->buffer.length == sizeof(u64))) { 1202 (obj->buffer.length == sizeof(u32) ||
1199 devices = *((u32 *) obj->buffer.pointer); 1203 obj->buffer.length == sizeof(u64))) {
1200 } else if (obj->type == ACPI_TYPE_INTEGER) { 1204 devices = *((u32 *) obj->buffer.pointer);
1201 devices = (u32) obj->integer.value; 1205 } else if (obj->type == ACPI_TYPE_INTEGER) {
1206 devices = (u32) obj->integer.value;
1207 }
1202 } else { 1208 } else {
1203 kfree(out.pointer); 1209 kfree(out.pointer);
1204 return AE_ERROR; 1210 return AE_ERROR;
@@ -1676,6 +1682,7 @@ static void acer_wmi_notify(u32 value, void *context)
1676 acpi_status status; 1682 acpi_status status;
1677 u16 device_state; 1683 u16 device_state;
1678 const struct key_entry *key; 1684 const struct key_entry *key;
1685 u32 scancode;
1679 1686
1680 status = wmi_get_event_data(value, &response); 1687 status = wmi_get_event_data(value, &response);
1681 if (status != AE_OK) { 1688 if (status != AE_OK) {
@@ -1712,6 +1719,7 @@ static void acer_wmi_notify(u32 value, void *context)
1712 pr_warn("Unknown key number - 0x%x\n", 1719 pr_warn("Unknown key number - 0x%x\n",
1713 return_value.key_num); 1720 return_value.key_num);
1714 } else { 1721 } else {
1722 scancode = return_value.key_num;
1715 switch (key->keycode) { 1723 switch (key->keycode) {
1716 case KEY_WLAN: 1724 case KEY_WLAN:
1717 case KEY_BLUETOOTH: 1725 case KEY_BLUETOOTH:
@@ -1725,9 +1733,11 @@ static void acer_wmi_notify(u32 value, void *context)
1725 rfkill_set_sw_state(bluetooth_rfkill, 1733 rfkill_set_sw_state(bluetooth_rfkill,
1726 !(device_state & ACER_WMID3_GDS_BLUETOOTH)); 1734 !(device_state & ACER_WMID3_GDS_BLUETOOTH));
1727 break; 1735 break;
1736 case KEY_TOUCHPAD_TOGGLE:
1737 scancode = (device_state & ACER_WMID3_GDS_TOUCHPAD) ?
1738 KEY_TOUCHPAD_ON : KEY_TOUCHPAD_OFF;
1728 } 1739 }
1729 sparse_keymap_report_entry(acer_wmi_input_dev, key, 1740 sparse_keymap_report_event(acer_wmi_input_dev, scancode, 1, true);
1730 1, true);
1731 } 1741 }
1732 break; 1742 break;
1733 case WMID_ACCEL_EVENT: 1743 case WMID_ACCEL_EVENT:
@@ -1946,12 +1956,14 @@ static u32 get_wmid_devices(void)
1946 return 0; 1956 return 0;
1947 1957
1948 obj = (union acpi_object *) out.pointer; 1958 obj = (union acpi_object *) out.pointer;
1949 if (obj && obj->type == ACPI_TYPE_BUFFER && 1959 if (obj) {
1950 (obj->buffer.length == sizeof(u32) || 1960 if (obj->type == ACPI_TYPE_BUFFER &&
1951 obj->buffer.length == sizeof(u64))) { 1961 (obj->buffer.length == sizeof(u32) ||
1952 devices = *((u32 *) obj->buffer.pointer); 1962 obj->buffer.length == sizeof(u64))) {
1953 } else if (obj->type == ACPI_TYPE_INTEGER) { 1963 devices = *((u32 *) obj->buffer.pointer);
1954 devices = (u32) obj->integer.value; 1964 } else if (obj->type == ACPI_TYPE_INTEGER) {
1965 devices = (u32) obj->integer.value;
1966 }
1955 } 1967 }
1956 1968
1957 kfree(out.pointer); 1969 kfree(out.pointer);