diff options
author | Kyle Evans <kvans32@gmail.com> | 2014-06-09 13:26:06 -0400 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2014-06-10 19:11:11 -0400 |
commit | f82bdd0d77b6bf0dea08a1d957ab45d503f328b1 (patch) | |
tree | ab33c3ed9fb0f8747d5682a702399acadaba21e8 /drivers/platform/x86 | |
parent | 8b9dd4fab26a0f328420cbda0845a325f45bcd92 (diff) |
hp-wmi: Enable hotkeys on some systems
This is a third attempt to enable these buttons. The new variable being
commit 997daa1bd9aca412ab97955a35b26c460c0ec7a4 (i.e. hp-wmi: detect
"2009 BIOS or later"). Older systems that do not have the 2009 BIOS query
method respond with a dummy value, in this case 4. Using that, we can
target a fairly narrow group of systems. i.e. old enough to not have
HPWMI_FEATURE_QUERY 0xd, but new enough to have HPWMI_BIOS_QUERY 0x9.
This group may be further limited if some systems respond with something
other than 4 to non-existant feature queries.
Signed-off-by: Kyle Evans <kvans32@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 8ba8956b5a48..484a8673b835 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -53,6 +53,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); | |||
53 | #define HPWMI_ALS_QUERY 0x3 | 53 | #define HPWMI_ALS_QUERY 0x3 |
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_HOTKEY_QUERY 0xc | 57 | #define HPWMI_HOTKEY_QUERY 0xc |
57 | #define HPWMI_FEATURE_QUERY 0xd | 58 | #define HPWMI_FEATURE_QUERY 0xd |
58 | #define HPWMI_WIRELESS2_QUERY 0x1b | 59 | #define HPWMI_WIRELESS2_QUERY 0x1b |
@@ -144,6 +145,7 @@ static const struct key_entry hp_wmi_keymap[] = { | |||
144 | { KE_KEY, 0x2142, { KEY_MEDIA } }, | 145 | { KE_KEY, 0x2142, { KEY_MEDIA } }, |
145 | { KE_KEY, 0x213b, { KEY_INFO } }, | 146 | { KE_KEY, 0x213b, { KEY_INFO } }, |
146 | { KE_KEY, 0x2169, { KEY_DIRECTION } }, | 147 | { KE_KEY, 0x2169, { KEY_DIRECTION } }, |
148 | { KE_KEY, 0x216a, { KEY_SETUP } }, | ||
147 | { KE_KEY, 0x231b, { KEY_HELP } }, | 149 | { KE_KEY, 0x231b, { KEY_HELP } }, |
148 | { KE_END, 0 } | 150 | { KE_END, 0 } |
149 | }; | 151 | }; |
@@ -304,6 +306,19 @@ static int hp_wmi_bios_2009_later(void) | |||
304 | return (state & 0x10) ? 1 : 0; | 306 | return (state & 0x10) ? 1 : 0; |
305 | } | 307 | } |
306 | 308 | ||
309 | static int hp_wmi_enable_hotkeys(void) | ||
310 | { | ||
311 | int ret; | ||
312 | int query = 0x6e; | ||
313 | |||
314 | ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query), | ||
315 | 0); | ||
316 | |||
317 | if (ret) | ||
318 | return -EINVAL; | ||
319 | return 0; | ||
320 | } | ||
321 | |||
307 | static int hp_wmi_set_block(void *data, bool blocked) | 322 | static int hp_wmi_set_block(void *data, bool blocked) |
308 | { | 323 | { |
309 | enum hp_wmi_radio r = (enum hp_wmi_radio) data; | 324 | enum hp_wmi_radio r = (enum hp_wmi_radio) data; |
@@ -648,6 +663,9 @@ static int __init hp_wmi_input_setup(void) | |||
648 | hp_wmi_tablet_state()); | 663 | hp_wmi_tablet_state()); |
649 | input_sync(hp_wmi_input_dev); | 664 | input_sync(hp_wmi_input_dev); |
650 | 665 | ||
666 | if (hp_wmi_bios_2009_later() == 4) | ||
667 | hp_wmi_enable_hotkeys(); | ||
668 | |||
651 | status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); | 669 | status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); |
652 | if (ACPI_FAILURE(status)) { | 670 | if (ACPI_FAILURE(status)) { |
653 | err = -EIO; | 671 | err = -EIO; |