[PATCH] Add resume support to serio bus.

From: Dmitry Torokhov
Date: Sun Feb 06 2005 - 02:50:08 EST


Hi,

This patch adds resume support to serio_bus based on serio reconnect
framework so now not only i8042 ports will be re-initialized at resume.
It also removes serio_reconnect calls from i8042 as they no longer
needed.

Tested on S4 (swsusp) with Synaptics touchpad.

--
Dmitry


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


ChangeSet@xxxxxx, 2005-02-06 02:39:30-05:00, dtor_core@xxxxxxxxxxxxx
Input: add resume method to serio bus so ports are properly
set up at resume time. Remove calls to serio_reconnect
from i8042 as they should now be reconnected in course
of regular resume process.

Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>


i8042.c | 8 ++++----
serio.c | 17 +++++++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)


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



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c 2005-02-06 02:40:01 -05:00
+++ b/drivers/input/serio/i8042.c 2005-02-06 02:40:01 -05:00
@@ -899,7 +899,7 @@
* Here we try to restore the original BIOS settings
*/

-static int i8042_suspend(struct device *dev, u32 state, u32 level)
+static int i8042_suspend(struct device *dev, pm_message_t state, u32 level)
{
if (level == SUSPEND_DISABLE) {
del_timer_sync(&i8042_timer);
@@ -932,12 +932,12 @@
}

/*
- * Reconnect anything that was connected to the ports.
+ * Activate all ports.
*/

for (i = 0; i < I8042_NUM_PORTS; i++)
- if (i8042_activate_port(&i8042_ports[i]) == 0)
- serio_reconnect(i8042_ports[i].serio);
+ i8042_activate_port(&i8042_ports[i]);
+
/*
* Restart timer (for polling "stuck" data)
*/
diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c 2005-02-06 02:40:01 -05:00
+++ b/drivers/input/serio/serio.c 2005-02-06 02:40:01 -05:00
@@ -774,6 +774,22 @@

#endif /* CONFIG_HOTPLUG */

+static int serio_resume(struct device *dev)
+{
+ struct serio *serio = to_serio_port(dev);
+
+ if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) {
+ serio_disconnect_port(serio);
+ /*
+ * Driver re-probing can take a while, so better let kseriod
+ * deal with it.
+ */
+ serio_rescan(serio);
+ }
+
+ return 0;
+}
+
/* called from serio_driver->connect/disconnect methods under serio_sem */
int serio_open(struct serio *serio, struct serio_driver *drv)
{
@@ -826,6 +842,7 @@
serio_bus.drv_attrs = serio_driver_attrs;
serio_bus.match = serio_bus_match;
serio_bus.hotplug = serio_hotplug;
+ serio_bus.resume = serio_resume;
bus_register(&serio_bus);

return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/