From patchwork Wed Sep 8 07:56:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Lacoste X-Patchwork-Id: 64119 X-Patchwork-Delegate: leann.ogasawara@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 1BB58B6EFF for ; Wed, 8 Sep 2010 18:45:55 +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 1OtGHn-0001rm-UH; Wed, 08 Sep 2010 09:45:43 +0100 Received: from mail-iw0-f177.google.com ([209.85.214.177]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OtFVz-0000qs-Qw for kernel-team@lists.ubuntu.com; Wed, 08 Sep 2010 08:56:20 +0100 Received: by iwn40 with SMTP id 40so7352248iwn.8 for ; Wed, 08 Sep 2010 00:56:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.190.149 with SMTP id di21mr9407044ibb.166.1283932578048; Wed, 08 Sep 2010 00:56:18 -0700 (PDT) Received: by 10.231.190.195 with HTTP; Wed, 8 Sep 2010 00:56:17 -0700 (PDT) Date: Wed, 8 Sep 2010 09:56:17 +0200 Message-ID: Subject: [Maverick] [pull request] Input: i8042 - reset keyboard controller wehen resuming from S2R From: Jerome Lacoste To: kernel-team@lists.ubuntu.com X-Mailman-Approved-At: Wed, 08 Sep 2010 09:45:42 +0100 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 This patches fixes: BugLink: http://bugs.launchpad.net/bugs/86820 (cherry-pick from commit 1ca56e513a9fd356d5a9e0de45dbe0e189e00386 inux/kernel/git/torvalds/linux-2.6.git) (upstream patch in 2.6.36, tested and backported on 2.6.32's Lucid for a month. Patches applies cleanly on 2.6.35-20.29) ------------------------------------------------------------------- From 1ca56e513a9fd356d5a9e0de45dbe0e189e00386 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 20 Jul 2010 20:25:34 -0700 Subject: [PATCH] Input: i8042 - reset keyboard controller wehen resuming from S2R Some laptops, such as Lenovo 3000 N100, require keyboard controller reset in order to have touchpad operable after suspend to RAM. Even if box does not need the reset it should be safe to do so, so instead of chasing after misbehaving boxes and grow DMI tables, let's reset the controller unconditionally. Reported-and-tested-by: Jerome Lacoste Signed-off-by: Dmitry Torokhov --- drivers/input/serio/i8042.c | 65 +++++++++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 24 deletions(-) if (error) diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 6440a8f..258b98b 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -861,9 +861,6 @@ static int i8042_controller_selftest(void) unsigned char param; int i = 0; - if (!i8042_reset) - return 0; - /* * We try this 5 times; on some really fragile systems this does not * take the first time... @@ -1020,7 +1017,8 @@ static void i8042_controller_reset(void) * Reset the controller if requested. */ - i8042_controller_selftest(); + if (i8042_reset) + i8042_controller_selftest(); /* * Restore the original control register setting. @@ -1094,23 +1092,11 @@ static void i8042_dritek_enable(void) #ifdef CONFIG_PM /* - * Here we try to restore the original BIOS settings to avoid - * upsetting it. - */ - -static int i8042_pm_reset(struct device *dev) -{ - i8042_controller_reset(); - - return 0; -} - -/* * Here we try to reset everything back to a state we had * before suspending. */ -static int i8042_pm_restore(struct device *dev) +static int i8042_controller_resume(bool force_reset) { int error; @@ -1118,9 +1104,11 @@ static int i8042_pm_restore(struct device *dev) if (error) return error; - error = i8042_controller_selftest(); - if (error) - return error; + if (i8042_reset || force_reset) { + error = i8042_controller_selftest(); + if (error) + return error; + } /* * Restore original CTR value and disable all ports @@ -1162,6 +1150,28 @@ static int i8042_pm_restore(struct device *dev) return 0; } +/* + * Here we try to restore the original BIOS settings to avoid + * upsetting it. + */ + +static int i8042_pm_reset(struct device *dev) +{ + i8042_controller_reset(); + + return 0; +} + +static int i8042_pm_resume(struct device *dev) +{ + /* + * On resume from S2R we always try to reset the controller + * to bring it in a sane state. (In case of S2D we expect + * BIOS to reset the controller for us.) + */ + return i8042_controller_resume(true); +} + static int i8042_pm_thaw(struct device *dev) { i8042_interrupt(0, NULL); @@ -1169,9 +1179,14 @@ static int i8042_pm_thaw(struct device *dev) return 0; } +static int i8042_pm_restore(struct device *dev) +{ + return i8042_controller_resume(false); +} + static const struct dev_pm_ops i8042_pm_ops = { .suspend = i8042_pm_reset, - .resume = i8042_pm_restore, + .resume = i8042_pm_resume, .thaw = i8042_pm_thaw, .poweroff = i8042_pm_reset, .restore = i8042_pm_restore, @@ -1389,9 +1404,11 @@ static int __init i8042_probe(struct platform_device *dev) i8042_platform_device = dev; - error = i8042_controller_selftest(); - if (error) - return error; + if (i8042_reset) { + error = i8042_controller_selftest(); + if (error) + return error; + } error = i8042_controller_init();