aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/ideapad-laptop.c
diff options
context:
space:
mode:
authorMaxim Mikityanskiy <maxtram95@gmail.com>2012-07-06 04:07:50 -0400
committerMatthew Garrett <mjg@redhat.com>2012-08-20 12:35:30 -0400
commit296f9fe05d916e3d791dcd166aa41c1dadca4735 (patch)
tree9af9664fafca4321953a2d7bdc03ad91525017ea /drivers/platform/x86/ideapad-laptop.c
parentad20c73b05ea40cfdb42758506fb6b6befa3c9e5 (diff)
ideapad: add Lenovo IdeaPad Z570 support (part 1)
The patch adds support for Lenovo IdeaPad Z570 laptop. It makes all special keys working, adds possibility to control fan like Windows does, controls Touchpad Disabled LED, toggles touchpad state via keyboard controller and corrects touchpad behavior on resume from suspend. It is new, modified version of patch. Now it does not depend on psmouse and does not need patching of input subsystem. Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com> This is part 1 for special button handling. 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.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 17f6dfd8dbfb..2396242e8418 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -65,6 +65,7 @@ enum {
65 VPCCMD_R_ODD, /* 0x21 */ 65 VPCCMD_R_ODD, /* 0x21 */
66 VPCCMD_R_RF = 0x23, 66 VPCCMD_R_RF = 0x23,
67 VPCCMD_W_RF, 67 VPCCMD_W_RF,
68 VPCCMD_R_SPECIAL_BUTTONS = 0x31,
68 VPCCMD_W_BL_POWER = 0x33, 69 VPCCMD_W_BL_POWER = 0x33,
69}; 70};
70 71
@@ -518,9 +519,13 @@ static void ideapad_platform_exit(struct ideapad_private *priv)
518 */ 519 */
519static const struct key_entry ideapad_keymap[] = { 520static const struct key_entry ideapad_keymap[] = {
520 { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } }, 521 { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } },
522 { KE_KEY, 7, { KEY_CAMERA } },
523 { KE_KEY, 11, { KEY_F16 } },
521 { KE_KEY, 13, { KEY_WLAN } }, 524 { KE_KEY, 13, { KEY_WLAN } },
522 { KE_KEY, 16, { KEY_PROG1 } }, 525 { KE_KEY, 16, { KEY_PROG1 } },
523 { KE_KEY, 17, { KEY_PROG2 } }, 526 { KE_KEY, 17, { KEY_PROG2 } },
527 { KE_KEY, 64, { KEY_PROG3 } },
528 { KE_KEY, 65, { KEY_PROG4 } },
524 { KE_END, 0 }, 529 { KE_END, 0 },
525}; 530};
526 531
@@ -587,6 +592,28 @@ static void ideapad_input_novokey(struct ideapad_private *priv)
587 ideapad_input_report(priv, 16); 592 ideapad_input_report(priv, 16);
588} 593}
589 594
595static void ideapad_check_special_buttons(struct ideapad_private *priv)
596{
597 unsigned long bit, value;
598
599 read_ec_data(ideapad_handle, VPCCMD_R_SPECIAL_BUTTONS, &value);
600
601 for (bit = 0; bit < 16; bit++) {
602 if (test_bit(bit, &value)) {
603 switch (bit) {
604 case 6:
605 /* Thermal Management button */
606 ideapad_input_report(priv, 65);
607 break;
608 case 1:
609 /* OneKey Theater button */
610 ideapad_input_report(priv, 64);
611 break;
612 }
613 }
614 }
615}
616
590/* 617/*
591 * backlight 618 * backlight
592 */ 619 */
@@ -785,6 +812,8 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
785 ideapad_sync_rfk_state(priv); 812 ideapad_sync_rfk_state(priv);
786 break; 813 break;
787 case 13: 814 case 13:
815 case 11:
816 case 7:
788 case 6: 817 case 6:
789 ideapad_input_report(priv, vpc_bit); 818 ideapad_input_report(priv, vpc_bit);
790 break; 819 break;
@@ -797,6 +826,9 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
797 case 2: 826 case 2:
798 ideapad_backlight_notify_power(priv); 827 ideapad_backlight_notify_power(priv);
799 break; 828 break;
829 case 0:
830 ideapad_check_special_buttons(priv);
831 break;
800 default: 832 default:
801 pr_info("Unknown event: %lu\n", vpc_bit); 833 pr_info("Unknown event: %lu\n", vpc_bit);
802 } 834 }