Commit a7d5c189 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'platform-drivers-x86-v4.3-2' of...

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
parents a8f15585 8a1513b4
...@@ -126,6 +126,24 @@ static const struct dmi_system_id asus_quirks[] = { ...@@ -126,6 +126,24 @@ static const struct dmi_system_id asus_quirks[] = {
}, },
.driver_data = &quirk_asus_wapf4, .driver_data = &quirk_asus_wapf4,
}, },
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X456UA",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X456UA"),
},
.driver_data = &quirk_asus_wapf4,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X456UF",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X456UF"),
},
.driver_data = &quirk_asus_wapf4,
},
{ {
.callback = dmi_matched, .callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X501U", .ident = "ASUSTeK COMPUTER INC. X501U",
......
...@@ -54,8 +54,9 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); ...@@ -54,8 +54,9 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
#define HPWMI_HARDWARE_QUERY 0x4 #define HPWMI_HARDWARE_QUERY 0x4
#define HPWMI_WIRELESS_QUERY 0x5 #define HPWMI_WIRELESS_QUERY 0x5
#define HPWMI_BIOS_QUERY 0x9 #define HPWMI_BIOS_QUERY 0x9
#define HPWMI_FEATURE_QUERY 0xb
#define HPWMI_HOTKEY_QUERY 0xc #define HPWMI_HOTKEY_QUERY 0xc
#define HPWMI_FEATURE_QUERY 0xd #define HPWMI_FEATURE2_QUERY 0xd
#define HPWMI_WIRELESS2_QUERY 0x1b #define HPWMI_WIRELESS2_QUERY 0x1b
#define HPWMI_POSTCODEERROR_QUERY 0x2a #define HPWMI_POSTCODEERROR_QUERY 0x2a
...@@ -295,25 +296,33 @@ static int hp_wmi_tablet_state(void) ...@@ -295,25 +296,33 @@ static int hp_wmi_tablet_state(void)
return (state & 0x4) ? 1 : 0; return (state & 0x4) ? 1 : 0;
} }
static int __init hp_wmi_bios_2009_later(void) static int __init hp_wmi_bios_2008_later(void)
{ {
int state = 0; int state = 0;
int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, 0, &state, int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, 0, &state,
sizeof(state), sizeof(state)); sizeof(state), sizeof(state));
if (ret) if (!ret)
return ret; return 1;
return (state & 0x10) ? 1 : 0; return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO;
} }
static int hp_wmi_enable_hotkeys(void) static int __init hp_wmi_bios_2009_later(void)
{ {
int ret; int state = 0;
int query = 0x6e; int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, 0, &state,
sizeof(state), sizeof(state));
if (!ret)
return 1;
ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query), return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO;
0); }
static int __init hp_wmi_enable_hotkeys(void)
{
int value = 0x6e;
int ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &value,
sizeof(value), 0);
if (ret) if (ret)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -663,7 +672,7 @@ static int __init hp_wmi_input_setup(void) ...@@ -663,7 +672,7 @@ static int __init hp_wmi_input_setup(void)
hp_wmi_tablet_state()); hp_wmi_tablet_state());
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
if (hp_wmi_bios_2009_later() == 4) if (!hp_wmi_bios_2009_later() && hp_wmi_bios_2008_later())
hp_wmi_enable_hotkeys(); hp_wmi_enable_hotkeys();
status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL);
......
...@@ -938,7 +938,7 @@ static int toshiba_usb_sleep_music_get(struct toshiba_acpi_dev *dev, u32 *state) ...@@ -938,7 +938,7 @@ static int toshiba_usb_sleep_music_get(struct toshiba_acpi_dev *dev, u32 *state)
else if (result == TOS_NOT_SUPPORTED) else if (result == TOS_NOT_SUPPORTED)
return -ENODEV; return -ENODEV;
return result = TOS_SUCCESS ? 0 : -EIO; return result == TOS_SUCCESS ? 0 : -EIO;
} }
static int toshiba_usb_sleep_music_set(struct toshiba_acpi_dev *dev, u32 state) static 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,11 +2398,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
if (error) if (error)
return error; return error;
error = toshiba_hotkey_event_type_get(dev, &events_type); if (toshiba_hotkey_event_type_get(dev, &events_type))
if (error) { pr_notice("Unable to query Hotkey Event Type\n");
pr_err("Unable to query Hotkey Event Type\n");
return error;
}
dev->hotkey_event_type = events_type; dev->hotkey_event_type = events_type;
dev->hotkey_dev = input_allocate_device(); dev->hotkey_dev = input_allocate_device();
......
...@@ -194,34 +194,6 @@ static bool wmi_parse_guid(const u8 *src, u8 *dest) ...@@ -194,34 +194,6 @@ static bool wmi_parse_guid(const u8 *src, u8 *dest)
return true; return true;
} }
/*
* Convert a raw GUID to the ACII string representation
*/
static int wmi_gtoa(const char *in, char *out)
{
int i;
for (i = 3; i >= 0; i--)
out += sprintf(out, "%02X", in[i] & 0xFF);
out += sprintf(out, "-");
out += sprintf(out, "%02X", in[5] & 0xFF);
out += sprintf(out, "%02X", in[4] & 0xFF);
out += sprintf(out, "-");
out += sprintf(out, "%02X", in[7] & 0xFF);
out += sprintf(out, "%02X", in[6] & 0xFF);
out += sprintf(out, "-");
out += sprintf(out, "%02X", in[8] & 0xFF);
out += sprintf(out, "%02X", in[9] & 0xFF);
out += sprintf(out, "-");
for (i = 10; i <= 15; i++)
out += sprintf(out, "%02X", in[i] & 0xFF);
*out = '\0';
return 0;
}
static bool find_guid(const char *guid_string, struct wmi_block **out) static bool find_guid(const char *guid_string, struct wmi_block **out)
{ {
char tmp[16], guid_input[16]; char tmp[16], guid_input[16];
...@@ -457,11 +429,7 @@ EXPORT_SYMBOL_GPL(wmi_set_block); ...@@ -457,11 +429,7 @@ EXPORT_SYMBOL_GPL(wmi_set_block);
static void wmi_dump_wdg(const struct guid_block *g) static void wmi_dump_wdg(const struct guid_block *g)
{ {
char guid_string[37]; pr_info("%pUL:\n", g->guid);
wmi_gtoa(g->guid, guid_string);
pr_info("%s:\n", guid_string);
pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]); pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
pr_info("\tnotify_id: %02X\n", g->notify_id); pr_info("\tnotify_id: %02X\n", g->notify_id);
pr_info("\treserved: %02X\n", g->reserved); pr_info("\treserved: %02X\n", g->reserved);
...@@ -661,7 +629,6 @@ EXPORT_SYMBOL_GPL(wmi_has_guid); ...@@ -661,7 +629,6 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
char guid_string[37];
struct wmi_block *wblock; struct wmi_block *wblock;
wblock = dev_get_drvdata(dev); wblock = dev_get_drvdata(dev);
...@@ -670,9 +637,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, ...@@ -670,9 +637,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
return strlen(buf); return strlen(buf);
} }
wmi_gtoa(wblock->gblock.guid, guid_string); return sprintf(buf, "wmi:%pUL\n", wblock->gblock.guid);
return sprintf(buf, "wmi:%s\n", guid_string);
} }
static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(modalias);
...@@ -695,7 +660,7 @@ static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -695,7 +660,7 @@ static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
if (!wblock) if (!wblock)
return -ENOMEM; return -ENOMEM;
wmi_gtoa(wblock->gblock.guid, guid_string); sprintf(guid_string, "%pUL", wblock->gblock.guid);
strcpy(&env->buf[env->buflen - 1], "wmi:"); strcpy(&env->buf[env->buflen - 1], "wmi:");
memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36); memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36);
...@@ -721,12 +686,9 @@ static struct class wmi_class = { ...@@ -721,12 +686,9 @@ static struct class wmi_class = {
static int wmi_create_device(const struct guid_block *gblock, static int wmi_create_device(const struct guid_block *gblock,
struct wmi_block *wblock, acpi_handle handle) struct wmi_block *wblock, acpi_handle handle)
{ {
char guid_string[37];
wblock->dev.class = &wmi_class; wblock->dev.class = &wmi_class;
wmi_gtoa(gblock->guid, guid_string); dev_set_name(&wblock->dev, "%pUL", gblock->guid);
dev_set_name(&wblock->dev, "%s", guid_string);
dev_set_drvdata(&wblock->dev, wblock); dev_set_drvdata(&wblock->dev, wblock);
...@@ -877,7 +839,6 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event) ...@@ -877,7 +839,6 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
struct guid_block *block; struct guid_block *block;
struct wmi_block *wblock; struct wmi_block *wblock;
struct list_head *p; struct list_head *p;
char guid_string[37];
list_for_each(p, &wmi_block_list) { list_for_each(p, &wmi_block_list) {
wblock = list_entry(p, struct wmi_block, list); wblock = list_entry(p, struct wmi_block, list);
...@@ -888,8 +849,8 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event) ...@@ -888,8 +849,8 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
if (wblock->handler) if (wblock->handler)
wblock->handler(event, wblock->handler_data); wblock->handler(event, wblock->handler_data);
if (debug_event) { if (debug_event) {
wmi_gtoa(wblock->gblock.guid, guid_string); pr_info("DEBUG Event GUID: %pUL\n",
pr_info("DEBUG Event GUID: %s\n", guid_string); wblock->gblock.guid);
} }
acpi_bus_generate_netlink_event( acpi_bus_generate_netlink_event(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment