aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-05-03 03:17:01 -0400
committerIngo Molnar <mingo@elte.hu>2010-05-03 03:17:01 -0400
commit53ba4f2fa73225113a488584df0d85d3cba52943 (patch)
treed85b984d9818abc3ccc0237eb53b710d9e96c39e /drivers/input
parentbd6d29c25bb1a24a4c160ec5de43e0004e01f72b (diff)
parent66f41d4c5c8a5deed66fdcc84509376c9a0bf9d8 (diff)
Merge commit 'v2.6.34-rc6' into core/locking
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/evdev.c2
-rw-r--r--drivers/input/ff-core.c1
-rw-r--r--drivers/input/ff-memless.c1
-rw-r--r--drivers/input/gameport/lightning.c1
-rw-r--r--drivers/input/input-polldev.c1
-rw-r--r--drivers/input/input.c46
-rw-r--r--drivers/input/joystick/db9.c1
-rw-r--r--drivers/input/joystick/gamecon.c3
-rw-r--r--drivers/input/joystick/turbografx.c1
-rw-r--r--drivers/input/keyboard/adp5520-keys.c1
-rw-r--r--drivers/input/keyboard/adp5588-keys.c1
-rw-r--r--drivers/input/keyboard/bf54x-keys.c3
-rw-r--r--drivers/input/keyboard/davinci_keyscan.c1
-rw-r--r--drivers/input/keyboard/ep93xx_keypad.c1
-rw-r--r--drivers/input/keyboard/gpio_keys.c1
-rw-r--r--drivers/input/keyboard/imx_keypad.c1
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c1
-rw-r--r--drivers/input/keyboard/jornada720_kbd.c1
-rw-r--r--drivers/input/keyboard/lm8323.c1
-rw-r--r--drivers/input/keyboard/locomokbd.c32
-rw-r--r--drivers/input/keyboard/matrix_keypad.c5
-rw-r--r--drivers/input/keyboard/max7359_keypad.c1
-rw-r--r--drivers/input/keyboard/omap-keypad.c1
-rw-r--r--drivers/input/keyboard/opencores-kbd.c1
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c1
-rw-r--r--drivers/input/keyboard/pxa930_rotary.c1
-rw-r--r--drivers/input/keyboard/sh_keysc.c1
-rw-r--r--drivers/input/keyboard/tosakbd.c1
-rw-r--r--drivers/input/keyboard/twl4030_keypad.c1
-rw-r--r--drivers/input/keyboard/w90p910_keypad.c1
-rw-r--r--drivers/input/misc/88pm860x_onkey.c156
-rw-r--r--drivers/input/misc/Kconfig21
-rw-r--r--drivers/input/misc/Makefile2
-rw-r--r--drivers/input/misc/ati_remote2.c15
-rw-r--r--drivers/input/misc/bfin_rotary.c1
-rw-r--r--drivers/input/misc/cobalt_btns.c1
-rw-r--r--drivers/input/misc/dm355evm_keys.c1
-rw-r--r--drivers/input/misc/pcap_keys.c1
-rw-r--r--drivers/input/misc/pcf50633-input.c1
-rw-r--r--drivers/input/misc/rotary_encoder.c1
-rw-r--r--drivers/input/misc/sgi_btns.c1
-rw-r--r--drivers/input/misc/sparcspkr.c1
-rw-r--r--drivers/input/misc/twl4030-vibra.c298
-rw-r--r--drivers/input/misc/winbond-cir.c13
-rw-r--r--drivers/input/misc/wistron_btns.c1
-rw-r--r--drivers/input/misc/wm831x-on.c10
-rw-r--r--drivers/input/misc/yealink.h2
-rw-r--r--drivers/input/mouse/alps.c51
-rw-r--r--drivers/input/mouse/appletouch.c6
-rw-r--r--drivers/input/mouse/bcm5974.c1
-rw-r--r--drivers/input/mouse/elantech.c1
-rw-r--r--drivers/input/mouse/hgpk.c1
-rw-r--r--drivers/input/mouse/lifebook.c1
-rw-r--r--drivers/input/mouse/pxa930_trkball.c1
-rw-r--r--drivers/input/mouse/sentelic.c1
-rw-r--r--drivers/input/mouse/synaptics.c1
-rw-r--r--drivers/input/mouse/synaptics_i2c.c1
-rw-r--r--drivers/input/mouse/touchkit_ps2.c1
-rw-r--r--drivers/input/mouse/trackpoint.c1
-rw-r--r--drivers/input/mousedev.c6
-rw-r--r--drivers/input/serio/altera_ps2.c1
-rw-r--r--drivers/input/serio/at32psif.c1
-rw-r--r--drivers/input/serio/ct82c710.c1
-rw-r--r--drivers/input/serio/gscps2.c1
-rw-r--r--drivers/input/serio/hil_mlc.c1
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h10
-rw-r--r--drivers/input/serio/i8042.c29
-rw-r--r--drivers/input/serio/libps2.c1
-rw-r--r--drivers/input/serio/parkbd.c1
-rw-r--r--drivers/input/serio/pcips2.c1
-rw-r--r--drivers/input/serio/q40kbd.c1
-rw-r--r--drivers/input/serio/rpckbd.c1
-rw-r--r--drivers/input/serio/serio_raw.c11
-rw-r--r--drivers/input/serio/xilinx_ps2.c1
-rw-r--r--drivers/input/sparse-keymap.c59
-rw-r--r--drivers/input/tablet/aiptek.c2
-rw-r--r--drivers/input/tablet/wacom_sys.c16
-rw-r--r--drivers/input/tablet/wacom_wac.c2
-rw-r--r--drivers/input/tablet/wacom_wac.h1
-rw-r--r--drivers/input/touchscreen/88pm860x-ts.c237
-rw-r--r--drivers/input/touchscreen/Kconfig21
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/ad7877.c2
-rw-r--r--drivers/input/touchscreen/ads7846.c20
-rw-r--r--drivers/input/touchscreen/atmel-wm97xx.c1
-rw-r--r--drivers/input/touchscreen/da9034-ts.c1
-rw-r--r--drivers/input/touchscreen/eeti_ts.c1
-rw-r--r--drivers/input/touchscreen/jornada720_ts.c1
-rw-r--r--drivers/input/touchscreen/mc13783_ts.c5
-rw-r--r--drivers/input/touchscreen/mcs5000_ts.c1
-rw-r--r--drivers/input/touchscreen/migor_ts.c1
-rw-r--r--drivers/input/touchscreen/pcap_ts.c1
-rw-r--r--drivers/input/touchscreen/s3c2410_ts.c1
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c1
-rw-r--r--drivers/input/touchscreen/w90p910_ts.c1
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c1
-rw-r--r--drivers/input/xen-kbdfront.c1
97 files changed, 1003 insertions, 150 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 9f9816baeb97..2ee6c7a68bdc 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
515 struct input_absinfo abs; 515 struct input_absinfo abs;
516 struct ff_effect effect; 516 struct ff_effect effect;
517 int __user *ip = (int __user *)p; 517 int __user *ip = (int __user *)p;
518 int i, t, u, v; 518 unsigned int i, t, u, v;
519 int error; 519 int error;
520 520
521 switch (cmd) { 521 switch (cmd) {
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index b2f07aa1604b..03078c08309a 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -29,6 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/slab.h>
32 33
33/* 34/*
34 * Check that the effect_id is a valid effect and whether the user 35 * Check that the effect_id is a valid effect and whether the user
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index f967008f332e..1d881c96ba8f 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -25,6 +25,7 @@
25 25
26#define debug(format, arg...) pr_debug("ff-memless: " format "\n", ## arg) 26#define debug(format, arg...) pr_debug("ff-memless: " format "\n", ## arg)
27 27
28#include <linux/slab.h>
28#include <linux/input.h> 29#include <linux/input.h>
29#include <linux/module.h> 30#include <linux/module.h>
30#include <linux/mutex.h> 31#include <linux/mutex.h>
diff --git a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c
index 06ad36ed3483..85d6ee09f11f 100644
--- a/drivers/input/gameport/lightning.c
+++ b/drivers/input/gameport/lightning.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/gameport.h> 36#include <linux/gameport.h>
37#include <linux/slab.h>
38 37
39#define L4_PORT 0x201 38#define L4_PORT 0x201
40#define L4_SELECT_ANALOG 0xa4 39#define L4_SELECT_ANALOG 0xa4
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 291d9393d359..10c9b0a845f0 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/jiffies.h> 11#include <linux/jiffies.h>
12#include <linux/slab.h>
12#include <linux/mutex.h> 13#include <linux/mutex.h>
13#include <linux/input-polldev.h> 14#include <linux/input-polldev.h>
14 15
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 41168d5f8c17..9c79bd56b51a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -14,6 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/slab.h>
17#include <linux/random.h> 18#include <linux/random.h>
18#include <linux/major.h> 19#include <linux/major.h>
19#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
@@ -582,7 +583,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode)
582} 583}
583 584
584static int input_default_getkeycode(struct input_dev *dev, 585static int input_default_getkeycode(struct input_dev *dev,
585 int scancode, int *keycode) 586 unsigned int scancode,
587 unsigned int *keycode)
586{ 588{
587 if (!dev->keycodesize) 589 if (!dev->keycodesize)
588 return -EINVAL; 590 return -EINVAL;
@@ -596,7 +598,8 @@ static int input_default_getkeycode(struct input_dev *dev,
596} 598}
597 599
598static int input_default_setkeycode(struct input_dev *dev, 600static int input_default_setkeycode(struct input_dev *dev,
599 int scancode, int keycode) 601 unsigned int scancode,
602 unsigned int keycode)
600{ 603{
601 int old_keycode; 604 int old_keycode;
602 int i; 605 int i;
@@ -654,12 +657,17 @@ static int input_default_setkeycode(struct input_dev *dev,
654 * This function should be called by anyone interested in retrieving current 657 * This function should be called by anyone interested in retrieving current
655 * keymap. Presently keyboard and evdev handlers use it. 658 * keymap. Presently keyboard and evdev handlers use it.
656 */ 659 */
657int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) 660int input_get_keycode(struct input_dev *dev,
661 unsigned int scancode, unsigned int *keycode)
658{ 662{
659 if (scancode < 0) 663 unsigned long flags;
660 return -EINVAL; 664 int retval;
665
666 spin_lock_irqsave(&dev->event_lock, flags);
667 retval = dev->getkeycode(dev, scancode, keycode);
668 spin_unlock_irqrestore(&dev->event_lock, flags);
661 669
662 return dev->getkeycode(dev, scancode, keycode); 670 return retval;
663} 671}
664EXPORT_SYMBOL(input_get_keycode); 672EXPORT_SYMBOL(input_get_keycode);
665 673
@@ -672,16 +680,14 @@ EXPORT_SYMBOL(input_get_keycode);
672 * This function should be called by anyone needing to update current 680 * This function should be called by anyone needing to update current
673 * keymap. Presently keyboard and evdev handlers use it. 681 * keymap. Presently keyboard and evdev handlers use it.
674 */ 682 */
675int input_set_keycode(struct input_dev *dev, int scancode, int keycode) 683int input_set_keycode(struct input_dev *dev,
684 unsigned int scancode, unsigned int keycode)
676{ 685{
677 unsigned long flags; 686 unsigned long flags;
678 int old_keycode; 687 int old_keycode;
679 int retval; 688 int retval;
680 689
681 if (scancode < 0) 690 if (keycode > KEY_MAX)
682 return -EINVAL;
683
684 if (keycode < 0 || keycode > KEY_MAX)
685 return -EINVAL; 691 return -EINVAL;
686 692
687 spin_lock_irqsave(&dev->event_lock, flags); 693 spin_lock_irqsave(&dev->event_lock, flags);
@@ -1881,35 +1887,37 @@ static int input_open_file(struct inode *inode, struct file *file)
1881 const struct file_operations *old_fops, *new_fops = NULL; 1887 const struct file_operations *old_fops, *new_fops = NULL;
1882 int err; 1888 int err;
1883 1889
1884 lock_kernel(); 1890 err = mutex_lock_interruptible(&input_mutex);
1891 if (err)
1892 return err;
1893
1885 /* No load-on-demand here? */ 1894 /* No load-on-demand here? */
1886 handler = input_table[iminor(inode) >> 5]; 1895 handler = input_table[iminor(inode) >> 5];
1887 if (!handler || !(new_fops = fops_get(handler->fops))) { 1896 if (handler)
1888 err = -ENODEV; 1897 new_fops = fops_get(handler->fops);
1889 goto out; 1898
1890 } 1899 mutex_unlock(&input_mutex);
1891 1900
1892 /* 1901 /*
1893 * That's _really_ odd. Usually NULL ->open means "nothing special", 1902 * That's _really_ odd. Usually NULL ->open means "nothing special",
1894 * not "no device". Oh, well... 1903 * not "no device". Oh, well...
1895 */ 1904 */
1896 if (!new_fops->open) { 1905 if (!new_fops || !new_fops->open) {
1897 fops_put(new_fops); 1906 fops_put(new_fops);
1898 err = -ENODEV; 1907 err = -ENODEV;
1899 goto out; 1908 goto out;
1900 } 1909 }
1910
1901 old_fops = file->f_op; 1911 old_fops = file->f_op;
1902 file->f_op = new_fops; 1912 file->f_op = new_fops;
1903 1913
1904 err = new_fops->open(inode, file); 1914 err = new_fops->open(inode, file);
1905
1906 if (err) { 1915 if (err) {
1907 fops_put(file->f_op); 1916 fops_put(file->f_op);
1908 file->f_op = fops_get(old_fops); 1917 file->f_op = fops_get(old_fops);
1909 } 1918 }
1910 fops_put(old_fops); 1919 fops_put(old_fops);
1911out: 1920out:
1912 unlock_kernel();
1913 return err; 1921 return err;
1914} 1922}
1915 1923
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 523959484753..8e7de5c7754f 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -36,6 +36,7 @@
36#include <linux/parport.h> 36#include <linux/parport.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/slab.h>
39 40
40MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 41MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
41MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver"); 42MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver");
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index ae998d99a5ae..fbd62abb66f9 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -39,6 +39,7 @@
39#include <linux/parport.h> 39#include <linux/parport.h>
40#include <linux/input.h> 40#include <linux/input.h>
41#include <linux/mutex.h> 41#include <linux/mutex.h>
42#include <linux/slab.h>
42 43
43MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 44MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
44MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver"); 45MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver");
@@ -819,7 +820,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
819 int i; 820 int i;
820 int err; 821 int err;
821 822
822 if (pad_type < 1 || pad_type > GC_MAX) { 823 if (pad_type < 1 || pad_type >= GC_MAX) {
823 pr_err("Pad type %d unknown\n", pad_type); 824 pr_err("Pad type %d unknown\n", pad_type);
824 return -EINVAL; 825 return -EINVAL;
825 } 826 }
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index b6f859869540..d53b9e900234 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -35,6 +35,7 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/mutex.h> 37#include <linux/mutex.h>
38#include <linux/slab.h>
38 39
39MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 40MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
40MODULE_DESCRIPTION("TurboGraFX parallel port interface driver"); 41MODULE_DESCRIPTION("TurboGraFX parallel port interface driver");
diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c
index a7ba27fb4109..3db8006dac3a 100644
--- a/drivers/input/keyboard/adp5520-keys.c
+++ b/drivers/input/keyboard/adp5520-keys.c
@@ -12,6 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/mfd/adp5520.h> 14#include <linux/mfd/adp5520.h>
15#include <linux/slab.h>
15 16
16struct adp5520_keys { 17struct adp5520_keys {
17 struct input_dev *input; 18 struct input_dev *input;
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index b5142d2d5112..4771ab172b59 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/input.h> 20#include <linux/input.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/slab.h>
22 23
23#include <linux/i2c/adp5588.h> 24#include <linux/i2c/adp5588.h>
24 25
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index fe376a27fe57..7d989603f875 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -34,6 +34,7 @@
34#include <linux/fs.h> 34#include <linux/fs.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <linux/slab.h>
37#include <linux/sched.h> 38#include <linux/sched.h>
38#include <linux/pm.h> 39#include <linux/pm.h>
39#include <linux/sysctl.h> 40#include <linux/sysctl.h>
@@ -162,7 +163,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
162 input_sync(input); 163 input_sync(input);
163 164
164 if (bfin_kpad_get_keypressed(bf54x_kpad)) { 165 if (bfin_kpad_get_keypressed(bf54x_kpad)) {
165 disable_irq(bf54x_kpad->irq); 166 disable_irq_nosync(bf54x_kpad->irq);
166 bf54x_kpad->lastkey = key; 167 bf54x_kpad->lastkey = key;
167 mod_timer(&bf54x_kpad->timer, 168 mod_timer(&bf54x_kpad->timer,
168 jiffies + bf54x_kpad->keyup_test_jiffies); 169 jiffies + bf54x_kpad->keyup_test_jiffies);
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
index d410d7a52f1d..a91ee941b5c1 100644
--- a/drivers/input/keyboard/davinci_keyscan.c
+++ b/drivers/input/keyboard/davinci_keyscan.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/slab.h>
33 34
34#include <asm/irq.h> 35#include <asm/irq.h>
35 36
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index bd25a3af1664..c8242dd190d0 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -25,6 +25,7 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/input/matrix_keypad.h> 27#include <linux/input/matrix_keypad.h>
28#include <linux/slab.h>
28 29
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <mach/ep93xx_keypad.h> 31#include <mach/ep93xx_keypad.h>
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 2b708aa85553..b8213fd13c3f 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -16,6 +16,7 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/slab.h>
19#include <linux/sysctl.h> 20#include <linux/sysctl.h>
20#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
21#include <linux/delay.h> 22#include <linux/delay.h>
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 2ee5b798024d..d92c15c39e68 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/slab.h>
24#include <linux/timer.h> 25#include <linux/timer.h>
25 26
26/* 27/*
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index 781fc6102860..5fc976dbce0b 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -24,6 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/slab.h>
27 28
28#include <asm/delay.h> 29#include <asm/delay.h>
29#include <asm/io.h> 30#include <asm/io.h>
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c
index 4e016d823069..2cd3e1d56ea4 100644
--- a/drivers/input/keyboard/jornada720_kbd.c
+++ b/drivers/input/keyboard/jornada720_kbd.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/slab.h>
26 27
27#include <mach/jornada720.h> 28#include <mach/jornada720.h>
28#include <mach/hardware.h> 29#include <mach/hardware.h>
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index 574eda2a4957..60ac4684f875 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -31,6 +31,7 @@
31#include <linux/input.h> 31#include <linux/input.h>
32#include <linux/leds.h> 32#include <linux/leds.h>
33#include <linux/i2c/lm8323.h> 33#include <linux/i2c/lm8323.h>
34#include <linux/slab.h>
34 35
35/* Commands to send to the chip. */ 36/* Commands to send to the chip. */
36#define LM8323_CMD_READ_ID 0x80 /* Read chip ID. */ 37#define LM8323_CMD_READ_ID 0x80 /* Read chip ID. */
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 9caed30f3bbb..b1ab29861e1c 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -192,11 +192,18 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
192static irqreturn_t locomokbd_interrupt(int irq, void *dev_id) 192static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
193{ 193{
194 struct locomokbd *locomokbd = dev_id; 194 struct locomokbd *locomokbd = dev_id;
195 u16 r;
196
197 r = locomo_readl(locomokbd->base + LOCOMO_KIC);
198 if ((r & 0x0001) == 0)
199 return IRQ_HANDLED;
200
201 locomo_writel(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */
202
195 /** wait chattering delay **/ 203 /** wait chattering delay **/
196 udelay(100); 204 udelay(100);
197 205
198 locomokbd_scankeyboard(locomokbd); 206 locomokbd_scankeyboard(locomokbd);
199
200 return IRQ_HANDLED; 207 return IRQ_HANDLED;
201} 208}
202 209
@@ -210,6 +217,25 @@ static void locomokbd_timer_callback(unsigned long data)
210 locomokbd_scankeyboard(locomokbd); 217 locomokbd_scankeyboard(locomokbd);
211} 218}
212 219
220static int locomokbd_open(struct input_dev *dev)
221{
222 struct locomokbd *locomokbd = input_get_drvdata(dev);
223 u16 r;
224
225 r = locomo_readl(locomokbd->base + LOCOMO_KIC) | 0x0010;
226 locomo_writel(r, locomokbd->base + LOCOMO_KIC);
227 return 0;
228}
229
230static void locomokbd_close(struct input_dev *dev)
231{
232 struct locomokbd *locomokbd = input_get_drvdata(dev);
233 u16 r;
234
235 r = locomo_readl(locomokbd->base + LOCOMO_KIC) & ~0x0010;
236 locomo_writel(r, locomokbd->base + LOCOMO_KIC);
237}
238
213static int __devinit locomokbd_probe(struct locomo_dev *dev) 239static int __devinit locomokbd_probe(struct locomo_dev *dev)
214{ 240{
215 struct locomokbd *locomokbd; 241 struct locomokbd *locomokbd;
@@ -253,6 +279,8 @@ static int __devinit locomokbd_probe(struct locomo_dev *dev)
253 input_dev->id.vendor = 0x0001; 279 input_dev->id.vendor = 0x0001;
254 input_dev->id.product = 0x0001; 280 input_dev->id.product = 0x0001;
255 input_dev->id.version = 0x0100; 281 input_dev->id.version = 0x0100;
282 input_dev->open = locomokbd_open;
283 input_dev->close = locomokbd_close;
256 input_dev->dev.parent = &dev->dev; 284 input_dev->dev.parent = &dev->dev;
257 285
258 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | 286 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
@@ -261,6 +289,8 @@ static int __devinit locomokbd_probe(struct locomo_dev *dev)
261 input_dev->keycodesize = sizeof(locomokbd_keycode[0]); 289 input_dev->keycodesize = sizeof(locomokbd_keycode[0]);
262 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); 290 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
263 291
292 input_set_drvdata(input_dev, locomokbd);
293
264 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); 294 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode));
265 for (i = 0; i < LOCOMOKBD_NUMKEYS; i++) 295 for (i = 0; i < LOCOMOKBD_NUMKEYS; i++)
266 set_bit(locomokbd->keycode[i], input_dev->keybit); 296 set_bit(locomokbd->keycode[i], input_dev->keybit);
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index d3c8b61a941d..b443e088fd3c 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/input/matrix_keypad.h> 24#include <linux/input/matrix_keypad.h>
25#include <linux/slab.h>
25 26
26struct matrix_keypad { 27struct matrix_keypad {
27 const struct matrix_keypad_platform_data *pdata; 28 const struct matrix_keypad_platform_data *pdata;
@@ -373,7 +374,9 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
373 input_dev->name = pdev->name; 374 input_dev->name = pdev->name;
374 input_dev->id.bustype = BUS_HOST; 375 input_dev->id.bustype = BUS_HOST;
375 input_dev->dev.parent = &pdev->dev; 376 input_dev->dev.parent = &pdev->dev;
376 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 377 input_dev->evbit[0] = BIT_MASK(EV_KEY);
378 if (!pdata->no_autorepeat)
379 input_dev->evbit[0] |= BIT_MASK(EV_REP);
377 input_dev->open = matrix_keypad_start; 380 input_dev->open = matrix_keypad_start;
378 input_dev->close = matrix_keypad_stop; 381 input_dev->close = matrix_keypad_stop;
379 382
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index 3b5b948eba39..7fc8185e5c1b 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/slab.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/input.h> 20#include <linux/input.h>
20#include <linux/input/matrix_keypad.h> 21#include <linux/input/matrix_keypad.h>
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 1a494d505431..a72e61ddca91 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -34,6 +34,7 @@
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/slab.h>
37#include <mach/gpio.h> 38#include <mach/gpio.h>
38#include <plat/keypad.h> 39#include <plat/keypad.h>
39#include <plat/menelaus.h> 40#include <plat/menelaus.h>
diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c
index 78cccddbf551..1f1a5563f60a 100644
--- a/drivers/input/keyboard/opencores-kbd.c
+++ b/drivers/input/keyboard/opencores-kbd.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/slab.h>
17 18
18struct opencores_kbd { 19struct opencores_kbd {
19 struct input_dev *input; 20 struct input_dev *input;
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 79cd3e9fdf2e..0e53b3bc39af 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -26,6 +26,7 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/input/matrix_keypad.h> 28#include <linux/input/matrix_keypad.h>
29#include <linux/slab.h>
29 30
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 32#include <asm/mach/map.h>
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c
index 95fbba470e65..b7123a44b6ec 100644
--- a/drivers/input/keyboard/pxa930_rotary.c
+++ b/drivers/input/keyboard/pxa930_rotary.c
@@ -13,6 +13,7 @@
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/slab.h>
16 17
17#include <mach/pxa930_rotary.h> 18#include <mach/pxa930_rotary.h>
18 19
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index 854e2035cd6e..d7dafd9425b6 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -22,6 +22,7 @@
22#include <linux/bitmap.h> 22#include <linux/bitmap.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/slab.h>
25 26
26static const struct { 27static const struct {
27 unsigned char kymd, keyout, keyin; 28 unsigned char kymd, keyout, keyin;
diff --git a/drivers/input/keyboard/tosakbd.c b/drivers/input/keyboard/tosakbd.c
index 42cb3faf7336..3910f269cfc8 100644
--- a/drivers/input/keyboard/tosakbd.c
+++ b/drivers/input/keyboard/tosakbd.c
@@ -18,6 +18,7 @@
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/slab.h>
21 22
22#include <mach/gpio.h> 23#include <mach/gpio.h>
23#include <mach/tosa.h> 24#include <mach/tosa.h>
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 21d6184efa96..7aa59e07b689 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -32,6 +32,7 @@
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/i2c/twl.h> 34#include <linux/i2c/twl.h>
35#include <linux/slab.h>
35 36
36 37
37/* 38/*
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index 6032def03707..4ef764cc493c 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -19,6 +19,7 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/slab.h>
22 23
23#include <mach/w90p910_keypad.h> 24#include <mach/w90p910_keypad.h>
24 25
diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c
new file mode 100644
index 000000000000..40dabd8487b5
--- /dev/null
+++ b/drivers/input/misc/88pm860x_onkey.c
@@ -0,0 +1,156 @@
1/*
2 * 88pm860x_onkey.c - Marvell 88PM860x ONKEY driver
3 *
4 * Copyright (C) 2009-2010 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of this
9 * archive for more details.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/platform_device.h>
24#include <linux/i2c.h>
25#include <linux/input.h>
26#include <linux/interrupt.h>
27#include <linux/mfd/88pm860x.h>
28#include <linux/slab.h>
29
30#define PM8607_WAKEUP 0x0b
31
32#define LONG_ONKEY_EN (1 << 1)
33#define ONKEY_STATUS (1 << 0)
34
35struct pm860x_onkey_info {
36 struct input_dev *idev;
37 struct pm860x_chip *chip;
38 struct i2c_client *i2c;
39 struct device *dev;
40 int irq;
41};
42
43/* 88PM860x gives us an interrupt when ONKEY is held */
44static irqreturn_t pm860x_onkey_handler(int irq, void *data)
45{
46 struct pm860x_onkey_info *info = data;
47 int ret;
48
49 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2);
50 ret &= ONKEY_STATUS;
51 input_report_key(info->idev, KEY_POWER, ret);
52 input_sync(info->idev);
53
54 /* Enable 8-second long onkey detection */
55 pm860x_set_bits(info->i2c, PM8607_WAKEUP, 3, LONG_ONKEY_EN);
56 return IRQ_HANDLED;
57}
58
59static int __devinit pm860x_onkey_probe(struct platform_device *pdev)
60{
61 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
62 struct pm860x_onkey_info *info;
63 int irq, ret;
64
65 irq = platform_get_irq(pdev, 0);
66 if (irq < 0) {
67 dev_err(&pdev->dev, "No IRQ resource!\n");
68 return -EINVAL;
69 }
70
71 info = kzalloc(sizeof(struct pm860x_onkey_info), GFP_KERNEL);
72 if (!info)
73 return -ENOMEM;
74 info->chip = chip;
75 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
76 info->dev = &pdev->dev;
77 info->irq = irq + chip->irq_base;
78
79 info->idev = input_allocate_device();
80 if (!info->idev) {
81 dev_err(chip->dev, "Failed to allocate input dev\n");
82 ret = -ENOMEM;
83 goto out;
84 }
85
86 info->idev->name = "88pm860x_on";
87 info->idev->phys = "88pm860x_on/input0";
88 info->idev->id.bustype = BUS_I2C;
89 info->idev->dev.parent = &pdev->dev;
90 info->irq = irq;
91 info->idev->evbit[0] = BIT_MASK(EV_KEY);
92 info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
93
94 ret = input_register_device(info->idev);
95 if (ret) {
96 dev_err(chip->dev, "Can't register input device: %d\n", ret);
97 goto out_reg;
98 }
99
100 ret = request_threaded_irq(info->irq, NULL, pm860x_onkey_handler,
101 IRQF_ONESHOT, "onkey", info);
102 if (ret < 0) {
103 dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
104 info->irq, ret);
105 goto out_irq;
106 }
107
108 platform_set_drvdata(pdev, info);
109 return 0;
110
111out_irq:
112 input_unregister_device(info->idev);
113 kfree(info);
114 return ret;
115
116out_reg:
117 input_free_device(info->idev);
118out:
119 kfree(info);
120 return ret;
121}
122
123static int __devexit pm860x_onkey_remove(struct platform_device *pdev)
124{
125 struct pm860x_onkey_info *info = platform_get_drvdata(pdev);
126
127 free_irq(info->irq, info);
128 input_unregister_device(info->idev);
129 kfree(info);
130 return 0;
131}
132
133static struct platform_driver pm860x_onkey_driver = {
134 .driver = {
135 .name = "88pm860x-onkey",
136 .owner = THIS_MODULE,
137 },
138 .probe = pm860x_onkey_probe,
139 .remove = __devexit_p(pm860x_onkey_remove),
140};
141
142static int __init pm860x_onkey_init(void)
143{
144 return platform_driver_register(&pm860x_onkey_driver);
145}
146module_init(pm860x_onkey_init);
147
148static void __exit pm860x_onkey_exit(void)
149{
150 platform_driver_unregister(&pm860x_onkey_driver);
151}
152module_exit(pm860x_onkey_exit);
153
154MODULE_DESCRIPTION("Marvell 88PM860x ONKEY driver");
155MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
156MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 16ec5233441c..23140a3bb8e0 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -12,6 +12,16 @@ menuconfig INPUT_MISC
12 12
13if INPUT_MISC 13if INPUT_MISC
14 14
15config INPUT_88PM860X_ONKEY
16 tristate "88PM860x ONKEY support"
17 depends on MFD_88PM860X
18 help
19 Support the ONKEY of Marvell 88PM860x PMICs as an input device
20 reporting power button status.
21
22 To compile this driver as a module, choose M here: the module
23 will be called 88pm860x_onkey.
24
15config INPUT_PCSPKR 25config INPUT_PCSPKR
16 tristate "PC Speaker support" 26 tristate "PC Speaker support"
17 depends on PCSPKR_PLATFORM 27 depends on PCSPKR_PLATFORM
@@ -204,6 +214,17 @@ config INPUT_TWL4030_PWRBUTTON
204 To compile this driver as a module, choose M here. The module will 214 To compile this driver as a module, choose M here. The module will
205 be called twl4030_pwrbutton. 215 be called twl4030_pwrbutton.
206 216
217config INPUT_TWL4030_VIBRA
218 tristate "Support for TWL4030 Vibrator"
219 depends on TWL4030_CORE
220 select TWL4030_CODEC
221 select INPUT_FF_MEMLESS
222 help
223 This option enables support for TWL4030 Vibrator Driver.
224
225 To compile this driver as a module, choose M here. The module will
226 be called twl4030_vibra.
227
207config INPUT_UINPUT 228config INPUT_UINPUT
208 tristate "User level driver support" 229 tristate "User level driver support"
209 help 230 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index a8b84854fb7b..7e95a5d474dc 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -4,6 +4,7 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_INPUT_88PM860X_ONKEY) += 88pm860x_onkey.o
7obj-$(CONFIG_INPUT_APANEL) += apanel.o 8obj-$(CONFIG_INPUT_APANEL) += apanel.o
8obj-$(CONFIG_INPUT_ATI_REMOTE) += ati_remote.o 9obj-$(CONFIG_INPUT_ATI_REMOTE) += ati_remote.o
9obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o 10obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
@@ -25,6 +26,7 @@ obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
25obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o 26obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
26obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 27obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
27obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o 28obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
29obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
28obj-$(CONFIG_INPUT_UINPUT) += uinput.o 30obj-$(CONFIG_INPUT_UINPUT) += uinput.o
29obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o 31obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o
30obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 32obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 0501f0e65157..2124b99378bb 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/usb/input.h> 12#include <linux/usb/input.h>
13#include <linux/slab.h>
13 14
14#define DRIVER_DESC "ATI/Philips USB RF remote driver" 15#define DRIVER_DESC "ATI/Philips USB RF remote driver"
15#define DRIVER_VERSION "0.3" 16#define DRIVER_VERSION "0.3"
@@ -474,10 +475,11 @@ static void ati_remote2_complete_key(struct urb *urb)
474} 475}
475 476
476static int ati_remote2_getkeycode(struct input_dev *idev, 477static int ati_remote2_getkeycode(struct input_dev *idev,
477 int scancode, int *keycode) 478 unsigned int scancode, unsigned int *keycode)
478{ 479{
479 struct ati_remote2 *ar2 = input_get_drvdata(idev); 480 struct ati_remote2 *ar2 = input_get_drvdata(idev);
480 int index, mode; 481 unsigned int mode;
482 int index;
481 483
482 mode = scancode >> 8; 484 mode = scancode >> 8;
483 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 485 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
@@ -491,10 +493,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev,
491 return 0; 493 return 0;
492} 494}
493 495
494static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode) 496static int ati_remote2_setkeycode(struct input_dev *idev,
497 unsigned int scancode, unsigned int keycode)
495{ 498{
496 struct ati_remote2 *ar2 = input_get_drvdata(idev); 499 struct ati_remote2 *ar2 = input_get_drvdata(idev);
497 int index, mode, old_keycode; 500 unsigned int mode, old_keycode;
501 int index;
498 502
499 mode = scancode >> 8; 503 mode = scancode >> 8;
500 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 504 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
@@ -504,9 +508,6 @@ static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keyc
504 if (index < 0) 508 if (index < 0)
505 return -EINVAL; 509 return -EINVAL;
506 510
507 if (keycode < KEY_RESERVED || keycode > KEY_MAX)
508 return -EINVAL;
509
510 old_keycode = ar2->keycode[mode][index]; 511 old_keycode = ar2->keycode[mode][index];
511 ar2->keycode[mode][index] = keycode; 512 ar2->keycode[mode][index] = keycode;
512 __set_bit(keycode, idev->keybit); 513 __set_bit(keycode, idev->keybit);
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index 61d10177fa83..4f72bdd69410 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -13,6 +13,7 @@
13#include <linux/pm.h> 13#include <linux/pm.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/slab.h>
16 17
17#include <asm/portmux.h> 18#include <asm/portmux.h>
18#include <asm/bfin_rotary.h> 19#include <asm/bfin_rotary.h>
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c
index ee73d7219c92..fd8407a29631 100644
--- a/drivers/input/misc/cobalt_btns.c
+++ b/drivers/input/misc/cobalt_btns.c
@@ -22,6 +22,7 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/slab.h>
25 26
26#define BUTTONS_POLL_INTERVAL 30 /* msec */ 27#define BUTTONS_POLL_INTERVAL 30 /* msec */
27#define BUTTONS_COUNT_THRESHOLD 3 28#define BUTTONS_COUNT_THRESHOLD 3
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c
index 766c06911f41..19af682c24fb 100644
--- a/drivers/input/misc/dm355evm_keys.c
+++ b/drivers/input/misc/dm355evm_keys.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/slab.h>
13#include <linux/input.h> 14#include <linux/input.h>
14#include <linux/input/sparse-keymap.h> 15#include <linux/input/sparse-keymap.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c
index 7ea969347ca9..99335c286250 100644
--- a/drivers/input/misc/pcap_keys.c
+++ b/drivers/input/misc/pcap_keys.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/mfd/ezx-pcap.h> 19#include <linux/mfd/ezx-pcap.h>
20#include <linux/slab.h>
20 21
21struct pcap_keys { 22struct pcap_keys {
22 struct pcap_chip *pcap; 23 struct pcap_chip *pcap;
diff --git a/drivers/input/misc/pcf50633-input.c b/drivers/input/misc/pcf50633-input.c
index 008de0c5834b..95562735728d 100644
--- a/drivers/input/misc/pcf50633-input.c
+++ b/drivers/input/misc/pcf50633-input.c
@@ -20,6 +20,7 @@
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/slab.h>
23 24
24#include <linux/mfd/pcf50633/core.h> 25#include <linux/mfd/pcf50633/core.h>
25 26
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index 4ae07935985e..1f8e0108962e 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/rotary_encoder.h> 24#include <linux/rotary_encoder.h>
25#include <linux/slab.h>
25 26
26#define DRV_NAME "rotary-encoder" 27#define DRV_NAME "rotary-encoder"
27 28
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c
index be3a15f5b25d..1a80c0dab83b 100644
--- a/drivers/input/misc/sgi_btns.c
+++ b/drivers/input/misc/sgi_btns.c
@@ -22,6 +22,7 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/slab.h>
25 26
26#ifdef CONFIG_SGI_IP22 27#ifdef CONFIG_SGI_IP22
27#include <asm/sgi/ioc.h> 28#include <asm/sgi/ioc.h>
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index b064419b90a2..0d45422f8095 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -9,6 +9,7 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/input.h> 10#include <linux/input.h>
11#include <linux/of_device.h> 11#include <linux/of_device.h>
12#include <linux/slab.h>
12 13
13#include <asm/io.h> 14#include <asm/io.h>
14 15
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c
new file mode 100644
index 000000000000..fee9eac8e04a
--- /dev/null
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -0,0 +1,298 @@
1/*
2 * twl4030-vibra.c - TWL4030 Vibrator driver
3 *
4 * Copyright (C) 2008-2010 Nokia Corporation
5 *
6 * Written by Henrik Saari <henrik.saari@nokia.com>
7 * Updates by Felipe Balbi <felipe.balbi@nokia.com>
8 * Input by Jari Vanhala <ext-jari.vanhala@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 *
24 */
25
26#include <linux/module.h>
27#include <linux/jiffies.h>
28#include <linux/platform_device.h>
29#include <linux/workqueue.h>
30#include <linux/i2c/twl.h>
31#include <linux/mfd/twl4030-codec.h>
32#include <linux/input.h>
33#include <linux/slab.h>
34
35/* MODULE ID2 */
36#define LEDEN 0x00
37
38/* ForceFeedback */
39#define EFFECT_DIR_180_DEG 0x8000 /* range is 0 - 0xFFFF */
40
41struct vibra_info {
42 struct device *dev;
43 struct input_dev *input_dev;
44
45 struct workqueue_struct *workqueue;
46 struct work_struct play_work;
47
48 bool enabled;
49 int speed;
50 int direction;
51
52 bool coexist;
53};
54
55static void vibra_disable_leds(void)
56{
57 u8 reg;
58
59 /* Disable LEDA & LEDB, cannot be used with vibra (PWM) */
60 twl_i2c_read_u8(TWL4030_MODULE_LED, &reg, LEDEN);
61 reg &= ~0x03;
62 twl_i2c_write_u8(TWL4030_MODULE_LED, LEDEN, reg);
63}
64
65/* Powers H-Bridge and enables audio clk */
66static void vibra_enable(struct vibra_info *info)
67{
68 u8 reg;
69
70 twl4030_codec_enable_resource(TWL4030_CODEC_RES_POWER);
71
72 /* turn H-Bridge on */
73 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
74 &reg, TWL4030_REG_VIBRA_CTL);
75 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
76 (reg | TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
77
78 twl4030_codec_enable_resource(TWL4030_CODEC_RES_APLL);
79
80 info->enabled = true;
81}
82
83static void vibra_disable(struct vibra_info *info)
84{
85 u8 reg;
86
87 /* Power down H-Bridge */
88 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
89 &reg, TWL4030_REG_VIBRA_CTL);
90 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
91 (reg & ~TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
92
93 twl4030_codec_disable_resource(TWL4030_CODEC_RES_POWER);
94 twl4030_codec_disable_resource(TWL4030_CODEC_RES_APLL);
95
96 info->enabled = false;
97}
98
99static void vibra_play_work(struct work_struct *work)
100{
101 struct vibra_info *info = container_of(work,
102 struct vibra_info, play_work);
103 int dir;
104 int pwm;
105 u8 reg;
106
107 dir = info->direction;
108 pwm = info->speed;
109
110 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
111 &reg, TWL4030_REG_VIBRA_CTL);
112 if (pwm && (!info->coexist || !(reg & TWL4030_VIBRA_SEL))) {
113
114 if (!info->enabled)
115 vibra_enable(info);
116
117 /* set vibra rotation direction */
118 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
119 &reg, TWL4030_REG_VIBRA_CTL);
120 reg = (dir) ? (reg | TWL4030_VIBRA_DIR) :
121 (reg & ~TWL4030_VIBRA_DIR);
122 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
123 reg, TWL4030_REG_VIBRA_CTL);
124
125 /* set PWM, 1 = max, 255 = min */
126 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
127 256 - pwm, TWL4030_REG_VIBRA_SET);
128 } else {
129 if (info->enabled)
130 vibra_disable(info);
131 }
132}
133
134/*** Input/ForceFeedback ***/
135
136static int vibra_play(struct input_dev *input, void *data,
137 struct ff_effect *effect)
138{
139 struct vibra_info *info = input_get_drvdata(input);
140
141 info->speed = effect->u.rumble.strong_magnitude >> 8;
142 if (!info->speed)
143 info->speed = effect->u.rumble.weak_magnitude >> 9;
144 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 0 : 1;
145 queue_work(info->workqueue, &info->play_work);
146 return 0;
147}
148
149static int twl4030_vibra_open(struct input_dev *input)
150{
151 struct vibra_info *info = input_get_drvdata(input);
152
153 info->workqueue = create_singlethread_workqueue("vibra");
154 if (info->workqueue == NULL) {
155 dev_err(&input->dev, "couldn't create workqueue\n");
156 return -ENOMEM;
157 }
158 return 0;
159}
160
161static void twl4030_vibra_close(struct input_dev *input)
162{
163 struct vibra_info *info = input_get_drvdata(input);
164
165 cancel_work_sync(&info->play_work);
166 INIT_WORK(&info->play_work, vibra_play_work); /* cleanup */
167 destroy_workqueue(info->workqueue);
168 info->workqueue = NULL;
169
170 if (info->enabled)
171 vibra_disable(info);
172}
173
174/*** Module ***/
175#if CONFIG_PM
176static int twl4030_vibra_suspend(struct device *dev)
177{
178 struct platform_device *pdev = to_platform_device(dev);
179 struct vibra_info *info = platform_get_drvdata(pdev);
180
181 if (info->enabled)
182 vibra_disable(info);
183
184 return 0;
185}
186
187static int twl4030_vibra_resume(struct device *dev)
188{
189 vibra_disable_leds();
190 return 0;
191}
192
193static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
194 twl4030_vibra_suspend, twl4030_vibra_resume);
195#endif
196
197static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
198{
199 struct twl4030_codec_vibra_data *pdata = pdev->dev.platform_data;
200 struct vibra_info *info;
201 int ret;
202
203 if (!pdata) {
204 dev_dbg(&pdev->dev, "platform_data not available\n");
205 return -EINVAL;
206 }
207
208 info = kzalloc(sizeof(*info), GFP_KERNEL);
209 if (!info)
210 return -ENOMEM;
211
212 info->dev = &pdev->dev;
213 info->coexist = pdata->coexist;
214 INIT_WORK(&info->play_work, vibra_play_work);
215
216 info->input_dev = input_allocate_device();
217 if (info->input_dev == NULL) {
218 dev_err(&pdev->dev, "couldn't allocate input device\n");
219 ret = -ENOMEM;
220 goto err_kzalloc;
221 }
222
223 input_set_drvdata(info->input_dev, info);
224
225 info->input_dev->name = "twl4030:vibrator";
226 info->input_dev->id.version = 1;
227 info->input_dev->dev.parent = pdev->dev.parent;
228 info->input_dev->open = twl4030_vibra_open;
229 info->input_dev->close = twl4030_vibra_close;
230 __set_bit(FF_RUMBLE, info->input_dev->ffbit);
231
232 ret = input_ff_create_memless(info->input_dev, NULL, vibra_play);
233 if (ret < 0) {
234 dev_dbg(&pdev->dev, "couldn't register vibrator to FF\n");
235 goto err_ialloc;
236 }
237
238 ret = input_register_device(info->input_dev);
239 if (ret < 0) {
240 dev_dbg(&pdev->dev, "couldn't register input device\n");
241 goto err_iff;
242 }
243
244 vibra_disable_leds();
245
246 platform_set_drvdata(pdev, info);
247 return 0;
248
249err_iff:
250 input_ff_destroy(info->input_dev);
251err_ialloc:
252 input_free_device(info->input_dev);
253err_kzalloc:
254 kfree(info);
255 return ret;
256}
257
258static int __devexit twl4030_vibra_remove(struct platform_device *pdev)
259{
260 struct vibra_info *info = platform_get_drvdata(pdev);
261
262 /* this also free ff-memless and calls close if needed */
263 input_unregister_device(info->input_dev);
264 kfree(info);
265 platform_set_drvdata(pdev, NULL);
266
267 return 0;
268}
269
270static struct platform_driver twl4030_vibra_driver = {
271 .probe = twl4030_vibra_probe,
272 .remove = __devexit_p(twl4030_vibra_remove),
273 .driver = {
274 .name = "twl4030_codec_vibra",
275 .owner = THIS_MODULE,
276#ifdef CONFIG_PM
277 .pm = &twl4030_vibra_pm_ops,
278#endif
279 },
280};
281
282static int __init twl4030_vibra_init(void)
283{
284 return platform_driver_register(&twl4030_vibra_driver);
285}
286module_init(twl4030_vibra_init);
287
288static void __exit twl4030_vibra_exit(void)
289{
290 platform_driver_unregister(&twl4030_vibra_driver);
291}
292module_exit(twl4030_vibra_exit);
293
294MODULE_ALIAS("platform:twl4030_codec_vibra");
295
296MODULE_DESCRIPTION("TWL4030 Vibra driver");
297MODULE_LICENSE("GPL");
298MODULE_AUTHOR("Nokia Corporation");
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c
index cbec3dfdd42b..64f1de7960c6 100644
--- a/drivers/input/misc/winbond-cir.c
+++ b/drivers/input/misc/winbond-cir.c
@@ -56,6 +56,7 @@
56#include <linux/io.h> 56#include <linux/io.h>
57#include <linux/bitrev.h> 57#include <linux/bitrev.h>
58#include <linux/bitops.h> 58#include <linux/bitops.h>
59#include <linux/slab.h>
59 60
60#define DRVNAME "winbond-cir" 61#define DRVNAME "winbond-cir"
61 62
@@ -385,26 +386,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
385} 386}
386 387
387static int 388static int
388wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode) 389wbcir_getkeycode(struct input_dev *dev,
390 unsigned int scancode, unsigned int *keycode)
389{ 391{
390 struct wbcir_data *data = input_get_drvdata(dev); 392 struct wbcir_data *data = input_get_drvdata(dev);
391 393
392 *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode); 394 *keycode = wbcir_do_getkeycode(data, scancode);
393 return 0; 395 return 0;
394} 396}
395 397
396static int 398static int
397wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode) 399wbcir_setkeycode(struct input_dev *dev,
400 unsigned int scancode, unsigned int keycode)
398{ 401{
399 struct wbcir_data *data = input_get_drvdata(dev); 402 struct wbcir_data *data = input_get_drvdata(dev);
400 struct wbcir_keyentry *keyentry; 403 struct wbcir_keyentry *keyentry;
401 struct wbcir_keyentry *new_keyentry; 404 struct wbcir_keyentry *new_keyentry;
402 unsigned long flags; 405 unsigned long flags;
403 unsigned int old_keycode = KEY_RESERVED; 406 unsigned int old_keycode = KEY_RESERVED;
404 u32 scancode = (u32)sscancode;
405
406 if (keycode < 0 || keycode > KEY_MAX)
407 return -EINVAL;
408 407
409 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL); 408 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
410 if (!new_keyentry) 409 if (!new_keyentry)
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index c0afb71a3a6d..04d5a4a3181f 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -29,6 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/preempt.h> 30#include <linux/preempt.h>
31#include <linux/string.h> 31#include <linux/string.h>
32#include <linux/slab.h>
32#include <linux/types.h> 33#include <linux/types.h>
33#include <linux/platform_device.h> 34#include <linux/platform_device.h>
34#include <linux/leds.h> 35#include <linux/leds.h>
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index ba4f5dd7c60e..c3d7ba5f5b47 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/slab.h>
22#include <linux/kernel.h> 23#include <linux/kernel.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/input.h> 25#include <linux/input.h>
@@ -97,8 +98,9 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
97 wm831x_on->dev->phys = "wm831x_on/input0"; 98 wm831x_on->dev->phys = "wm831x_on/input0";
98 wm831x_on->dev->dev.parent = &pdev->dev; 99 wm831x_on->dev->dev.parent = &pdev->dev;
99 100
100 ret = wm831x_request_irq(wm831x, irq, wm831x_on_irq, 101 ret = request_threaded_irq(irq, NULL, wm831x_on_irq,
101 IRQF_TRIGGER_RISING, "wm831x_on", wm831x_on); 102 IRQF_TRIGGER_RISING, "wm831x_on",
103 wm831x_on);
102 if (ret < 0) { 104 if (ret < 0) {
103 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret); 105 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret);
104 goto err_input_dev; 106 goto err_input_dev;
@@ -114,7 +116,7 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
114 return 0; 116 return 0;
115 117
116err_irq: 118err_irq:
117 wm831x_free_irq(wm831x, irq, NULL); 119 free_irq(irq, wm831x_on);
118err_input_dev: 120err_input_dev:
119 input_free_device(wm831x_on->dev); 121 input_free_device(wm831x_on->dev);
120err: 122err:
@@ -127,7 +129,7 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev)
127 struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); 129 struct wm831x_on *wm831x_on = platform_get_drvdata(pdev);
128 int irq = platform_get_irq(pdev, 0); 130 int irq = platform_get_irq(pdev, 0);
129 131
130 wm831x_free_irq(wm831x_on->wm831x, irq, wm831x_on); 132 free_irq(irq, wm831x_on);
131 cancel_delayed_work_sync(&wm831x_on->work); 133 cancel_delayed_work_sync(&wm831x_on->work);
132 input_unregister_device(wm831x_on->dev); 134 input_unregister_device(wm831x_on->dev);
133 kfree(wm831x_on); 135 kfree(wm831x_on);
diff --git a/drivers/input/misc/yealink.h b/drivers/input/misc/yealink.h
index 48af0be9cbdf..1e0f52397010 100644
--- a/drivers/input/misc/yealink.h
+++ b/drivers/input/misc/yealink.h
@@ -127,7 +127,7 @@ struct yld_ctl_packet {
127 * yld_status struct. 127 * yld_status struct.
128 */ 128 */
129 129
130/* LCD, each segment must be driven seperately. 130/* LCD, each segment must be driven separately.
131 * 131 *
132 * Layout: 132 * Layout:
133 * 133 *
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index f93c2c0daf1f..0d22cb9ce42e 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -15,6 +15,7 @@
15 * the Free Software Foundation. 15 * the Free Software Foundation.
16 */ 16 */
17 17
18#include <linux/slab.h>
18#include <linux/input.h> 19#include <linux/input.h>
19#include <linux/serio.h> 20#include <linux/serio.h>
20#include <linux/libps2.h> 21#include <linux/libps2.h>
@@ -63,6 +64,9 @@ static const struct alps_model_info alps_model_data[] = {
63 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, 64 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
64 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, 65 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
65 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 66 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
67 { { 0x73, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, /* HP Pavilion dm3 */
68 { { 0x52, 0x01, 0x14 }, 0xff, 0xff,
69 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
66}; 70};
67 71
68/* 72/*
@@ -118,40 +122,27 @@ static void alps_report_buttons(struct psmouse *psmouse,
118 struct input_dev *dev1, struct input_dev *dev2, 122 struct input_dev *dev1, struct input_dev *dev2,
119 int left, int right, int middle) 123 int left, int right, int middle)
120{ 124{
121 struct alps_data *priv = psmouse->private; 125 struct input_dev *dev;
122 const struct alps_model_info *model = priv->i;
123
124 if (model->flags & ALPS_PS2_INTERLEAVED) {
125 struct input_dev *dev;
126 126
127 /* 127 /*
128 * If shared button has already been reported on the 128 * If shared button has already been reported on the
129 * other device (dev2) then this event should be also 129 * other device (dev2) then this event should be also
130 * sent through that device. 130 * sent through that device.
131 */ 131 */
132 dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1; 132 dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
133 input_report_key(dev, BTN_LEFT, left); 133 input_report_key(dev, BTN_LEFT, left);
134 134
135 dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1; 135 dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
136 input_report_key(dev, BTN_RIGHT, right); 136 input_report_key(dev, BTN_RIGHT, right);
137 137
138 dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1; 138 dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
139 input_report_key(dev, BTN_MIDDLE, middle); 139 input_report_key(dev, BTN_MIDDLE, middle);
140 140
141 /* 141 /*
142 * Sync the _other_ device now, we'll do the first 142 * Sync the _other_ device now, we'll do the first
143 * device later once we report the rest of the events. 143 * device later once we report the rest of the events.
144 */ 144 */
145 input_sync(dev2); 145 input_sync(dev2);
146 } else {
147 /*
148 * For devices with non-interleaved packets we know what
149 * device buttons belong to so we can simply report them.
150 */
151 input_report_key(dev1, BTN_LEFT, left);
152 input_report_key(dev1, BTN_RIGHT, right);
153 input_report_key(dev1, BTN_MIDDLE, middle);
154 }
155} 146}
156 147
157static void alps_process_packet(struct psmouse *psmouse) 148static void alps_process_packet(struct psmouse *psmouse)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 908b5b44052f..53ec7ddd1826 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -205,8 +205,8 @@ struct atp {
205 bool overflow_warned; 205 bool overflow_warned;
206 int x_old; /* last reported x/y, */ 206 int x_old; /* last reported x/y, */
207 int y_old; /* used for smoothing */ 207 int y_old; /* used for smoothing */
208 signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; 208 u8 xy_cur[ATP_XSENSORS + ATP_YSENSORS];
209 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 209 u8 xy_old[ATP_XSENSORS + ATP_YSENSORS];
210 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 210 int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
211 int idlecount; /* number of empty packets */ 211 int idlecount; /* number of empty packets */
212 struct work_struct work; 212 struct work_struct work;
@@ -531,7 +531,7 @@ static void atp_complete_geyser_1_2(struct urb *urb)
531 531
532 for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { 532 for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
533 /* accumulate the change */ 533 /* accumulate the change */
534 signed char change = dev->xy_old[i] - dev->xy_cur[i]; 534 int change = dev->xy_old[i] - dev->xy_cur[i];
535 dev->xy_acc[i] -= change; 535 dev->xy_acc[i] -= change;
536 536
537 /* prevent down drifting */ 537 /* prevent down drifting */
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 4f8fe0886b2a..b89879bd860f 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -803,7 +803,6 @@ static struct usb_driver bcm5974_driver = {
803 .disconnect = bcm5974_disconnect, 803 .disconnect = bcm5974_disconnect,
804 .suspend = bcm5974_suspend, 804 .suspend = bcm5974_suspend,
805 .resume = bcm5974_resume, 805 .resume = bcm5974_resume,
806 .reset_resume = bcm5974_resume,
807 .id_table = bcm5974_table, 806 .id_table = bcm5974_table,
808 .supports_autosuspend = 1, 807 .supports_autosuspend = 1,
809}; 808};
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b27684f267bf..a138b5da79f9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/slab.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/input.h> 16#include <linux/input.h>
16#include <linux/serio.h> 17#include <linux/serio.h>
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 9169d1591c1f..08d66d820d2b 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -30,6 +30,7 @@
30 */ 30 */
31 31
32#define DEBUG 32#define DEBUG
33#include <linux/slab.h>
33#include <linux/input.h> 34#include <linux/input.h>
34#include <linux/serio.h> 35#include <linux/serio.h>
35#include <linux/libps2.h> 36#include <linux/libps2.h>
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 7c1d7d420ae3..c31ad11df6bb 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -16,6 +16,7 @@
16#include <linux/serio.h> 16#include <linux/serio.h>
17#include <linux/libps2.h> 17#include <linux/libps2.h>
18#include <linux/dmi.h> 18#include <linux/dmi.h>
19#include <linux/slab.h>
19 20
20#include "psmouse.h" 21#include "psmouse.h"
21#include "lifebook.h" 22#include "lifebook.h"
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c
index 1e827ad0afbe..943cfec15665 100644
--- a/drivers/input/mouse/pxa930_trkball.c
+++ b/drivers/input/mouse/pxa930_trkball.c
@@ -18,6 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/slab.h>
21 22
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/pxa930_trkball.h> 24#include <mach/pxa930_trkball.h>
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 81a6b81cb2fe..1242775fee19 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -26,6 +26,7 @@
26#include <linux/libps2.h> 26#include <linux/libps2.h>
27#include <linux/serio.h> 27#include <linux/serio.h>
28#include <linux/jiffies.h> 28#include <linux/jiffies.h>
29#include <linux/slab.h>
29 30
30#include "psmouse.h" 31#include "psmouse.h"
31#include "sentelic.h" 32#include "sentelic.h"
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d3f5243fa093..026df6010161 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -28,6 +28,7 @@
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/serio.h> 29#include <linux/serio.h>
30#include <linux/libps2.h> 30#include <linux/libps2.h>
31#include <linux/slab.h>
31#include "psmouse.h" 32#include "psmouse.h"
32#include "synaptics.h" 33#include "synaptics.h"
33 34
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index 9867dfe2a638..8291e7399ffa 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -17,6 +17,7 @@
17#include <linux/input.h> 17#include <linux/input.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/slab.h>
20 21
21#define DRIVER_NAME "synaptics_i2c" 22#define DRIVER_NAME "synaptics_i2c"
22/* maximum product id is 15 characters */ 23/* maximum product id is 15 characters */
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c
index 909431c31ab4..88121c59c3cc 100644
--- a/drivers/input/mouse/touchkit_ps2.c
+++ b/drivers/input/mouse/touchkit_ps2.c
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/slab.h>
30 29
31#include <linux/input.h> 30#include <linux/input.h>
32#include <linux/serio.h> 31#include <linux/serio.h>
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 63d4a67830f2..0643e49ca603 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -8,6 +8,7 @@
8 * Trademarks are the property of their respective owners. 8 * Trademarks are the property of their respective owners.
9 */ 9 */
10 10
11#include <linux/slab.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/serio.h> 13#include <linux/serio.h>
13#include <linux/module.h> 14#include <linux/module.h>
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index a13d80f7da17..f34b22bce4ff 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/smp_lock.h>
19#include <linux/poll.h> 18#include <linux/poll.h>
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/init.h> 20#include <linux/init.h>
@@ -542,10 +541,8 @@ static int mousedev_open(struct inode *inode, struct file *file)
542 if (i >= MOUSEDEV_MINORS) 541 if (i >= MOUSEDEV_MINORS)
543 return -ENODEV; 542 return -ENODEV;
544 543
545 lock_kernel();
546 error = mutex_lock_interruptible(&mousedev_table_mutex); 544 error = mutex_lock_interruptible(&mousedev_table_mutex);
547 if (error) { 545 if (error) {
548 unlock_kernel();
549 return error; 546 return error;
550 } 547 }
551 mousedev = mousedev_table[i]; 548 mousedev = mousedev_table[i];
@@ -554,7 +551,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
554 mutex_unlock(&mousedev_table_mutex); 551 mutex_unlock(&mousedev_table_mutex);
555 552
556 if (!mousedev) { 553 if (!mousedev) {
557 unlock_kernel();
558 return -ENODEV; 554 return -ENODEV;
559 } 555 }
560 556
@@ -575,7 +571,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
575 goto err_free_client; 571 goto err_free_client;
576 572
577 file->private_data = client; 573 file->private_data = client;
578 unlock_kernel();
579 return 0; 574 return 0;
580 575
581 err_free_client: 576 err_free_client:
@@ -583,7 +578,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
583 kfree(client); 578 kfree(client);
584 err_put_mousedev: 579 err_put_mousedev:
585 put_device(&mousedev->dev); 580 put_device(&mousedev->dev);
586 unlock_kernel();
587 return error; 581 return error;
588} 582}
589 583
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c
index 320b7ca48bf8..7998560a1904 100644
--- a/drivers/input/serio/altera_ps2.c
+++ b/drivers/input/serio/altera_ps2.c
@@ -18,6 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/slab.h>
21 22
22#define DRV_NAME "altera_ps2" 23#define DRV_NAME "altera_ps2"
23 24
diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
index b54452a8c771..6ee8f0ddad51 100644
--- a/drivers/input/serio/at32psif.c
+++ b/drivers/input/serio/at32psif.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/slab.h>
21 22
22/* PSIF register offsets */ 23/* PSIF register offsets */
23#define PSIF_CR 0x00 24#define PSIF_CR 0x00
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c
index d1380fc72cc6..4a3084695c00 100644
--- a/drivers/input/serio/ct82c710.c
+++ b/drivers/input/serio/ct82c710.c
@@ -35,6 +35,7 @@
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/slab.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40 41
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index 06addfa7cc47..3c287dd879d3 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h>
27#include <linux/serio.h> 28#include <linux/serio.h>
28#include <linux/input.h> 29#include <linux/input.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 6cd03ebaf5fb..c92f4edfee7b 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -58,6 +58,7 @@
58#include <linux/module.h> 58#include <linux/module.h>
59#include <linux/init.h> 59#include <linux/init.h>
60#include <linux/interrupt.h> 60#include <linux/interrupt.h>
61#include <linux/slab.h>
61#include <linux/timer.h> 62#include <linux/timer.h>
62#include <linux/list.h> 63#include <linux/list.h>
63 64
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 2a5982e532f8..ead0494721d0 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -442,6 +442,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
442 }, 442 },
443 }, 443 },
444 { 444 {
445 /* Medion Akoya E1222 */
446 .matches = {
447 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
448 DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
449 },
450 },
451 {
445 /* Mivvy M310 */ 452 /* Mivvy M310 */
446 .matches = { 453 .matches = {
447 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), 454 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
@@ -624,6 +631,9 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
624 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); 631 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
625 } 632 }
626 633
634 /* Keyboard ports are always supposed to be wakeup-enabled */
635 device_set_wakeup_enable(&dev->dev, true);
636
627 i8042_pnp_kbd_devices++; 637 i8042_pnp_kbd_devices++;
628 return 0; 638 return 0;
629} 639}
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index b54aee7cd9e3..6440a8f55686 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -21,6 +21,7 @@
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/i8042.h> 23#include <linux/i8042.h>
24#include <linux/slab.h>
24 25
25#include <asm/io.h> 26#include <asm/io.h>
26 27
@@ -38,7 +39,7 @@ MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port.");
38 39
39static bool i8042_nomux; 40static bool i8042_nomux;
40module_param_named(nomux, i8042_nomux, bool, 0); 41module_param_named(nomux, i8042_nomux, bool, 0);
41MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing conrtoller is present."); 42MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing controller is present.");
42 43
43static bool i8042_unlock; 44static bool i8042_unlock;
44module_param_named(unlock, i8042_unlock, bool, 0); 45module_param_named(unlock, i8042_unlock, bool, 0);
@@ -430,7 +431,7 @@ static bool i8042_filter(unsigned char data, unsigned char str,
430 } 431 }
431 432
432 if (i8042_platform_filter && i8042_platform_filter(data, str, serio)) { 433 if (i8042_platform_filter && i8042_platform_filter(data, str, serio)) {
433 dbg("Filtered out by platfrom filter\n"); 434 dbg("Filtered out by platform filter\n");
434 return true; 435 return true;
435 } 436 }
436 437
@@ -1386,6 +1387,8 @@ static int __init i8042_probe(struct platform_device *dev)
1386{ 1387{
1387 int error; 1388 int error;
1388 1389
1390 i8042_platform_device = dev;
1391
1389 error = i8042_controller_selftest(); 1392 error = i8042_controller_selftest();
1390 if (error) 1393 if (error)
1391 return error; 1394 return error;
@@ -1421,6 +1424,7 @@ static int __init i8042_probe(struct platform_device *dev)
1421 i8042_free_aux_ports(); /* in case KBD failed but AUX not */ 1424 i8042_free_aux_ports(); /* in case KBD failed but AUX not */
1422 i8042_free_irqs(); 1425 i8042_free_irqs();
1423 i8042_controller_reset(); 1426 i8042_controller_reset();
1427 i8042_platform_device = NULL;
1424 1428
1425 return error; 1429 return error;
1426} 1430}
@@ -1430,6 +1434,7 @@ static int __devexit i8042_remove(struct platform_device *dev)
1430 i8042_unregister_ports(); 1434 i8042_unregister_ports();
1431 i8042_free_irqs(); 1435 i8042_free_irqs();
1432 i8042_controller_reset(); 1436 i8042_controller_reset();
1437 i8042_platform_device = NULL;
1433 1438
1434 return 0; 1439 return 0;
1435} 1440}
@@ -1448,6 +1453,7 @@ static struct platform_driver i8042_driver = {
1448 1453
1449static int __init i8042_init(void) 1454static int __init i8042_init(void)
1450{ 1455{
1456 struct platform_device *pdev;
1451 int err; 1457 int err;
1452 1458
1453 dbg_init(); 1459 dbg_init();
@@ -1460,31 +1466,18 @@ static int __init i8042_init(void)
1460 if (err) 1466 if (err)
1461 goto err_platform_exit; 1467 goto err_platform_exit;
1462 1468
1463 i8042_platform_device = platform_device_alloc("i8042", -1); 1469 pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0);
1464 if (!i8042_platform_device) { 1470 if (IS_ERR(pdev)) {
1465 err = -ENOMEM; 1471 err = PTR_ERR(pdev);
1466 goto err_platform_exit; 1472 goto err_platform_exit;
1467 } 1473 }
1468 1474
1469 err = platform_device_add(i8042_platform_device);
1470 if (err)
1471 goto err_free_device;
1472
1473 err = platform_driver_probe(&i8042_driver, i8042_probe);
1474 if (err)
1475 goto err_del_device;
1476
1477 panic_blink = i8042_panic_blink; 1475 panic_blink = i8042_panic_blink;
1478 1476
1479 return 0; 1477 return 0;
1480 1478
1481 err_del_device:
1482 platform_device_del(i8042_platform_device);
1483 err_free_device:
1484 platform_device_put(i8042_platform_device);
1485 err_platform_exit: 1479 err_platform_exit:
1486 i8042_platform_exit(); 1480 i8042_platform_exit();
1487
1488 return err; 1481 return err;
1489} 1482}
1490 1483
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index f3876acc3e83..980af94ba9c8 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -14,7 +14,6 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/slab.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/input.h> 18#include <linux/input.h>
20#include <linux/serio.h> 19#include <linux/serio.h>
diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c
index b089977e0ef9..26b45936f9fd 100644
--- a/drivers/input/serio/parkbd.c
+++ b/drivers/input/serio/parkbd.c
@@ -46,6 +46,7 @@
46 46
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/parport.h> 48#include <linux/parport.h>
49#include <linux/slab.h>
49#include <linux/init.h> 50#include <linux/init.h>
50#include <linux/serio.h> 51#include <linux/serio.h>
51 52
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c
index 797314be7af2..43494742541c 100644
--- a/drivers/input/serio/pcips2.c
+++ b/drivers/input/serio/pcips2.c
@@ -15,6 +15,7 @@
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/slab.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/serio.h> 20#include <linux/serio.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c
index e36a0901646c..5eb84b3b67fb 100644
--- a/drivers/input/serio/q40kbd.c
+++ b/drivers/input/serio/q40kbd.c
@@ -36,6 +36,7 @@
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/bitops.h> 37#include <linux/bitops.h>
38#include <linux/platform_device.h> 38#include <linux/platform_device.h>
39#include <linux/slab.h>
39 40
40#include <asm/io.h> 41#include <asm/io.h>
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
index ed045c99f84b..9da6fbcaaa7e 100644
--- a/drivers/input/serio/rpckbd.c
+++ b/drivers/input/serio/rpckbd.c
@@ -34,6 +34,7 @@
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/slab.h>
37 38
38#include <asm/irq.h> 39#include <asm/irq.h>
39#include <mach/hardware.h> 40#include <mach/hardware.h>
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index 27fdaaffbb40..998664854440 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -81,12 +81,12 @@ static int serio_raw_open(struct inode *inode, struct file *file)
81 struct serio_raw_list *list; 81 struct serio_raw_list *list;
82 int retval = 0; 82 int retval = 0;
83 83
84 lock_kernel();
85 retval = mutex_lock_interruptible(&serio_raw_mutex); 84 retval = mutex_lock_interruptible(&serio_raw_mutex);
86 if (retval) 85 if (retval)
87 goto out_bkl; 86 return retval;
88 87
89 if (!(serio_raw = serio_raw_locate(iminor(inode)))) { 88 serio_raw = serio_raw_locate(iminor(inode));
89 if (!serio_raw) {
90 retval = -ENODEV; 90 retval = -ENODEV;
91 goto out; 91 goto out;
92 } 92 }
@@ -96,7 +96,8 @@ static int serio_raw_open(struct inode *inode, struct file *file)
96 goto out; 96 goto out;
97 } 97 }
98 98
99 if (!(list = kzalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { 99 list = kzalloc(sizeof(struct serio_raw_list), GFP_KERNEL);
100 if (!list) {
100 retval = -ENOMEM; 101 retval = -ENOMEM;
101 goto out; 102 goto out;
102 } 103 }
@@ -109,8 +110,6 @@ static int serio_raw_open(struct inode *inode, struct file *file)
109 110
110out: 111out:
111 mutex_unlock(&serio_raw_mutex); 112 mutex_unlock(&serio_raw_mutex);
112out_bkl:
113 unlock_kernel();
114 return retval; 113 return retval;
115} 114}
116 115
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index 8298e1f68234..f84f8e32e3f1 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -19,6 +19,7 @@
19#include <linux/serio.h> 19#include <linux/serio.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/slab.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/list.h> 24#include <linux/list.h>
24#include <linux/io.h> 25#include <linux/io.h>
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index fbd3987af57f..014248344763 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/input/sparse-keymap.h> 17#include <linux/input/sparse-keymap.h>
18#include <linux/slab.h>
18 19
19MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); 20MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>");
20MODULE_DESCRIPTION("Generic support for sparse keymaps"); 21MODULE_DESCRIPTION("Generic support for sparse keymaps");
@@ -64,36 +65,39 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
64EXPORT_SYMBOL(sparse_keymap_entry_from_keycode); 65EXPORT_SYMBOL(sparse_keymap_entry_from_keycode);
65 66
66static int sparse_keymap_getkeycode(struct input_dev *dev, 67static int sparse_keymap_getkeycode(struct input_dev *dev,
67 int scancode, int *keycode) 68 unsigned int scancode,
69 unsigned int *keycode)
68{ 70{
69 const struct key_entry *key = 71 const struct key_entry *key;
70 sparse_keymap_entry_from_scancode(dev, scancode);
71 72
72 if (key && key->type == KE_KEY) { 73 if (dev->keycode) {
73 *keycode = key->keycode; 74 key = sparse_keymap_entry_from_scancode(dev, scancode);
74 return 0; 75 if (key && key->type == KE_KEY) {
76 *keycode = key->keycode;
77 return 0;
78 }
75 } 79 }
76 80
77 return -EINVAL; 81 return -EINVAL;
78} 82}
79 83
80static int sparse_keymap_setkeycode(struct input_dev *dev, 84static int sparse_keymap_setkeycode(struct input_dev *dev,
81 int scancode, int keycode) 85 unsigned int scancode,
86 unsigned int keycode)
82{ 87{
83 struct key_entry *key; 88 struct key_entry *key;
84 int old_keycode; 89 int old_keycode;
85 90
86 if (keycode < 0 || keycode > KEY_MAX) 91 if (dev->keycode) {
87 return -EINVAL; 92 key = sparse_keymap_entry_from_scancode(dev, scancode);
88 93 if (key && key->type == KE_KEY) {
89 key = sparse_keymap_entry_from_scancode(dev, scancode); 94 old_keycode = key->keycode;
90 if (key && key->type == KE_KEY) { 95 key->keycode = keycode;
91 old_keycode = key->keycode; 96 set_bit(keycode, dev->keybit);
92 key->keycode = keycode; 97 if (!sparse_keymap_entry_from_keycode(dev, old_keycode))
93 set_bit(keycode, dev->keybit); 98 clear_bit(old_keycode, dev->keybit);
94 if (!sparse_keymap_entry_from_keycode(dev, old_keycode)) 99 return 0;
95 clear_bit(old_keycode, dev->keybit); 100 }
96 return 0;
97 } 101 }
98 102
99 return -EINVAL; 103 return -EINVAL;
@@ -161,7 +165,7 @@ int sparse_keymap_setup(struct input_dev *dev,
161 return 0; 165 return 0;
162 166
163 err_out: 167 err_out:
164 kfree(keymap); 168 kfree(map);
165 return error; 169 return error;
166 170
167} 171}
@@ -173,14 +177,27 @@ EXPORT_SYMBOL(sparse_keymap_setup);
173 * 177 *
174 * This function is used to free memory allocated by sparse keymap 178 * This function is used to free memory allocated by sparse keymap
175 * in an input device that was set up by sparse_keymap_setup(). 179 * in an input device that was set up by sparse_keymap_setup().
180 * NOTE: It is safe to cal this function while input device is
181 * still registered (however the drivers should care not to try to
182 * use freed keymap and thus have to shut off interrups/polling
183 * before freeing the keymap).
176 */ 184 */
177void sparse_keymap_free(struct input_dev *dev) 185void sparse_keymap_free(struct input_dev *dev)
178{ 186{
187 unsigned long flags;
188
189 /*
190 * Take event lock to prevent racing with input_get_keycode()
191 * and input_set_keycode() if we are called while input device
192 * is still registered.
193 */
194 spin_lock_irqsave(&dev->event_lock, flags);
195
179 kfree(dev->keycode); 196 kfree(dev->keycode);
180 dev->keycode = NULL; 197 dev->keycode = NULL;
181 dev->keycodemax = 0; 198 dev->keycodemax = 0;
182 dev->getkeycode = NULL; 199
183 dev->setkeycode = NULL; 200 spin_unlock_irqrestore(&dev->event_lock, flags);
184} 201}
185EXPORT_SYMBOL(sparse_keymap_free); 202EXPORT_SYMBOL(sparse_keymap_free);
186 203
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 7d005a3616d7..4be039d7dcad 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -362,7 +362,7 @@ static const int macroKeyEvents[] = {
362}; 362};
363 363
364/*********************************************************************** 364/***********************************************************************
365 * Map values to strings and back. Every map shoudl have the following 365 * Map values to strings and back. Every map should have the following
366 * as its last element: { NULL, AIPTEK_INVALID_VALUE }. 366 * as its last element: { NULL, AIPTEK_INVALID_VALUE }.
367 */ 367 */
368#define AIPTEK_INVALID_VALUE -1 368#define AIPTEK_INVALID_VALUE -1
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index a1770e6feeec..f46502589e4e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -371,7 +371,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
371 } else if (pen) { 371 } else if (pen) {
372 /* penabled only accepts exact bytes of data */ 372 /* penabled only accepts exact bytes of data */
373 if (features->type == TABLETPC2FG) 373 if (features->type == TABLETPC2FG)
374 features->pktlen = WACOM_PKGLEN_PENABLED; 374 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
375 features->device_type = BTN_TOOL_PEN; 375 features->device_type = BTN_TOOL_PEN;
376 features->x_max = 376 features->x_max =
377 wacom_le16_to_cpu(&report[i + 3]); 377 wacom_le16_to_cpu(&report[i + 3]);
@@ -410,7 +410,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
410 } else if (pen) { 410 } else if (pen) {
411 /* penabled only accepts exact bytes of data */ 411 /* penabled only accepts exact bytes of data */
412 if (features->type == TABLETPC2FG) 412 if (features->type == TABLETPC2FG)
413 features->pktlen = WACOM_PKGLEN_PENABLED; 413 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
414 features->device_type = BTN_TOOL_PEN; 414 features->device_type = BTN_TOOL_PEN;
415 features->y_max = 415 features->y_max =
416 wacom_le16_to_cpu(&report[i + 3]); 416 wacom_le16_to_cpu(&report[i + 3]);
@@ -673,13 +673,15 @@ static int wacom_resume(struct usb_interface *intf)
673 int rv; 673 int rv;
674 674
675 mutex_lock(&wacom->lock); 675 mutex_lock(&wacom->lock);
676 if (wacom->open) { 676
677 /* switch to wacom mode first */
678 wacom_query_tablet_data(intf, features);
679
680 if (wacom->open)
677 rv = usb_submit_urb(wacom->irq, GFP_NOIO); 681 rv = usb_submit_urb(wacom->irq, GFP_NOIO);
678 /* switch to wacom mode if needed */ 682 else
679 if (!wacom_retrieve_hid_descriptor(intf, features))
680 wacom_query_tablet_data(intf, features);
681 } else
682 rv = 0; 683 rv = 0;
684
683 mutex_unlock(&wacom->lock); 685 mutex_unlock(&wacom->lock);
684 686
685 return rv; 687 return rv;
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 3d81443e683a..4a852d815c68 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1028,7 +1028,7 @@ static const struct wacom_features wacom_features_0x93 =
1028static const struct wacom_features wacom_features_0x9A = 1028static const struct wacom_features wacom_features_0x9A =
1029 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1029 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1030static const struct wacom_features wacom_features_0x9F = 1030static const struct wacom_features wacom_features_0x9F =
1031 { "Wacom ISDv4 9F", WACOM_PKGLEN_PENABLED, 26202, 16325, 255, 0, TABLETPC }; 1031 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1032static const struct wacom_features wacom_features_0xE2 = 1032static const struct wacom_features wacom_features_0xE2 =
1033 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 1033 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
1034static const struct wacom_features wacom_features_0xE3 = 1034static const struct wacom_features wacom_features_0xE3 =
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 8590b1e8ec37..b50cf04e61a8 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -17,7 +17,6 @@
17#define WACOM_PKGLEN_GRAPHIRE 8 17#define WACOM_PKGLEN_GRAPHIRE 8
18#define WACOM_PKGLEN_BBFUN 9 18#define WACOM_PKGLEN_BBFUN 9
19#define WACOM_PKGLEN_INTUOS 10 19#define WACOM_PKGLEN_INTUOS 10
20#define WACOM_PKGLEN_PENABLED 8
21#define WACOM_PKGLEN_TPC1FG 5 20#define WACOM_PKGLEN_TPC1FG 5
22#define WACOM_PKGLEN_TPC2FG 14 21#define WACOM_PKGLEN_TPC2FG 14
23 22
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
new file mode 100644
index 000000000000..b3aebc2166ba
--- /dev/null
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -0,0 +1,237 @@
1/*
2 * Touchscreen driver for Marvell 88PM860x
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/platform_device.h>
14#include <linux/i2c.h>
15#include <linux/input.h>
16#include <linux/mfd/88pm860x.h>
17#include <linux/slab.h>
18
19#define MEAS_LEN (8)
20#define ACCURATE_BIT (12)
21
22/* touch register */
23#define MEAS_EN3 (0x52)
24
25#define MEAS_TSIX_1 (0x8D)
26#define MEAS_TSIX_2 (0x8E)
27#define MEAS_TSIY_1 (0x8F)
28#define MEAS_TSIY_2 (0x90)
29#define MEAS_TSIZ1_1 (0x91)
30#define MEAS_TSIZ1_2 (0x92)
31#define MEAS_TSIZ2_1 (0x93)
32#define MEAS_TSIZ2_2 (0x94)
33
34/* bit definitions of touch */
35#define MEAS_PD_EN (1 << 3)
36#define MEAS_TSIX_EN (1 << 4)
37#define MEAS_TSIY_EN (1 << 5)
38#define MEAS_TSIZ1_EN (1 << 6)
39#define MEAS_TSIZ2_EN (1 << 7)
40
41struct pm860x_touch {
42 struct input_dev *idev;
43 struct i2c_client *i2c;
44 struct pm860x_chip *chip;
45 int irq;
46 int res_x; /* resistor of Xplate */
47};
48
49static irqreturn_t pm860x_touch_handler(int irq, void *data)
50{
51 struct pm860x_touch *touch = data;
52 struct pm860x_chip *chip = touch->chip;
53 unsigned char buf[MEAS_LEN];
54 int x, y, pen_down;
55 int z1, z2, rt = 0;
56 int ret;
57
58 ret = pm860x_bulk_read(touch->i2c, MEAS_TSIX_1, MEAS_LEN, buf);
59 if (ret < 0)
60 goto out;
61
62 pen_down = buf[1] & (1 << 6);
63 x = ((buf[0] & 0xFF) << 4) | (buf[1] & 0x0F);
64 y = ((buf[2] & 0xFF) << 4) | (buf[3] & 0x0F);
65 z1 = ((buf[4] & 0xFF) << 4) | (buf[5] & 0x0F);
66 z2 = ((buf[6] & 0xFF) << 4) | (buf[7] & 0x0F);
67
68 if (pen_down) {
69 if ((x != 0) && (z1 != 0) && (touch->res_x != 0)) {
70 rt = z2 / z1 - 1;
71 rt = (rt * touch->res_x * x) >> ACCURATE_BIT;
72 dev_dbg(chip->dev, "z1:%d, z2:%d, rt:%d\n",
73 z1, z2, rt);
74 }
75 input_report_abs(touch->idev, ABS_X, x);
76 input_report_abs(touch->idev, ABS_Y, y);
77 input_report_abs(touch->idev, ABS_PRESSURE, rt);
78 input_report_key(touch->idev, BTN_TOUCH, 1);
79 dev_dbg(chip->dev, "pen down at [%d, %d].\n", x, y);
80 } else {
81 input_report_abs(touch->idev, ABS_PRESSURE, 0);
82 input_report_key(touch->idev, BTN_TOUCH, 0);
83 dev_dbg(chip->dev, "pen release\n");
84 }
85 input_sync(touch->idev);
86
87out:
88 return IRQ_HANDLED;
89}
90
91static int pm860x_touch_open(struct input_dev *dev)
92{
93 struct pm860x_touch *touch = input_get_drvdata(dev);
94 int data, ret;
95
96 data = MEAS_PD_EN | MEAS_TSIX_EN | MEAS_TSIY_EN
97 | MEAS_TSIZ1_EN | MEAS_TSIZ2_EN;
98 ret = pm860x_set_bits(touch->i2c, MEAS_EN3, data, data);
99 if (ret < 0)
100 goto out;
101 return 0;
102out:
103 return ret;
104}
105
106static void pm860x_touch_close(struct input_dev *dev)
107{
108 struct pm860x_touch *touch = input_get_drvdata(dev);
109 int data;
110
111 data = MEAS_PD_EN | MEAS_TSIX_EN | MEAS_TSIY_EN
112 | MEAS_TSIZ1_EN | MEAS_TSIZ2_EN;
113 pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
114}
115
116static int __devinit pm860x_touch_probe(struct platform_device *pdev)
117{
118 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
119 struct pm860x_platform_data *pm860x_pdata = \
120 pdev->dev.parent->platform_data;
121 struct pm860x_touch_pdata *pdata = NULL;
122 struct pm860x_touch *touch;
123 int irq, ret;
124
125 irq = platform_get_irq(pdev, 0);
126 if (irq < 0) {
127 dev_err(&pdev->dev, "No IRQ resource!\n");
128 return -EINVAL;
129 }
130
131 if (!pm860x_pdata) {
132 dev_err(&pdev->dev, "platform data is missing\n");
133 return -EINVAL;
134 }
135
136 pdata = pm860x_pdata->touch;
137 if (!pdata) {
138 dev_err(&pdev->dev, "touchscreen data is missing\n");
139 return -EINVAL;
140 }
141
142 touch = kzalloc(sizeof(struct pm860x_touch), GFP_KERNEL);
143 if (touch == NULL)
144 return -ENOMEM;
145 dev_set_drvdata(&pdev->dev, touch);
146
147 touch->idev = input_allocate_device();
148 if (touch->idev == NULL) {
149 dev_err(&pdev->dev, "Failed to allocate input device!\n");
150 ret = -ENOMEM;
151 goto out;
152 }
153
154 touch->idev->name = "88pm860x-touch";
155 touch->idev->phys = "88pm860x/input0";
156 touch->idev->id.bustype = BUS_I2C;
157 touch->idev->dev.parent = &pdev->dev;
158 touch->idev->open = pm860x_touch_open;
159 touch->idev->close = pm860x_touch_close;
160 touch->chip = chip;
161 touch->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
162 touch->irq = irq + chip->irq_base;
163 touch->res_x = pdata->res_x;
164 input_set_drvdata(touch->idev, touch);
165
166 ret = request_threaded_irq(touch->irq, NULL, pm860x_touch_handler,
167 IRQF_ONESHOT, "touch", touch);
168 if (ret < 0)
169 goto out_irq;
170
171 __set_bit(EV_ABS, touch->idev->evbit);
172 __set_bit(ABS_X, touch->idev->absbit);
173 __set_bit(ABS_Y, touch->idev->absbit);
174 __set_bit(ABS_PRESSURE, touch->idev->absbit);
175 __set_bit(EV_SYN, touch->idev->evbit);
176 __set_bit(EV_KEY, touch->idev->evbit);
177 __set_bit(BTN_TOUCH, touch->idev->keybit);
178
179 input_set_abs_params(touch->idev, ABS_X, 0, 1 << ACCURATE_BIT, 0, 0);
180 input_set_abs_params(touch->idev, ABS_Y, 0, 1 << ACCURATE_BIT, 0, 0);
181 input_set_abs_params(touch->idev, ABS_PRESSURE, 0, 1 << ACCURATE_BIT,
182 0, 0);
183
184 ret = input_register_device(touch->idev);
185 if (ret < 0) {
186 dev_err(chip->dev, "Failed to register touch!\n");
187 goto out_rg;
188 }
189
190 platform_set_drvdata(pdev, touch);
191 return 0;
192out_rg:
193 free_irq(touch->irq, touch);
194out_irq:
195 input_free_device(touch->idev);
196out:
197 kfree(touch);
198 return ret;
199}
200
201static int __devexit pm860x_touch_remove(struct platform_device *pdev)
202{
203 struct pm860x_touch *touch = platform_get_drvdata(pdev);
204
205 input_unregister_device(touch->idev);
206 free_irq(touch->irq, touch);
207 platform_set_drvdata(pdev, NULL);
208 kfree(touch);
209 return 0;
210}
211
212static struct platform_driver pm860x_touch_driver = {
213 .driver = {
214 .name = "88pm860x-touch",
215 .owner = THIS_MODULE,
216 },
217 .probe = pm860x_touch_probe,
218 .remove = __devexit_p(pm860x_touch_remove),
219};
220
221static int __init pm860x_touch_init(void)
222{
223 return platform_driver_register(&pm860x_touch_driver);
224}
225module_init(pm860x_touch_init);
226
227static void __exit pm860x_touch_exit(void)
228{
229 platform_driver_unregister(&pm860x_touch_driver);
230}
231module_exit(pm860x_touch_exit);
232
233MODULE_DESCRIPTION("Touchscreen driver for Marvell Semiconductor 88PM860x");
234MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
235MODULE_LICENSE("GPL");
236MODULE_ALIAS("platform:88pm860x-touch");
237
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 6457e060ae49..8a8fa4d2d6a8 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -11,18 +11,31 @@ menuconfig INPUT_TOUCHSCREEN
11 11
12if INPUT_TOUCHSCREEN 12if INPUT_TOUCHSCREEN
13 13
14config TOUCHSCREEN_88PM860X
15 tristate "Marvell 88PM860x touchscreen"
16 depends on MFD_88PM860X
17 help
18 Say Y here if you have a 88PM860x PMIC and want to enable
19 support for the built-in touchscreen.
20
21 If unsure, say N.
22
23 To compile this driver as a module, choose M here: the
24 module will be called 88pm860x-ts.
25
14config TOUCHSCREEN_ADS7846 26config TOUCHSCREEN_ADS7846
15 tristate "ADS7846/TSC2046 and ADS7843 based touchscreens" 27 tristate "ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens"
16 depends on SPI_MASTER 28 depends on SPI_MASTER
17 depends on HWMON = n || HWMON 29 depends on HWMON = n || HWMON
18 help 30 help
19 Say Y here if you have a touchscreen interface using the 31 Say Y here if you have a touchscreen interface using the
20 ADS7846/TSC2046 or ADS7843 controller, and your board-specific 32 ADS7846/TSC2046/AD7873 or ADS7843/AD7843 controller,
21 setup code includes that in its table of SPI devices. 33 and your board-specific setup code includes that in its
34 table of SPI devices.
22 35
23 If HWMON is selected, and the driver is told the reference voltage 36 If HWMON is selected, and the driver is told the reference voltage
24 on your board, you will also get hwmon interfaces for the voltage 37 on your board, you will also get hwmon interfaces for the voltage
25 (and on ads7846/tsc2046, temperature) sensors of this chip. 38 (and on ads7846/tsc2046/ad7873, temperature) sensors of this chip.
26 39
27 If unsure, say N (but it's safe to say "Y"). 40 If unsure, say N (but it's safe to say "Y").
28 41
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index d61a3b4def9a..7fef7d5cca23 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -6,6 +6,7 @@
6 6
7wm97xx-ts-y := wm97xx-core.o 7wm97xx-ts-y := wm97xx-core.o
8 8
9obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o
9obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o 10obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
10obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o 11obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
11obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o 12obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939c705e..e019d53d1ab4 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -46,7 +46,7 @@
46#include <linux/spi/ad7877.h> 46#include <linux/spi/ad7877.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48 48
49#define TS_PEN_UP_TIMEOUT msecs_to_jiffies(50) 49#define TS_PEN_UP_TIMEOUT msecs_to_jiffies(100)
50 50
51#define MAX_SPI_FREQ_HZ 20000000 51#define MAX_SPI_FREQ_HZ 20000000
52#define MAX_12BIT ((1<<12)-1) 52#define MAX_12BIT ((1<<12)-1)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 8b05d8e97543..532279cda0e4 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -36,6 +36,7 @@
36 * TSC2046 is just newer ads7846 silicon. 36 * TSC2046 is just newer ads7846 silicon.
37 * Support for ads7843 tested on Atmel at91sam926x-EK. 37 * Support for ads7843 tested on Atmel at91sam926x-EK.
38 * Support for ads7845 has only been stubbed in. 38 * Support for ads7845 has only been stubbed in.
39 * Support for Analog Devices AD7873 and AD7843 tested.
39 * 40 *
40 * IRQ handling needs a workaround because of a shortcoming in handling 41 * IRQ handling needs a workaround because of a shortcoming in handling
41 * edge triggered IRQs on some platforms like the OMAP1/2. These 42 * edge triggered IRQs on some platforms like the OMAP1/2. These
@@ -821,6 +822,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
821 822
822 spin_unlock_irq(&ts->lock); 823 spin_unlock_irq(&ts->lock);
823 824
825 if (device_may_wakeup(&ts->spi->dev))
826 enable_irq_wake(ts->spi->irq);
827
824 return 0; 828 return 0;
825 829
826} 830}
@@ -829,6 +833,9 @@ static int ads7846_resume(struct spi_device *spi)
829{ 833{
830 struct ads7846 *ts = dev_get_drvdata(&spi->dev); 834 struct ads7846 *ts = dev_get_drvdata(&spi->dev);
831 835
836 if (device_may_wakeup(&ts->spi->dev))
837 disable_irq_wake(ts->spi->irq);
838
832 spin_lock_irq(&ts->lock); 839 spin_lock_irq(&ts->lock);
833 840
834 ts->is_suspended = 0; 841 ts->is_suspended = 0;
@@ -984,6 +991,15 @@ static int __devinit ads7846_probe(struct spi_device *spi)
984 991
985 vref = pdata->keep_vref_on; 992 vref = pdata->keep_vref_on;
986 993
994 if (ts->model == 7873) {
995 /* The AD7873 is almost identical to the ADS7846
996 * keep VREF off during differential/ratiometric
997 * conversion modes
998 */
999 ts->model = 7846;
1000 vref = 0;
1001 }
1002
987 /* set up the transfers to read touchscreen state; this assumes we 1003 /* set up the transfers to read touchscreen state; this assumes we
988 * use formula #2 for pressure, not #3. 1004 * use formula #2 for pressure, not #3.
989 */ 1005 */
@@ -1191,6 +1207,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1191 if (err) 1207 if (err)
1192 goto err_remove_attr_group; 1208 goto err_remove_attr_group;
1193 1209
1210 device_init_wakeup(&spi->dev, pdata->wakeup);
1211
1194 return 0; 1212 return 0;
1195 1213
1196 err_remove_attr_group: 1214 err_remove_attr_group:
@@ -1220,6 +1238,8 @@ static int __devexit ads7846_remove(struct spi_device *spi)
1220{ 1238{
1221 struct ads7846 *ts = dev_get_drvdata(&spi->dev); 1239 struct ads7846 *ts = dev_get_drvdata(&spi->dev);
1222 1240
1241 device_init_wakeup(&spi->dev, false);
1242
1223 ads784x_hwmon_unregister(spi, ts); 1243 ads784x_hwmon_unregister(spi, ts);
1224 input_unregister_device(ts->input); 1244 input_unregister_device(ts->input);
1225 1245
diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c
index a12242f77e23..fa8e56bd9094 100644
--- a/drivers/input/touchscreen/atmel-wm97xx.c
+++ b/drivers/input/touchscreen/atmel-wm97xx.c
@@ -19,6 +19,7 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/slab.h>
22 23
23#define AC97C_ICA 0x10 24#define AC97C_ICA 0x10
24#define AC97C_CBRHR 0x30 25#define AC97C_CBRHR 0x30
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c
index 3ffd4c4b170c..2b72a5923c16 100644
--- a/drivers/input/touchscreen/da9034-ts.c
+++ b/drivers/input/touchscreen/da9034-ts.c
@@ -19,6 +19,7 @@
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/mfd/da903x.h> 21#include <linux/mfd/da903x.h>
22#include <linux/slab.h>
22 23
23#define DA9034_MANUAL_CTRL 0x50 24#define DA9034_MANUAL_CTRL 0x50
24#define DA9034_LDO_ADC_EN (1 << 4) 25#define DA9034_LDO_ADC_EN (1 << 4)
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 9029bd3f34e5..204b8a1a601c 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -33,6 +33,7 @@
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/gpio.h> 34#include <linux/gpio.h>
35#include <linux/input/eeti_ts.h> 35#include <linux/input/eeti_ts.h>
36#include <linux/slab.h>
36 37
37static int flip_x; 38static int flip_x;
38module_param(flip_x, bool, 0644); 39module_param(flip_x, bool, 0644);
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c
index c8b7e8a45c4d..4b0a061811ff 100644
--- a/drivers/input/touchscreen/jornada720_ts.c
+++ b/drivers/input/touchscreen/jornada720_ts.c
@@ -18,6 +18,7 @@
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/slab.h>
21 22
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/jornada720.h> 24#include <mach/jornada720.h>
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index be115b3b65eb..c5bc62d85bb6 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/slab.h>
20#include <linux/init.h> 21#include <linux/init.h>
21 22
22#define MC13783_TS_NAME "mc13783-ts" 23#define MC13783_TS_NAME "mc13783-ts"
@@ -44,7 +45,7 @@ static irqreturn_t mc13783_ts_handler(int irq, void *data)
44{ 45{
45 struct mc13783_ts_priv *priv = data; 46 struct mc13783_ts_priv *priv = data;
46 47
47 mc13783_ackirq(priv->mc13783, irq); 48 mc13783_irq_ack(priv->mc13783, irq);
48 49
49 /* 50 /*
50 * Kick off reading coordinates. Note that if work happens already 51 * Kick off reading coordinates. Note that if work happens already
@@ -135,7 +136,7 @@ static int mc13783_ts_open(struct input_dev *dev)
135 136
136 mc13783_lock(priv->mc13783); 137 mc13783_lock(priv->mc13783);
137 138
138 mc13783_ackirq(priv->mc13783, MC13783_IRQ_TS); 139 mc13783_irq_ack(priv->mc13783, MC13783_IRQ_TS);
139 140
140 ret = mc13783_irq_request(priv->mc13783, MC13783_IRQ_TS, 141 ret = mc13783_irq_request(priv->mc13783, MC13783_IRQ_TS,
141 mc13783_ts_handler, MC13783_TS_NAME, priv); 142 mc13783_ts_handler, MC13783_TS_NAME, priv);
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c
index 4c28b89757f9..ce8ab0269f6f 100644
--- a/drivers/input/touchscreen/mcs5000_ts.c
+++ b/drivers/input/touchscreen/mcs5000_ts.c
@@ -20,6 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/input.h> 21#include <linux/input.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/slab.h>
23 24
24/* Registers */ 25/* Registers */
25#define MCS5000_TS_STATUS 0x00 26#define MCS5000_TS_STATUS 0x00
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c
index 141dd584330e..defe5dd3627c 100644
--- a/drivers/input/touchscreen/migor_ts.c
+++ b/drivers/input/touchscreen/migor_ts.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/slab.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <linux/i2c.h> 28#include <linux/i2c.h>
28#include <linux/timer.h> 29#include <linux/timer.h>
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c
index b79097e3028a..ea6ef16e59b4 100644
--- a/drivers/input/touchscreen/pcap_ts.c
+++ b/drivers/input/touchscreen/pcap_ts.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/slab.h>
17#include <linux/pm.h> 18#include <linux/pm.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 3755a47d053c..98a7d1279486 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -26,7 +26,6 @@
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/slab.h>
30#include <linux/gpio.h> 29#include <linux/gpio.h>
31#include <linux/input.h> 30#include <linux/input.h>
32#include <linux/init.h> 31#include <linux/init.h>
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 89dcbe7b4b02..028a5363eea1 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -26,7 +26,6 @@
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/suspend.h> 28#include <linux/suspend.h>
29#include <linux/slab.h>
30#include <linux/kthread.h> 29#include <linux/kthread.h>
31#include <linux/freezer.h> 30#include <linux/freezer.h>
32#include <linux/ucb1400.h> 31#include <linux/ucb1400.h>
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c
index 6ccbdbbf33fe..cc18265be1a8 100644
--- a/drivers/input/touchscreen/w90p910_ts.c
+++ b/drivers/input/touchscreen/w90p910_ts.c
@@ -16,6 +16,7 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/input.h> 17#include <linux/input.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/slab.h>
19 20
20/* ADC controller bit defines */ 21/* ADC controller bit defines */
21#define ADC_DELAY 0xf00 22#define ADC_DELAY 0xf00
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index f944918466e5..5109bf3dd858 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -48,6 +48,7 @@
48#include <linux/wm97xx.h> 48#include <linux/wm97xx.h>
49#include <linux/uaccess.h> 49#include <linux/uaccess.h>
50#include <linux/io.h> 50#include <linux/io.h>
51#include <linux/slab.h>
51 52
52#define TS_NAME "wm97xx" 53#define TS_NAME "wm97xx"
53#define WM_CORE_VERSION "1.00" 54#define WM_CORE_VERSION "1.00"
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index d30436fee476..e14081675bb2 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -21,6 +21,7 @@
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/slab.h>
24 25
25#include <asm/xen/hypervisor.h> 26#include <asm/xen/hypervisor.h>
26 27