LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] input: fix aux port detection with some i8042 chips
@ 2007-05-03 23:38 Roland Scheidegger
  2007-05-09  3:19 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Scheidegger @ 2007-05-03 23:38 UTC (permalink / raw)
  To: linux-kernel, dmitry.torokhov

From: Roland Scheidegger <sroland@tungstengraphics.com>

The i8042 driver fails detection of the AUX port with some chips,
because they apparently do not change the I8042_CTR_AUXDIS bit
immediately. This is known to affect at least HP500 / HP510 notebooks,
consequently the built-in touchpad will not work. The patch will simply
reread the value until it gets the expected value or a retry limit is
hit, without touching other workaround code in the same area.

Signed-off-by: Roland Scheidegger <sroland@tungstengraphics.com>

---
There is some discussion about non-working touchpads in HP500 notebooks
in ubuntu and a (ugly) workaround for this problem here:
http://ubuntuforums.org/showthread.php?t=344103. I've got a HP510 and
even with 2.6.21 the aux port would get disabled. Works with the patch,
for the record the i8042 here needs around 6 tries (sometimes a bit
more, sometimes less) until it reads the I8042_CTR_AUXDIS bit correctly,
both after disabling and enabling the aux port.
(please CC: on any replies)

Signed-off-by: Roland Scheidegger <sroland@tungstengraphics.com>

--- linux-2.6/drivers/input/serio/i8042.c.orig	2007-05-03
16:32:26.000000000 +0200
+++ linux-2.6/drivers/input/serio/i8042.c	2007-05-03 16:56:00.000000000
+0200
@@ -537,6 +537,7 @@ static int __devinit i8042_check_aux(voi
 	int retval = -1;
 	int irq_registered = 0;
 	int aux_loop_broken = 0;
+	int i = 0;
 	unsigned long flags;
 	unsigned char param;

@@ -582,14 +583,27 @@ static int __devinit i8042_check_aux(voi

 	if (i8042_command(&param, I8042_CMD_AUX_DISABLE))
 		return -1;
-	if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (~param &
I8042_CTR_AUXDIS)) {
+	/* some chips need some time to set the I8042_CTR_AUXDIS bit */
+	for (i = 0; i < 100; i++) {
+		if (!i8042_command(&param, I8042_CMD_CTL_RCTR) && (param &
I8042_CTR_AUXDIS))
+			break;
+		udelay(50);
+	}
+	if (i == 100) {
 		printk(KERN_WARNING "Failed to disable AUX port, but continuing
anyway... Is this a SiS?\n");
 		printk(KERN_WARNING "If AUX port is really absent please use the
'i8042.noaux' option.\n");
 	}

 	if (i8042_command(&param, I8042_CMD_AUX_ENABLE))
 		return -1;
-	if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (param &
I8042_CTR_AUXDIS))
+	for (i = 0; i < 100; i++) {
+		if (i8042_command(&param, I8042_CMD_CTL_RCTR))
+			return -1;
+		if (~param & I8042_CTR_AUXDIS)
+			break;
+		udelay(50);
+	}
+	if (i == 100)
 		return -1;

 /*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] input: fix aux port detection with some i8042 chips
  2007-05-03 23:38 [PATCH] input: fix aux port detection with some i8042 chips Roland Scheidegger
@ 2007-05-09  3:19 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2007-05-09  3:19 UTC (permalink / raw)
  To: Roland Scheidegger; +Cc: linux-kernel

On Thursday 03 May 2007 19:38, Roland Scheidegger wrote:
> From: Roland Scheidegger <sroland@tungstengraphics.com>
> 
> The i8042 driver fails detection of the AUX port with some chips,
> because they apparently do not change the I8042_CTR_AUXDIS bit
> immediately. This is known to affect at least HP500 / HP510 notebooks,
> consequently the built-in touchpad will not work. The patch will simply
> reread the value until it gets the expected value or a retry limit is
> hit, without touching other workaround code in the same area.
> 

Applied with some rearrangements, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-09  3:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-03 23:38 [PATCH] input: fix aux port detection with some i8042 chips Roland Scheidegger
2007-05-09  3:19 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).