Commit de4c8cc7 authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Len Brown

thinkpad-acpi: report brightness events when required

Report KEY_BRIGHTNESSUP and KEY_BRIGHTNESSDOWN input events when the
ThinkPad is in "passive brightness control" mode (because either we or
ACPI video touched _BCL), and ACPI video is not processing these
events by itself.

This happens only on Lenovo ThinkPads with ACPI video support, when
operating with the ACPI video driver in acpi_backlight=vendor mode.

Issuing these events is the right thing to do, and will work around
bugzilla #13368, if userspace is properly configured and actively
handles these events.

For other ThinkPads, and when ACPI video is handling brightness
changes, thinkpad-acpi will continue NOT sending KEY_BRIGHTNESS*
events by default.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 230d8cf2
...@@ -2854,6 +2854,15 @@ static void hotkey_exit(void) ...@@ -2854,6 +2854,15 @@ static void hotkey_exit(void)
} }
} }
static void __init hotkey_unmap(const unsigned int scancode)
{
if (hotkey_keycode_map[scancode] != KEY_RESERVED) {
clear_bit(hotkey_keycode_map[scancode],
tpacpi_inputdev->keybit);
hotkey_keycode_map[scancode] = KEY_RESERVED;
}
}
static int __init hotkey_init(struct ibm_init_struct *iibm) static int __init hotkey_init(struct ibm_init_struct *iibm)
{ {
/* Requirements for changing the default keymaps: /* Requirements for changing the default keymaps:
...@@ -2932,11 +2941,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -2932,11 +2941,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
KEY_UNKNOWN, /* 0x0D: FN+INSERT */ KEY_UNKNOWN, /* 0x0D: FN+INSERT */
KEY_UNKNOWN, /* 0x0E: FN+DELETE */ KEY_UNKNOWN, /* 0x0E: FN+DELETE */
/* These either have to go through ACPI video, or /* These should be enabled --only-- when ACPI video
* act like in the IBM ThinkPads, so don't ever * is disabled (i.e. in "vendor" mode), and are handled
* enable them by default */ * in a special way by the init code */
KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */
KEY_RESERVED, /* 0x10: FN+END (brightness down) */ KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */
KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
...@@ -3162,15 +3171,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -3162,15 +3171,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
"Disabling thinkpad-acpi brightness events " "Disabling thinkpad-acpi brightness events "
"by default...\n"); "by default...\n");
/* The hotkey_reserved_mask change below is not /* Disable brightness up/down on Lenovo thinkpads when
* necessary while the keys are at KEY_RESERVED in the * ACPI is handling them, otherwise it is plain impossible
* default map, but better safe than sorry, leave it * for userspace to do something even remotely sane */
* here as a marker of what we have to do, especially
* when we finally become able to set this at runtime
* on response to X.org requests */
hotkey_reserved_mask |= hotkey_reserved_mask |=
(1 << TP_ACPI_HOTKEYSCAN_FNHOME) (1 << TP_ACPI_HOTKEYSCAN_FNHOME)
| (1 << TP_ACPI_HOTKEYSCAN_FNEND); | (1 << TP_ACPI_HOTKEYSCAN_FNEND);
hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNHOME);
hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNEND);
} }
#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment