rpms/kernel/F-11 input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch, NONE, 1.1 input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch, NONE, 1.1 kernel.spec, 1.1767, 1.1768

Chuck Ebbert cebbert at fedoraproject.org
Sat Oct 17 13:18:08 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18621

Modified Files:
	kernel.spec 
Added Files:
	input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch 
	input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch 
Log Message:
Keyboard and mouse fixes from 2.6.32 (#522126)

input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch:
 i8042-x86ia64io.h |   33 +++++++++++++++++++++++++++++++++
 i8042.c           |    4 +++-
 2 files changed, 36 insertions(+), 1 deletion(-)

--- NEW FILE input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch ---
From: Dmitry Torokhov <dmitry.torokhov at gmail.com>
Date: Fri, 4 Sep 2009 04:45:34 +0000 (-0700)
Subject: Input: i8042 - bypass AUX IRQ delivery test on laptops
X-Git-Tag: v2.6.32-rc1~686^2^2~8
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=1c7827ae70e7c8456e08f7bb9ef2238d27814cbe

Input: i8042 - bypass AUX IRQ delivery test on laptops

It seems that many laptops do not fully implement AUX LOOP command in
their keyboard controllers, causing issues with touchpad detection.
We know however that almost every laptop/portable uses a PS/2 pointing
device and, even if user disables it in favor of an external mouse,
the system will not use IRQ 12 for anything else. Therefore we may
bypass AUX IRQ delivery test when running on a laptop and assume that
it is routed properly.

Just to be safe we require the box to have good PNP data in order to
bypass the test.

[Jin Dongming <jin.dongming at np.css.fujitsu.com>: fix crash caused
 by missing terminator in the DMI table]

Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
---

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index ae04d8a..66829a8 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -449,6 +449,34 @@ static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
 	},
 	{ }
 };
+
+static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
+	{
+		.ident = "Portable",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
+		},
+	},
+	{
+		.ident = "Laptop",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
+		},
+	},
+	{
+		.ident = "Notebook",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
+		},
+	},
+	{
+		.ident = "Sub-Notebook",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
+		},
+	},
+	{ }
+};
 #endif
 
 /*
@@ -727,6 +755,11 @@ static int __init i8042_pnp_init(void)
 	i8042_kbd_irq = i8042_pnp_kbd_irq;
 	i8042_aux_irq = i8042_pnp_aux_irq;
 
+#ifdef CONFIG_X86
+	i8042_bypass_aux_irq_test = !pnp_data_busted &&
+				    dmi_check_system(i8042_dmi_laptop_table);
+#endif
+
 	return 0;
 }
 
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 9f5c050..b53a015 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -83,6 +83,8 @@ module_param_named(debug, i8042_debug, bool, 0600);
 MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
 #endif
 
+static bool i8042_bypass_aux_irq_test;
+
 #include "i8042.h"
 
 static DEFINE_SPINLOCK(i8042_lock);
@@ -641,7 +643,7 @@ static int __devinit i8042_check_aux(void)
  * used it for a PCI card or somethig else.
  */
 
