]> code.ossystems Code Review - openembedded-core.git/blob
1ae8257203424923c51465e41d61e3fd33f24c4d
[openembedded-core.git] /
1 From 2c5ccde448ae5f4062802bcd6002f856acbd268f Mon Sep 17 00:00:00 2001
2 From: Arjan van de Ven <arjan@linux.intel.com>
3 Date: Tue, 3 Feb 2009 16:26:16 -0800
4 Subject: [PATCH] input: introduce a tougher i8042.reset
5
6 Some bad touchpads don't reset right the first time (MSI Wind U-100 for
7 example). This patch will retry the reset up to 5 times.
8
9 In addition, this patch also adds a module parameter to not treat
10 reset failures as fatal to the usage of the device. This prevents
11 a touchpad failure from also disabling the keyboard....
12
13 Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
14 ---
15  Documentation/kernel-parameters.txt |    2 ++
16  drivers/input/serio/i8042.c         |   33 ++++++++++++++++++++++++---------
17  2 files changed, 26 insertions(+), 9 deletions(-)
18
19 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
20 index ac613a6..a43e3bd 100644
21 --- a/Documentation/kernel-parameters.txt
22 +++ b/Documentation/kernel-parameters.txt
23 @@ -855,6 +855,8 @@ and is between 256 and 4096 characters. It is defined in the file
24                         [HW] Frequency with which keyboard LEDs should blink
25                              when kernel panics (default is 0.5 sec)
26         i8042.reset     [HW] Reset the controller during init and cleanup
27 +       i8042.nonfatal  [HW] Don't treat i8042.reset failures as fatal for the
28 +                            device initialization.
29         i8042.unlock    [HW] Unlock (ignore) the keylock
30  
31         i810=           [HW,DRM]
32 diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
33 index 170f71e..2473a9a 100644
34 --- a/drivers/input/serio/i8042.c
35 +++ b/drivers/input/serio/i8042.c
36 @@ -47,6 +47,10 @@ static unsigned int i8042_reset;
37  module_param_named(reset, i8042_reset, bool, 0);
38  MODULE_PARM_DESC(reset, "Reset controller during init and cleanup.");
39  
40 +static unsigned int i8042_nonfatal;
41 +module_param_named(nonfatal, i8042_nonfatal, bool, 0);
42 +MODULE_PARM_DESC(reset, "Treat controller test failures as non-fatal.");
43 +
44  static unsigned int i8042_direct;
45  module_param_named(direct, i8042_direct, bool, 0);
46  MODULE_PARM_DESC(direct, "Put keyboard port into non-translated mode.");
47 @@ -712,22 +716,33 @@ static int i8042_controller_check(void)
48  static int i8042_controller_selftest(void)
49  {
50         unsigned char param;
51 +       int i = 0;
52  
53         if (!i8042_reset)
54                 return 0;
55  
56 -       if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
57 -               printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
58 -               return -ENODEV;
59 -       }
60 +       /*
61 +        * We try this 5 times; on some really fragile systems this does not
62 +        * take the first time...
63 +        */
64 +       do {
65 +
66 +               if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
67 +                       printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
68 +                       return -ENODEV;
69 +               }
70 +
71 +               if (param == I8042_RET_CTL_TEST)
72 +                       return 0;
73  
74 -       if (param != I8042_RET_CTL_TEST) {
75                 printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n",
76 -                        param, I8042_RET_CTL_TEST);
77 -               return -EIO;
78 -       }
79 +                       param, I8042_RET_CTL_TEST);
80 +               msleep(50);
81 +       } while (i++ < 5);
82  
83 -       return 0;
84 +       if (i8042_nonfatal)
85 +               return 0;
86 +       return -EIO;
87  }
88  
89  /*
90 -- 
91 1.6.0.6
92