diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2009-04-09 11:36:50 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-04-11 17:09:12 -0700 |
commit | 5ea2fc6491631d2c3f346dcb0d9d6edd44ccf4cd (patch) | |
tree | f4ffb679ac763a312efb912d195e8ebc56e7d87b /drivers/input | |
parent | 59cc1dd97ca9ac0363ef2f770901fbd86e2b970a (diff) | |
download | linux-3.10-5ea2fc6491631d2c3f346dcb0d9d6edd44ccf4cd.tar.gz linux-3.10-5ea2fc6491631d2c3f346dcb0d9d6edd44ccf4cd.tar.bz2 linux-3.10-5ea2fc6491631d2c3f346dcb0d9d6edd44ccf4cd.zip |
Input: i8042 - introduce a tougher reset
Some touchpads don't reset right the first time (MSI Wind U-100 for
example). This patch will retry the reset up to 5 times.
In addition, on x86, we don't fail entire i8042 initialization if
controller reset fails in hope that keyboard port will still be
functional and user will still get a working keyboard. This is
especially important on netbooks.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/serio/i8042.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 170f71ee577..3cffb704e37 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -712,22 +712,43 @@ static int i8042_controller_check(void) static int i8042_controller_selftest(void) { unsigned char param; + int i = 0; if (!i8042_reset) return 0; - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { - printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); - return -ENODEV; - } + /* + * We try this 5 times; on some really fragile systems this does not + * take the first time... + */ + do { + + if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { + printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); + return -ENODEV; + } + + if (param == I8042_RET_CTL_TEST) + return 0; - if (param != I8042_RET_CTL_TEST) { printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", - param, I8042_RET_CTL_TEST); - return -EIO; - } + param, I8042_RET_CTL_TEST); + msleep(50); + } while (i++ < 5); +#ifdef CONFIG_X86 + /* + * On x86, we don't fail entire i8042 initialization if controller + * reset fails in hopes that keyboard port will still be functional + * and user will still get a working keyboard. This is especially + * important on netbooks. On other arches we trust hardware more. + */ + printk(KERN_INFO + "i8042: giving up on controller selftest, continuing anyway...\n"); return 0; +#else + return -EIO; +#endif } /* |