aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-18 00:41:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-18 00:41:02 -0400
commita7d5c189719846889c029c34e24e166a465368fa (patch)
tree51a267b497ad838acfec29afd135033d693b43d5
parenta8f155855842f04273666192d3767fa9b94aaa58 (diff)
parent8a1513b49321e503fd6c8b6793e3b1f9a8a3285b (diff)
Merge tag 'platform-drivers-x86-v4.3-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
Pull x86 platform driver fixes from Darren Hart: "Fix an issue introduced by the previous major toshiba rework. Add a quirk. Workaround a few platform specific firmware items. One cleanup to wmi I inadvertently dropped from a previous pull request. Details: hp-wmi: - limit hotkey enable toshiba_acpi: - Fix hotkeys registration on some toshiba models - Fix USB Sleep and Music always disabled wmi: - Remove private %pUL implementation asus-nb-wmi: - Add wapf=4 quirk for X456UA/X456UF" * tag 'platform-drivers-x86-v4.3-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: hp-wmi: limit hotkey enable toshiba_acpi: Fix hotkeys registration on some toshiba models toshiba_acpi: Fix USB Sleep and Music always disabled wmi: Remove private %pUL implementation asus-nb-wmi: Add wapf=4 quirk for X456UA/X456UF
-rw-r--r--drivers/platform/x86/asus-nb-wmi.c18
-rw-r--r--drivers/platform/x86/hp-wmi.c31
-rw-r--r--drivers/platform/x86/toshiba_acpi.c10
-rw-r--r--drivers/platform/x86/wmi.c51
4 files changed, 48 insertions, 62 deletions
diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index abdaed34c728..131fee2b093e 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -128,6 +128,24 @@ static const struct dmi_system_id asus_quirks[] = {
128 }, 128 },
129 { 129 {
130 .callback = dmi_matched, 130 .callback = dmi_matched,
131 .ident = "ASUSTeK COMPUTER INC. X456UA",
132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
134 DMI_MATCH(DMI_PRODUCT_NAME, "X456UA"),
135 },
136 .driver_data = &quirk_asus_wapf4,
137 },
138 {
139 .callback = dmi_matched,
140 .ident = "ASUSTeK COMPUTER INC. X456UF",
141 .matches = {
142 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
143 DMI_MATCH(DMI_PRODUCT_NAME, "X456UF"),
144 },
145 .driver_data = &quirk_asus_wapf4,
146 },
147 {
148 .callback = dmi_matched,
131 .ident = "ASUSTeK COMPUTER INC. X501U", 149 .ident = "ASUSTeK COMPUTER INC. X501U",
132 .matches = { 150 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 151 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 06697315a088..fb4dd7b3ee71 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -54,8 +54,9 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
54#define HPWMI_HARDWARE_QUERY 0x4 54#define HPWMI_HARDWARE_QUERY 0x4
55#define HPWMI_WIRELESS_QUERY 0x5 55#define HPWMI_WIRELESS_QUERY 0x5
56#define HPWMI_BIOS_QUERY 0x9 56#define HPWMI_BIOS_QUERY 0x9
57#define HPWMI_FEATURE_QUERY 0xb
57#define HPWMI_HOTKEY_QUERY 0xc 58#define HPWMI_HOTKEY_QUERY 0xc
58#define HPWMI_FEATURE_QUERY 0xd 59#define HPWMI_FEATURE2_QUERY 0xd
59#define HPWMI_WIRELESS2_QUERY 0x1b 60#define HPWMI_WIRELESS2_QUERY 0x1b
60#define HPWMI_POSTCODEERROR_QUERY 0x2a 61#define HPWMI_POSTCODEERROR_QUERY 0x2a
61 62
@@ -295,25 +296,33 @@ static int hp_wmi_tablet_state(void)
295 return (state & 0x4) ? 1 : 0; 296 return (state & 0x4) ? 1 : 0;
296} 297}
297 298
298static int __init hp_wmi_bios_2009_later(void) 299static int __init hp_wmi_bios_2008_later(void)
299{ 300{
300 int state = 0; 301 int state = 0;
301 int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, 0, &state, 302 int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, 0, &state,
302 sizeof(state), sizeof(state)); 303 sizeof(state), sizeof(state));
303 if (ret) 304 if (!ret)
304 return ret; 305 return 1;
305 306
306 return (state & 0x10) ? 1 : 0; 307 return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO;
307} 308}
308 309
309static int hp_wmi_enable_hotkeys(void) 310static int __init hp_wmi_bios_2009_later(void)
310{ 311{
311 int ret; 312 int state = 0;
312 int query = 0x6e; 313 int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, 0, &state,
314 sizeof(state), sizeof(state));
315 if (!ret)
316 return 1;
313 317
314 ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query), 318 return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO;
315 0); 319}
316 320
321static int __init hp_wmi_enable_hotkeys(void)
322{
323 int value = 0x6e;
324 int ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &value,
325 sizeof(value), 0);
317 if (ret) 326 if (ret)
318 return -EINVAL; 327 return -EINVAL;
319 return 0; 328 return 0;
@@ -663,7 +672,7 @@ static int __init hp_wmi_input_setup(void)
663 hp_wmi_tablet_state()); 672 hp_wmi_tablet_state());
664 input_sync(hp_wmi_input_dev); 673 input_sync(hp_wmi_input_dev);
665 674
666 if (hp_wmi_bios_2009_later() == 4) 675 if (!hp_wmi_bios_2009_later() && hp_wmi_bios_2008_later())
667 hp_wmi_enable_hotkeys(); 676 hp_wmi_enable_hotkeys();
668 677
669 status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); 678 status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL);
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 6740c513919c..f2372f400ddb 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -938,7 +938,7 @@ static int toshiba_usb_sleep_music_get(struct toshiba_acpi_dev *dev, u32 *state)
938 else if (result == TOS_NOT_SUPPORTED) 938 else if (result == TOS_NOT_SUPPORTED)
939 return -ENODEV; 939 return -ENODEV;
940 940
941 return result = TOS_SUCCESS ? 0 : -EIO; 941 return result == TOS_SUCCESS ? 0 : -EIO;
942} 942}
943 943
944static int toshiba_usb_sleep_music_set(struct toshiba_acpi_dev *dev, u32 state) 944static int toshiba_usb_sleep_music_set(struct toshiba_acpi_dev *dev, u32 state)
@@ -2398,11 +2398,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
2398 if (error) 2398 if (error)
2399 return error; 2399 return error;
2400 2400
2401 error = toshiba_hotkey_event_type_get(dev, &events_type); 2401 if (toshiba_hotkey_event_type_get(dev, &events_type))
2402 if (error) { 2402 pr_notice("Unable to query Hotkey Event Type\n");
2403 pr_err("Unable to query Hotkey Event Type\n"); 2403
2404 return error;
2405 }
2406 dev->hotkey_event_type = events_type; 2404 dev->hotkey_event_type = events_type;
2407 2405
2408 dev->hotkey_dev = input_allocate_device(); 2406 dev->hotkey_dev = input_allocate_device();
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index aac47573f9ed..eb391a281833 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -194,34 +194,6 @@ static bool wmi_parse_guid(const u8 *src, u8 *dest)
194 return true; 194 return true;
195} 195}
196 196
197/*
198 * Convert a raw GUID to the ACII string representation
199 */
200static int wmi_gtoa(const char *in, char *out)
201{
202 int i;
203
204 for (i = 3; i >= 0; i--)
205 out += sprintf(out, "%02X", in[i] & 0xFF);
206
207 out += sprintf(out, "-");
208 out += sprintf(out, "%02X", in[5] & 0xFF);
209 out += sprintf(out, "%02X", in[4] & 0xFF);
210 out += sprintf(out, "-");
211 out += sprintf(out, "%02X", in[7] & 0xFF);
212 out += sprintf(out, "%02X", in[6] & 0xFF);
213 out += sprintf(out, "-");
214 out += sprintf(out, "%02X", in[8] & 0xFF);
215 out += sprintf(out, "%02X", in[9] & 0xFF);
216 out += sprintf(out, "-");
217
218 for (i = 10; i <= 15; i++)
219 out += sprintf(out, "%02X", in[i] & 0xFF);
220
221 *out = '\0';
222 return 0;
223}
224
225static bool find_guid(const char *guid_string, struct wmi_block **out) 197static bool find_guid(const char *guid_string, struct wmi_block **out)
226{ 198{
227 char tmp[16], guid_input[16]; 199 char tmp[16], guid_input[16];
@@ -457,11 +429,7 @@ EXPORT_SYMBOL_GPL(wmi_set_block);
457 429
458static void wmi_dump_wdg(const struct guid_block *g) 430static void wmi_dump_wdg(const struct guid_block *g)
459{ 431{
460 char guid_string[37]; 432 pr_info("%pUL:\n", g->guid);
461
462 wmi_gtoa(g->guid, guid_string);
463
464 pr_info("%s:\n", guid_string);
465 pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]); 433 pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
466 pr_info("\tnotify_id: %02X\n", g->notify_id); 434 pr_info("\tnotify_id: %02X\n", g->notify_id);
467 pr_info("\treserved: %02X\n", g->reserved); 435 pr_info("\treserved: %02X\n", g->reserved);
@@ -661,7 +629,6 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);
661static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 629static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
662 char *buf) 630 char *buf)
663{ 631{
664 char guid_string[37];
665 struct wmi_block *wblock; 632 struct wmi_block *wblock;
666 633
667 wblock = dev_get_drvdata(dev); 634 wblock = dev_get_drvdata(dev);
@@ -670,9 +637,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
670 return strlen(buf); 637 return strlen(buf);
671 } 638 }
672 639
673 wmi_gtoa(wblock->gblock.guid, guid_string); 640 return sprintf(buf, "wmi:%pUL\n", wblock->gblock.guid);
674
675 return sprintf(buf, "wmi:%s\n", guid_string);
676} 641}
677static DEVICE_ATTR_RO(modalias); 642static DEVICE_ATTR_RO(modalias);
678 643
@@ -695,7 +660,7 @@ static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
695 if (!wblock) 660 if (!wblock)
696 return -ENOMEM; 661 return -ENOMEM;
697 662
698 wmi_gtoa(wblock->gblock.guid, guid_string); 663 sprintf(guid_string, "%pUL", wblock->gblock.guid);
699 664
700 strcpy(&env->buf[env->buflen - 1], "wmi:"); 665 strcpy(&env->buf[env->buflen - 1], "wmi:");
701 memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36); 666 memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36);
@@ -721,12 +686,9 @@ static struct class wmi_class = {
721static int wmi_create_device(const struct guid_block *gblock, 686static int wmi_create_device(const struct guid_block *gblock,
722 struct wmi_block *wblock, acpi_handle handle) 687 struct wmi_block *wblock, acpi_handle handle)
723{ 688{
724 char guid_string[37];
725
726 wblock->dev.class = &wmi_class; 689 wblock->dev.class = &wmi_class;
727 690
728 wmi_gtoa(gblock->guid, guid_string); 691 dev_set_name(&wblock->dev, "%pUL", gblock->guid);
729 dev_set_name(&wblock->dev, "%s", guid_string);
730 692
731 dev_set_drvdata(&wblock->dev, wblock); 693 dev_set_drvdata(&wblock->dev, wblock);
732 694
@@ -877,7 +839,6 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
877 struct guid_block *block; 839 struct guid_block *block;
878 struct wmi_block *wblock; 840 struct wmi_block *wblock;
879 struct list_head *p; 841 struct list_head *p;
880 char guid_string[37];
881 842
882 list_for_each(p, &wmi_block_list) { 843 list_for_each(p, &wmi_block_list) {
883 wblock = list_entry(p, struct wmi_block, list); 844 wblock = list_entry(p, struct wmi_block, list);
@@ -888,8 +849,8 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
888 if (wblock->handler) 849 if (wblock->handler)
889 wblock->handler(event, wblock->handler_data); 850 wblock->handler(event, wblock->handler_data);
890 if (debug_event) { 851 if (debug_event) {
891 wmi_gtoa(wblock->gblock.guid, guid_string); 852 pr_info("DEBUG Event GUID: %pUL\n",
892 pr_info("DEBUG Event GUID: %s\n", guid_string); 853 wblock->gblock.guid);
893 } 854 }
894 855
895 acpi_bus_generate_netlink_event( 856 acpi_bus_generate_netlink_event(