aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt51
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c24
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.
4630x1011 0x10 FN+END Brightness down. See brightness 4650x1011 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
583Brightness hotkey notes: 585Brightness hotkey notes:
584 586
585These are the current sane choices for brightness key mapping in 587Don't mess with the brightness hotkeys in a Thinkpad. If you want
586thinkpad-acpi: 588notifications for OSD, use the sysfs backlight class event support.
587 589
588For IBM and Lenovo models *without* ACPI backlight control (the ones on 590The driver will issue KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN events
589which thinkpad-acpi will autoload its backlight interface by default, 591automatically for the cases were userspace has to do something to
590and on which ACPI video does not export a backlight interface): 592implement brightness changes. When you override these events, you will
591 593either fail to handle properly the ThinkPads that require explicit
5921. Don't enable or map the brightness hotkeys in thinkpad-acpi, as 594action to change backlight brightness, or the ThinkPads that require
593 these older firmware versions unfortunately won't respect the hotkey 595that 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
5992. 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
6043. 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
611For Lenovo models *with* ACPI backlight control:
612
6131. 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
6202. 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
627Bluetooth 598Bluetooth
@@ -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
14400x020600: Marker for backlight change event support.
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 6160813d906a..44061367a10d 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:
@@ -6073,6 +6073,12 @@ static int brightness_get(struct backlight_device *bd)
6073 return status & TP_EC_BACKLIGHT_LVLMSK; 6073 return status & TP_EC_BACKLIGHT_LVLMSK;
6074} 6074}
6075 6075
6076static void tpacpi_brightness_notify_change(void)
6077{
6078 backlight_force_update(ibm_backlight_device,
6079 BACKLIGHT_UPDATE_HOTKEY);
6080}
6081
6076static struct backlight_ops ibm_backlight_data = { 6082static struct backlight_ops ibm_backlight_data = {
6077 .get_brightness = brightness_get, 6083 .get_brightness = brightness_get,
6078 .update_status = brightness_update_status, 6084 .update_status = brightness_update_status,
@@ -6227,6 +6233,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
6227 ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; 6233 ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK;
6228 backlight_update_status(ibm_backlight_device); 6234 backlight_update_status(ibm_backlight_device);
6229 6235
6236 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT,
6237 "brightness: registering brightness hotkeys "
6238 "as change notification\n");
6239 tpacpi_hotkey_driver_mask_set(hotkey_driver_mask
6240 | TP_ACPI_HKEY_BRGHTUP_MASK
6241 | TP_ACPI_HKEY_BRGHTDWN_MASK);;
6230 return 0; 6242 return 0;
6231} 6243}
6232 6244
@@ -6303,6 +6315,9 @@ static int brightness_write(char *buf)
6303 * Doing it this way makes the syscall restartable in case of EINTR 6315 * Doing it this way makes the syscall restartable in case of EINTR
6304 */ 6316 */
6305 rc = brightness_set(level); 6317 rc = brightness_set(level);
6318 if (!rc && ibm_backlight_device)
6319 backlight_force_update(ibm_backlight_device,
6320 BACKLIGHT_UPDATE_SYSFS);
6306 return (rc == -EINTR)? -ERESTARTSYS : rc; 6321 return (rc == -EINTR)? -ERESTARTSYS : rc;
6307} 6322}
6308 6323
@@ -7702,6 +7717,13 @@ static struct ibm_struct fan_driver_data = {
7702 */ 7717 */
7703static void tpacpi_driver_event(const unsigned int hkey_event) 7718static void tpacpi_driver_event(const unsigned int hkey_event)
7704{ 7719{
7720 if (ibm_backlight_device) {
7721 switch (hkey_event) {
7722 case TP_HKEY_EV_BRGHT_UP:
7723 case TP_HKEY_EV_BRGHT_DOWN:
7724 tpacpi_brightness_notify_change();
7725 }
7726 }
7705} 7727}
7706 7728
7707 7729