Add patches accepted for 2.6.30-rc1
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.30-rc1 / 0012-thinkpad-acpi-enhanced-debugging-messages-for-the-h.patch
blob6a80cefc5616a64a54d320a1c5a7be7929542710
1 From 56e2c200945dafafb86169762eb1e88aed0ce69e Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sat, 4 Apr 2009 04:25:51 +0000
4 Subject: thinkpad-acpi: enhanced debugging messages for the hotkey subdriver
6 Enhance debugging messages for the hotkey subdriver.
8 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
9 Signed-off-by: Len Brown <len.brown@intel.com>
10 ---
11 Documentation/laptops/thinkpad-acpi.txt | 1 +
12 drivers/platform/x86/thinkpad_acpi.c | 39 +++++++++++++++++++++++--------
13 2 files changed, 30 insertions(+), 10 deletions(-)
15 diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
16 index 7daca05..abbbe78 100644
17 --- a/Documentation/laptops/thinkpad-acpi.txt
18 +++ b/Documentation/laptops/thinkpad-acpi.txt
19 @@ -1496,6 +1496,7 @@ to enable more than one output class, just add their values.
20 0x0002 Removal
21 0x0004 RF Transmitter control (RFKILL)
22 (bluetooth, WWAN, UWB...)
23 + 0x0008 HKEY event interface, hotkeys
25 There is also a kernel build option to enable more debugging
26 information, which may be necessary to debug driver problems.
27 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
28 index 57ab551..0a4796a 100644
29 --- a/drivers/platform/x86/thinkpad_acpi.c
30 +++ b/drivers/platform/x86/thinkpad_acpi.c
31 @@ -190,6 +190,7 @@ enum {
32 #define TPACPI_DBG_INIT 0x0001
33 #define TPACPI_DBG_EXIT 0x0002
34 #define TPACPI_DBG_RFKILL 0x0004
35 +#define TPACPI_DBG_HKEY 0x0008
37 #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off")
38 #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
39 @@ -1961,6 +1962,8 @@ static ssize_t hotkey_mask_store(struct device *dev,
41 mutex_unlock(&hotkey_mutex);
43 + tpacpi_disclose_usertask("hotkey_mask", "set to 0x%08lx\n", t);
45 return (res) ? res : count;
48 @@ -2047,6 +2050,8 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
50 mutex_unlock(&hotkey_mutex);
52 + tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t);
54 return count;
57 @@ -2079,6 +2084,8 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
58 hotkey_poll_setup(1);
59 mutex_unlock(&hotkey_mutex);
61 + tpacpi_disclose_usertask("hotkey_poll_freq", "set to %lu\n", t);
63 return count;
66 @@ -2248,7 +2255,7 @@ static void hotkey_exit(void)
67 kfree(hotkey_keycode_map);
69 if (tp_features.hotkey) {
70 - dbg_printk(TPACPI_DBG_EXIT,
71 + dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
72 "restoring original hot key mask\n");
73 /* no short-circuit boolean operator below! */
74 if ((hotkey_mask_set(hotkey_orig_mask) |
75 @@ -2378,7 +2385,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
76 int status;
77 int hkeyv;
79 - vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
80 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
81 + "initializing hotkey subdriver\n");
83 BUG_ON(!tpacpi_inputdev);
84 BUG_ON(tpacpi_inputdev->open != NULL ||
85 @@ -2395,7 +2403,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
86 /* hotkey not supported on 570 */
87 tp_features.hotkey = hkey_handle != NULL;
89 - vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n",
90 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
91 + "hotkeys are %s\n",
92 str_supported(tp_features.hotkey));
94 if (!tp_features.hotkey)
95 @@ -2427,10 +2436,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
96 * T4x, X31, and later
98 tp_features.hotkey_mask = 1;
99 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
100 + "firmware HKEY interface version: 0x%x\n",
101 + hkeyv);
105 - vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
106 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
107 + "hotkey masks are %s\n",
108 str_supported(tp_features.hotkey_mask));
110 if (tp_features.hotkey_mask) {
111 @@ -2469,7 +2482,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
112 hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK;
115 - vdbg_printk(TPACPI_DBG_INIT,
116 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
117 "hotkey source mask 0x%08x, polling freq %d\n",
118 hotkey_source_mask, hotkey_poll_freq);
119 #endif
120 @@ -2523,12 +2536,12 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
123 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) {
124 - dbg_printk(TPACPI_DBG_INIT,
125 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
126 "using Lenovo default hot key map\n");
127 memcpy(hotkey_keycode_map, &lenovo_keycode_map,
128 TPACPI_HOTKEY_MAP_SIZE);
129 } else {
130 - dbg_printk(TPACPI_DBG_INIT,
131 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
132 "using IBM default hot key map\n");
133 memcpy(hotkey_keycode_map, &ibm_keycode_map,
134 TPACPI_HOTKEY_MAP_SIZE);
135 @@ -2585,7 +2598,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
136 | (1 << TP_ACPI_HOTKEYSCAN_FNEND);
139 - dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n");
140 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
141 + "enabling firmware HKEY event interface...\n");
142 res = hotkey_status_set(true);
143 if (res) {
144 hotkey_exit();
145 @@ -2599,8 +2613,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
146 return res;
149 - dbg_printk(TPACPI_DBG_INIT,
150 - "legacy hot key reporting over procfs %s\n",
151 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
152 + "legacy ibm/hotkey event reporting over procfs %s\n",
153 (hotkey_report_mode < 2) ?
154 "enabled" : "disabled");
156 @@ -2971,6 +2985,11 @@ static int hotkey_write(char *buf)
157 goto errexit;
161 + if (!res)
162 + tpacpi_disclose_usertask("procfs hotkey",
163 + "set mask to 0x%08x\n", mask);
165 if (!res && mask != hotkey_mask)
166 res = hotkey_mask_set(mask);
169 1.6.2.1