Commit aae7cd96b4e51e28032b2fa14f1552cec5d90146

Authored by Srihari Vijayaraghavan
Committed by Greg Kroah-Hartman
1 parent 17afe47690

Input: i8042 - reset keyboard to fix Elantech touchpad detection

commit 148e9a711e034e06310a8c36b64957934ebe30f2 upstream.

On some laptops, keyboard needs to be reset in order to successfully detect
touchpad (e.g., some Gigabyte laptop models with Elantech touchpads).
Without resettin keyboard touchpad pretends to be completely dead.

Based on the original patch by Mateusz Jończyk this version has been
expanded to include DMI based detection & application of the fix
automatically on the affected models of laptops. This has been confirmed to
fix problem by three users already on three different models of laptops.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=81331
Signed-off-by: Srihari Vijayaraghavan <linux.bug.reporting@gmail.com>
Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Tested-by: Srihari Vijayaraghavan <linux.bug.reporting@gmail.com>
Tested by: Zakariya Dehlawi <zdehlawi@gmail.com>
Tested-by: Guillaum Bouchard <guillaum.bouchard@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 3 changed files with 47 additions and 0 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -1270,6 +1270,7 @@
1270 1270 i8042.notimeout [HW] Ignore timeout condition signalled by controller
1271 1271 i8042.reset [HW] Reset the controller during init and cleanup
1272 1272 i8042.unlock [HW] Unlock (ignore) the keylock
  1273 + i8042.kbdreset [HW] Reset device connected to KBD port
1273 1274  
1274 1275 i810= [HW,DRM]
1275 1276  
drivers/input/serio/i8042-x86ia64io.h
... ... @@ -735,6 +735,35 @@
735 735 { }
736 736 };
737 737  
  738 +/*
  739 + * Some laptops need keyboard reset before probing for the trackpad to get
  740 + * it detected, initialised & finally work.
  741 + */
  742 +static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
  743 + {
  744 + /* Gigabyte P35 v2 - Elantech touchpad */
  745 + .matches = {
  746 + DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  747 + DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
  748 + },
  749 + },
  750 + {
  751 + /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
  752 + .matches = {
  753 + DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  754 + DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
  755 + },
  756 + },
  757 + {
  758 + /* Gigabyte P34 - Elantech touchpad */
  759 + .matches = {
  760 + DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  761 + DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
  762 + },
  763 + },
  764 + { }
  765 +};
  766 +
738 767 #endif /* CONFIG_X86 */
739 768  
740 769 #ifdef CONFIG_PNP
... ... @@ -1029,6 +1058,9 @@
1029 1058  
1030 1059 if (dmi_check_system(i8042_dmi_dritek_table))
1031 1060 i8042_dritek = true;
  1061 +
  1062 + if (dmi_check_system(i8042_dmi_kbdreset_table))
  1063 + i8042_kbdreset = true;
1032 1064  
1033 1065 /*
1034 1066 * A20 was already enabled during early kernel init. But some buggy
drivers/input/serio/i8042.c
... ... @@ -67,6 +67,10 @@
67 67 module_param_named(notimeout, i8042_notimeout, bool, 0);
68 68 MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042");
69 69  
  70 +static bool i8042_kbdreset;
  71 +module_param_named(kbdreset, i8042_kbdreset, bool, 0);
  72 +MODULE_PARM_DESC(kbdreset, "Reset device connected to KBD port");
  73 +
70 74 #ifdef CONFIG_X86
71 75 static bool i8042_dritek;
72 76 module_param_named(dritek, i8042_dritek, bool, 0);
... ... @@ -788,6 +792,16 @@
788 792  
789 793 if (i8042_toggle_aux(true))
790 794 return -1;
  795 +
  796 +/*
  797 + * Reset keyboard (needed on some laptops to successfully detect
  798 + * touchpad, e.g., some Gigabyte laptop models with Elantech
  799 + * touchpads).
  800 + */
  801 + if (i8042_kbdreset) {
  802 + pr_warn("Attempting to reset device connected to KBD port\n");
  803 + i8042_kbd_write(NULL, (unsigned char) 0xff);
  804 + }
791 805  
792 806 /*
793 807 * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and