public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Scheidegger <sroland@tungstengraphics.com>
To: linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: [PATCH] input: fix aux port detection with some i8042 chips
Date: Fri, 04 May 2007 01:38:57 +0200	[thread overview]
Message-ID: <463A7291.1050600@tungstengraphics.com> (raw)

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;

 /*

             reply	other threads:[~2007-05-03 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 23:38 Roland Scheidegger [this message]
2007-05-09  3:19 ` [PATCH] input: fix aux port detection with some i8042 chips Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463A7291.1050600@tungstengraphics.com \
    --to=sroland@tungstengraphics.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox