Re: [PATCH 1/1] Elantech touchpad detection fix for laptops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Folks & Dmitry,

Further to the previous patch, here is the current version (against
mainline) updated with the DMI info of another laptop model where this
fix had helped a user.

Can you please review it & give some feedback? If it looks good as it
is, then on behalf of all affected users (including yours truly), may
I request for it to be merged upstream (and possibly stable too)?

(If the patch gets spoiled by gmail, please ref to this bugzilla URL,
where this patch is there as a file attachment:
https://bugzilla.kernel.org/show_bug.cgi?id=81331)

Thanks
commit c77a39a799b51fbb68b72330267c2d32a8e20542
Author: Srihari Vijayaraghavan <linux.bug.reporting@xxxxxxxxx>
Date:   Mon Jan 5 18:53:04 2015 +1100

    As reported in kernel bugzilla 81331, on many laptops keyboard needs to be reset
    for the detection of Elantech touchpad. Based on the original patch by Mateusz Jończyk
    this version has been expanded to include DMI based detection & application of the fix
    automatically. Confirmed to fix the problem by three users already.
    
    Signed-off-by: Srihari Vijayaraghavan <linux.bug.reporting@xxxxxxxxx>
    Acked-by: Mateusz Jończyk <mat.jonczyk@xxxxx>
    Tested-by: Srihari Vijayaraghavan <linux.bug.reporting@xxxxxxxxx>
    Tested by: Zakariya Dehlawi <zdehlawi@xxxxxxxxx>
    Tested-by: Guillaum Bouchard <guillaum.bouchard@xxxxxxxxx>

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4df73da..c6e8cbc 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1277,6 +1277,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	i8042.notimeout	[HW] Ignore timeout condition signalled by controller
 	i8042.reset	[HW] Reset the controller during init and cleanup
 	i8042.unlock	[HW] Unlock (ignore) the keylock
+	i8042.kbdreset  [HW] Reset keyboard to detect Elantech touchpad
 
 	i810=		[HW,DRM]
 
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index c66d1b5..734360b 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -745,6 +745,36 @@ static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
 	{ }
 };
 
+/*
+ * Just as per kernel bugzilla #81331, some Elantech touchpad based laptops
+ * need keyboard reset while probing for the tochpad to get detected,
+ * initialised & finally work.
+ */
+static const struct dmi_system_id __initconst i8042_dmi_elantech_kbdreset_table[] = {
+        {
+                /* Gigabyte P35 v2 */
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
+                        DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
+                },
+        },
+	{
+		/* Aorus branded Gigabyte X3 Plus */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
+		},
+	},
+        {
+                /* Gigabyte P34 */
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
+                        DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
+                },
+        },
+	{ }
+};
+
 #endif /* CONFIG_X86 */
 
 #ifdef CONFIG_PNP
@@ -1040,6 +1070,9 @@ static int __init i8042_platform_init(void)
 	if (dmi_check_system(i8042_dmi_dritek_table))
 		i8042_dritek = true;
 
+	if (dmi_check_system(i8042_dmi_elantech_kbdreset_table))
+		i8042_kbdreset = true;
+
 	/*
 	 * A20 was already enabled during early kernel init. But some buggy
 	 * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 924e4bf..92d0aa8 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -67,6 +67,10 @@ static bool i8042_notimeout;
 module_param_named(notimeout, i8042_notimeout, bool, 0);
 MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042");
 
+static bool i8042_kbdreset;
+module_param_named(kbdreset, i8042_kbdreset, bool, 0);
+MODULE_PARM_DESC(kbdreset, "Reset keyboard to detect Elantech touchpad on some laptops");
+
 #ifdef CONFIG_X86
 static bool i8042_dritek;
 module_param_named(dritek, i8042_dritek, bool, 0);
@@ -790,6 +794,14 @@ static int __init i8042_check_aux(void)
 		return -1;
 
 /*
+ * Reset keyboard to detect touchpad on some laptops having Elantech touchpad
+ */
+	if (i8042_kbdreset) {
+		pr_warn("Resetting keyboard to detect Elantech touchpad on some laptops\n");
+		i8042_kbd_write(NULL, (unsigned char) 0xff);
+	}
+
+/*
  * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and
  * used it for a PCI card or somethig else.
  */

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux