aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/eeepc-laptop.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index e21f7cd72e4e..f54cfeac5221 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -166,6 +166,8 @@ static struct key_entry eeepc_keymap[] = {
166 {KE_KEY, 0x1b, KEY_ZOOM }, 166 {KE_KEY, 0x1b, KEY_ZOOM },
167 {KE_KEY, 0x1c, KEY_PROG2 }, 167 {KE_KEY, 0x1c, KEY_PROG2 },
168 {KE_KEY, 0x1d, KEY_PROG3 }, 168 {KE_KEY, 0x1d, KEY_PROG3 },
169 {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN },
170 {KE_KEY, NOTIFY_BRN_MIN + 2, KEY_BRIGHTNESSUP },
169 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, 171 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
170 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, 172 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
171 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, 173 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -512,11 +514,16 @@ static int eeepc_hotk_check(void)
512 return 0; 514 return 0;
513} 515}
514 516
515static void notify_brn(void) 517static int notify_brn(void)
516{ 518{
519 /* returns the *previous* brightness, or -1 */
517 struct backlight_device *bd = eeepc_backlight_device; 520 struct backlight_device *bd = eeepc_backlight_device;
518 if (bd) 521 if (bd) {
522 int old = bd->props.brightness;
519 bd->props.brightness = read_brightness(bd); 523 bd->props.brightness = read_brightness(bd);
524 return old;
525 }
526 return -1;
520} 527}
521 528
522static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 529static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
@@ -558,17 +565,33 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
558{ 565{
559 static struct key_entry *key; 566 static struct key_entry *key;
560 u16 count; 567 u16 count;
568 int brn = -ENODEV;
561 569
562 if (!ehotk) 570 if (!ehotk)
563 return; 571 return;
564 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 572 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
565 notify_brn(); 573 brn = notify_brn();
566 count = ehotk->event_count[event % 128]++; 574 count = ehotk->event_count[event % 128]++;
567 acpi_bus_generate_proc_event(ehotk->device, event, count); 575 acpi_bus_generate_proc_event(ehotk->device, event, count);
568 acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, 576 acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
569 dev_name(&ehotk->device->dev), event, 577 dev_name(&ehotk->device->dev), event,
570 count); 578 count);
571 if (ehotk->inputdev) { 579 if (ehotk->inputdev) {
580 if (brn != -ENODEV) {
581 /* brightness-change events need special
582 * handling for conversion to key events
583 */
584 if (brn < 0)
585 brn = event;
586 else
587 brn += NOTIFY_BRN_MIN;
588 if (event < brn)
589 event = NOTIFY_BRN_MIN; /* brightness down */
590 else if (event > brn)
591 event = NOTIFY_BRN_MIN + 2; /* ... up */
592 else
593 event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
594 }
572 key = eepc_get_entry_by_scancode(event); 595 key = eepc_get_entry_by_scancode(event);
573 if (key) { 596 if (key) {
574 switch (key->type) { 597 switch (key->type) {