From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Karol Kozimor <sziwan@hell.org.pl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
Date: Thu, 4 Dec 2003 23:27:06 -0500 [thread overview]
Message-ID: <200312042327.06645.dtor_core@ameritech.net> (raw)
In-Reply-To: <20031204224643.GA23592@hell.org.pl>
On Thursday 04 December 2003 05:46 pm, Karol Kozimor wrote:
> Thus wrote Dmitry Torokhov:
> > Here is an attempt to implement resume for i8042 using
> > serio_reconnect facility that can be found in -mm kernels. It also
> > depends on bunch of other changes in input subsystem all of which can
> > be found here: http://www.geocities.com/dt_or/input
> >
> > They should apply cleanly to -test11.
>
> Your patches seem to work fine for my keyboard -- it reconnects and
> works smoothly (the interrupts are fine). My Synaptics touchpad is
> however not present after resume -- no response and no mention of i8042
> in /proc/interrupts after S3 resume. I attach a dmesg excerpt in hope
> that helps you in any way. Thanks for the good work!
Karol,
I realized that I was not switching from the Legacy to Multiplexed mode
and that could (or even should I might say) cause dead mouse. I have
passive multiplexor so the old code worked for me.
Could you please try this patch (on top of everything else). It complies
but I have not booted with it.
Thank you,
Dmitry
===== drivers/input/serio/i8042.c 1.35 vs edited =====
--- 1.35/drivers/input/serio/i8042.c Wed Dec 3 02:52:13 2003
+++ edited/drivers/input/serio/i8042.c Thu Dec 4 23:17:26 2003
@@ -60,6 +60,7 @@
static unsigned char i8042_initial_ctr;
static unsigned char i8042_ctr;
static unsigned char i8042_mux_open;
+static unsigned char i8042_mux_present;
struct timer_list i8042_timer;
static int i8042_sysdev_initialized;
@@ -565,58 +566,16 @@
}
-/*
- * Here we try to reset everything back to a state in which suspended
- */
-
-static int i8042_controller_resume(struct sys_device *dev)
-{
- int i;
-
- if (i8042_controller_init()) {
- printk(KERN_ERR "i8042: resume failed\n");
- return -1;
- }
/*
- * Reconnect anything that was connected to the ports.
+ * i8042_enable_mux_mode checks whether the controller has an active
+ * multiplexor and puts the chip into Multiplexed (as opposed to
+ * Legacy) mode.
*/
-
- if (i8042_kbd_values.exists && i8042_activate_port(&i8042_kbd_port) == 0)
- serio_reconnect(&i8042_kbd_port);
-
- if (i8042_aux_values.exists && i8042_activate_port(&i8042_aux_port) == 0)
- serio_reconnect(&i8042_aux_port);
-
- for (i = 0; i < 4; i++)
- if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port + i) == 0)
- serio_reconnect(i8042_mux_port + i);
-
- return 0;
-}
-
-
-/*
- * i8042_check_mux() checks whether the controller supports the PS/2 Active
- * Multiplexing specification by Synaptics, Phoenix, Insyde and
- * LCS/Telegraphics.
- */
-
-static int __init i8042_check_mux(struct i8042_values *values)
+static int i8042_enable_mux_mode(struct i8042_values *values)
{
- unsigned char param;
- static int i8042_check_mux_cookie;
- int i;
-
-/*
- * Check if AUX irq is available.
- */
-
- if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ,
- "i8042", &i8042_check_mux_cookie))
- return -1;
- free_irq(values->irq, &i8042_check_mux_cookie);
+ unsigned char param;
/*
* Get rid of bytes in the queue.
*/
@@ -639,9 +598,14 @@
if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b)
return -1;
- printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n",
- (~param >> 4) & 0xf, ~param & 0xf);
+ return ~param;
+}
+
+static int i8042_activate_mux(struct i8042_values *values)
+{
+ unsigned char param;
+ int i;
/*
* Disable all muxed ports by disabling AUX.
*/
@@ -649,8 +613,10 @@
i8042_ctr |= I8042_CTR_AUXDIS;
i8042_ctr &= ~I8042_CTR_AUXINT;
- if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
+ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+ printk(KERN_ERR "i8042.c: Failed to disable AUX port, can't use MUX.\n");
return -1;
+ }
/*
* Enable all muxed ports.
@@ -664,6 +630,40 @@
return 0;
}
+
+/*
+ * i8042_check_mux() checks whether the controller supports the PS/2 Active
+ * Multiplexing specification by Synaptics, Phoenix, Insyde and
+ * LCS/Telegraphics.
+ */
+
+static int __init i8042_check_mux(struct i8042_values *values)
+{
+ static int i8042_check_mux_cookie;
+ int mux_version;
+
+/*
+ * Check if AUX irq is available.
+ */
+ if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ,
+ "i8042", &i8042_check_mux_cookie))
+ return -1;
+ free_irq(values->irq, &i8042_check_mux_cookie);
+
+ if ((mux_version = i8042_enable_mux_mode(values)) < 0)
+ return 0;
+
+ printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n",
+ (mux_version >> 4) & 0xf, mux_version & 0xf);
+
+ if (i8042_activate_mux(values))
+ return -1;
+
+ i8042_mux_present = 1;
+ return 0;
+}
+
+
/*
* i8042_check_aux() applies as much paranoia as it can at detecting
* the presence of an AUX interface.
@@ -846,6 +846,41 @@
values->name = i8042_mux_short[index];
values->mux = index;
}
+
+/*
+ * Here we try to reset everything back to a state in which suspended
+ */
+static int i8042_controller_resume(struct sys_device *dev)
+{
+ int i;
+
+ if (i8042_controller_init()) {
+ printk(KERN_ERR "i8042: resume failed\n");
+ return -1;
+ }
+
+ if (i8042_mux_present &&
+ (i8042_enable_mux_mode(&i8042_aux_values) < 0 || i8042_activate_mux(&i8042_aux_values))) {
+ printk(KERN_WARNING "i8042: failed to resume active multiplexor, mouse won't wotk.\n");
+ }
+
+/*
+ * Reconnect anything that was connected to the ports.
+ */
+
+ if (i8042_kbd_values.exists && i8042_activate_port(&i8042_kbd_port) == 0)
+ serio_reconnect(&i8042_kbd_port);
+
+ if (i8042_aux_values.exists && i8042_activate_port(&i8042_aux_port) == 0)
+ serio_reconnect(&i8042_aux_port);
+
+ for (i = 0; i < 4; i++)
+ if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port + i) == 0)
+ serio_reconnect(i8042_mux_port + i);
+
+ return 0;
+}
+
static struct sysdev_class kbc_sysclass = {
set_kset_name("i8042"),
next prev parent reply other threads:[~2003-12-05 4:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <XQFu.15s.3@gated-at.bofh.it>
2003-12-04 22:46 ` [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse) Karol Kozimor
2003-12-05 4:27 ` Dmitry Torokhov [this message]
2003-12-01 7:15 Dmitry Torokhov
2003-12-01 17:15 ` Pavel Machek
2003-12-02 10:40 ` Thomas Weidner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200312042327.06645.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sziwan@hell.org.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.