diff options
-rw-r--r-- | Documentation/laptops/thinkpad-acpi.txt | 51 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 24 |
2 files changed, 35 insertions, 40 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index aafcaa634191..f5056c7fb5be 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -460,6 +460,8 @@ event code Key Notes | |||
460 | For Lenovo ThinkPads with a new | 460 | For Lenovo ThinkPads with a new |
461 | BIOS, it has to be handled either | 461 | BIOS, it has to be handled either |
462 | by the ACPI OSI, or by userspace. | 462 | by the ACPI OSI, or by userspace. |
463 | The driver does the right thing, | ||
464 | never mess with this. | ||
463 | 0x1011 0x10 FN+END Brightness down. See brightness | 465 | 0x1011 0x10 FN+END Brightness down. See brightness |
464 | up for details. | 466 | up for details. |
465 | 467 | ||
@@ -582,46 +584,15 @@ with hotkey_report_mode. | |||
582 | 584 | ||
583 | Brightness hotkey notes: | 585 | Brightness hotkey notes: |
584 | 586 | ||
585 | These are the current sane choices for brightness key mapping in | 587 | Don't mess with the brightness hotkeys in a Thinkpad. If you want |
586 | thinkpad-acpi: | 588 | notifications for OSD, use the sysfs backlight class event support. |
587 | 589 | ||
588 | For IBM and Lenovo models *without* ACPI backlight control (the ones on | 590 | The driver will issue KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN events |
589 | which thinkpad-acpi will autoload its backlight interface by default, | 591 | automatically for the cases were userspace has to do something to |
590 | and on which ACPI video does not export a backlight interface): | 592 | implement brightness changes. When you override these events, you will |
591 | 593 | either fail to handle properly the ThinkPads that require explicit | |
592 | 1. Don't enable or map the brightness hotkeys in thinkpad-acpi, as | 594 | action to change backlight brightness, or the ThinkPads that require |
593 | these older firmware versions unfortunately won't respect the hotkey | 595 | that no action be taken to work properly. |
594 | mask for brightness keys anyway, and always reacts to them. This | ||
595 | usually work fine, unless X.org drivers are doing something to block | ||
596 | the BIOS. In that case, use (3) below. This is the default mode of | ||
597 | operation. | ||
598 | |||
599 | 2. Enable the hotkeys, but map them to something else that is NOT | ||
600 | KEY_BRIGHTNESS_UP/DOWN or any other keycode that would cause | ||
601 | userspace to try to change the backlight level, and use that as an | ||
602 | on-screen-display hint. | ||
603 | |||
604 | 3. IF AND ONLY IF X.org drivers find a way to block the firmware from | ||
605 | automatically changing the brightness, enable the hotkeys and map | ||
606 | them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN, and feed that to | ||
607 | something that calls xbacklight. thinkpad-acpi will not be able to | ||
608 | change brightness in that case either, so you should disable its | ||
609 | backlight interface. | ||
610 | |||
611 | For Lenovo models *with* ACPI backlight control: | ||
612 | |||
613 | 1. Load up ACPI video and use that. ACPI video will report ACPI | ||
614 | events for brightness change keys. Do not mess with thinkpad-acpi | ||
615 | defaults in this case. thinkpad-acpi should not have anything to do | ||
616 | with backlight events in a scenario where ACPI video is loaded: | ||
617 | brightness hotkeys must be disabled, and the backlight interface is | ||
618 | to be kept disabled as well. This is the default mode of operation. | ||
619 | |||
620 | 2. Do *NOT* load up ACPI video, enable the hotkeys in thinkpad-acpi, | ||
621 | and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN. Process | ||
622 | these keys on userspace somehow (e.g. by calling xbacklight). | ||
623 | The driver will do this automatically if it detects that ACPI video | ||
624 | has been disabled. | ||
625 | 596 | ||
626 | 597 | ||
627 | Bluetooth | 598 | Bluetooth |
@@ -1465,3 +1436,5 @@ Sysfs interface changelog: | |||
1465 | and it is always able to disable hot keys. Very old | 1436 | and it is always able to disable hot keys. Very old |
1466 | thinkpads are properly supported. hotkey_bios_mask | 1437 | thinkpads are properly supported. hotkey_bios_mask |
1467 | is deprecated and marked for removal. | 1438 | is deprecated and marked for removal. |
1439 | |||
1440 | 0x020600: Marker for backlight change event support. | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index cf61d6a8ef6f..758dc0b3ed91 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.23" | 24 | #define TPACPI_VERSION "0.23" |
25 | #define TPACPI_SYSFS_VERSION 0x020500 | 25 | #define TPACPI_SYSFS_VERSION 0x020600 |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Changelog: | 28 | * Changelog: |
@@ -6092,6 +6092,12 @@ static int brightness_get(struct backlight_device *bd) | |||
6092 | return status & TP_EC_BACKLIGHT_LVLMSK; | 6092 | return status & TP_EC_BACKLIGHT_LVLMSK; |
6093 | } | 6093 | } |
6094 | 6094 | ||
6095 | static void tpacpi_brightness_notify_change(void) | ||
6096 | { | ||
6097 | backlight_force_update(ibm_backlight_device, | ||
6098 | BACKLIGHT_UPDATE_HOTKEY); | ||
6099 | } | ||
6100 | |||
6095 | static struct backlight_ops ibm_backlight_data = { | 6101 | static struct backlight_ops ibm_backlight_data = { |
6096 | .get_brightness = brightness_get, | 6102 | .get_brightness = brightness_get, |
6097 | .update_status = brightness_update_status, | 6103 | .update_status = brightness_update_status, |
@@ -6246,6 +6252,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6246 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; | 6252 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; |
6247 | backlight_update_status(ibm_backlight_device); | 6253 | backlight_update_status(ibm_backlight_device); |
6248 | 6254 | ||
6255 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, | ||
6256 | "brightness: registering brightness hotkeys " | ||
6257 | "as change notification\n"); | ||
6258 | tpacpi_hotkey_driver_mask_set(hotkey_driver_mask | ||
6259 | | TP_ACPI_HKEY_BRGHTUP_MASK | ||
6260 | | TP_ACPI_HKEY_BRGHTDWN_MASK);; | ||
6249 | return 0; | 6261 | return 0; |
6250 | } | 6262 | } |
6251 | 6263 | ||
@@ -6322,6 +6334,9 @@ static int brightness_write(char *buf) | |||
6322 | * Doing it this way makes the syscall restartable in case of EINTR | 6334 | * Doing it this way makes the syscall restartable in case of EINTR |
6323 | */ | 6335 | */ |
6324 | rc = brightness_set(level); | 6336 | rc = brightness_set(level); |
6337 | if (!rc && ibm_backlight_device) | ||
6338 | backlight_force_update(ibm_backlight_device, | ||
6339 | BACKLIGHT_UPDATE_SYSFS); | ||
6325 | return (rc == -EINTR)? -ERESTARTSYS : rc; | 6340 | return (rc == -EINTR)? -ERESTARTSYS : rc; |
6326 | } | 6341 | } |
6327 | 6342 | ||
@@ -7721,6 +7736,13 @@ static struct ibm_struct fan_driver_data = { | |||
7721 | */ | 7736 | */ |
7722 | static void tpacpi_driver_event(const unsigned int hkey_event) | 7737 | static void tpacpi_driver_event(const unsigned int hkey_event) |
7723 | { | 7738 | { |
7739 | if (ibm_backlight_device) { | ||
7740 | switch (hkey_event) { | ||
7741 | case TP_HKEY_EV_BRGHT_UP: | ||
7742 | case TP_HKEY_EV_BRGHT_DOWN: | ||
7743 | tpacpi_brightness_notify_change(); | ||
7744 | } | ||
7745 | } | ||
7724 | } | 7746 | } |
7725 | 7747 | ||
7726 | 7748 | ||