aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-09-12 14:22:18 -0400
committerLen Brown <len.brown@intel.com>2009-09-19 00:54:34 -0400
commitde4c8cc7bddd9c43dc1b85517ab445ffa8163058 (patch)
tree80397a4742e942dd05949267421d20f24885aeab /drivers/platform
parent230d8cf25ac32c7d2fdb4dda861ec5d954000ffb (diff)
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: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9c3bb0c498e1..955adf67e8f0 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2854,6 +2854,15 @@ static void hotkey_exit(void)
2854 } 2854 }
2855} 2855}
2856 2856
2857static void __init hotkey_unmap(const unsigned int scancode)
2858{
2859 if (hotkey_keycode_map[scancode] != KEY_RESERVED) {
2860 clear_bit(hotkey_keycode_map[scancode],
2861 tpacpi_inputdev->keybit);
2862 hotkey_keycode_map[scancode] = KEY_RESERVED;
2863 }
2864}
2865
2857static int __init hotkey_init(struct ibm_init_struct *iibm) 2866static int __init hotkey_init(struct ibm_init_struct *iibm)
2858{ 2867{
2859 /* Requirements for changing the default keymaps: 2868 /* Requirements for changing the default keymaps:
@@ -2932,11 +2941,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2932 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 2941 KEY_UNKNOWN, /* 0x0D: FN+INSERT */
2933 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 2942 KEY_UNKNOWN, /* 0x0E: FN+DELETE */
2934 2943
2935 /* These either have to go through ACPI video, or 2944 /* These should be enabled --only-- when ACPI video
2936 * act like in the IBM ThinkPads, so don't ever 2945 * is disabled (i.e. in "vendor" mode), and are handled
2937 * enable them by default */ 2946 * in a special way by the init code */
2938 KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ 2947 KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */
2939 KEY_RESERVED, /* 0x10: FN+END (brightness down) */ 2948 KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */
2940 2949
2941 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 2950 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
2942 2951
@@ -3162,15 +3171,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3162 "Disabling thinkpad-acpi brightness events " 3171 "Disabling thinkpad-acpi brightness events "
3163 "by default...\n"); 3172 "by default...\n");
3164 3173
3165 /* The hotkey_reserved_mask change below is not 3174 /* Disable brightness up/down on Lenovo thinkpads when
3166 * necessary while the keys are at KEY_RESERVED in the 3175 * ACPI is handling them, otherwise it is plain impossible
3167 * default map, but better safe than sorry, leave it 3176 * for userspace to do something even remotely sane */
3168 * here as a marker of what we have to do, especially
3169 * when we finally become able to set this at runtime
3170 * on response to X.org requests */
3171 hotkey_reserved_mask |= 3177 hotkey_reserved_mask |=
3172 (1 << TP_ACPI_HOTKEYSCAN_FNHOME) 3178 (1 << TP_ACPI_HOTKEYSCAN_FNHOME)
3173 | (1 << TP_ACPI_HOTKEYSCAN_FNEND); 3179 | (1 << TP_ACPI_HOTKEYSCAN_FNEND);
3180 hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNHOME);
3181 hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNEND);
3174 } 3182 }
3175 3183
3176#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 3184#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL