diff options
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 6 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 47 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 27 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 81 |
4 files changed, 107 insertions, 54 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index eeafc6c0160d..bfc1a8892a32 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -269,16 +269,16 @@ static struct key_entry asus_keymap[] = { | |||
269 | {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE}, | 269 | {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE}, |
270 | {KE_KEY, 0x40, KEY_PREVIOUSSONG}, | 270 | {KE_KEY, 0x40, KEY_PREVIOUSSONG}, |
271 | {KE_KEY, 0x41, KEY_NEXTSONG}, | 271 | {KE_KEY, 0x41, KEY_NEXTSONG}, |
272 | {KE_KEY, 0x43, KEY_STOP}, | 272 | {KE_KEY, 0x43, KEY_STOPCD}, |
273 | {KE_KEY, 0x45, KEY_PLAYPAUSE}, | 273 | {KE_KEY, 0x45, KEY_PLAYPAUSE}, |
274 | {KE_KEY, 0x50, KEY_EMAIL}, | 274 | {KE_KEY, 0x50, KEY_EMAIL}, |
275 | {KE_KEY, 0x51, KEY_WWW}, | 275 | {KE_KEY, 0x51, KEY_WWW}, |
276 | {KE_KEY, 0x5C, BTN_EXTRA}, /* Performance */ | 276 | {KE_KEY, 0x5C, KEY_SCREENLOCK}, /* Screenlock */ |
277 | {KE_KEY, 0x5D, KEY_WLAN}, | 277 | {KE_KEY, 0x5D, KEY_WLAN}, |
278 | {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, | 278 | {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, |
279 | {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ | 279 | {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ |
280 | {KE_KEY, 0x82, KEY_CAMERA}, | 280 | {KE_KEY, 0x82, KEY_CAMERA}, |
281 | {KE_KEY, 0x8A, KEY_TV}, | 281 | {KE_KEY, 0x8A, KEY_PROG1}, |
282 | {KE_KEY, 0x95, KEY_MEDIA}, | 282 | {KE_KEY, 0x95, KEY_MEDIA}, |
283 | {KE_KEY, 0x99, KEY_PHONE}, | 283 | {KE_KEY, 0x99, KEY_PHONE}, |
284 | {KE_END, 0}, | 284 | {KE_END, 0}, |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 6f54fd1757cd..353a898c3693 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -158,6 +158,7 @@ enum { KE_KEY, KE_END }; | |||
158 | static struct key_entry eeepc_keymap[] = { | 158 | static struct key_entry eeepc_keymap[] = { |
159 | /* Sleep already handled via generic ACPI code */ | 159 | /* Sleep already handled via generic ACPI code */ |
160 | {KE_KEY, 0x10, KEY_WLAN }, | 160 | {KE_KEY, 0x10, KEY_WLAN }, |
161 | {KE_KEY, 0x11, KEY_WLAN }, | ||
161 | {KE_KEY, 0x12, KEY_PROG1 }, | 162 | {KE_KEY, 0x12, KEY_PROG1 }, |
162 | {KE_KEY, 0x13, KEY_MUTE }, | 163 | {KE_KEY, 0x13, KEY_MUTE }, |
163 | {KE_KEY, 0x14, KEY_VOLUMEDOWN }, | 164 | {KE_KEY, 0x14, KEY_VOLUMEDOWN }, |
@@ -166,6 +167,8 @@ static struct key_entry eeepc_keymap[] = { | |||
166 | {KE_KEY, 0x1b, KEY_ZOOM }, | 167 | {KE_KEY, 0x1b, KEY_ZOOM }, |
167 | {KE_KEY, 0x1c, KEY_PROG2 }, | 168 | {KE_KEY, 0x1c, KEY_PROG2 }, |
168 | {KE_KEY, 0x1d, KEY_PROG3 }, | 169 | {KE_KEY, 0x1d, KEY_PROG3 }, |
170 | {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN }, | ||
171 | {KE_KEY, NOTIFY_BRN_MIN + 2, KEY_BRIGHTNESSUP }, | ||
169 | {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, | 172 | {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, |
170 | {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, | 173 | {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, |
171 | {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, | 174 | {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, |
@@ -381,11 +384,13 @@ static ssize_t show_sys_acpi(int cm, char *buf) | |||
381 | EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); | 384 | EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); |
382 | EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); | 385 | EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); |
383 | EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); | 386 | EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); |
387 | EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV); | ||
384 | 388 | ||
385 | static struct attribute *platform_attributes[] = { | 389 | static struct attribute *platform_attributes[] = { |
386 | &dev_attr_camera.attr, | 390 | &dev_attr_camera.attr, |
387 | &dev_attr_cardr.attr, | 391 | &dev_attr_cardr.attr, |
388 | &dev_attr_disp.attr, | 392 | &dev_attr_disp.attr, |
393 | &dev_attr_cpufv.attr, | ||
389 | NULL | 394 | NULL |
390 | }; | 395 | }; |
391 | 396 | ||
@@ -512,15 +517,21 @@ static int eeepc_hotk_check(void) | |||
512 | return 0; | 517 | return 0; |
513 | } | 518 | } |
514 | 519 | ||
515 | static void notify_brn(void) | 520 | static int notify_brn(void) |
516 | { | 521 | { |
522 | /* returns the *previous* brightness, or -1 */ | ||
517 | struct backlight_device *bd = eeepc_backlight_device; | 523 | struct backlight_device *bd = eeepc_backlight_device; |
518 | if (bd) | 524 | if (bd) { |
525 | int old = bd->props.brightness; | ||
519 | bd->props.brightness = read_brightness(bd); | 526 | bd->props.brightness = read_brightness(bd); |
527 | return old; | ||
528 | } | ||
529 | return -1; | ||
520 | } | 530 | } |
521 | 531 | ||
522 | static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | 532 | static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) |
523 | { | 533 | { |
534 | enum rfkill_state state; | ||
524 | struct pci_dev *dev; | 535 | struct pci_dev *dev; |
525 | struct pci_bus *bus = pci_find_bus(0, 1); | 536 | struct pci_bus *bus = pci_find_bus(0, 1); |
526 | 537 | ||
@@ -532,7 +543,9 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | |||
532 | return; | 543 | return; |
533 | } | 544 | } |
534 | 545 | ||
535 | if (get_acpi(CM_ASL_WLAN) == 1) { | 546 | eeepc_wlan_rfkill_state(ehotk->eeepc_wlan_rfkill, &state); |
547 | |||
548 | if (state == RFKILL_STATE_UNBLOCKED) { | ||
536 | dev = pci_get_slot(bus, 0); | 549 | dev = pci_get_slot(bus, 0); |
537 | if (dev) { | 550 | if (dev) { |
538 | /* Device already present */ | 551 | /* Device already present */ |
@@ -552,23 +565,41 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | |||
552 | pci_dev_put(dev); | 565 | pci_dev_put(dev); |
553 | } | 566 | } |
554 | } | 567 | } |
568 | |||
569 | rfkill_force_state(ehotk->eeepc_wlan_rfkill, state); | ||
555 | } | 570 | } |
556 | 571 | ||
557 | static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) | 572 | static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) |
558 | { | 573 | { |
559 | static struct key_entry *key; | 574 | static struct key_entry *key; |
560 | u16 count; | 575 | u16 count; |
576 | int brn = -ENODEV; | ||
561 | 577 | ||
562 | if (!ehotk) | 578 | if (!ehotk) |
563 | return; | 579 | return; |
564 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) | 580 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) |
565 | notify_brn(); | 581 | brn = notify_brn(); |
566 | count = ehotk->event_count[event % 128]++; | 582 | count = ehotk->event_count[event % 128]++; |
567 | acpi_bus_generate_proc_event(ehotk->device, event, count); | 583 | acpi_bus_generate_proc_event(ehotk->device, event, count); |
568 | acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, | 584 | acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, |
569 | dev_name(&ehotk->device->dev), event, | 585 | dev_name(&ehotk->device->dev), event, |
570 | count); | 586 | count); |
571 | if (ehotk->inputdev) { | 587 | if (ehotk->inputdev) { |
588 | if (brn != -ENODEV) { | ||
589 | /* brightness-change events need special | ||
590 | * handling for conversion to key events | ||
591 | */ | ||
592 | if (brn < 0) | ||
593 | brn = event; | ||
594 | else | ||
595 | brn += NOTIFY_BRN_MIN; | ||
596 | if (event < brn) | ||
597 | event = NOTIFY_BRN_MIN; /* brightness down */ | ||
598 | else if (event > brn) | ||
599 | event = NOTIFY_BRN_MIN + 2; /* ... up */ | ||
600 | else | ||
601 | event = NOTIFY_BRN_MIN + 1; /* ... unchanged */ | ||
602 | } | ||
572 | key = eepc_get_entry_by_scancode(event); | 603 | key = eepc_get_entry_by_scancode(event); |
573 | if (key) { | 604 | if (key) { |
574 | switch (key->type) { | 605 | switch (key->type) { |
@@ -649,6 +680,9 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
649 | if (ACPI_FAILURE(status)) | 680 | if (ACPI_FAILURE(status)) |
650 | printk(EEEPC_ERR "Error installing notify handler\n"); | 681 | printk(EEEPC_ERR "Error installing notify handler\n"); |
651 | 682 | ||
683 | eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); | ||
684 | eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); | ||
685 | |||
652 | if (get_acpi(CM_ASL_WLAN) != -1) { | 686 | if (get_acpi(CM_ASL_WLAN) != -1) { |
653 | ehotk->eeepc_wlan_rfkill = rfkill_allocate(&device->dev, | 687 | ehotk->eeepc_wlan_rfkill = rfkill_allocate(&device->dev, |
654 | RFKILL_TYPE_WLAN); | 688 | RFKILL_TYPE_WLAN); |
@@ -704,9 +738,6 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
704 | goto bluetooth_fail; | 738 | goto bluetooth_fail; |
705 | } | 739 | } |
706 | 740 | ||
707 | eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); | ||
708 | eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); | ||
709 | |||
710 | return 0; | 741 | return 0; |
711 | 742 | ||
712 | bluetooth_fail: | 743 | bluetooth_fail: |
@@ -717,6 +748,8 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
717 | wlan_fail: | 748 | wlan_fail: |
718 | if (ehotk->eeepc_wlan_rfkill) | 749 | if (ehotk->eeepc_wlan_rfkill) |
719 | rfkill_free(ehotk->eeepc_wlan_rfkill); | 750 | rfkill_free(ehotk->eeepc_wlan_rfkill); |
751 | eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); | ||
752 | eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); | ||
720 | ehotk_fail: | 753 | ehotk_fail: |
721 | kfree(ehotk); | 754 | kfree(ehotk); |
722 | ehotk = NULL; | 755 | ehotk = NULL; |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 184e99e72684..f1963b05175b 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -317,7 +317,8 @@ static void sony_laptop_report_input_event(u8 event) | |||
317 | struct input_dev *key_dev = sony_laptop_input.key_dev; | 317 | struct input_dev *key_dev = sony_laptop_input.key_dev; |
318 | struct sony_laptop_keypress kp = { NULL }; | 318 | struct sony_laptop_keypress kp = { NULL }; |
319 | 319 | ||
320 | if (event == SONYPI_EVENT_FNKEY_RELEASED) { | 320 | if (event == SONYPI_EVENT_FNKEY_RELEASED || |
321 | event == SONYPI_EVENT_ANYBUTTON_RELEASED) { | ||
321 | /* Nothing, not all VAIOs generate this event */ | 322 | /* Nothing, not all VAIOs generate this event */ |
322 | return; | 323 | return; |
323 | } | 324 | } |
@@ -905,7 +906,6 @@ static struct sony_nc_event sony_127_events[] = { | |||
905 | { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 906 | { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
906 | { 0x86, SONYPI_EVENT_PKEY_P5 }, | 907 | { 0x86, SONYPI_EVENT_PKEY_P5 }, |
907 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 908 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
908 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, | ||
909 | { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED }, | 909 | { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED }, |
910 | { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 910 | { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
911 | { 0, 0 }, | 911 | { 0, 0 }, |
@@ -1004,6 +1004,7 @@ static int sony_nc_function_setup(struct acpi_device *device) | |||
1004 | sony_call_snc_handle(0x0100, 0, &result); | 1004 | sony_call_snc_handle(0x0100, 0, &result); |
1005 | sony_call_snc_handle(0x0101, 0, &result); | 1005 | sony_call_snc_handle(0x0101, 0, &result); |
1006 | sony_call_snc_handle(0x0102, 0x100, &result); | 1006 | sony_call_snc_handle(0x0102, 0x100, &result); |
1007 | sony_call_snc_handle(0x0127, 0, &result); | ||
1007 | 1008 | ||
1008 | return 0; | 1009 | return 0; |
1009 | } | 1010 | } |
@@ -1040,7 +1041,7 @@ static int sony_nc_resume(struct acpi_device *device) | |||
1040 | 1041 | ||
1041 | /* set the last requested brightness level */ | 1042 | /* set the last requested brightness level */ |
1042 | if (sony_backlight_device && | 1043 | if (sony_backlight_device && |
1043 | !sony_backlight_update_status(sony_backlight_device)) | 1044 | sony_backlight_update_status(sony_backlight_device) < 0) |
1044 | printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); | 1045 | printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); |
1045 | 1046 | ||
1046 | return 0; | 1047 | return 0; |
@@ -1101,8 +1102,11 @@ static int sony_nc_setup_wifi_rfkill(struct acpi_device *device) | |||
1101 | err = rfkill_register(sony_wifi_rfkill); | 1102 | err = rfkill_register(sony_wifi_rfkill); |
1102 | if (err) | 1103 | if (err) |
1103 | rfkill_free(sony_wifi_rfkill); | 1104 | rfkill_free(sony_wifi_rfkill); |
1104 | else | 1105 | else { |
1105 | sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill; | 1106 | sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill; |
1107 | sony_nc_rfkill_set(sony_wifi_rfkill->data, | ||
1108 | RFKILL_STATE_UNBLOCKED); | ||
1109 | } | ||
1106 | return err; | 1110 | return err; |
1107 | } | 1111 | } |
1108 | 1112 | ||
@@ -1122,8 +1126,11 @@ static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device) | |||
1122 | err = rfkill_register(sony_bluetooth_rfkill); | 1126 | err = rfkill_register(sony_bluetooth_rfkill); |
1123 | if (err) | 1127 | if (err) |
1124 | rfkill_free(sony_bluetooth_rfkill); | 1128 | rfkill_free(sony_bluetooth_rfkill); |
1125 | else | 1129 | else { |
1126 | sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill; | 1130 | sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill; |
1131 | sony_nc_rfkill_set(sony_bluetooth_rfkill->data, | ||
1132 | RFKILL_STATE_UNBLOCKED); | ||
1133 | } | ||
1127 | return err; | 1134 | return err; |
1128 | } | 1135 | } |
1129 | 1136 | ||
@@ -1142,8 +1149,11 @@ static int sony_nc_setup_wwan_rfkill(struct acpi_device *device) | |||
1142 | err = rfkill_register(sony_wwan_rfkill); | 1149 | err = rfkill_register(sony_wwan_rfkill); |
1143 | if (err) | 1150 | if (err) |
1144 | rfkill_free(sony_wwan_rfkill); | 1151 | rfkill_free(sony_wwan_rfkill); |
1145 | else | 1152 | else { |
1146 | sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill; | 1153 | sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill; |
1154 | sony_nc_rfkill_set(sony_wwan_rfkill->data, | ||
1155 | RFKILL_STATE_UNBLOCKED); | ||
1156 | } | ||
1147 | return err; | 1157 | return err; |
1148 | } | 1158 | } |
1149 | 1159 | ||
@@ -1162,8 +1172,11 @@ static int sony_nc_setup_wimax_rfkill(struct acpi_device *device) | |||
1162 | err = rfkill_register(sony_wimax_rfkill); | 1172 | err = rfkill_register(sony_wimax_rfkill); |
1163 | if (err) | 1173 | if (err) |
1164 | rfkill_free(sony_wimax_rfkill); | 1174 | rfkill_free(sony_wimax_rfkill); |
1165 | else | 1175 | else { |
1166 | sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill; | 1176 | sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill; |
1177 | sony_nc_rfkill_set(sony_wimax_rfkill->data, | ||
1178 | RFKILL_STATE_UNBLOCKED); | ||
1179 | } | ||
1167 | return err; | 1180 | return err; |
1168 | } | 1181 | } |
1169 | 1182 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a40b075743d9..912be65b6261 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define TPACPI_VERSION "0.22" | 24 | #define TPACPI_VERSION "0.23" |
25 | #define TPACPI_SYSFS_VERSION 0x020300 | 25 | #define TPACPI_SYSFS_VERSION 0x020300 |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -303,11 +303,17 @@ static u32 dbg_level; | |||
303 | 303 | ||
304 | static struct workqueue_struct *tpacpi_wq; | 304 | static struct workqueue_struct *tpacpi_wq; |
305 | 305 | ||
306 | enum led_status_t { | ||
307 | TPACPI_LED_OFF = 0, | ||
308 | TPACPI_LED_ON, | ||
309 | TPACPI_LED_BLINK, | ||
310 | }; | ||
311 | |||
306 | /* Special LED class that can defer work */ | 312 | /* Special LED class that can defer work */ |
307 | struct tpacpi_led_classdev { | 313 | struct tpacpi_led_classdev { |
308 | struct led_classdev led_classdev; | 314 | struct led_classdev led_classdev; |
309 | struct work_struct work; | 315 | struct work_struct work; |
310 | enum led_brightness new_brightness; | 316 | enum led_status_t new_state; |
311 | unsigned int led; | 317 | unsigned int led; |
312 | }; | 318 | }; |
313 | 319 | ||
@@ -2946,12 +2952,18 @@ static int hotkey_read(char *p) | |||
2946 | return len; | 2952 | return len; |
2947 | } | 2953 | } |
2948 | 2954 | ||
2949 | static void hotkey_enabledisable_warn(void) | 2955 | static void hotkey_enabledisable_warn(bool enable) |
2950 | { | 2956 | { |
2951 | tpacpi_log_usertask("procfs hotkey enable/disable"); | 2957 | tpacpi_log_usertask("procfs hotkey enable/disable"); |
2952 | WARN(1, TPACPI_WARN | 2958 | if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), |
2953 | "hotkey enable/disable functionality has been " | 2959 | TPACPI_WARN |
2954 | "removed from the driver. Hotkeys are always enabled.\n"); | 2960 | "hotkey enable/disable functionality has been " |
2961 | "removed from the driver. Hotkeys are always " | ||
2962 | "enabled\n")) | ||
2963 | printk(TPACPI_ERR | ||
2964 | "Please remove the hotkey=enable module " | ||
2965 | "parameter, it is deprecated. Hotkeys are always " | ||
2966 | "enabled\n"); | ||
2955 | } | 2967 | } |
2956 | 2968 | ||
2957 | static int hotkey_write(char *buf) | 2969 | static int hotkey_write(char *buf) |
@@ -2971,9 +2983,9 @@ static int hotkey_write(char *buf) | |||
2971 | res = 0; | 2983 | res = 0; |
2972 | while ((cmd = next_cmd(&buf))) { | 2984 | while ((cmd = next_cmd(&buf))) { |
2973 | if (strlencmp(cmd, "enable") == 0) { | 2985 | if (strlencmp(cmd, "enable") == 0) { |
2974 | hotkey_enabledisable_warn(); | 2986 | hotkey_enabledisable_warn(1); |
2975 | } else if (strlencmp(cmd, "disable") == 0) { | 2987 | } else if (strlencmp(cmd, "disable") == 0) { |
2976 | hotkey_enabledisable_warn(); | 2988 | hotkey_enabledisable_warn(0); |
2977 | res = -EPERM; | 2989 | res = -EPERM; |
2978 | } else if (strlencmp(cmd, "reset") == 0) { | 2990 | } else if (strlencmp(cmd, "reset") == 0) { |
2979 | mask = hotkey_orig_mask; | 2991 | mask = hotkey_orig_mask; |
@@ -4207,7 +4219,7 @@ static void light_set_status_worker(struct work_struct *work) | |||
4207 | container_of(work, struct tpacpi_led_classdev, work); | 4219 | container_of(work, struct tpacpi_led_classdev, work); |
4208 | 4220 | ||
4209 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) | 4221 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) |
4210 | light_set_status((data->new_brightness != LED_OFF)); | 4222 | light_set_status((data->new_state != TPACPI_LED_OFF)); |
4211 | } | 4223 | } |
4212 | 4224 | ||
4213 | static void light_sysfs_set(struct led_classdev *led_cdev, | 4225 | static void light_sysfs_set(struct led_classdev *led_cdev, |
@@ -4217,7 +4229,8 @@ static void light_sysfs_set(struct led_classdev *led_cdev, | |||
4217 | container_of(led_cdev, | 4229 | container_of(led_cdev, |
4218 | struct tpacpi_led_classdev, | 4230 | struct tpacpi_led_classdev, |
4219 | led_classdev); | 4231 | led_classdev); |
4220 | data->new_brightness = brightness; | 4232 | data->new_state = (brightness != LED_OFF) ? |
4233 | TPACPI_LED_ON : TPACPI_LED_OFF; | ||
4221 | queue_work(tpacpi_wq, &data->work); | 4234 | queue_work(tpacpi_wq, &data->work); |
4222 | } | 4235 | } |
4223 | 4236 | ||
@@ -4724,12 +4737,6 @@ enum { /* For TPACPI_LED_OLD */ | |||
4724 | TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ | 4737 | TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ |
4725 | }; | 4738 | }; |
4726 | 4739 | ||
4727 | enum led_status_t { | ||
4728 | TPACPI_LED_OFF = 0, | ||
4729 | TPACPI_LED_ON, | ||
4730 | TPACPI_LED_BLINK, | ||
4731 | }; | ||
4732 | |||
4733 | static enum led_access_mode led_supported; | 4740 | static enum led_access_mode led_supported; |
4734 | 4741 | ||
4735 | TPACPI_HANDLE(led, ec, "SLED", /* 570 */ | 4742 | TPACPI_HANDLE(led, ec, "SLED", /* 570 */ |
@@ -4841,23 +4848,13 @@ static int led_set_status(const unsigned int led, | |||
4841 | return rc; | 4848 | return rc; |
4842 | } | 4849 | } |
4843 | 4850 | ||
4844 | static void led_sysfs_set_status(unsigned int led, | ||
4845 | enum led_brightness brightness) | ||
4846 | { | ||
4847 | led_set_status(led, | ||
4848 | (brightness == LED_OFF) ? | ||
4849 | TPACPI_LED_OFF : | ||
4850 | (tpacpi_led_state_cache[led] == TPACPI_LED_BLINK) ? | ||
4851 | TPACPI_LED_BLINK : TPACPI_LED_ON); | ||
4852 | } | ||
4853 | |||
4854 | static void led_set_status_worker(struct work_struct *work) | 4851 | static void led_set_status_worker(struct work_struct *work) |
4855 | { | 4852 | { |
4856 | struct tpacpi_led_classdev *data = | 4853 | struct tpacpi_led_classdev *data = |
4857 | container_of(work, struct tpacpi_led_classdev, work); | 4854 | container_of(work, struct tpacpi_led_classdev, work); |
4858 | 4855 | ||
4859 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) | 4856 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) |
4860 | led_sysfs_set_status(data->led, data->new_brightness); | 4857 | led_set_status(data->led, data->new_state); |
4861 | } | 4858 | } |
4862 | 4859 | ||
4863 | static void led_sysfs_set(struct led_classdev *led_cdev, | 4860 | static void led_sysfs_set(struct led_classdev *led_cdev, |
@@ -4866,7 +4863,13 @@ static void led_sysfs_set(struct led_classdev *led_cdev, | |||
4866 | struct tpacpi_led_classdev *data = container_of(led_cdev, | 4863 | struct tpacpi_led_classdev *data = container_of(led_cdev, |
4867 | struct tpacpi_led_classdev, led_classdev); | 4864 | struct tpacpi_led_classdev, led_classdev); |
4868 | 4865 | ||
4869 | data->new_brightness = brightness; | 4866 | if (brightness == LED_OFF) |
4867 | data->new_state = TPACPI_LED_OFF; | ||
4868 | else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK) | ||
4869 | data->new_state = TPACPI_LED_ON; | ||
4870 | else | ||
4871 | data->new_state = TPACPI_LED_BLINK; | ||
4872 | |||
4870 | queue_work(tpacpi_wq, &data->work); | 4873 | queue_work(tpacpi_wq, &data->work); |
4871 | } | 4874 | } |
4872 | 4875 | ||
@@ -4884,7 +4887,7 @@ static int led_sysfs_blink_set(struct led_classdev *led_cdev, | |||
4884 | } else if ((*delay_on != 500) || (*delay_off != 500)) | 4887 | } else if ((*delay_on != 500) || (*delay_off != 500)) |
4885 | return -EINVAL; | 4888 | return -EINVAL; |
4886 | 4889 | ||
4887 | data->new_brightness = TPACPI_LED_BLINK; | 4890 | data->new_state = TPACPI_LED_BLINK; |
4888 | queue_work(tpacpi_wq, &data->work); | 4891 | queue_work(tpacpi_wq, &data->work); |
4889 | 4892 | ||
4890 | return 0; | 4893 | return 0; |
@@ -7858,6 +7861,15 @@ static int __init thinkpad_acpi_module_init(void) | |||
7858 | MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); | 7861 | MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); |
7859 | 7862 | ||
7860 | /* | 7863 | /* |
7864 | * This will autoload the driver in almost every ThinkPad | ||
7865 | * in widespread use. | ||
7866 | * | ||
7867 | * Only _VERY_ old models, like the 240, 240x and 570 lack | ||
7868 | * the HKEY event interface. | ||
7869 | */ | ||
7870 | MODULE_DEVICE_TABLE(acpi, ibm_htk_device_ids); | ||
7871 | |||
7872 | /* | ||
7861 | * DMI matching for module autoloading | 7873 | * DMI matching for module autoloading |
7862 | * | 7874 | * |
7863 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs | 7875 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs |
@@ -7869,18 +7881,13 @@ MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); | |||
7869 | #define IBM_BIOS_MODULE_ALIAS(__type) \ | 7881 | #define IBM_BIOS_MODULE_ALIAS(__type) \ |
7870 | MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*") | 7882 | MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*") |
7871 | 7883 | ||
7872 | /* Non-ancient thinkpads */ | ||
7873 | MODULE_ALIAS("dmi:bvnIBM:*:svnIBM:*:pvrThinkPad*:rvnIBM:*"); | ||
7874 | MODULE_ALIAS("dmi:bvnLENOVO:*:svnLENOVO:*:pvrThinkPad*:rvnLENOVO:*"); | ||
7875 | |||
7876 | /* Ancient thinkpad BIOSes have to be identified by | 7884 | /* Ancient thinkpad BIOSes have to be identified by |
7877 | * BIOS type or model number, and there are far less | 7885 | * BIOS type or model number, and there are far less |
7878 | * BIOS types than model numbers... */ | 7886 | * BIOS types than model numbers... */ |
7879 | IBM_BIOS_MODULE_ALIAS("I[BDHIMNOTWVYZ]"); | 7887 | IBM_BIOS_MODULE_ALIAS("I[MU]"); /* 570, 570e */ |
7880 | IBM_BIOS_MODULE_ALIAS("1[0368A-GIKM-PST]"); | ||
7881 | IBM_BIOS_MODULE_ALIAS("K[UX-Z]"); | ||
7882 | 7888 | ||
7883 | MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh"); | 7889 | MODULE_AUTHOR("Borislav Deianov <borislav@users.sf.net>"); |
7890 | MODULE_AUTHOR("Henrique de Moraes Holschuh <hmh@hmh.eng.br>"); | ||
7884 | MODULE_DESCRIPTION(TPACPI_DESC); | 7891 | MODULE_DESCRIPTION(TPACPI_DESC); |
7885 | MODULE_VERSION(TPACPI_VERSION); | 7892 | MODULE_VERSION(TPACPI_VERSION); |
7886 | MODULE_LICENSE("GPL"); | 7893 | MODULE_LICENSE("GPL"); |