Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ideapad: add Lenovo IdeaPad Z570 support (part 2)

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 2 for touchpad toggle

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

authored by

Maxim Mikityanskiy and committed by
Matthew Garrett
07a4a4fc 296f9fe0

+36
+1
drivers/platform/x86/Kconfig
··· 289 289 tristate "Lenovo IdeaPad Laptop Extras" 290 290 depends on ACPI 291 291 depends on RFKILL && INPUT 292 + depends on SERIO_I8042 292 293 select INPUT_SPARSEKMAP 293 294 help 294 295 This is a driver for the rfkill switches on Lenovo IdeaPad netbooks.
+35
drivers/platform/x86/ideapad-laptop.c
··· 36 36 #include <linux/fb.h> 37 37 #include <linux/debugfs.h> 38 38 #include <linux/seq_file.h> 39 + #include <linux/i8042.h> 39 40 40 41 #define IDEAPAD_RFKILL_DEV_NUM (3) 41 42 ··· 527 526 { KE_KEY, 17, { KEY_PROG2 } }, 528 527 { KE_KEY, 64, { KEY_PROG3 } }, 529 528 { KE_KEY, 65, { KEY_PROG4 } }, 529 + { KE_KEY, 66, { KEY_TOUCHPAD_OFF } }, 530 + { KE_KEY, 67, { KEY_TOUCHPAD_ON } }, 530 531 { KE_END, 0 }, 531 532 }; 532 533 ··· 721 718 }; 722 719 MODULE_DEVICE_TABLE(acpi, ideapad_device_ids); 723 720 721 + static void ideapad_sync_touchpad_state(struct acpi_device *adevice) 722 + { 723 + struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); 724 + unsigned long value; 725 + 726 + /* Without reading from EC touchpad LED doesn't switch state */ 727 + if (!read_ec_data(adevice->handle, VPCCMD_R_TOUCHPAD, &value)) { 728 + /* Some IdeaPads don't really turn off touchpad - they only 729 + * switch the LED state. We (de)activate KBC AUX port to turn 730 + * touchpad off and on. We send KEY_TOUCHPAD_OFF and 731 + * KEY_TOUCHPAD_ON to not to get out of sync with LED */ 732 + unsigned char param; 733 + i8042_command(&param, value ? I8042_CMD_AUX_ENABLE : 734 + I8042_CMD_AUX_DISABLE); 735 + ideapad_input_report(priv, value ? 67 : 66); 736 + } 737 + } 738 + 724 739 static int __devinit ideapad_acpi_add(struct acpi_device *adevice) 725 740 { 726 741 int ret, i; ··· 775 754 priv->rfk[i] = NULL; 776 755 } 777 756 ideapad_sync_rfk_state(priv); 757 + ideapad_sync_touchpad_state(adevice); 778 758 779 759 if (!acpi_video_backlight_support()) { 780 760 ret = ideapad_backlight_init(priv); ··· 839 817 case 6: 840 818 ideapad_input_report(priv, vpc_bit); 841 819 break; 820 + case 5: 821 + ideapad_sync_touchpad_state(adevice); 822 + break; 842 823 case 4: 843 824 ideapad_backlight_notify_brightness(priv); 844 825 break; ··· 861 836 } 862 837 } 863 838 839 + static int ideapad_acpi_resume(struct device *device) 840 + { 841 + ideapad_sync_rfk_state(ideapad_priv); 842 + ideapad_sync_touchpad_state(to_acpi_device(device)); 843 + return 0; 844 + } 845 + 846 + static SIMPLE_DEV_PM_OPS(ideapad_pm, NULL, ideapad_acpi_resume); 847 + 864 848 static struct acpi_driver ideapad_acpi_driver = { 865 849 .name = "ideapad_acpi", 866 850 .class = "IdeaPad", ··· 877 843 .ops.add = ideapad_acpi_add, 878 844 .ops.remove = ideapad_acpi_remove, 879 845 .ops.notify = ideapad_acpi_notify, 846 + .drv.pm = &ideapad_pm, 880 847 .owner = THIS_MODULE, 881 848 }; 882 849