aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c17
-rw-r--r--drivers/input/joystick/amijoy.c2
-rw-r--r--drivers/input/joystick/analog.c2
-rw-r--r--drivers/input/joystick/db9.c4
-rw-r--r--drivers/input/joystick/gamecon.c6
-rw-r--r--drivers/input/joystick/turbografx.c4
-rw-r--r--drivers/input/keyboard/Kconfig6
-rw-r--r--drivers/input/keyboard/atkbd.c4
-rw-r--r--drivers/input/keyboard/gpio_keys.c15
-rw-r--r--drivers/input/keyboard/hilkbd.c2
-rw-r--r--drivers/input/mouse/inport.c2
-rw-r--r--drivers/input/mouse/logibm.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c34
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/input/mouse/synaptics.c1
-rw-r--r--drivers/input/serio/i8042.c63
-rw-r--r--drivers/input/serio/serio.c36
17 files changed, 109 insertions, 92 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index efa1b1f75393..a9a706f8fff9 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -588,18 +588,9 @@ static inline void input_proc_exit(void) { }
588static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \ 588static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \
589{ \ 589{ \
590 struct input_dev *input_dev = to_input_dev(dev); \ 590 struct input_dev *input_dev = to_input_dev(dev); \
591 int retval; \
592 \ 591 \
593 retval = mutex_lock_interruptible(&input_dev->mutex); \ 592 return scnprintf(buf, PAGE_SIZE, "%s\n", \
594 if (retval) \ 593 input_dev->name ? input_dev->name : ""); \
595 return retval; \
596 \
597 retval = scnprintf(buf, PAGE_SIZE, \
598 "%s\n", input_dev->name ? input_dev->name : ""); \
599 \
600 mutex_unlock(&input_dev->mutex); \
601 \
602 return retval; \
603} \ 594} \
604static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL); 595static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL);
605 596
@@ -1049,10 +1040,6 @@ void input_unregister_device(struct input_dev *dev)
1049 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); 1040 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
1050 sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); 1041 sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
1051 1042
1052 mutex_lock(&dev->mutex);
1053 dev->name = dev->phys = dev->uniq = NULL;
1054 mutex_unlock(&dev->mutex);
1055
1056 class_device_unregister(&dev->cdev); 1043 class_device_unregister(&dev->cdev);
1057 1044
1058 input_wakeup_procfs_readers(); 1045 input_wakeup_procfs_readers();
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index e608691b5a61..b0f5541ec3e6 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -50,8 +50,6 @@ static int amijoy[2] = { 0, 1 };
50module_param_array_named(map, amijoy, uint, NULL, 0); 50module_param_array_named(map, amijoy, uint, NULL, 0);
51MODULE_PARM_DESC(map, "Map of attached joysticks in form of <a>,<b> (default is 0,1)"); 51MODULE_PARM_DESC(map, "Map of attached joysticks in form of <a>,<b> (default is 0,1)");
52 52
53__obsolete_setup("amijoy=");
54
55static int amijoy_used; 53static int amijoy_used;
56static DEFINE_MUTEX(amijoy_mutex); 54static DEFINE_MUTEX(amijoy_mutex);
57static struct input_dev *amijoy_dev[2]; 55static struct input_dev *amijoy_dev[2];
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 7ef68456d7d6..51f1e4bfff3e 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -58,8 +58,6 @@ static int analog_options[ANALOG_PORTS];
58module_param_array_named(map, js, charp, &js_nargs, 0); 58module_param_array_named(map, js, charp, &js_nargs, 0);
59MODULE_PARM_DESC(map, "Describes analog joysticks type/capabilities"); 59MODULE_PARM_DESC(map, "Describes analog joysticks type/capabilities");
60 60
61__obsolete_setup("js=");
62
63/* 61/*
64 * Times, feature definitions. 62 * Times, feature definitions.
65 */ 63 */
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 5080e15c6d30..b41bd2eb37dd 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -59,10 +59,6 @@ MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)");
59module_param_array_named(dev3, db9[2].args, int, &db9[2].nargs, 0); 59module_param_array_named(dev3, db9[2].args, int, &db9[2].nargs, 0);
60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)"); 60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)");
61 61
62__obsolete_setup("db9=");
63__obsolete_setup("db9_2=");
64__obsolete_setup("db9_3=");
65
66#define DB9_ARG_PARPORT 0 62#define DB9_ARG_PARPORT 0
67#define DB9_ARG_MODE 1 63#define DB9_ARG_MODE 1
68 64
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index fe12aa37393d..711e4b3e9e61 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -60,10 +60,6 @@ MODULE_PARM_DESC(map2, "Describes second set of devices");
60module_param_array_named(map3, gc[2].args, int, &gc[2].nargs, 0); 60module_param_array_named(map3, gc[2].args, int, &gc[2].nargs, 0);
61MODULE_PARM_DESC(map3, "Describes third set of devices"); 61MODULE_PARM_DESC(map3, "Describes third set of devices");
62 62
63__obsolete_setup("gc=");
64__obsolete_setup("gc_2=");
65__obsolete_setup("gc_3=");
66
67/* see also gs_psx_delay parameter in PSX support section */ 63/* see also gs_psx_delay parameter in PSX support section */
68 64
69#define GC_SNES 1 65#define GC_SNES 1
@@ -403,8 +399,6 @@ static int gc_psx_delay = GC_PSX_DELAY;
403module_param_named(psx_delay, gc_psx_delay, uint, 0); 399module_param_named(psx_delay, gc_psx_delay, uint, 0);
404MODULE_PARM_DESC(psx_delay, "Delay when accessing Sony PSX controller (usecs)"); 400MODULE_PARM_DESC(psx_delay, "Delay when accessing Sony PSX controller (usecs)");
405 401
406__obsolete_setup("gc_psx_delay=");
407
408static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; 402static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y };
409static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, 403static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y,
410 BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR }; 404 BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR };
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 5570fd5487c7..037d3487fcc7 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -60,10 +60,6 @@ MODULE_PARM_DESC(map2, "Describes second set of devices");
60module_param_array_named(map3, tgfx[2].args, int, &tgfx[2].nargs, 0); 60module_param_array_named(map3, tgfx[2].args, int, &tgfx[2].nargs, 0);
61MODULE_PARM_DESC(map3, "Describes third set of devices"); 61MODULE_PARM_DESC(map3, "Describes third set of devices");
62 62
63__obsolete_setup("tgfx=");
64__obsolete_setup("tgfx_2=");
65__obsolete_setup("tgfx_3=");
66
67#define TGFX_REFRESH_TIME HZ/100 /* 10 ms */ 63#define TGFX_REFRESH_TIME HZ/100 /* 10 ms */
68 64
69#define TGFX_TRIGGER 0x08 65#define TGFX_TRIGGER 0x08
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1b81a72e19d9..64509689fa65 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -215,11 +215,11 @@ config KEYBOARD_AAED2000
215 module will be called aaed2000_kbd. 215 module will be called aaed2000_kbd.
216 216
217config KEYBOARD_GPIO 217config KEYBOARD_GPIO
218 tristate "Buttons on CPU GPIOs (PXA)" 218 tristate "Buttons on CPU GPIOs (PXA)"
219 depends on ARCH_PXA 219 depends on (ARCH_SA1100 || ARCH_PXA || ARCH_S3C2410)
220 help 220 help
221 This driver implements support for buttons connected 221 This driver implements support for buttons connected
222 directly to GPIO pins of PXA CPUs. 222 directly to GPIO pins of SA1100, PXA or S3C24xx CPUs.
223 223
224 Say Y here if your device has buttons connected 224 Say Y here if your device has buttons connected
225 directly to GPIO pins of the CPU. 225 directly to GPIO pins of the CPU.
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index c621a9177a56..663877076bc7 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -63,10 +63,6 @@ static int atkbd_extra;
63module_param_named(extra, atkbd_extra, bool, 0); 63module_param_named(extra, atkbd_extra, bool, 0);
64MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); 64MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards");
65 65
66__obsolete_setup("atkbd_set=");
67__obsolete_setup("atkbd_reset");
68__obsolete_setup("atkbd_softrepeat=");
69
70/* 66/*
71 * Scancode to keycode tables. These are just the default setting, and 67 * Scancode to keycode tables. These are just the default setting, and
72 * are loadable via an userland utility. 68 * are loadable via an userland utility.
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 7ad479e4e3b3..fa03a00b4c6d 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -24,7 +24,7 @@
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26 26
27#include <asm/arch/pxa-regs.h> 27#include <asm/gpio.h>
28#include <asm/arch/hardware.h> 28#include <asm/arch/hardware.h>
29 29
30#include <asm/hardware/gpio_keys.h> 30#include <asm/hardware/gpio_keys.h>
@@ -38,8 +38,8 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
38 38
39 for (i = 0; i < pdata->nbuttons; i++) { 39 for (i = 0; i < pdata->nbuttons; i++) {
40 int gpio = pdata->buttons[i].gpio; 40 int gpio = pdata->buttons[i].gpio;
41 if (irq == IRQ_GPIO(gpio)) { 41 if (irq == gpio_to_irq(gpio)) {
42 int state = ((GPLR(gpio) & GPIO_bit(gpio)) ? 1 : 0) ^ (pdata->buttons[i].active_low); 42 int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low);
43 43
44 input_report_key(input, pdata->buttons[i].keycode, state); 44 input_report_key(input, pdata->buttons[i].keycode, state);
45 input_sync(input); 45 input_sync(input);
@@ -75,14 +75,15 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
75 75
76 for (i = 0; i < pdata->nbuttons; i++) { 76 for (i = 0; i < pdata->nbuttons; i++) {
77 int code = pdata->buttons[i].keycode; 77 int code = pdata->buttons[i].keycode;
78 int irq = IRQ_GPIO(pdata->buttons[i].gpio); 78 int irq = gpio_to_irq(pdata->buttons[i].gpio);
79 79
80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); 80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
81 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, 81 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", 82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys",
83 pdev); 83 pdev);
84 if (error) { 84 if (error) {
85 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", irq, ret); 85 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
86 irq, error);
86 goto fail; 87 goto fail;
87 } 88 }
88 set_bit(code, input->keybit); 89 set_bit(code, input->keybit);
@@ -98,7 +99,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
98 99
99 fail: 100 fail:
100 for (i = i - 1; i >= 0; i--) 101 for (i = i - 1; i >= 0; i--)
101 free_irq(IRQ_GPIO(pdata->buttons[i].gpio), pdev); 102 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev);
102 103
103 input_free_device(input); 104 input_free_device(input);
104 105
@@ -112,7 +113,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
112 int i; 113 int i;
113 114
114 for (i = 0; i < pdata->nbuttons; i++) { 115 for (i = 0; i < pdata->nbuttons; i++) {
115 int irq = IRQ_GPIO(pdata->buttons[i].gpio); 116 int irq = gpio_to_irq(pdata->buttons[i].gpio);
116 free_irq(irq, pdev); 117 free_irq(irq, pdev);
117 } 118 }
118 119
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index 255a6ec75a48..4de4dc297d50 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -294,8 +294,10 @@ err3:
294 disable_irq(HIL_IRQ); 294 disable_irq(HIL_IRQ);
295 free_irq(HIL_IRQ, hil_dev.dev_id); 295 free_irq(HIL_IRQ, hil_dev.dev_id);
296err2: 296err2:
297#if defined(CONFIG_HP300)
297 release_region(HILBASE + HIL_DATA, 2); 298 release_region(HILBASE + HIL_DATA, 2);
298err1: 299err1:
300#endif
299 input_free_device(hil_dev.dev); 301 input_free_device(hil_dev.dev);
300 hil_dev.dev = NULL; 302 hil_dev.dev = NULL;
301 return err; 303 return err;
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 701ebd5473cf..79b624fe8994 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -84,8 +84,6 @@ static int inport_irq = INPORT_IRQ;
84module_param_named(irq, inport_irq, uint, 0); 84module_param_named(irq, inport_irq, uint, 0);
85MODULE_PARM_DESC(irq, "IRQ number (5=default)"); 85MODULE_PARM_DESC(irq, "IRQ number (5=default)");
86 86
87__obsolete_setup("inport_irq=");
88
89static struct input_dev *inport_dev; 87static struct input_dev *inport_dev;
90 88
91static irqreturn_t inport_interrupt(int irq, void *dev_id) 89static irqreturn_t inport_interrupt(int irq, void *dev_id)
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index db205995bffd..26c3b2e2ca94 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -75,8 +75,6 @@ static int logibm_irq = LOGIBM_IRQ;
75module_param_named(irq, logibm_irq, uint, 0); 75module_param_named(irq, logibm_irq, uint, 0);
76MODULE_PARM_DESC(irq, "IRQ number (5=default)"); 76MODULE_PARM_DESC(irq, "IRQ number (5=default)");
77 77
78__obsolete_setup("logibm_irq=");
79
80static struct input_dev *logibm_dev; 78static struct input_dev *logibm_dev;
81 79
82static irqreturn_t logibm_interrupt(int irq, void *dev_id) 80static irqreturn_t logibm_interrupt(int irq, void *dev_id)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index a0e4a033e2db..0fe5869d7d4c 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -93,12 +93,6 @@ static struct attribute_group psmouse_attribute_group = {
93 .attrs = psmouse_attributes, 93 .attrs = psmouse_attributes,
94}; 94};
95 95
96__obsolete_setup("psmouse_noext");
97__obsolete_setup("psmouse_resolution=");
98__obsolete_setup("psmouse_smartscroll=");
99__obsolete_setup("psmouse_resetafter=");
100__obsolete_setup("psmouse_rate=");
101
102/* 96/*
103 * psmouse_mutex protects all operations changing state of mouse 97 * psmouse_mutex protects all operations changing state of mouse
104 * (connecting, disconnecting, changing rate or resolution via 98 * (connecting, disconnecting, changing rate or resolution via
@@ -987,8 +981,36 @@ static void psmouse_resync(struct work_struct *work)
987static void psmouse_cleanup(struct serio *serio) 981static void psmouse_cleanup(struct serio *serio)
988{ 982{
989 struct psmouse *psmouse = serio_get_drvdata(serio); 983 struct psmouse *psmouse = serio_get_drvdata(serio);
984 struct psmouse *parent = NULL;
985
986 mutex_lock(&psmouse_mutex);
987
988 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
989 parent = serio_get_drvdata(serio->parent);
990 psmouse_deactivate(parent);
991 }
992
993 psmouse_deactivate(psmouse);
994
995 if (psmouse->cleanup)
996 psmouse->cleanup(psmouse);
990 997
991 psmouse_reset(psmouse); 998 psmouse_reset(psmouse);
999
1000/*
1001 * Some boxes, such as HP nx7400, get terribly confused if mouse
1002 * is not fully enabled before suspending/shutting down.
1003 */
1004 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
1005
1006 if (parent) {
1007 if (parent->pt_deactivate)
1008 parent->pt_deactivate(parent);
1009
1010 psmouse_activate(parent);
1011 }
1012
1013 mutex_unlock(&psmouse_mutex);
992} 1014}
993 1015
994/* 1016/*
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 1b74cae8a556..cf1de95b6f27 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -68,6 +68,7 @@ struct psmouse {
68 68
69 int (*reconnect)(struct psmouse *psmouse); 69 int (*reconnect)(struct psmouse *psmouse);
70 void (*disconnect)(struct psmouse *psmouse); 70 void (*disconnect)(struct psmouse *psmouse);
71 void (*cleanup)(struct psmouse *psmouse);
71 int (*poll)(struct psmouse *psmouse); 72 int (*poll)(struct psmouse *psmouse);
72 73
73 void (*pt_activate)(struct psmouse *psmouse); 74 void (*pt_activate)(struct psmouse *psmouse);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 49ac696d6cff..f0f9413d762c 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -652,6 +652,7 @@ int synaptics_init(struct psmouse *psmouse)
652 psmouse->set_rate = synaptics_set_rate; 652 psmouse->set_rate = synaptics_set_rate;
653 psmouse->disconnect = synaptics_disconnect; 653 psmouse->disconnect = synaptics_disconnect;
654 psmouse->reconnect = synaptics_reconnect; 654 psmouse->reconnect = synaptics_reconnect;
655 psmouse->cleanup = synaptics_reset;
655 psmouse->pktsize = 6; 656 psmouse->pktsize = 6;
656 /* Synaptics can usually stay in sync without extra help */ 657 /* Synaptics can usually stay in sync without extra help */
657 psmouse->resync_time = 0; 658 psmouse->resync_time = 0;
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index c3fdfc1f342a..ec195a36e8f6 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -76,13 +76,6 @@ module_param_named(debug, i8042_debug, bool, 0600);
76MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); 76MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
77#endif 77#endif
78 78
79__obsolete_setup("i8042_noaux");
80__obsolete_setup("i8042_nomux");
81__obsolete_setup("i8042_unlock");
82__obsolete_setup("i8042_reset");
83__obsolete_setup("i8042_direct");
84__obsolete_setup("i8042_dumbkbd");
85
86#include "i8042.h" 79#include "i8042.h"
87 80
88static DEFINE_SPINLOCK(i8042_lock); 81static DEFINE_SPINLOCK(i8042_lock);
@@ -724,7 +717,7 @@ static int i8042_controller_init(void)
724 if (~i8042_read_status() & I8042_STR_KEYLOCK) { 717 if (~i8042_read_status() & I8042_STR_KEYLOCK) {
725 if (i8042_unlock) 718 if (i8042_unlock)
726 i8042_ctr |= I8042_CTR_IGNKEYLOCK; 719 i8042_ctr |= I8042_CTR_IGNKEYLOCK;
727 else 720 else
728 printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); 721 printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n");
729 } 722 }
730 spin_unlock_irqrestore(&i8042_lock, flags); 723 spin_unlock_irqrestore(&i8042_lock, flags);
@@ -791,27 +784,6 @@ static void i8042_controller_reset(void)
791 784
792 785
793/* 786/*
794 * Here we try to reset everything back to a state in which the BIOS will be
795 * able to talk to the hardware when rebooting.
796 */
797
798static void i8042_controller_cleanup(void)
799{
800 int i;
801
802/*
803 * Reset anything that is connected to the ports.
804 */
805
806 for (i = 0; i < I8042_NUM_PORTS; i++)
807 if (i8042_ports[i].serio)
808 serio_cleanup(i8042_ports[i].serio);
809
810 i8042_controller_reset();
811}
812
813
814/*
815 * i8042_panic_blink() will flash the keyboard LEDs and is called when 787 * i8042_panic_blink() will flash the keyboard LEDs and is called when
816 * kernel panics. Flashing LEDs is useful for users running X who may 788 * kernel panics. Flashing LEDs is useful for users running X who may
817 * not see the console and will help distingushing panics from "real" 789 * not see the console and will help distingushing panics from "real"
@@ -857,13 +829,22 @@ static long i8042_panic_blink(long count)
857 829
858#undef DELAY 830#undef DELAY
859 831
832#ifdef CONFIG_PM
860/* 833/*
861 * Here we try to restore the original BIOS settings 834 * Here we try to restore the original BIOS settings. We only want to
835 * do that once, when we really suspend, not when we taking memory
836 * snapshot for swsusp (in this case we'll perform required cleanup
837 * as part of shutdown process).
862 */ 838 */
863 839
864static int i8042_suspend(struct platform_device *dev, pm_message_t state) 840static int i8042_suspend(struct platform_device *dev, pm_message_t state)
865{ 841{
866 i8042_controller_cleanup(); 842 if (dev->dev.power.power_state.event != state.event) {
843 if (state.event == PM_EVENT_SUSPEND)
844 i8042_controller_reset();
845
846 dev->dev.power.power_state = state;
847 }
867 848
868 return 0; 849 return 0;
869} 850}
@@ -877,6 +858,12 @@ static int i8042_resume(struct platform_device *dev)
877{ 858{
878 int error; 859 int error;
879 860
861/*
862 * Do not bother with restoring state if we haven't suspened yet
863 */
864 if (dev->dev.power.power_state.event == PM_EVENT_ON)
865 return 0;
866
880 error = i8042_controller_check(); 867 error = i8042_controller_check();
881 if (error) 868 if (error)
882 return error; 869 return error;
@@ -886,9 +873,12 @@ static int i8042_resume(struct platform_device *dev)
886 return error; 873 return error;
887 874
888/* 875/*
889 * Restore pre-resume CTR value and disable all ports 876 * Restore original CTR value and disable all ports
890 */ 877 */
891 878
879 i8042_ctr = i8042_initial_ctr;
880 if (i8042_direct)
881 i8042_ctr &= ~I8042_CTR_XLATE;
892 i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; 882 i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS;
893 i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); 883 i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT);
894 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 884 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
@@ -909,8 +899,11 @@ static int i8042_resume(struct platform_device *dev)
909 899
910 i8042_interrupt(0, NULL); 900 i8042_interrupt(0, NULL);
911 901
902 dev->dev.power.power_state = PMSG_ON;
903
912 return 0; 904 return 0;
913} 905}
906#endif /* CONFIG_PM */
914 907
915/* 908/*
916 * We need to reset the 8042 back to original mode on system shutdown, 909 * We need to reset the 8042 back to original mode on system shutdown,
@@ -919,7 +912,7 @@ static int i8042_resume(struct platform_device *dev)
919 912
920static void i8042_shutdown(struct platform_device *dev) 913static void i8042_shutdown(struct platform_device *dev)
921{ 914{
922 i8042_controller_cleanup(); 915 i8042_controller_reset();
923} 916}
924 917
925static int __devinit i8042_create_kbd_port(void) 918static int __devinit i8042_create_kbd_port(void)
@@ -1154,9 +1147,11 @@ static struct platform_driver i8042_driver = {
1154 }, 1147 },
1155 .probe = i8042_probe, 1148 .probe = i8042_probe,
1156 .remove = __devexit_p(i8042_remove), 1149 .remove = __devexit_p(i8042_remove),
1150 .shutdown = i8042_shutdown,
1151#ifdef CONFIG_PM
1157 .suspend = i8042_suspend, 1152 .suspend = i8042_suspend,
1158 .resume = i8042_resume, 1153 .resume = i8042_resume,
1159 .shutdown = i8042_shutdown, 1154#endif
1160}; 1155};
1161 1156
1162static int __init i8042_init(void) 1157static int __init i8042_init(void)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 17c8c63cbe1a..a15e531ec755 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -778,6 +778,19 @@ static int serio_driver_remove(struct device *dev)
778 return 0; 778 return 0;
779} 779}
780 780
781static void serio_cleanup(struct serio *serio)
782{
783 if (serio->drv && serio->drv->cleanup)
784 serio->drv->cleanup(serio);
785}
786
787static void serio_shutdown(struct device *dev)
788{
789 struct serio *serio = to_serio_port(dev);
790
791 serio_cleanup(serio);
792}
793
781static void serio_attach_driver(struct serio_driver *drv) 794static void serio_attach_driver(struct serio_driver *drv)
782{ 795{
783 int error; 796 int error;
@@ -910,11 +923,25 @@ static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buf
910 923
911#endif /* CONFIG_HOTPLUG */ 924#endif /* CONFIG_HOTPLUG */
912 925
926#ifdef CONFIG_PM
927static int serio_suspend(struct device *dev, pm_message_t state)
928{
929 if (dev->power.power_state.event != state.event) {
930 if (state.event == PM_EVENT_SUSPEND)
931 serio_cleanup(to_serio_port(dev));
932
933 dev->power.power_state = state;
934 }
935
936 return 0;
937}
938
913static int serio_resume(struct device *dev) 939static int serio_resume(struct device *dev)
914{ 940{
915 struct serio *serio = to_serio_port(dev); 941 struct serio *serio = to_serio_port(dev);
916 942
917 if (serio_reconnect_driver(serio)) { 943 if (dev->power.power_state.event != PM_EVENT_ON &&
944 serio_reconnect_driver(serio)) {
918 /* 945 /*
919 * Driver re-probing can take a while, so better let kseriod 946 * Driver re-probing can take a while, so better let kseriod
920 * deal with it. 947 * deal with it.
@@ -922,8 +949,11 @@ static int serio_resume(struct device *dev)
922 serio_rescan(serio); 949 serio_rescan(serio);
923 } 950 }
924 951
952 dev->power.power_state = PMSG_ON;
953
925 return 0; 954 return 0;
926} 955}
956#endif /* CONFIG_PM */
927 957
928/* called from serio_driver->connect/disconnect methods under serio_mutex */ 958/* called from serio_driver->connect/disconnect methods under serio_mutex */
929int serio_open(struct serio *serio, struct serio_driver *drv) 959int serio_open(struct serio *serio, struct serio_driver *drv)
@@ -974,7 +1004,11 @@ static struct bus_type serio_bus = {
974 .uevent = serio_uevent, 1004 .uevent = serio_uevent,
975 .probe = serio_driver_probe, 1005 .probe = serio_driver_probe,
976 .remove = serio_driver_remove, 1006 .remove = serio_driver_remove,
1007 .shutdown = serio_shutdown,
1008#ifdef CONFIG_PM
1009 .suspend = serio_suspend,
977 .resume = serio_resume, 1010 .resume = serio_resume,
1011#endif
978}; 1012};
979 1013
980static int __init serio_init(void) 1014static int __init serio_init(void)