linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
       [not found] <XQFu.15s.3@gated-at.bofh.it>
@ 2003-12-04 22:46 ` Karol Kozimor
  2003-12-05  4:27   ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Karol Kozimor @ 2003-12-04 22:46 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel

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 'sziwan' Kozimor
sziwan@hell.org.pl

[...]
mice: PS/2 mouse device common for all mice
i8042.c: Detected active multiplexing controller, rev 1.1.
serio: i8042 AUX0 port at 0x60,0x64 irq 12
serio: i8042 AUX1 port at 0x60,0x64 irq 12
serio: i8042 AUX2 port at 0x60,0x64 irq 12
serio: i8042 AUX3 port at 0x60,0x64 irq 12
Synaptics Touchpad, model: 1
 Firmware: 4.6
 180 degree mounted touchpad
 Sensor: 18
 new absolute packet format
 Touchpad has extended capability bits
 -> four buttons
 -> multifinger detection
 -> palm detection
input: SynPS/2 Synaptics TouchPad on isa0060/serio4
serio: i8042 KBD port at 0x60,0x64 irq 1
input: AT Translated Set 2 keyboard on isa0060/serio0
[...]
 hwsleep-0257 [28] acpi_enter_sleep_state: Entering sleep state [S3]
[...]
Restarting tasks...<6>input: AT Translated Set 2 keyboard on isa0060/serio0 (reconnected)
 done


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2003-12-05  4:27 UTC (permalink / raw)
  To: Karol Kozimor; +Cc: linux-kernel

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(&param, 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"),


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
  2003-12-01  7:15 Dmitry Torokhov
  2003-12-01 17:15 ` Pavel Machek
@ 2003-12-02 10:40 ` Thomas Weidner
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Weidner @ 2003-12-02 10:40 UTC (permalink / raw)
  To: linux-kernel

"Dmitry Torokhov" <dtor_core@ameritech.net> schrieb im Newsbeitrag
news:200312010215.58533.dtor_core@ameritech.net...
> Hi,
>
> 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.
>

I haven't looked at the patches,but after i applied all to the kernel, my
ps/2 keyboard works again correctly.
it was broken in -test11,that i need to unplug it and then plug it again in
to make it work,after booting.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
  2003-12-01  7:15 Dmitry Torokhov
@ 2003-12-01 17:15 ` Pavel Machek
  2003-12-02 10:40 ` Thomas Weidner
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2003-12-01 17:15 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, Vojtech Pavlik

Hi!

> 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.

It looks very reasonable to me... I'd like it to be in 2.6.1... or
even better 2.6.0.
								Pavel

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC/PATCH 1/3] Input: resume support for i8042 (atkbd & psmouse)
@ 2003-12-01  7:15 Dmitry Torokhov
  2003-12-01 17:15 ` Pavel Machek
  2003-12-02 10:40 ` Thomas Weidner
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2003-12-01  7:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pavel Machek, Vojtech Pavlik

Hi,

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.

Dmitry 

===================================================================


ChangeSet@1.1514, 2003-12-01 01:41:05-05:00, dtor_core@ameritech.net
  Input: add i8042 to sysfs, implement resume methods using
         serio_reconnect facility


 i8042.c |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 81 insertions(+), 9 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c	Mon Dec  1 01:45:25 2003
+++ b/drivers/input/serio/i8042.c	Mon Dec  1 01:45:25 2003
@@ -17,6 +17,7 @@
 #include <linux/config.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/sysdev.h>
 #include <linux/serio.h>
 
 #include <asm/io.h>
@@ -61,6 +62,8 @@
 static unsigned char i8042_mux_open;
 struct timer_list i8042_timer;
 
+static int i8042_sysdev_initialized;
+
 /*
  * Shared IRQ's require a device pointer, but this driver doesn't support
  * multiple devices
@@ -214,16 +217,35 @@
 }
 
 /*
- * i8042_open() is called when a port is open by the higher layer.
- * It allocates the interrupt and enables it in the chip.
+ * i8042_activate_port() enables port on a chip.
  */
 
-static int i8042_open(struct serio *port)
+static int i8042_activate_port(struct serio *port)
 {
 	struct i8042_values *values = port->driver;
 
 	i8042_flush();
 
+	i8042_ctr |= values->irqen;
+
+	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+		i8042_ctr &= ~values->irqen;
+		return -1;
+	}
+
+	return 0;
+}
+
+
+/*
+ * i8042_open() is called when a port is open by the higher layer.
+ * It allocates the interrupt and calls i8042_enable_port.
+ */
+
+static int i8042_open(struct serio *port)
+{
+	struct i8042_values *values = port->driver;
+
 	if (values->mux != -1)
 		if (i8042_mux_open++)
 			return 0;
@@ -234,10 +256,8 @@
 		goto irq_fail;
 	}
 
-	i8042_ctr |= values->irqen;
-
-	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
-		printk(KERN_ERR "i8042.c: Can't write CTR while opening %s, unregistering the port\n", values->name);
+	if (i8042_activate_port(port)) {
+		printk(KERN_ERR "i8042.c: Can't activate %s, unregistering the port\n", values->name);
 		goto ctr_fail;
 	}
 
@@ -246,7 +266,6 @@
 	return 0;
 
 ctr_fail:
-	i8042_ctr &= ~values->irqen;
 	free_irq(values->irq, i8042_request_irq_cookie);
 
 irq_fail:
@@ -406,7 +425,7 @@
  * desired.
  */
 	
-static int __init i8042_controller_init(void)
+static int i8042_controller_init(void)
 {
 
 /*
@@ -541,6 +560,37 @@
 }
 
 /*
+ * 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.
+ */
+
+	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.
@@ -791,6 +841,16 @@
 	values->mux = index;
 }
 
+static struct sysdev_class kbc_sysclass = {
+       set_kset_name("i8042"),
+       .resume = i8042_controller_resume,
+};
+
+static struct sys_device device_i8042 = {
+       .id     = 0,
+       .cls    = &kbc_sysclass,
+};
+
 int __init i8042_init(void)
 {
 	int i;
@@ -825,6 +885,13 @@
 	i8042_timer.function = i8042_timer_func;
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
+        if (sysdev_class_register(&kbc_sysclass) == 0) {
+                if (sys_device_register(&device_i8042) == 0)
+			i8042_sysdev_initialized = 1;
+		else
+			sysdev_class_unregister(&kbc_sysclass);
+        }
+
 	register_reboot_notifier(&i8042_notifier);
 
 	return 0;
@@ -835,6 +902,11 @@
 	int i;
 
 	unregister_reboot_notifier(&i8042_notifier);
+
+	if (i8042_sysdev_initialized) {
+		sys_device_unregister(&device_i8042);
+		sysdev_class_unregister(&kbc_sysclass);
+	}
 
 	del_timer(&i8042_timer);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-12-05  4:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2003-12-01  7:15 Dmitry Torokhov
2003-12-01 17:15 ` Pavel Machek
2003-12-02 10:40 ` Thomas Weidner

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).