Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
ACPI: thinkpad-acpi: bump up version to 0.16
ACPI: thinkpad-acpi: revert new 2.6.23 CONFIG_THINKPAD_ACPI_INPUT_ENABLED option
ACPI: fix CONFIG_NET=n acpi_bus_generate_netlink_event build failure
msi-laptop: replace ',' with ';'
ACPI: (more) delete CONFIG_ACPI_PROCFS_SLEEP (again)

+173 -104
+77 -19
Documentation/thinkpad-acpi.txt
··· 1 1 ThinkPad ACPI Extras Driver 2 2 3 - Version 0.15 4 - July 1st, 2007 3 + Version 0.16 4 + August 2nd, 2007 5 5 6 6 Borislav Deianov <borislav@users.sf.net> 7 7 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ··· 161 161 firmware that such a driver is present, and modifies how the ThinkPad 162 162 firmware will behave in many situations. 163 163 164 + The driver enables the hot key feature automatically when loaded. The 165 + feature can later be disabled and enabled back at runtime. The driver 166 + will also restore the hot key feature to its previous state and mask 167 + when it is unloaded. 168 + 164 169 When the hotkey feature is enabled and the hot key mask is set (see 165 - below), the various hot keys either generate ACPI events in the 166 - following format: 170 + below), the driver will report HKEY events in the following format: 167 171 168 172 ibm/hotkey HKEY 00000080 0000xxxx 169 173 170 - or events over the input layer. The input layer support accepts the 171 - standard IOCTLs to remap the keycodes assigned to each hotkey. 174 + Some of these events refer to hot key presses, but not all. 172 175 173 - When the input device is open, the driver will suppress any ACPI hot key 174 - events that get translated into a meaningful input layer event, in order 175 - to avoid sending duplicate events to userspace. Hot keys that are 176 - mapped to KEY_RESERVED in the keymap are not translated, and will always 177 - generate an ACPI ibm/hotkey HKEY event, and no input layer events. 176 + The driver will generate events over the input layer for hot keys and 177 + radio switches, and over the ACPI netlink layer for other events. The 178 + input layer support accepts the standard IOCTLs to remap the keycodes 179 + assigned to each hot key. 178 180 179 181 The hot key bit mask allows some control over which hot keys generate 180 182 events. If a key is "masked" (bit set to 0 in the mask), the firmware ··· 257 255 attribute will read 0 if the switch is in the "radios 258 256 disabled" postition, and 1 if the switch is in the 259 257 "radios enabled" position. 258 + 259 + hotkey_report_mode: 260 + Returns the state of the procfs ACPI event report mode 261 + filter for hot keys. If it is set to 1 (the default), 262 + all hot key presses are reported both through the input 263 + layer and also as ACPI events through procfs (but not 264 + through netlink). If it is set to 2, hot key presses 265 + are reported only through the input layer. 266 + 267 + This attribute is read-only in kernels 2.6.23 or later, 268 + and read-write on earlier kernels. 269 + 270 + May return -EPERM (write access locked out by module 271 + parameter) or -EACCES (read-only). 260 272 261 273 input layer notes: 262 274 ··· 409 393 hot key press or release, but the firmware will do it for either one, not 410 394 both. 411 395 412 - If a key is mapped to KEY_RESERVED, it generates no input events at all, 413 - and it may generate a legacy thinkpad-acpi ACPI hotkey event. 414 - 396 + If a key is mapped to KEY_RESERVED, it generates no input events at all. 415 397 If a key is mapped to KEY_UNKNOWN, it generates an input event that 416 - includes an scan code, and it may also generate a legacy thinkpad-acpi 417 - ACPI hotkey event. 418 - 419 - If a key is mapped to anything else, it will only generate legacy 420 - thinkpad-acpi ACPI hotkey events if nobody has opened the input device. 398 + includes an scan code. If a key is mapped to anything else, it will 399 + generate input device EV_KEY events. 421 400 422 401 Non hot-key ACPI HKEY event map: 423 402 0x5001 Lid closed 424 403 0x5002 Lid opened 425 404 0x7000 Radio Switch may have changed state 405 + 406 + The above events are not propagated by the driver, except for legacy 407 + compatibility purposes when hotkey_report_mode is set to 1. 408 + 409 + Compatibility notes: 410 + 411 + ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never 412 + supported the input layer, and sent events over the procfs ACPI event 413 + interface. 414 + 415 + To avoid sending duplicate events over the input layer and the ACPI 416 + event interface, thinkpad-acpi 0.16 implements a module parameter 417 + (hotkey_report_mode), and also a sysfs device attribute with the same 418 + name. 419 + 420 + Make no mistake here: userspace is expected to switch to using the input 421 + layer interface of thinkpad-acpi, together with the ACPI netlink event 422 + interface in kernels 2.6.23 and later, or with the ACPI procfs event 423 + interface in kernels 2.6.22 and earlier. 424 + 425 + If no hotkey_report_mode module parameter is specified (or it is set to 426 + zero), the driver defaults to mode 1 (see below), and on kernels 2.6.22 427 + and earlier, also allows one to change the hotkey_report_mode through 428 + sysfs. In kernels 2.6.23 and later, where the netlink ACPI event 429 + interface is available, hotkey_report_mode cannot be changed through 430 + sysfs (it is read-only). 431 + 432 + If the hotkey_report_mode module parameter is set to 1 or 2, it cannot 433 + be changed later through sysfs (any writes will return -EPERM to signal 434 + that hotkey_report_mode was locked. On 2.6.23 and later, where 435 + hotkey_report_mode cannot be changed at all, writes will return -EACES). 436 + 437 + hotkey_report_mode set to 1 makes the driver export through the procfs 438 + ACPI event interface all hot key presses (which are *also* sent to the 439 + input layer). This is a legacy compatibility behaviour, and it is also 440 + the default mode of operation for the driver. 441 + 442 + hotkey_report_mode set to 2 makes the driver filter out the hot key 443 + presses from the procfs ACPI event interface, so these events will only 444 + be sent through the input layer. Userspace that has been updated to use 445 + the thinkpad-acpi input layer interface should set hotkey_report_mode to 446 + 2. 447 + 448 + Hot key press events are never sent to the ACPI netlink event interface. 449 + Really up-to-date userspace under kernel 2.6.23 and later is to use the 450 + netlink interface and the input layer interface, and don't bother at all 451 + with hotkey_report_mode. 426 452 427 453 428 454 Bluetooth
+1 -1
drivers/acpi/event.c
··· 240 240 return 0; 241 241 } 242 242 243 - EXPORT_SYMBOL(acpi_generate_netlink_event); 243 + EXPORT_SYMBOL(acpi_bus_generate_netlink_event); 244 244 245 245 static int acpi_event_genetlink_init(void) 246 246 {
+5 -5
drivers/acpi/sleep/proc.c
··· 23 23 */ 24 24 25 25 ACPI_MODULE_NAME("sleep") 26 - #ifdef CONFIG_ACPI_PROCFS_SLEEP 26 + #ifdef CONFIG_ACPI_PROCFS 27 27 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) 28 28 { 29 29 int i; ··· 76 76 Done: 77 77 return error ? error : count; 78 78 } 79 - #endif /* CONFIG_ACPI_PROCFS_SLEEP */ 79 + #endif /* CONFIG_ACPI_PROCFS */ 80 80 81 81 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86) 82 82 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ ··· 471 471 .release = single_release, 472 472 }; 473 473 474 - #ifdef CONFIG_ACPI_PROCFS_SLEEP 474 + #ifdef CONFIG_ACPI_PROCFS 475 475 static const struct file_operations acpi_system_sleep_fops = { 476 476 .open = acpi_system_sleep_open_fs, 477 477 .read = seq_read, ··· 479 479 .llseek = seq_lseek, 480 480 .release = single_release, 481 481 }; 482 - #endif /* CONFIG_ACPI_PROCFS_SLEEP */ 482 + #endif /* CONFIG_ACPI_PROCFS */ 483 483 484 484 #ifdef HAVE_ACPI_LEGACY_ALARM 485 485 static const struct file_operations acpi_system_alarm_fops = { ··· 506 506 if (acpi_disabled) 507 507 return 0; 508 508 509 - #ifdef CONFIG_ACPI_PROCFS_SLEEP 509 + #ifdef CONFIG_ACPI_PROCFS 510 510 /* 'sleep' [R/W] */ 511 511 entry = 512 512 create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
-20
drivers/misc/Kconfig
··· 202 202 203 203 If you are not sure, say Y here. 204 204 205 - config THINKPAD_ACPI_INPUT_ENABLED 206 - bool "Enable input layer support by default" 207 - depends on THINKPAD_ACPI 208 - default n 209 - ---help--- 210 - This option enables thinkpad-acpi hot key handling over the input 211 - layer at driver load time. When it is unset, the driver does not 212 - enable hot key handling by default, and also starts up with a mostly 213 - empty keymap. 214 - 215 - This option should be enabled if you have a new enough HAL or other 216 - userspace support that properly handles the thinkpad-acpi event 217 - device. It auto-tunes the hot key support to those reported by the 218 - firmware and enables it automatically. 219 - 220 - If unsure, say N here to retain the old behaviour of ibm-acpi, and 221 - thinkpad-acpi up to kernel 2.6.21: userspace will have to enable and 222 - set up the thinkpad-acpi hot key handling using the sysfs interace 223 - after loading the driver. 224 - 225 205 226 206 endif # MISC_DEVICES
+1 -1
drivers/misc/msi-laptop.c
··· 353 353 if (IS_ERR(msibl_device)) 354 354 return PTR_ERR(msibl_device); 355 355 356 - msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1, 356 + msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1; 357 357 358 358 ret = platform_driver_register(&msipf_driver); 359 359 if (ret)
+88 -58
drivers/misc/thinkpad_acpi.c
··· 21 21 * 02110-1301, USA. 22 22 */ 23 23 24 - #define IBM_VERSION "0.15" 24 + #define IBM_VERSION "0.16" 25 25 #define TPACPI_SYSFS_VERSION 0x010000 26 26 27 27 /* ··· 906 906 static struct device_attribute dev_attr_hotkey_radio_sw = 907 907 __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL); 908 908 909 + /* sysfs hotkey report_mode -------------------------------------------- */ 910 + static ssize_t hotkey_report_mode_show(struct device *dev, 911 + struct device_attribute *attr, 912 + char *buf) 913 + { 914 + return snprintf(buf, PAGE_SIZE, "%d\n", 915 + (hotkey_report_mode != 0) ? hotkey_report_mode : 1); 916 + } 917 + 918 + static struct device_attribute dev_attr_hotkey_report_mode = 919 + __ATTR(hotkey_report_mode, S_IRUGO, hotkey_report_mode_show, NULL); 920 + 909 921 /* --------------------------------------------------------------------- */ 910 922 911 - static struct attribute *hotkey_mask_attributes[] = { 923 + static struct attribute *hotkey_attributes[] __initdata = { 924 + &dev_attr_hotkey_enable.attr, 925 + &dev_attr_hotkey_report_mode.attr, 926 + }; 927 + 928 + static struct attribute *hotkey_mask_attributes[] __initdata = { 912 929 &dev_attr_hotkey_mask.attr, 913 930 &dev_attr_hotkey_bios_enabled.attr, 914 931 &dev_attr_hotkey_bios_mask.attr, ··· 1004 987 str_supported(tp_features.hotkey)); 1005 988 1006 989 if (tp_features.hotkey) { 1007 - hotkey_dev_attributes = create_attr_set(7, NULL); 990 + hotkey_dev_attributes = create_attr_set(8, NULL); 1008 991 if (!hotkey_dev_attributes) 1009 992 return -ENOMEM; 1010 - res = add_to_attr_set(hotkey_dev_attributes, 1011 - &dev_attr_hotkey_enable.attr); 993 + res = add_many_to_attr_set(hotkey_dev_attributes, 994 + hotkey_attributes, 995 + ARRAY_SIZE(hotkey_attributes)); 1012 996 if (res) 1013 997 return res; 1014 998 ··· 1073 1055 TPACPI_HOTKEY_MAP_SIZE); 1074 1056 } 1075 1057 1076 - #ifndef CONFIG_THINKPAD_ACPI_INPUT_ENABLED 1077 - for (i = 0; i < 12; i++) 1078 - hotkey_keycode_map[i] = KEY_UNKNOWN; 1079 - #endif /* ! CONFIG_THINKPAD_ACPI_INPUT_ENABLED */ 1080 - 1081 1058 set_bit(EV_KEY, tpacpi_inputdev->evbit); 1082 1059 set_bit(EV_MSC, tpacpi_inputdev->evbit); 1083 1060 set_bit(MSC_SCAN, tpacpi_inputdev->mscbit); ··· 1094 1081 set_bit(SW_RADIO, tpacpi_inputdev->swbit); 1095 1082 } 1096 1083 1097 - #ifdef CONFIG_THINKPAD_ACPI_INPUT_ENABLED 1098 1084 dbg_printk(TPACPI_DBG_INIT, 1099 1085 "enabling hot key handling\n"); 1100 1086 res = hotkey_set(1, (hotkey_all_mask & ~hotkey_reserved_mask) 1101 1087 | hotkey_orig_mask); 1102 1088 if (res) 1103 1089 return res; 1104 - #endif /* CONFIG_THINKPAD_ACPI_INPUT_ENABLED */ 1090 + 1091 + dbg_printk(TPACPI_DBG_INIT, 1092 + "legacy hot key reporting over procfs %s\n", 1093 + (hotkey_report_mode < 2) ? 1094 + "enabled" : "disabled"); 1105 1095 } 1106 1096 1107 1097 return (tp_features.hotkey)? 0 : 1; ··· 1158 1142 { 1159 1143 u32 hkey; 1160 1144 unsigned int keycode, scancode; 1161 - int sendacpi = 1; 1145 + int send_acpi_ev = 0; 1162 1146 1163 1147 if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) { 1164 - if (tpacpi_inputdev->users > 0) { 1165 - switch (hkey >> 12) { 1166 - case 1: 1167 - /* 0x1000-0x1FFF: key presses */ 1168 - scancode = hkey & 0xfff; 1169 - if (scancode > 0 && scancode < 0x21) { 1170 - scancode--; 1171 - keycode = hotkey_keycode_map[scancode]; 1172 - tpacpi_input_send_key(scancode, keycode); 1173 - sendacpi = (keycode == KEY_RESERVED 1174 - || keycode == KEY_UNKNOWN); 1175 - } else { 1176 - printk(IBM_ERR 1177 - "hotkey 0x%04x out of range for keyboard map\n", 1178 - hkey); 1179 - } 1180 - break; 1181 - case 5: 1182 - /* 0x5000-0x5FFF: LID */ 1183 - /* we don't handle it through this path, just 1184 - * eat up known LID events */ 1185 - if (hkey != 0x5001 && hkey != 0x5002) { 1186 - printk(IBM_ERR 1187 - "unknown LID-related hotkey event: 0x%04x\n", 1188 - hkey); 1189 - } 1190 - break; 1191 - case 7: 1192 - /* 0x7000-0x7FFF: misc */ 1193 - if (tp_features.hotkey_wlsw && hkey == 0x7000) { 1194 - tpacpi_input_send_radiosw(); 1195 - sendacpi = 0; 1196 - break; 1197 - } 1198 - /* fallthrough to default */ 1199 - default: 1200 - /* case 2: dock-related */ 1201 - /* 0x2305 - T43 waking up due to bay lever eject while aslept */ 1202 - /* case 3: ultra-bay related. maybe bay in dock? */ 1203 - /* 0x3003 - T43 after wake up by bay lever eject (0x2305) */ 1204 - printk(IBM_NOTICE "unhandled hotkey event 0x%04x\n", hkey); 1148 + switch (hkey >> 12) { 1149 + case 1: 1150 + /* 0x1000-0x1FFF: key presses */ 1151 + scancode = hkey & 0xfff; 1152 + if (scancode > 0 && scancode < 0x21) { 1153 + scancode--; 1154 + keycode = hotkey_keycode_map[scancode]; 1155 + tpacpi_input_send_key(scancode, keycode); 1156 + } else { 1157 + printk(IBM_ERR 1158 + "hotkey 0x%04x out of range for keyboard map\n", 1159 + hkey); 1160 + send_acpi_ev = 1; 1205 1161 } 1162 + break; 1163 + case 5: 1164 + /* 0x5000-0x5FFF: LID */ 1165 + /* we don't handle it through this path, just 1166 + * eat up known LID events */ 1167 + if (hkey != 0x5001 && hkey != 0x5002) { 1168 + printk(IBM_ERR 1169 + "unknown LID-related hotkey event: 0x%04x\n", 1170 + hkey); 1171 + send_acpi_ev = 1; 1172 + } 1173 + break; 1174 + case 7: 1175 + /* 0x7000-0x7FFF: misc */ 1176 + if (tp_features.hotkey_wlsw && hkey == 0x7000) { 1177 + tpacpi_input_send_radiosw(); 1178 + break; 1179 + } 1180 + /* fallthrough to default */ 1181 + default: 1182 + /* case 2: dock-related */ 1183 + /* 0x2305 - T43 waking up due to bay lever eject while aslept */ 1184 + /* case 3: ultra-bay related. maybe bay in dock? */ 1185 + /* 0x3003 - T43 after wake up by bay lever eject (0x2305) */ 1186 + printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey); 1187 + send_acpi_ev = 1; 1206 1188 } 1207 - 1208 - if (sendacpi) 1209 - acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 1210 1189 } else { 1211 1190 printk(IBM_ERR "unknown hotkey notification event %d\n", event); 1212 - acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); 1191 + hkey = 0; 1192 + send_acpi_ev = 1; 1193 + } 1194 + 1195 + /* Legacy events */ 1196 + if (send_acpi_ev || hotkey_report_mode < 2) 1197 + acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 1198 + 1199 + /* netlink events */ 1200 + if (send_acpi_ev) { 1201 + acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 1202 + ibm->acpi->device->dev.bus_id, 1203 + event, hkey); 1213 1204 } 1214 1205 } 1215 1206 ··· 4646 4623 static int brightness_mode; 4647 4624 module_param_named(brightness_mode, brightness_mode, int, 0); 4648 4625 4626 + static unsigned int hotkey_report_mode; 4627 + module_param(hotkey_report_mode, uint, 0); 4628 + 4649 4629 #define IBM_PARAM(feature) \ 4650 4630 module_param_call(feature, set_ibm_param, NULL, NULL, 0) 4651 4631 ··· 4673 4647 static int __init thinkpad_acpi_module_init(void) 4674 4648 { 4675 4649 int ret, i; 4650 + 4651 + /* Parameter checking */ 4652 + if (hotkey_report_mode > 2) 4653 + return -EINVAL; 4676 4654 4677 4655 /* Driver-level probe */ 4678 4656
+1
drivers/misc/thinkpad_acpi.h
··· 181 181 static int experimental; 182 182 static u32 dbg_level; 183 183 static int force_load; 184 + static unsigned int hotkey_report_mode; 184 185 185 186 static int thinkpad_acpi_module_init(void); 186 187 static void thinkpad_acpi_module_exit(void);