* [patch for 2.6.29? 1/2] input: introduce a tougher i8042.reset
@ 2009-02-11 21:10 akpm
2009-02-12 0:45 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2009-02-11 21:10 UTC (permalink / raw)
To: dtor; +Cc: linux-input, akpm, arjan
From: Arjan van de Ven <arjan@linux.intel.com>
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, this patch also adds a module parameter to not treat reset
failures as fatal to the usage of the device. This prevents a touchpad
failure from also disabling the keyboard.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
Documentation/kernel-parameters.txt | 2 +
drivers/input/serio/i8042.c | 33 ++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff -puN Documentation/kernel-parameters.txt~input-introduce-a-tougher-i8042reset Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt~input-introduce-a-tougher-i8042reset
+++ a/Documentation/kernel-parameters.txt
@@ -852,6 +852,8 @@ and is between 256 and 4096 characters.
[HW] Frequency with which keyboard LEDs should blink
when kernel panics (default is 0.5 sec)
i8042.reset [HW] Reset the controller during init and cleanup
+ i8042.nonfatal [HW] Don't treat i8042.reset failures as fatal for the
+ device initialization.
i8042.unlock [HW] Unlock (ignore) the keylock
i810= [HW,DRM]
diff -puN drivers/input/serio/i8042.c~input-introduce-a-tougher-i8042reset drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c~input-introduce-a-tougher-i8042reset
+++ a/drivers/input/serio/i8042.c
@@ -47,6 +47,10 @@ static unsigned int i8042_reset;
module_param_named(reset, i8042_reset, bool, 0);
MODULE_PARM_DESC(reset, "Reset controller during init and cleanup.");
+static unsigned int i8042_nonfatal;
+module_param_named(nonfatal, i8042_nonfatal, bool, 0);
+MODULE_PARM_DESC(reset, "Treat controller test failures as non-fatal.");
+
static unsigned int i8042_direct;
module_param_named(direct, i8042_direct, bool, 0);
MODULE_PARM_DESC(direct, "Put keyboard port into non-translated mode.");
@@ -712,22 +716,33 @@ 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);
- return 0;
+ if (i8042_nonfatal)
+ return 0;
+ return -EIO;
}
/*
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch for 2.6.29? 1/2] input: introduce a tougher i8042.reset
2009-02-11 21:10 [patch for 2.6.29? 1/2] input: introduce a tougher i8042.reset akpm
@ 2009-02-12 0:45 ` Jiri Kosina
2009-02-13 8:44 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2009-02-12 0:45 UTC (permalink / raw)
To: akpm; +Cc: dtor, linux-input, arjan
On Wed, 11 Feb 2009, akpm@linux-foundation.org wrote:
> 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.
Yes, I agree we should seriously consider this a 2.6.29 material if we
want to avoid a lot of repeating bugreports in the future, as more and
more people start buying these toys.
In addition to that, I'd propose the patch below also for 2.6.29. Dmitry,
what do you think?
From: Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 1/1] psmouse/synaptics: ensure we reset the device on resume
When resuming from suspend newer Synaptics touchpads do not recover
correctly. Analysis of the resume sequence as applied in Linux was
compared to that of other operating systems. This indicated that the
other OSs were resetting the mouse before attempting to detect it (for
all Synaptics touchpads, old and new). Applying this same modification
fixes these newer Synaptics touchpads and brings the driver into line
with common OS reset behaviour.
This patch adds this reset by default providing a module option to
restore the previous non-reset behaviour:
psmouse.synaptics_resume_reset=N
Also a message is emmitted on resume hinting as to how to fix a broken
touchpad.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
drivers/input/mouse/synaptics.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d349c4a..5b01c14 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -60,11 +60,21 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
return 0;
}
+static int synaptics_resume_reset = 1;
+module_param(synaptics_resume_reset, bool, 0);
+MODULE_PARM_DESC(synaptics_resume_reset,
+ "Enable reset on resume for Synaptics");
+
int synaptics_detect(struct psmouse *psmouse, int set_properties)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4];
+ if (synaptics_resume_reset) {
+ printk(KERN_CRIT "WARNING: synaptics was reset on resume, see synaptics_resume_reset if you have trouble on resume\n");
+ psmouse_reset(psmouse);
+ }
+
param[0] = 0;
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch for 2.6.29? 1/2] input: introduce a tougher i8042.reset
2009-02-12 0:45 ` Jiri Kosina
@ 2009-02-13 8:44 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2009-02-13 8:44 UTC (permalink / raw)
To: Jiri Kosina; +Cc: akpm, linux-input, arjan
Hi Jiri, Andrew,
On Thu, Feb 12, 2009 at 01:45:15AM +0100, Jiri Kosina wrote:
> On Wed, 11 Feb 2009, akpm@linux-foundation.org wrote:
>
> > 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.
>
> Yes, I agree we should seriously consider this a 2.6.29 material if we
> want to avoid a lot of repeating bugreports in the future, as more and
> more people start buying these toys.
>
We have never reset KBC on x86 leaving BIOS deal with it so that's the
first. Is there a bug report or thread I could read a bit more about the
problem?
> In addition to that, I'd propose the patch below also for 2.6.29. Dmitry,
> what do you think?
>
No, not in the current form. We already have psmouse_reset() on resume
(and during ordinary detect). If we need it earlier that is fine but
we don't need to do it twice. The option has to go too, since we
currently are resetting the device I don't think it is needed.
>
> From: Andy Whitcroft <apw@canonical.com>
> Subject: [PATCH 1/1] psmouse/synaptics: ensure we reset the device on resume
>
> When resuming from suspend newer Synaptics touchpads do not recover
> correctly. Analysis of the resume sequence as applied in Linux was
> compared to that of other operating systems. This indicated that the
> other OSs were resetting the mouse before attempting to detect it (for
> all Synaptics touchpads, old and new). Applying this same modification
> fixes these newer Synaptics touchpads and brings the driver into line
> with common OS reset behaviour.
>
> This patch adds this reset by default providing a module option to
> restore the previous non-reset behaviour:
>
> psmouse.synaptics_resume_reset=N
>
> Also a message is emmitted on resume hinting as to how to fix a broken
> touchpad.
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
> drivers/input/mouse/synaptics.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index d349c4a..5b01c14 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -60,11 +60,21 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
> return 0;
> }
>
> +static int synaptics_resume_reset = 1;
> +module_param(synaptics_resume_reset, bool, 0);
> +MODULE_PARM_DESC(synaptics_resume_reset,
> + "Enable reset on resume for Synaptics");
> +
> int synaptics_detect(struct psmouse *psmouse, int set_properties)
> {
> struct ps2dev *ps2dev = &psmouse->ps2dev;
> unsigned char param[4];
>
> + if (synaptics_resume_reset) {
> + printk(KERN_CRIT "WARNING: synaptics was reset on resume, see synaptics_resume_reset if you have trouble on resume\n");
> + psmouse_reset(psmouse);
> + }
> +
> param[0] = 0;
>
> ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
>
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-13 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 21:10 [patch for 2.6.29? 1/2] input: introduce a tougher i8042.reset akpm
2009-02-12 0:45 ` Jiri Kosina
2009-02-13 8:44 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).