Skip to content

Commit aae7cd9

Browse files
Srihari Vijayaraghavangregkh
authored andcommitted
Input: i8042 - reset keyboard to fix Elantech touchpad detection
commit 148e9a7 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>
1 parent 17afe47 commit aae7cd9

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

‎Documentation/kernel-parameters.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
12701270
i8042.notimeout [HW] Ignore timeout condition signalled by controller
12711271
i8042.reset [HW] Reset the controller during init and cleanup
12721272
i8042.unlock [HW] Unlock (ignore) the keylock
1273+
i8042.kbdreset [HW] Reset device connected to KBD port
12731274

12741275
i810= [HW,DRM]
12751276

‎drivers/input/serio/i8042-x86ia64io.h‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,35 @@ static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
735735
{ }
736736
};
737737

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+
738767
#endif /* CONFIG_X86 */
739768

740769
#ifdef CONFIG_PNP
@@ -1030,6 +1059,9 @@ static int __init i8042_platform_init(void)
10301059
if (dmi_check_system(i8042_dmi_dritek_table))
10311060
i8042_dritek = true;
10321061

1062+
if (dmi_check_system(i8042_dmi_kbdreset_table))
1063+
i8042_kbdreset = true;
1064+
10331065
/*
10341066
* A20 was already enabled during early kernel init. But some buggy
10351067
* BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to

‎drivers/input/serio/i8042.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ static bool i8042_notimeout;
6767
module_param_named(notimeout, i8042_notimeout, bool, 0);
6868
MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042");
6969

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+
7074
#ifdef CONFIG_X86
7175
static bool i8042_dritek;
7276
module_param_named(dritek, i8042_dritek, bool, 0);
@@ -789,6 +793,16 @@ static int __init i8042_check_aux(void)
789793
if (i8042_toggle_aux(true))
790794
return -1;
791795

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+
}
805+
792806
/*
793807
* Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and
794808
* used it for a PCI card or somethig else.

0 commit comments

Comments
 (0)