diff options
| -rw-r--r-- | Documentation/laptops/thinkpad-acpi.txt | 1 | ||||
| -rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 39 |
2 files changed, 30 insertions, 10 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 7daca0553676..abbbe78a003b 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
| @@ -1496,6 +1496,7 @@ to enable more than one output class, just add their values. | |||
| 1496 | 0x0002 Removal | 1496 | 0x0002 Removal |
| 1497 | 0x0004 RF Transmitter control (RFKILL) | 1497 | 0x0004 RF Transmitter control (RFKILL) |
| 1498 | (bluetooth, WWAN, UWB...) | 1498 | (bluetooth, WWAN, UWB...) |
| 1499 | 0x0008 HKEY event interface, hotkeys | ||
| 1499 | 1500 | ||
| 1500 | There is also a kernel build option to enable more debugging | 1501 | There is also a kernel build option to enable more debugging |
| 1501 | information, which may be necessary to debug driver problems. | 1502 | information, which may be necessary to debug driver problems. |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 57ab5512c796..0a4796a246ea 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -190,6 +190,7 @@ enum { | |||
| 190 | #define TPACPI_DBG_INIT 0x0001 | 190 | #define TPACPI_DBG_INIT 0x0001 |
| 191 | #define TPACPI_DBG_EXIT 0x0002 | 191 | #define TPACPI_DBG_EXIT 0x0002 |
| 192 | #define TPACPI_DBG_RFKILL 0x0004 | 192 | #define TPACPI_DBG_RFKILL 0x0004 |
| 193 | #define TPACPI_DBG_HKEY 0x0008 | ||
| 193 | 194 | ||
| 194 | #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off") | 195 | #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off") |
| 195 | #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") | 196 | #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") |
| @@ -1961,6 +1962,8 @@ static ssize_t hotkey_mask_store(struct device *dev, | |||
| 1961 | 1962 | ||
| 1962 | mutex_unlock(&hotkey_mutex); | 1963 | mutex_unlock(&hotkey_mutex); |
| 1963 | 1964 | ||
| 1965 | tpacpi_disclose_usertask("hotkey_mask", "set to 0x%08lx\n", t); | ||
| 1966 | |||
| 1964 | return (res) ? res : count; | 1967 | return (res) ? res : count; |
| 1965 | } | 1968 | } |
| 1966 | 1969 | ||
| @@ -2047,6 +2050,8 @@ static ssize_t hotkey_source_mask_store(struct device *dev, | |||
| 2047 | 2050 | ||
| 2048 | mutex_unlock(&hotkey_mutex); | 2051 | mutex_unlock(&hotkey_mutex); |
| 2049 | 2052 | ||
| 2053 | tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t); | ||
| 2054 | |||
| 2050 | return count; | 2055 | return count; |
| 2051 | } | 2056 | } |
| 2052 | 2057 | ||
| @@ -2079,6 +2084,8 @@ static ssize_t hotkey_poll_freq_store(struct device *dev, | |||
| 2079 | hotkey_poll_setup(1); | 2084 | hotkey_poll_setup(1); |
| 2080 | mutex_unlock(&hotkey_mutex); | 2085 | mutex_unlock(&hotkey_mutex); |
| 2081 | 2086 | ||
| 2087 | tpacpi_disclose_usertask("hotkey_poll_freq", "set to %lu\n", t); | ||
| 2088 | |||
| 2082 | return count; | 2089 | return count; |
| 2083 | } | 2090 | } |
| 2084 | 2091 | ||
| @@ -2248,7 +2255,7 @@ static void hotkey_exit(void) | |||
| 2248 | kfree(hotkey_keycode_map); | 2255 | kfree(hotkey_keycode_map); |
| 2249 | 2256 | ||
| 2250 | if (tp_features.hotkey) { | 2257 | if (tp_features.hotkey) { |
| 2251 | dbg_printk(TPACPI_DBG_EXIT, | 2258 | dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY, |
| 2252 | "restoring original hot key mask\n"); | 2259 | "restoring original hot key mask\n"); |
| 2253 | /* no short-circuit boolean operator below! */ | 2260 | /* no short-circuit boolean operator below! */ |
| 2254 | if ((hotkey_mask_set(hotkey_orig_mask) | | 2261 | if ((hotkey_mask_set(hotkey_orig_mask) | |
| @@ -2378,7 +2385,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2378 | int status; | 2385 | int status; |
| 2379 | int hkeyv; | 2386 | int hkeyv; |
| 2380 | 2387 | ||
| 2381 | vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n"); | 2388 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2389 | "initializing hotkey subdriver\n"); | ||
| 2382 | 2390 | ||
| 2383 | BUG_ON(!tpacpi_inputdev); | 2391 | BUG_ON(!tpacpi_inputdev); |
| 2384 | BUG_ON(tpacpi_inputdev->open != NULL || | 2392 | BUG_ON(tpacpi_inputdev->open != NULL || |
| @@ -2395,7 +2403,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2395 | /* hotkey not supported on 570 */ | 2403 | /* hotkey not supported on 570 */ |
| 2396 | tp_features.hotkey = hkey_handle != NULL; | 2404 | tp_features.hotkey = hkey_handle != NULL; |
| 2397 | 2405 | ||
| 2398 | vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n", | 2406 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2407 | "hotkeys are %s\n", | ||
| 2399 | str_supported(tp_features.hotkey)); | 2408 | str_supported(tp_features.hotkey)); |
| 2400 | 2409 | ||
| 2401 | if (!tp_features.hotkey) | 2410 | if (!tp_features.hotkey) |
| @@ -2427,10 +2436,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2427 | * T4x, X31, and later | 2436 | * T4x, X31, and later |
| 2428 | */ | 2437 | */ |
| 2429 | tp_features.hotkey_mask = 1; | 2438 | tp_features.hotkey_mask = 1; |
| 2439 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, | ||
| 2440 | "firmware HKEY interface version: 0x%x\n", | ||
| 2441 | hkeyv); | ||
| 2430 | } | 2442 | } |
| 2431 | } | 2443 | } |
| 2432 | 2444 | ||
| 2433 | vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", | 2445 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2446 | "hotkey masks are %s\n", | ||
| 2434 | str_supported(tp_features.hotkey_mask)); | 2447 | str_supported(tp_features.hotkey_mask)); |
| 2435 | 2448 | ||
| 2436 | if (tp_features.hotkey_mask) { | 2449 | if (tp_features.hotkey_mask) { |
| @@ -2469,7 +2482,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2469 | hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; | 2482 | hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; |
| 2470 | } | 2483 | } |
| 2471 | 2484 | ||
| 2472 | vdbg_printk(TPACPI_DBG_INIT, | 2485 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2473 | "hotkey source mask 0x%08x, polling freq %d\n", | 2486 | "hotkey source mask 0x%08x, polling freq %d\n", |
| 2474 | hotkey_source_mask, hotkey_poll_freq); | 2487 | hotkey_source_mask, hotkey_poll_freq); |
| 2475 | #endif | 2488 | #endif |
| @@ -2523,12 +2536,12 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2523 | } | 2536 | } |
| 2524 | 2537 | ||
| 2525 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { | 2538 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { |
| 2526 | dbg_printk(TPACPI_DBG_INIT, | 2539 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2527 | "using Lenovo default hot key map\n"); | 2540 | "using Lenovo default hot key map\n"); |
| 2528 | memcpy(hotkey_keycode_map, &lenovo_keycode_map, | 2541 | memcpy(hotkey_keycode_map, &lenovo_keycode_map, |
| 2529 | TPACPI_HOTKEY_MAP_SIZE); | 2542 | TPACPI_HOTKEY_MAP_SIZE); |
| 2530 | } else { | 2543 | } else { |
| 2531 | dbg_printk(TPACPI_DBG_INIT, | 2544 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2532 | "using IBM default hot key map\n"); | 2545 | "using IBM default hot key map\n"); |
| 2533 | memcpy(hotkey_keycode_map, &ibm_keycode_map, | 2546 | memcpy(hotkey_keycode_map, &ibm_keycode_map, |
| 2534 | TPACPI_HOTKEY_MAP_SIZE); | 2547 | TPACPI_HOTKEY_MAP_SIZE); |
| @@ -2585,7 +2598,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2585 | | (1 << TP_ACPI_HOTKEYSCAN_FNEND); | 2598 | | (1 << TP_ACPI_HOTKEYSCAN_FNEND); |
| 2586 | } | 2599 | } |
| 2587 | 2600 | ||
| 2588 | dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); | 2601 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2602 | "enabling firmware HKEY event interface...\n"); | ||
| 2589 | res = hotkey_status_set(true); | 2603 | res = hotkey_status_set(true); |
| 2590 | if (res) { | 2604 | if (res) { |
| 2591 | hotkey_exit(); | 2605 | hotkey_exit(); |
| @@ -2599,8 +2613,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2599 | return res; | 2613 | return res; |
| 2600 | } | 2614 | } |
| 2601 | 2615 | ||
| 2602 | dbg_printk(TPACPI_DBG_INIT, | 2616 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
| 2603 | "legacy hot key reporting over procfs %s\n", | 2617 | "legacy ibm/hotkey event reporting over procfs %s\n", |
| 2604 | (hotkey_report_mode < 2) ? | 2618 | (hotkey_report_mode < 2) ? |
| 2605 | "enabled" : "disabled"); | 2619 | "enabled" : "disabled"); |
| 2606 | 2620 | ||
| @@ -2971,6 +2985,11 @@ static int hotkey_write(char *buf) | |||
| 2971 | goto errexit; | 2985 | goto errexit; |
| 2972 | } | 2986 | } |
| 2973 | } | 2987 | } |
| 2988 | |||
| 2989 | if (!res) | ||
| 2990 | tpacpi_disclose_usertask("procfs hotkey", | ||
| 2991 | "set mask to 0x%08x\n", mask); | ||
| 2992 | |||
| 2974 | if (!res && mask != hotkey_mask) | 2993 | if (!res && mask != hotkey_mask) |
| 2975 | res = hotkey_mask_set(mask); | 2994 | res = hotkey_mask_set(mask); |
| 2976 | 2995 | ||
