diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-04-04 00:25:48 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-04 03:14:52 -0400 |
commit | 2586d5663d0a17d69383acf6110f16a979a07c4e (patch) | |
tree | 5bfe1ef88ee03084175bb94c4c1079402fefbe7b | |
parent | 73a94d86a8625371f76de0ee12dc5bacd3ed42c0 (diff) |
thinkpad-acpi: remove HKEY disable functionality
The HKEY disable functionality basically cripples the entire event
model of the ThinkPad firmware and of the thinkpad-acpi driver.
Remove this functionality from the driver. HKEY must be enabled at
all times while thinkpad-acpi is loaded, and disabled otherwise.
For sysfs, according to the sysfs ABI and the thinkpad-acpi sysfs
rules of engagement, we will just remove the attributes. This will be
done in two stages: disable their function now, after two kernel
releases, remove the attributes.
For procfs, we call WARN(). If nothing triggers it, I will simply
remove the enable/disable commands entirely in the future along with
the sysfs attributes.
I don't expect much, if any fallout from this. There really isn't any
reason to mess with hotkey_enable or with the enable/disable commands
to /proc/acpi/ibm/hotkey, and this has been true for years...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | Documentation/laptops/thinkpad-acpi.txt | 39 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 49 |
2 files changed, 46 insertions, 42 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index e8f52fbadfe0..de6f14c79070 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -179,17 +179,14 @@ system. Enabling the hotkey functionality of thinkpad-acpi signals the | |||
179 | firmware that such a driver is present, and modifies how the ThinkPad | 179 | firmware that such a driver is present, and modifies how the ThinkPad |
180 | firmware will behave in many situations. | 180 | firmware will behave in many situations. |
181 | 181 | ||
182 | The driver enables the hot key feature automatically when loaded. The | 182 | The driver enables the HKEY ("hot key") event reporting automatically |
183 | feature can later be disabled and enabled back at runtime. The driver | 183 | when loaded, and disables it when it is removed. |
184 | will also restore the hot key feature to its previous state and mask | ||
185 | when it is unloaded. | ||
186 | 184 | ||
187 | When the hotkey feature is enabled and the hot key mask is set (see | 185 | The driver will report HKEY events in the following format: |
188 | below), the driver will report HKEY events in the following format: | ||
189 | 186 | ||
190 | ibm/hotkey HKEY 00000080 0000xxxx | 187 | ibm/hotkey HKEY 00000080 0000xxxx |
191 | 188 | ||
192 | Some of these events refer to hot key presses, but not all. | 189 | Some of these events refer to hot key presses, but not all of them. |
193 | 190 | ||
194 | The driver will generate events over the input layer for hot keys and | 191 | The driver will generate events over the input layer for hot keys and |
195 | radio switches, and over the ACPI netlink layer for other events. The | 192 | radio switches, and over the ACPI netlink layer for other events. The |
@@ -221,13 +218,17 @@ procfs notes: | |||
221 | 218 | ||
222 | The following commands can be written to the /proc/acpi/ibm/hotkey file: | 219 | The following commands can be written to the /proc/acpi/ibm/hotkey file: |
223 | 220 | ||
224 | echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature | ||
225 | echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature | ||
226 | echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys | 221 | echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys |
227 | echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys | 222 | echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys |
228 | ... any other 8-hex-digit mask ... | 223 | ... any other 8-hex-digit mask ... |
229 | echo reset > /proc/acpi/ibm/hotkey -- restore the original mask | 224 | echo reset > /proc/acpi/ibm/hotkey -- restore the original mask |
230 | 225 | ||
226 | The following commands have been deprecated and will cause the kernel | ||
227 | to log a warning: | ||
228 | |||
229 | echo enable > /proc/acpi/ibm/hotkey -- does nothing | ||
230 | echo disable > /proc/acpi/ibm/hotkey -- returns an error | ||
231 | |||
231 | The procfs interface does not support NVRAM polling control. So as to | 232 | The procfs interface does not support NVRAM polling control. So as to |
232 | maintain maximum bug-to-bug compatibility, it does not report any masks, | 233 | maintain maximum bug-to-bug compatibility, it does not report any masks, |
233 | nor does it allow one to manipulate the hot key mask when the firmware | 234 | nor does it allow one to manipulate the hot key mask when the firmware |
@@ -236,12 +237,9 @@ does not support masks at all, even if NVRAM polling is in use. | |||
236 | sysfs notes: | 237 | sysfs notes: |
237 | 238 | ||
238 | hotkey_bios_enabled: | 239 | hotkey_bios_enabled: |
239 | Returns the status of the hot keys feature when | 240 | DEPRECATED, WILL BE REMOVED SOON. |
240 | thinkpad-acpi was loaded. Upon module unload, the hot | ||
241 | key feature status will be restored to this value. | ||
242 | 241 | ||
243 | 0: hot keys were disabled | 242 | Returns 0. |
244 | 1: hot keys were enabled (unusual) | ||
245 | 243 | ||
246 | hotkey_bios_mask: | 244 | hotkey_bios_mask: |
247 | Returns the hot keys mask when thinkpad-acpi was loaded. | 245 | Returns the hot keys mask when thinkpad-acpi was loaded. |
@@ -249,13 +247,10 @@ sysfs notes: | |||
249 | to this value. | 247 | to this value. |
250 | 248 | ||
251 | hotkey_enable: | 249 | hotkey_enable: |
252 | Enables/disables the hot keys feature in the ACPI | 250 | DEPRECATED, WILL BE REMOVED SOON. |
253 | firmware, and reports current status of the hot keys | ||
254 | feature. Has no effect on the NVRAM hot key polling | ||
255 | functionality. | ||
256 | 251 | ||
257 | 0: disables the hot keys feature / feature disabled | 252 | 0: returns -EPERM |
258 | 1: enables the hot keys feature / feature enabled | 253 | 1: does nothing |
259 | 254 | ||
260 | hotkey_mask: | 255 | hotkey_mask: |
261 | bit mask to enable driver-handling (and depending on | 256 | bit mask to enable driver-handling (and depending on |
@@ -1535,3 +1530,7 @@ Sysfs interface changelog: | |||
1535 | 1530 | ||
1536 | 0x020200: Add poll()/select() support to the following attributes: | 1531 | 0x020200: Add poll()/select() support to the following attributes: |
1537 | hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason | 1532 | hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason |
1533 | |||
1534 | 0x020300: hotkey enable/disable support removed, attributes | ||
1535 | hotkey_bios_enabled and hotkey_enable deprecated and | ||
1536 | marked for removal. | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 852be7c1a172..f003fb7c79ca 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define TPACPI_VERSION "0.22" | 24 | #define TPACPI_VERSION "0.22" |
25 | #define TPACPI_SYSFS_VERSION 0x020200 | 25 | #define TPACPI_SYSFS_VERSION 0x020300 |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Changelog: | 28 | * Changelog: |
@@ -1424,7 +1424,6 @@ static enum { /* Reasons for waking up */ | |||
1424 | 1424 | ||
1425 | static int hotkey_autosleep_ack; | 1425 | static int hotkey_autosleep_ack; |
1426 | 1426 | ||
1427 | static int hotkey_orig_status; | ||
1428 | static u32 hotkey_orig_mask; | 1427 | static u32 hotkey_orig_mask; |
1429 | static u32 hotkey_all_mask; | 1428 | static u32 hotkey_all_mask; |
1430 | static u32 hotkey_reserved_mask; | 1429 | static u32 hotkey_reserved_mask; |
@@ -1571,9 +1570,9 @@ static int hotkey_status_get(int *status) | |||
1571 | return 0; | 1570 | return 0; |
1572 | } | 1571 | } |
1573 | 1572 | ||
1574 | static int hotkey_status_set(int status) | 1573 | static int hotkey_status_set(bool enable) |
1575 | { | 1574 | { |
1576 | if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", status)) | 1575 | if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", enable ? 1 : 0)) |
1577 | return -EIO; | 1576 | return -EIO; |
1578 | 1577 | ||
1579 | return 0; | 1578 | return 0; |
@@ -1889,6 +1888,9 @@ static ssize_t hotkey_enable_show(struct device *dev, | |||
1889 | { | 1888 | { |
1890 | int res, status; | 1889 | int res, status; |
1891 | 1890 | ||
1891 | printk_deprecated_attribute("hotkey_enable", | ||
1892 | "Hotkey reporting is always enabled"); | ||
1893 | |||
1892 | res = hotkey_status_get(&status); | 1894 | res = hotkey_status_get(&status); |
1893 | if (res) | 1895 | if (res) |
1894 | return res; | 1896 | return res; |
@@ -1901,14 +1903,17 @@ static ssize_t hotkey_enable_store(struct device *dev, | |||
1901 | const char *buf, size_t count) | 1903 | const char *buf, size_t count) |
1902 | { | 1904 | { |
1903 | unsigned long t; | 1905 | unsigned long t; |
1904 | int res; | 1906 | |
1907 | printk_deprecated_attribute("hotkey_enable", | ||
1908 | "Hotkeys can be disabled through hotkey_mask"); | ||
1905 | 1909 | ||
1906 | if (parse_strtoul(buf, 1, &t)) | 1910 | if (parse_strtoul(buf, 1, &t)) |
1907 | return -EINVAL; | 1911 | return -EINVAL; |
1908 | 1912 | ||
1909 | res = hotkey_status_set(t); | 1913 | if (t == 0) |
1914 | return -EPERM; | ||
1910 | 1915 | ||
1911 | return (res) ? res : count; | 1916 | return count; |
1912 | } | 1917 | } |
1913 | 1918 | ||
1914 | static struct device_attribute dev_attr_hotkey_enable = | 1919 | static struct device_attribute dev_attr_hotkey_enable = |
@@ -1964,7 +1969,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev, | |||
1964 | struct device_attribute *attr, | 1969 | struct device_attribute *attr, |
1965 | char *buf) | 1970 | char *buf) |
1966 | { | 1971 | { |
1967 | return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_orig_status); | 1972 | return sprintf(buf, "0\n"); |
1968 | } | 1973 | } |
1969 | 1974 | ||
1970 | static struct device_attribute dev_attr_hotkey_bios_enabled = | 1975 | static struct device_attribute dev_attr_hotkey_bios_enabled = |
@@ -2243,7 +2248,7 @@ static void hotkey_exit(void) | |||
2243 | "restoring original hot key mask\n"); | 2248 | "restoring original hot key mask\n"); |
2244 | /* no short-circuit boolean operator below! */ | 2249 | /* no short-circuit boolean operator below! */ |
2245 | if ((hotkey_mask_set(hotkey_orig_mask) | | 2250 | if ((hotkey_mask_set(hotkey_orig_mask) | |
2246 | hotkey_status_set(hotkey_orig_status)) != 0) | 2251 | hotkey_status_set(false)) != 0) |
2247 | printk(TPACPI_ERR | 2252 | printk(TPACPI_ERR |
2248 | "failed to restore hot key mask " | 2253 | "failed to restore hot key mask " |
2249 | "to BIOS defaults\n"); | 2254 | "to BIOS defaults\n"); |
@@ -2438,10 +2443,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2438 | 2443 | ||
2439 | /* hotkey_source_mask *must* be zero for | 2444 | /* hotkey_source_mask *must* be zero for |
2440 | * the first hotkey_mask_get */ | 2445 | * the first hotkey_mask_get */ |
2441 | res = hotkey_status_get(&hotkey_orig_status); | ||
2442 | if (res) | ||
2443 | goto err_exit; | ||
2444 | |||
2445 | if (tp_features.hotkey_mask) { | 2446 | if (tp_features.hotkey_mask) { |
2446 | res = hotkey_mask_get(); | 2447 | res = hotkey_mask_get(); |
2447 | if (res) | 2448 | if (res) |
@@ -2581,7 +2582,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2581 | } | 2582 | } |
2582 | 2583 | ||
2583 | dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); | 2584 | dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); |
2584 | res = hotkey_status_set(1); | 2585 | res = hotkey_status_set(true); |
2585 | if (res) { | 2586 | if (res) { |
2586 | hotkey_exit(); | 2587 | hotkey_exit(); |
2587 | return res; | 2588 | return res; |
@@ -2926,9 +2927,17 @@ static int hotkey_read(char *p) | |||
2926 | return len; | 2927 | return len; |
2927 | } | 2928 | } |
2928 | 2929 | ||
2930 | static void hotkey_enabledisable_warn(void) | ||
2931 | { | ||
2932 | tpacpi_log_usertask("procfs hotkey enable/disable"); | ||
2933 | WARN(1, TPACPI_WARN | ||
2934 | "hotkey enable/disable functionality has been " | ||
2935 | "removed from the driver. Hotkeys are always enabled.\n"); | ||
2936 | } | ||
2937 | |||
2929 | static int hotkey_write(char *buf) | 2938 | static int hotkey_write(char *buf) |
2930 | { | 2939 | { |
2931 | int res, status; | 2940 | int res; |
2932 | u32 mask; | 2941 | u32 mask; |
2933 | char *cmd; | 2942 | char *cmd; |
2934 | 2943 | ||
@@ -2938,17 +2947,16 @@ static int hotkey_write(char *buf) | |||
2938 | if (mutex_lock_killable(&hotkey_mutex)) | 2947 | if (mutex_lock_killable(&hotkey_mutex)) |
2939 | return -ERESTARTSYS; | 2948 | return -ERESTARTSYS; |
2940 | 2949 | ||
2941 | status = -1; | ||
2942 | mask = hotkey_mask; | 2950 | mask = hotkey_mask; |
2943 | 2951 | ||
2944 | res = 0; | 2952 | res = 0; |
2945 | while ((cmd = next_cmd(&buf))) { | 2953 | while ((cmd = next_cmd(&buf))) { |
2946 | if (strlencmp(cmd, "enable") == 0) { | 2954 | if (strlencmp(cmd, "enable") == 0) { |
2947 | status = 1; | 2955 | hotkey_enabledisable_warn(); |
2948 | } else if (strlencmp(cmd, "disable") == 0) { | 2956 | } else if (strlencmp(cmd, "disable") == 0) { |
2949 | status = 0; | 2957 | hotkey_enabledisable_warn(); |
2958 | res = -EPERM; | ||
2950 | } else if (strlencmp(cmd, "reset") == 0) { | 2959 | } else if (strlencmp(cmd, "reset") == 0) { |
2951 | status = hotkey_orig_status; | ||
2952 | mask = hotkey_orig_mask; | 2960 | mask = hotkey_orig_mask; |
2953 | } else if (sscanf(cmd, "0x%x", &mask) == 1) { | 2961 | } else if (sscanf(cmd, "0x%x", &mask) == 1) { |
2954 | /* mask set */ | 2962 | /* mask set */ |
@@ -2959,9 +2967,6 @@ static int hotkey_write(char *buf) | |||
2959 | goto errexit; | 2967 | goto errexit; |
2960 | } | 2968 | } |
2961 | } | 2969 | } |
2962 | if (status != -1) | ||
2963 | res = hotkey_status_set(status); | ||
2964 | |||
2965 | if (!res && mask != hotkey_mask) | 2970 | if (!res && mask != hotkey_mask) |
2966 | res = hotkey_mask_set(mask); | 2971 | res = hotkey_mask_set(mask); |
2967 | 2972 | ||