aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/ideapad-laptop.c
diff options
context:
space:
mode:
authorIke Panhc <ike.pan@canonical.com>2011-09-05 14:32:10 -0400
committerMatthew Garrett <mjg@redhat.com>2011-10-24 10:52:39 -0400
commitf43d9ec06028b8cb122a7a2b367a7af066342918 (patch)
treeed704ae9d51905c7abf06a25a7eafa08b2facb18 /drivers/platform/x86/ideapad-laptop.c
parent923de84ab07cfcee75946191f17a6e7fb98e3ac8 (diff)
ideapad: add event for Novo key
Novo key is the Lenovo define key on every ideapads, which has two definition. Long press and short click. Driver will report KEY_PROG1 on short click and KEY_PROG2 when long press. On pre-install OS for ideapads there are application waiting for the event and there is no such application for Linux yet, so I think to report KEY_PROG is fine in anyway. Also change the scancode from hex to decimal because they are related to vpc bit in notify function which is in decimal. Signed-off-by: Ike Panhc <ike.pan@canonical.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/ideapad-laptop.c')
-rw-r--r--drivers/platform/x86/ideapad-laptop.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index ab3add3327ad..39a72a8aeb8c 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -386,8 +386,10 @@ static void ideapad_platform_exit(struct ideapad_private *priv)
386 * input device 386 * input device
387 */ 387 */
388static const struct key_entry ideapad_keymap[] = { 388static const struct key_entry ideapad_keymap[] = {
389 { KE_KEY, 0x06, { KEY_SWITCHVIDEOMODE } }, 389 { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } },
390 { KE_KEY, 0x0D, { KEY_WLAN } }, 390 { KE_KEY, 13, { KEY_WLAN } },
391 { KE_KEY, 16, { KEY_PROG1 } },
392 { KE_KEY, 17, { KEY_PROG2 } },
391 { KE_END, 0 }, 393 { KE_END, 0 },
392}; 394};
393 395
@@ -442,6 +444,18 @@ static void ideapad_input_report(struct ideapad_private *priv,
442 sparse_keymap_report_event(priv->inputdev, scancode, 1, true); 444 sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
443} 445}
444 446
447static void ideapad_input_novokey(struct ideapad_private *priv)
448{
449 unsigned long long_pressed;
450
451 if (read_ec_data(ideapad_handle, VPCCMD_R_NOVO, &long_pressed))
452 return;
453 if (long_pressed)
454 ideapad_input_report(priv, 17);
455 else
456 ideapad_input_report(priv, 16);
457}
458
445/* 459/*
446 * backlight 460 * backlight
447 */ 461 */
@@ -634,6 +648,9 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
634 case 4: 648 case 4:
635 ideapad_backlight_notify_brightness(priv); 649 ideapad_backlight_notify_brightness(priv);
636 break; 650 break;
651 case 3:
652 ideapad_input_novokey(priv);
653 break;
637 case 2: 654 case 2:
638 ideapad_backlight_notify_power(priv); 655 ideapad_backlight_notify_power(priv);
639 break; 656 break;