From patchwork Tue Oct 13 03:24:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 53293 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9D3Wx7f007645 for ; Tue, 13 Oct 2009 03:32:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758884AbZJMDZb (ORCPT ); Mon, 12 Oct 2009 23:25:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758882AbZJMDZb (ORCPT ); Mon, 12 Oct 2009 23:25:31 -0400 Received: from ey-out-2122.google.com ([74.125.78.26]:2461 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758868AbZJMDZ3 (ORCPT ); Mon, 12 Oct 2009 23:25:29 -0400 Received: by ey-out-2122.google.com with SMTP id 4so2048796eyf.19 for ; Mon, 12 Oct 2009 20:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=LTjpl/MmaM8TZ2V+01GQRbBQ0v2hc0LKoysbsKWxJqI=; b=RyXb7KnxgNfvaSV5zKp8ViPrgbTt2h1rTJf+1vzmSDCGRRpy4UGIDi8UUDyHRYkH5n VHQMeYKCMWSzeQas+9+GZN/fOTbFoxuA+4WOiQ4zZONI7jRhTuCf6kOp1EFPygMfFLb4 bBMVcBaQJAGlRPfhIcncd6xEsRvnK4/qX2ikA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=adOV2KQtVFplIvddiGB4kTl9+5jW7PWtqMTMQ9EgQJN3d7ctD3yzys7PpnknXEfy34 2SyJVEtsQONEzrdyKJ7t5K4yonNcIpRquW6EiZ8C36FwBXiKxq0EhzMq5woIrKrYuf4t Liw6YSZpODxoQIBA0CXpY9gLdjBUiSRmYoYOk= Received: by 10.216.89.141 with SMTP id c13mr2198819wef.66.1255404262179; Mon, 12 Oct 2009 20:24:22 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137]) by mx.google.com with ESMTPS id i34sm1602612gve.8.2009.10.12.20.24.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 12 Oct 2009 20:24:20 -0700 (PDT) Date: Mon, 12 Oct 2009 20:24:14 -0700 From: Dmitry Torokhov To: "Carlos R. Mafra" Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , linux-input@vger.kernel.org Subject: Re: [bisected regression] Touchpad "paste" stops working after suspend to RAM Message-ID: <20091013032414.GC2887@core.coreip.homeip.net> References: <20091011162155.GA4260@Pilar.aei.mpg.de> <20091011180134.GA5197@core.coreip.homeip.net> <20091011193100.GA4410@Pilar.aei.mpg.de> <20091012090224.GB7403@core.coreip.homeip.net> <20091012100929.GA4402@Pilar.aei.mpg.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091012100929.GA4402@Pilar.aei.mpg.de> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 690aed9..52ad50f 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -395,8 +395,19 @@ int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command) int psmouse_reset(struct psmouse *psmouse) { unsigned char param[2]; + int error; + + error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_RESET_BAT); + if (error == -EAGAIN) { + /* + * Controller requested us to resend the command. + */ + msleep(100); + error = ps2_command(&psmouse->ps2dev, + param, PSMOUSE_CMD_RESET_BAT); + } - if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_RESET_BAT)) + if (error) return -1; if (param[0] != PSMOUSE_RET_BAT && param[1] != PSMOUSE_RET_ID) diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index f3876ac..5201b0c 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c @@ -39,7 +39,7 @@ MODULE_LICENSE("GPL"); int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout) { serio_pause_rx(ps2dev->serio); - ps2dev->nak = 1; + ps2dev->nak = ETIME; ps2dev->flags |= PS2_FLAG_ACK; serio_continue_rx(ps2dev->serio); @@ -187,17 +187,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) int timeout; int send = (command >> 12) & 0xf; int receive = (command >> 8) & 0xf; - int rc = -1; + int rc; int i; if (receive > sizeof(ps2dev->cmdbuf)) { WARN_ON(1); - return -1; + return -EINVAL; } if (send && !param) { WARN_ON(1); - return -1; + return -EINVAL; } serio_pause_rx(ps2dev->serio); @@ -213,13 +213,16 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) * ACKing the reset command, and so it can take a long * time before the ACK arrrives. */ - if (ps2_sendbyte(ps2dev, command & 0xff, - command == PS2_CMD_RESET_BAT ? 1000 : 200)) + rc = ps2_sendbyte(ps2dev, command & 0xff, + command == PS2_CMD_RESET_BAT ? 1000 : 200); + if (rc) goto out; - for (i = 0; i < send; i++) - if (ps2_sendbyte(ps2dev, param[i], 200)) + for (i = 0; i < send; i++) { + rc = ps2_sendbyte(ps2dev, param[i], 200); + if (rc) goto out; + } /* * The reset command takes a long time to execute. @@ -240,10 +243,10 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) for (i = 0; i < receive; i++) param[i] = ps2dev->cmdbuf[(receive - 1) - i]; - if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) + if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) { + rc = ETIME; goto out; - - rc = 0; + } out: serio_pause_rx(ps2dev->serio); @@ -293,13 +296,13 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data) case PS2_RET_NAK: ps2dev->flags |= PS2_FLAG_NAK; - ps2dev->nak = PS2_RET_NAK; + ps2dev->nak = EAGAIN; break; case PS2_RET_ERR: if (ps2dev->flags & PS2_FLAG_NAK) { ps2dev->flags &= ~PS2_FLAG_NAK; - ps2dev->nak = PS2_RET_ERR; + ps2dev->nak = EIO; break; } @@ -365,7 +368,7 @@ EXPORT_SYMBOL(ps2_handle_response); void ps2_cmd_aborted(struct ps2dev *ps2dev) { if (ps2dev->flags & PS2_FLAG_ACK) - ps2dev->nak = 1; + ps2dev->nak = EIO; if (ps2dev->flags & (PS2_FLAG_ACK | PS2_FLAG_CMD)) wake_up(&ps2dev->wait);