From patchwork Tue Apr 6 17:55:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peter M. Petrakis" X-Patchwork-Id: 49534 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id CBE76B7D57 for ; Wed, 7 Apr 2010 03:55:56 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NzD08-0003nr-Te; Tue, 06 Apr 2010 18:55:48 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NzD03-0003kL-SR for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2010 18:55:43 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NzD03-00042K-2q for ; Tue, 06 Apr 2010 18:55:43 +0100 Received: from [91.189.91.3] (helo=[10.0.1.3]) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NzD02-0006Td-Rm for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2010 18:55:43 +0100 Message-ID: <4BBB759E.5020005@canonical.com> Date: Tue, 06 Apr 2010 13:55:42 -0400 From: "Peter M. Petrakis" Organization: Canonical USA Inc. User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100322 Thunderbird/3.0.3 MIME-Version: 1.0 To: kernel-team@lists.ubuntu.com Subject: Re: [PATCH] psmouse: touchpad doesn't reconnect after resume: Synaptics ps2 Bug: 551234 References: <4BB1192B.8030109@canonical.com> <20100401092430.GP4950@shadowen.org> In-Reply-To: <20100401092430.GP4950@shadowen.org> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Turns out that I don't need the msleep and incorporated everyone's suggestions. Thanks. Peter On 04/01/2010 05:24 AM, Andy Whitcroft wrote: > On Mon, Mar 29, 2010 at 05:18:35PM -0400, Peter M. Petrakis wrote: >> Hi All, >> >> This is my first stab at correcting some PS/2 misbehavior when returning >> from S3. Fire away :). Thanks. >> >> Peter >> >> P.S. Collaborated with Colin King on this one. > >> From 006e55bacfe64f5fe6b8c12af071f7b2bf528c3a Mon Sep 17 00:00:00 2001 >> From: Peter M. Petrakis >> Date: Fri, 26 Mar 2010 17:23:43 -0400 >> Subject: [PATCH] Perform a reset should psmouse_probe fail for any reason. This is necessary for some PS/2 devices who can't even be identified when returning from sleep (S3). >> >> --- >> psmouse-base.c | 28 +++++++++++++++++++++++++--- >> 1 files changed, 25 insertions(+), 3 deletions(-) >> >> diff --git a/psmouse-base.c b/psmouse-base.c >> index b407b35..3b8e63c 100644 >> --- a/psmouse-base.c >> +++ b/psmouse-base.c >> @@ -856,12 +856,12 @@ static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, >> return NULL; >> } >> >> - >> /* >> - * psmouse_probe() probes for a PS/2 mouse. >> + * __psmouse_probe() probes for a PS/2 mouse. >> + * Wrapped by psmouse_probe() for clean reset code. >> */ >> >> -static int psmouse_probe(struct psmouse *psmouse) >> +static int __psmouse_probe(struct psmouse *psmouse) >> { >> struct ps2dev *ps2dev =&psmouse->ps2dev; >> unsigned char param[2]; >> @@ -892,6 +892,28 @@ static int psmouse_probe(struct psmouse *psmouse) >> } >> >> /* >> + * Wrapper for probe routine to cleanly reset the device should >> + * the initial probe fail for any reason. >> + */ >> +static int psmouse_probe(struct psmouse *psmouse) { >> + struct ps2dev *ps2dev =&psmouse->ps2dev; >> + int tries = 3; >> + int ret = -1; >> + >> +retry: >> + if (tries> 0&& ((ret = __psmouse_probe(psmouse)) != 0)) { >> + printk(KERN_ERR "psmouse.c: Error encountered while probing PS/2 device on %s " >> + "reseting...\n", ps2dev->serio->phys); >> + psmouse_reset(psmouse); >> + msleep(500); >> + tries--; >> + goto retry; >> + } > > How does this behave if the machine does not have a psmouse on this > port? Do we still call here? If so that sounds like it might add 1.5s > to boot/resume? > > Is 500ms a number picked out of the air or does it have some basis in an > errata? It seems like a long time in the real world. > > Also what machines have this issue, what devices? Can we quirk this on > only for the machines which are broken? > > Finally, what releases is this aimed at? > >> + >> + return ret; >> +} >> + >> +/* >> * Here we set the mouse resolution. >> */ > > -apw Acked-by: Andy Whitcroft diff --git a/psmouse-base.c b/psmouse-base.c index b407b35..d79eafc 100644 --- a/psmouse-base.c +++ b/psmouse-base.c @@ -856,12 +856,12 @@ static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, return NULL; } - /* - * psmouse_probe() probes for a PS/2 mouse. + * __psmouse_probe() probes for a PS/2 mouse. + * Wrapped by psmouse_probe() for clean reset code. */ -static int psmouse_probe(struct psmouse *psmouse) +static int __psmouse_probe(struct psmouse *psmouse) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[2]; @@ -892,6 +892,23 @@ static int psmouse_probe(struct psmouse *psmouse) } /* + * Wrapper for probe routine to cleanly reset the device should + * the initial probe fail for any reason. + */ +static int psmouse_probe(struct psmouse *psmouse) { + struct ps2dev *ps2dev = &psmouse->ps2dev; + int i, ret = -1; + + for (i=0; ((ret = __psmouse_probe(psmouse)) != 0) && i < 3; i++) { + printk(KERN_ERR "psmouse.c: Error encountered while probing" + " PS/2 device on %s, reseting.\n", ps2dev->serio->phys); + psmouse_reset(psmouse); + } + + return ret; +} + +/* * Here we set the mouse resolution. */