From patchwork Mon Nov 2 07:47:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 56942 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 nA27mFY1011574 for ; Mon, 2 Nov 2009 07:48:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753999AbZKBHrm (ORCPT ); Mon, 2 Nov 2009 02:47:42 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754006AbZKBHrl (ORCPT ); Mon, 2 Nov 2009 02:47:41 -0500 Received: from mail-px0-f179.google.com ([209.85.216.179]:47951 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753999AbZKBHrj (ORCPT ); Mon, 2 Nov 2009 02:47:39 -0500 Received: by pxi9 with SMTP id 9so3024107pxi.4 for ; Sun, 01 Nov 2009 23:47:43 -0800 (PST) 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=kWpTs5bXCxLb6qiZsgXjrFbGDga7Ru8WM/ksa24sJPI=; b=UFE3Shg7ta+epSEDSC8ijWVwcvTmXUQa3z4jwEv2iE7sfiKkzpyXKBxZ8CyUV8+m56 LT83ueUXo7+ik8MJDacNmlCD05Z6QHSIk3pSGWNGlmE1ttmRUWEmNxeSL/FtcPR5t2h9 1PRnVh52ft9Zazhh9D//TyPI6AS7PhrHiP5s8= 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=TSKTm6UAhEvpUvFz8yXoDvYz0wexM1AM985R9qyURbeVKigW/k/yJ6cqDaOGgCGmsH uHmXpvTK3senFZfNBFv5YKbWVzu581v/ArEWTMLXIrYjZAK3yrmmL9OwsIyj3U0qwphK 9YH/CuaGoAyj8AB15yt0wJNZve0peEUH3A4sk= Received: by 10.114.186.32 with SMTP id j32mr7627816waf.165.1257148063652; Sun, 01 Nov 2009 23:47:43 -0800 (PST) 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 23sm1246309pxi.9.2009.11.01.23.47.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 01 Nov 2009 23:47:41 -0800 (PST) Date: Sun, 1 Nov 2009 23:47:37 -0800 From: Dmitry Torokhov To: Dave Young Cc: Vojtech Pavlik , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown Subject: Re: [PATCH][RFC] input: remove bios I8042_CTR_XLATE check to make keyboard usable Message-ID: <20091102074737.GA3063@core.coreip.homeip.net> References: <20091027053404.GA2241@darkstar.vlan7> <20091028054309.GA2368@core.coreip.homeip.net> <20091028100318.GA4861@suse.cz> <20091028104211.GA2207@darkstar.vlan7> <20091029003325.GA2739@darkstar.vlan7> <20091029032633.GA7959@core.coreip.homeip.net> <20091029071544.GA2220@darkstar.vlan7> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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/serio/i8042.c b/drivers/input/serio/i8042.c index a315781..43f2b19 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -836,17 +836,32 @@ static int i8042_controller_selftest(void) static int i8042_controller_init(void) { unsigned long flags; + int n = 0; + unsigned char ctr[2]; /* - * Save the CTR for restoral on unload / reboot. + * Save the CTR for restore on unload / reboot. */ - if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) { - printk(KERN_ERR "i8042.c: Can't read CTR while initializing i8042.\n"); - return -EIO; - } + do { + if (n >= 10) { + printk(KERN_ERR + "i8042.c: Unable to get stable CTR read.\n"); + return -EIO; + } + + if (n != 0) + udelay(50); + + if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) { + printk(KERN_ERR + "i8042.c: Can't read CTR while initializing i8042.\n"); + return -EIO; + } - i8042_initial_ctr = i8042_ctr; + } while (n < 2 || ctr[0] != ctr[1]); + + i8042_initial_ctr = i8042_ctr = ctr[0]; /* * Disable the keyboard interface and interrupt. @@ -895,6 +910,12 @@ static int i8042_controller_init(void) return -EIO; } +/* + * Flush whatever accumulated while we were disabling keyboard port + */ + + i8042_flush(); + return 0; } @@ -914,7 +935,7 @@ 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)) + if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n"); /*