-	if (i8042_noloop || aux_loop_broken) {
+	if (i8042_noloop || i8042_bypass_aux_irq_test || aux_loop_broken) {
 /*
  * Without LOOP command we can't test AUX IRQ delivery. Assume the port
  * is working and hope we are right.

input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch:
 i8042.c |   50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

--- NEW FILE input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch ---
From: Dmitry Torokhov <dmitry.torokhov at gmail.com>
Date: Thu, 10 Sep 2009 02:08:15 +0000 (-0700)
Subject: Input: i8042 - try disabling and re-enabling AUX port at close
X-Git-Tag: v2.6.32-rc1~686^2^2~5
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5ddbc77c3eb54336fcd44b7b66b44784d65677e2

Input: i8042 - try disabling and re-enabling AUX port at close

Ever since we switched from having a polling timer to registering IRQ
handlers for both keyboard and AUX ports at the driver registration
time, on certain boxes probing for a mouse results in keyboard
stopping working. The only real difference between old and new way is
that before we disabled ports after unsuccessful probe whereas now we
leave them as is. Try to emulate the old behavior by disabling and
immediately re-enabling AUX and KBD ports when corresponding serio
port is being closed.

Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
---

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index b53a015..8aaf8fc 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -264,6 +264,49 @@ static int i8042_aux_write(struct serio *serio, unsigned char c)
 					I8042_CMD_MUX_SEND + port->mux);
 }
 
+
+/*
+ * i8042_aux_close attempts to clear AUX or KBD port state by disabling
+ * and then re-enabling it.
+ */
+
+static void i8042_port_close(struct serio *serio)
+{
+	int irq_bit;
+	int disable_bit;
+	const char *port_name;
+
+	if (serio == i8042_ports[I8042_AUX_PORT_NO].serio) {
+		irq_bit = I8042_CTR_AUXINT;
+		disable_bit = I8042_CTR_AUXDIS;
+		port_name = "AUX";
+	} else {
+		irq_bit = I8042_CTR_KBDINT;
+		disable_bit = I8042_CTR_KBDDIS;
+		port_name = "KBD";
+	}
+
+	i8042_ctr &= ~irq_bit;
+	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
+		printk(KERN_WARNING
+			"i8042.c: Can't write CTR while closing %s port.\n",
+			port_name);
+
+	udelay(50);
+
+	i8042_ctr &= ~disable_bit;
+	i8042_ctr |= irq_bit;
+	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
+		printk(KERN_ERR "i8042.c: Can't reactivate %s port.\n",
+			port_name);
+
+	/*
+	 * See if there is any data appeared while we were messing with
+	 * port state.
+	 */
+	i8042_interrupt(0, NULL);
+}
+
 /*
  * i8042_start() is called by serio core when port is about to finish
  * registering. It will mark port as existing so i8042_interrupt can
@@ -393,7 +436,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
 }
 
 /*
- * i8042_enable_kbd_port enables keybaord port on chip
+ * i8042_enable_kbd_port enables keyboard port on chip
  */
 
 static int i8042_enable_kbd_port(void)
@@ -841,6 +884,9 @@ static void i8042_controller_reset(void)
 	i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS;
 	i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT);
 
+	if (i8042_command(&i8042_initial_ctr, I8042_CMD_CTL_WCTR))
+		printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n");
+
 /*
  * Disable MUX mode if present.
  */
@@ -1026,6 +1072,7 @@ static int __devinit i8042_create_kbd_port(void)
 	serio->write		= i8042_dumbkbd ? NULL : i8042_kbd_write;
 	serio->start		= i8042_start;
 	serio->stop		= i8042_stop;
+	serio->close		= i8042_port_close;
 	serio->port_data	= port;
 	serio->dev.parent	= &i8042_platform_device->dev;
 	strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
@@ -1056,6 +1103,7 @@ static int __devinit i8042_create_aux_port(int idx)
 	if (idx < 0) {
 		strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name));
 		strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
+		serio->close = i8042_port_close;
 	} else {
 		snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx);
 		snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1767
retrieving revision 1.1768
diff -u -p -r1.1767 -r1.1768
--- kernel.spec	17 Oct 2009 12:59:18 -0000	1.1767
+++ kernel.spec	17 Oct 2009 13:18:07 -0000	1.1768
@@ -808,6 +808,10 @@ Patch16000: netlink-fix-typo-in-initiali
 
 Patch16200: sched-update-the-clock-of-runqueue-select-task-rq-selected.patch
 
+# fix mouse and keyboard detection (#522126)
+Patch16300: input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch
+Patch16310: input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1511,8 +1515,14 @@ ApplyPatch ax25-fix-possible-oops-in-ax2
 # netlink security fix (CVE-2009-3612)
 ApplyPatch netlink-fix-typo-in-initialization.patch
 
+# fix wakeup latency
 ApplyPatch sched-update-the-clock-of-runqueue-select-task-rq-selected.patch
 
+# fix mouse and keyboard detection (#522126)
+ApplyPatch input-i8042-bypass-aux-irq-delivery-test-on-laptops.patch
+ApplyPatch input-i8042-try-disabling-and-re-enabling-aux-port-at-close.patch
+
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2101,6 +2111,9 @@ fi
 # and build.
 
 %changelog
+* Sat Oct 17 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.30.9-89
+- Keyboard and mouse fixes from 2.6.32 (#522126)
+
 * Sat Oct 17 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.30.9-88
 - Scheduler wakeup patch, fixes high latency on wakeup
   (sched-update-the-clock-of-runqueue-select-task-rq-selected.patch)




More information about the scm-commits mailing list