aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/evbug.c12
-rw-r--r--drivers/input/evdev.c101
-rw-r--r--drivers/input/ff-memless.c4
-rw-r--r--drivers/input/gameport/emu10k1-gp.c2
-rw-r--r--drivers/input/gameport/gameport.c22
-rw-r--r--drivers/input/gameport/lightning.c2
-rw-r--r--drivers/input/gameport/ns558.c2
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/input/joystick/a3d.c2
-rw-r--r--drivers/input/joystick/amijoy.c2
-rw-r--r--drivers/input/joystick/cobra.c2
-rw-r--r--drivers/input/joystick/db9.c2
-rw-r--r--drivers/input/joystick/gf2k.c2
-rw-r--r--drivers/input/joystick/grip.c2
-rw-r--r--drivers/input/joystick/grip_mp.c2
-rw-r--r--drivers/input/joystick/guillemot.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-ff.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-serio.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c8
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/joystick/interact.c2
-rw-r--r--drivers/input/joystick/joydump.c2
-rw-r--r--drivers/input/joystick/magellan.c2
-rw-r--r--drivers/input/joystick/spaceball.c2
-rw-r--r--drivers/input/joystick/spaceorb.c2
-rw-r--r--drivers/input/joystick/stinger.c2
-rw-r--r--drivers/input/joystick/tmdc.c2
-rw-r--r--drivers/input/joystick/turbografx.c2
-rw-r--r--drivers/input/joystick/twidjoy.c4
-rw-r--r--drivers/input/joystick/warrior.c2
-rw-r--r--drivers/input/joystick/xpad.c12
-rw-r--r--drivers/input/keyboard/amikbd.c2
-rw-r--r--drivers/input/keyboard/atkbd.c46
-rw-r--r--drivers/input/keyboard/gpio_keys.c89
-rw-r--r--drivers/input/keyboard/lkkbd.c6
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c15
-rw-r--r--drivers/input/keyboard/sunkbd.c2
-rw-r--r--drivers/input/keyboard/xtkbd.c2
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ati_remote.c18
-rw-r--r--drivers/input/misc/ati_remote2.c18
-rw-r--r--drivers/input/misc/keyspan_remote.c20
-rw-r--r--drivers/input/misc/powermate.c6
-rw-r--r--drivers/input/misc/sgi_btns.c178
-rw-r--r--drivers/input/misc/wistron_btns.c19
-rw-r--r--drivers/input/misc/yealink.c50
-rw-r--r--drivers/input/mouse/appletouch.c299
-rw-r--r--drivers/input/mouse/atarimouse.c27
-rw-r--r--drivers/input/mouse/hil_ptr.c37
-rw-r--r--drivers/input/mouse/inport.c2
-rw-r--r--drivers/input/mouse/logibm.c2
-rw-r--r--drivers/input/mouse/pc110pad.c2
-rw-r--r--drivers/input/mouse/sermouse.c2
-rw-r--r--drivers/input/serio/Kconfig10
-rw-r--r--drivers/input/serio/Makefile1
-rw-r--r--drivers/input/serio/ct82c710.c2
-rw-r--r--drivers/input/serio/hil_mlc.c6
-rw-r--r--drivers/input/serio/hp_sdc.c9
-rw-r--r--drivers/input/serio/hp_sdc_mlc.c2
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h67
-rw-r--r--drivers/input/serio/libps2.c52
-rw-r--r--drivers/input/serio/q40kbd.c4
-rw-r--r--drivers/input/serio/rpckbd.c2
-rw-r--r--drivers/input/serio/serio.c9
-rw-r--r--drivers/input/serio/xilinx_ps2.c380
-rw-r--r--drivers/input/tablet/acecad.c4
-rw-r--r--drivers/input/tablet/aiptek.c6
-rw-r--r--drivers/input/tablet/gtco.c2
-rw-r--r--drivers/input/tablet/kbtab.c6
-rw-r--r--drivers/input/tablet/wacom.h2
-rw-r--r--drivers/input/tablet/wacom_sys.c6
-rw-r--r--drivers/input/tablet/wacom_wac.c39
-rw-r--r--drivers/input/touchscreen/Kconfig46
-rw-r--r--drivers/input/touchscreen/Makefile4
-rw-r--r--drivers/input/touchscreen/gunze.c2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c2
-rw-r--r--drivers/input/touchscreen/htcpen.c255
-rw-r--r--drivers/input/touchscreen/inexio.c207
-rw-r--r--drivers/input/touchscreen/migor_ts.c250
-rw-r--r--drivers/input/touchscreen/touchit213.c234
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c42
-rw-r--r--drivers/input/touchscreen/wm9712.c18
85 files changed, 2214 insertions, 523 deletions
diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c
index c21f2f127234..0353601ac3b5 100644
--- a/drivers/input/evbug.c
+++ b/drivers/input/evbug.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: evbug.c,v 1.10 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
@@ -41,7 +39,7 @@ MODULE_LICENSE("GPL");
41static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) 39static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
42{ 40{
43 printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", 41 printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n",
44 handle->dev->phys, type, code, value); 42 handle->dev->dev.bus_id, type, code, value);
45} 43}
46 44
47static int evbug_connect(struct input_handler *handler, struct input_dev *dev, 45static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
@@ -66,7 +64,10 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
66 if (error) 64 if (error)
67 goto err_unregister_handle; 65 goto err_unregister_handle;
68 66
69 printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); 67 printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n",
68 dev->dev.bus_id,
69 dev->name ?: "unknown",
70 dev->phys ?: "unknown");
70 71
71 return 0; 72 return 0;
72 73
@@ -79,7 +80,8 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
79 80
80static void evbug_disconnect(struct input_handle *handle) 81static void evbug_disconnect(struct input_handle *handle)
81{ 82{
82 printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); 83 printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n",
84 handle->dev->dev.bus_id);
83 85
84 input_close_device(handle); 86 input_close_device(handle);
85 input_unregister_handle(handle); 87 input_unregister_handle(handle);
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b32984bc516f..2d65411f6763 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -300,6 +300,35 @@ struct input_event_compat {
300 __s32 value; 300 __s32 value;
301}; 301};
302 302
303struct ff_periodic_effect_compat {
304 __u16 waveform;
305 __u16 period;
306 __s16 magnitude;
307 __s16 offset;
308 __u16 phase;
309
310 struct ff_envelope envelope;
311
312 __u32 custom_len;
313 compat_uptr_t custom_data;
314};
315
316struct ff_effect_compat {
317 __u16 type;
318 __s16 id;
319 __u16 direction;
320 struct ff_trigger trigger;
321 struct ff_replay replay;
322
323 union {
324 struct ff_constant_effect constant;
325 struct ff_ramp_effect ramp;
326 struct ff_periodic_effect_compat periodic;
327 struct ff_condition_effect condition[2]; /* One for each axis */
328 struct ff_rumble_effect rumble;
329 } u;
330};
331
303/* Note to the author of this code: did it ever occur to 332/* Note to the author of this code: did it ever occur to
304 you why the ifdefs are needed? Think about it again. -AK */ 333 you why the ifdefs are needed? Think about it again. -AK */
305#ifdef CONFIG_X86_64 334#ifdef CONFIG_X86_64
@@ -368,6 +397,42 @@ static int evdev_event_to_user(char __user *buffer,
368 return 0; 397 return 0;
369} 398}
370 399
400static int evdev_ff_effect_from_user(const char __user *buffer, size_t size,
401 struct ff_effect *effect)
402{
403 if (COMPAT_TEST) {
404 struct ff_effect_compat *compat_effect;
405
406 if (size != sizeof(struct ff_effect_compat))
407 return -EINVAL;
408
409 /*
410 * It so happens that the pointer which needs to be changed
411 * is the last field in the structure, so we can copy the
412 * whole thing and replace just the pointer.
413 */
414
415 compat_effect = (struct ff_effect_compat *)effect;
416
417 if (copy_from_user(compat_effect, buffer,
418 sizeof(struct ff_effect_compat)))
419 return -EFAULT;
420
421 if (compat_effect->type == FF_PERIODIC &&
422 compat_effect->u.periodic.waveform == FF_CUSTOM)
423 effect->u.periodic.custom_data =
424 compat_ptr(compat_effect->u.periodic.custom_data);
425 } else {
426 if (size != sizeof(struct ff_effect))
427 return -EINVAL;
428
429 if (copy_from_user(effect, buffer, sizeof(struct ff_effect)))
430 return -EFAULT;
431 }
432
433 return 0;
434}
435
371#else 436#else
372 437
373static inline size_t evdev_event_size(void) 438static inline size_t evdev_event_size(void)
@@ -393,6 +458,18 @@ static int evdev_event_to_user(char __user *buffer,
393 return 0; 458 return 0;
394} 459}
395 460
461static int evdev_ff_effect_from_user(const char __user *buffer, size_t size,
462 struct ff_effect *effect)
463{
464 if (size != sizeof(struct ff_effect))
465 return -EINVAL;
466
467 if (copy_from_user(effect, buffer, sizeof(struct ff_effect)))
468 return -EFAULT;
469
470 return 0;
471}
472
396#endif /* CONFIG_COMPAT */ 473#endif /* CONFIG_COMPAT */
397 474
398static ssize_t evdev_write(struct file *file, const char __user *buffer, 475static ssize_t evdev_write(struct file *file, const char __user *buffer,
@@ -633,17 +710,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
633 710
634 return input_set_keycode(dev, t, v); 711 return input_set_keycode(dev, t, v);
635 712
636 case EVIOCSFF:
637 if (copy_from_user(&effect, p, sizeof(effect)))
638 return -EFAULT;
639
640 error = input_ff_upload(dev, &effect, file);
641
642 if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
643 return -EFAULT;
644
645 return error;
646
647 case EVIOCRMFF: 713 case EVIOCRMFF:
648 return input_ff_erase(dev, (int)(unsigned long) p, file); 714 return input_ff_erase(dev, (int)(unsigned long) p, file);
649 715
@@ -733,6 +799,19 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
733 799
734 if (_IOC_DIR(cmd) == _IOC_WRITE) { 800 if (_IOC_DIR(cmd) == _IOC_WRITE) {
735 801
802 if (_IOC_NR(cmd) == _IOC_NR(EVIOCSFF)) {
803
804 if (evdev_ff_effect_from_user(p, _IOC_SIZE(cmd), &effect))
805 return -EFAULT;
806
807 error = input_ff_upload(dev, &effect, file);
808
809 if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
810 return -EFAULT;
811
812 return error;
813 }
814
736 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { 815 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
737 816
738 t = _IOC_NR(cmd) & ABS_MAX; 817 t = _IOC_NR(cmd) & ABS_MAX;
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index d226d935b0dc..6790e975a98c 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -247,9 +247,9 @@ static void ml_combine_effects(struct ff_effect *effect,
247 * in s8, this should be changed to something more generic 247 * in s8, this should be changed to something more generic
248 */ 248 */
249 effect->u.ramp.start_level = 249 effect->u.ramp.start_level =
250 max(min(effect->u.ramp.start_level + x, 0x7f), -0x80); 250 clamp_val(effect->u.ramp.start_level + x, -0x80, 0x7f);
251 effect->u.ramp.end_level = 251 effect->u.ramp.end_level =
252 max(min(effect->u.ramp.end_level + y, 0x7f), -0x80); 252 clamp_val(effect->u.ramp.end_level + y, -0x80, 0x7f);
253 break; 253 break;
254 254
255 case FF_RUMBLE: 255 case FF_RUMBLE:
diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c
index 9793ac36d17f..b04930f7ea7d 100644
--- a/drivers/input/gameport/emu10k1-gp.c
+++ b/drivers/input/gameport/emu10k1-gp.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: emu10k1-gp.c,v 1.8 2002/01/22 20:40:46 vojtech Exp $
3 *
4 * Copyright (c) 2001 Vojtech Pavlik 2 * Copyright (c) 2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index c5600ac5feb3..078e4eed0894 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -36,7 +36,6 @@ EXPORT_SYMBOL(__gameport_register_driver);
36EXPORT_SYMBOL(gameport_unregister_driver); 36EXPORT_SYMBOL(gameport_unregister_driver);
37EXPORT_SYMBOL(gameport_open); 37EXPORT_SYMBOL(gameport_open);
38EXPORT_SYMBOL(gameport_close); 38EXPORT_SYMBOL(gameport_close);
39EXPORT_SYMBOL(gameport_rescan);
40EXPORT_SYMBOL(gameport_set_phys); 39EXPORT_SYMBOL(gameport_set_phys);
41EXPORT_SYMBOL(gameport_start_polling); 40EXPORT_SYMBOL(gameport_start_polling);
42EXPORT_SYMBOL(gameport_stop_polling); 41EXPORT_SYMBOL(gameport_stop_polling);
@@ -230,8 +229,6 @@ static void gameport_find_driver(struct gameport *gameport)
230 */ 229 */
231 230
232enum gameport_event_type { 231enum gameport_event_type {
233 GAMEPORT_RESCAN,
234 GAMEPORT_RECONNECT,
235 GAMEPORT_REGISTER_PORT, 232 GAMEPORT_REGISTER_PORT,
236 GAMEPORT_REGISTER_DRIVER, 233 GAMEPORT_REGISTER_DRIVER,
237}; 234};
@@ -365,15 +362,6 @@ static void gameport_handle_event(void)
365 gameport_add_port(event->object); 362 gameport_add_port(event->object);
366 break; 363 break;
367 364
368 case GAMEPORT_RECONNECT:
369 gameport_reconnect_port(event->object);
370 break;
371
372 case GAMEPORT_RESCAN:
373 gameport_disconnect_port(event->object);
374 gameport_find_driver(event->object);
375 break;
376
377 case GAMEPORT_REGISTER_DRIVER: 365 case GAMEPORT_REGISTER_DRIVER:
378 gameport_add_driver(event->object); 366 gameport_add_driver(event->object);
379 break; 367 break;
@@ -651,16 +639,6 @@ static void gameport_disconnect_port(struct gameport *gameport)
651 device_release_driver(&gameport->dev); 639 device_release_driver(&gameport->dev);
652} 640}
653 641
654void gameport_rescan(struct gameport *gameport)
655{
656 gameport_queue_event(gameport, NULL, GAMEPORT_RESCAN);
657}
658
659void gameport_reconnect(struct gameport *gameport)
660{
661 gameport_queue_event(gameport, NULL, GAMEPORT_RECONNECT);
662}
663
664/* 642/*
665 * Submits register request to kgameportd for subsequent execution. 643 * Submits register request to kgameportd for subsequent execution.
666 * Note that port registration is always asynchronous. 644 * Note that port registration is always asynchronous.
diff --git a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c
index 6b4d4561d465..06ad36ed3483 100644
--- a/drivers/input/gameport/lightning.c
+++ b/drivers/input/gameport/lightning.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: lightning.c,v 1.20 2002/01/22 20:41:31 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c
index 7b7a546323cf..2b282cde4b89 100644
--- a/drivers/input/gameport/ns558.c
+++ b/drivers/input/gameport/ns558.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: ns558.c,v 1.43 2002/01/24 19:23:21 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * Copyright (c) 1999 Brian Gerst 3 * Copyright (c) 1999 Brian Gerst
6 */ 4 */
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 408df0bd6be5..c13ced3e0d3d 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -242,7 +242,7 @@ static void input_handle_event(struct input_dev *dev,
242 break; 242 break;
243 } 243 }
244 244
245 if (type != EV_SYN) 245 if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
246 dev->sync = 0; 246 dev->sync = 0;
247 247
248 if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) 248 if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
index 52ba16f487c7..92498d470b1f 100644
--- a/drivers/input/joystick/a3d.c
+++ b/drivers/input/joystick/a3d.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: a3d.c,v 1.21 2002/01/22 20:11:50 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index deb9f825f92c..05022f07ec77 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: amijoy.c,v 1.13 2002/01/22 20:26:32 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
index 55646a6d89f5..639b975a8ed7 100644
--- a/drivers/input/joystick/cobra.c
+++ b/drivers/input/joystick/cobra.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: cobra.c,v 1.19 2002/01/22 20:26:52 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 960e501c60c8..523959484753 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: db9.c,v 1.13 2002/04/07 20:13:37 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index 1f6302c0eb3f..cb6eef1f2d99 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: gf2k.c,v 1.19 2002/01/22 20:27:43 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
index fd3853ab1aad..684e07cfccc8 100644
--- a/drivers/input/joystick/grip.c
+++ b/drivers/input/joystick/grip.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: grip.c,v 1.21 2002/01/22 20:27:57 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
index c57e21d68c00..8279481b16e7 100644
--- a/drivers/input/joystick/grip_mp.c
+++ b/drivers/input/joystick/grip_mp.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: grip_mp.c,v 1.9 2002/07/20 19:28:45 bonnland Exp $
3 *
4 * Driver for the Gravis Grip Multiport, a gamepad "hub" that 2 * Driver for the Gravis Grip Multiport, a gamepad "hub" that
5 * connects up to four 9-pin digital gamepads/joysticks. 3 * connects up to four 9-pin digital gamepads/joysticks.
6 * Driver tested on SMP and UP kernel versions 2.4.18-4 and 2.4.18-5. 4 * Driver tested on SMP and UP kernel versions 2.4.18-4 and 2.4.18-5.
diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c
index aa6bfb3fb8cd..25ec3fad9f27 100644
--- a/drivers/input/joystick/guillemot.c
+++ b/drivers/input/joystick/guillemot.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: guillemot.c,v 1.10 2002/01/22 20:28:12 vojtech Exp $
3 *
4 * Copyright (c) 2001 Vojtech Pavlik 2 * Copyright (c) 2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c
index f2a4381d0ab8..7839b7b6fa96 100644
--- a/drivers/input/joystick/iforce/iforce-ff.c
+++ b/drivers/input/joystick/iforce/iforce-ff.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index a2517fa72eb8..61ee6e38739d 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
index 45c4939ced75..015b50aa76fc 100644
--- a/drivers/input/joystick/iforce/iforce-packets.c
+++ b/drivers/input/joystick/iforce/iforce-packets.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c
index 7b4bc19cef27..46d5041d2d9d 100644
--- a/drivers/input/joystick/iforce/iforce-serio.c
+++ b/drivers/input/joystick/iforce/iforce-serio.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 7fb3cf81cfbf..851cc4087c2f 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -1,6 +1,4 @@
1 /* 1 /*
2 * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
@@ -89,10 +87,10 @@ static void iforce_usb_irq(struct urb *urb)
89 case -ESHUTDOWN: 87 case -ESHUTDOWN:
90 /* this urb is terminated, clean up */ 88 /* this urb is terminated, clean up */
91 dbg("%s - urb shutting down with status: %d", 89 dbg("%s - urb shutting down with status: %d",
92 __FUNCTION__, urb->status); 90 __func__, urb->status);
93 return; 91 return;
94 default: 92 default:
95 dbg("%s - urb has status of: %d", __FUNCTION__, urb->status); 93 dbg("%s - urb has status of: %d", __func__, urb->status);
96 goto exit; 94 goto exit;
97 } 95 }
98 96
@@ -103,7 +101,7 @@ exit:
103 status = usb_submit_urb (urb, GFP_ATOMIC); 101 status = usb_submit_urb (urb, GFP_ATOMIC);
104 if (status) 102 if (status)
105 err ("%s - usb_submit_urb failed with result %d", 103 err ("%s - usb_submit_urb failed with result %d",
106 __FUNCTION__, status); 104 __func__, status);
107} 105}
108 106
109static void iforce_usb_out(struct urb *urb) 107static void iforce_usb_out(struct urb *urb)
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index a964a7cfd210..f2d91f4028ca 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $
3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 4 *
diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c
index bc8ea95dfd0e..8c3290b68205 100644
--- a/drivers/input/joystick/interact.c
+++ b/drivers/input/joystick/interact.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: interact.c,v 1.16 2002/01/22 20:28:25 vojtech Exp $
3 *
4 * Copyright (c) 2001 Vojtech Pavlik 2 * Copyright (c) 2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/joydump.c b/drivers/input/joystick/joydump.c
index 88ec5a918f2e..2a1b82c8b31c 100644
--- a/drivers/input/joystick/joydump.c
+++ b/drivers/input/joystick/joydump.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: joydump.c,v 1.1 2002/01/23 06:56:16 jsimmons Exp $
3 *
4 * Copyright (c) 1996-2001 Vojtech Pavlik 2 * Copyright (c) 1996-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index 54e676948ebb..40e40780747d 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: magellan.c,v 1.16 2002/01/22 20:28:39 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index d4087fd49656..0cd9b29356a8 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: spaceball.c,v 1.17 2002/01/22 20:29:03 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
index f7ce4004f4ba..a694bf8e557b 100644
--- a/drivers/input/joystick/spaceorb.c
+++ b/drivers/input/joystick/spaceorb.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
index baa10b2f7ba1..e0db9f5e4b41 100644
--- a/drivers/input/joystick/stinger.c
+++ b/drivers/input/joystick/stinger.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: stinger.c,v 1.10 2002/01/22 20:29:31 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * Copyright (c) 2000 Mark Fletcher 3 * Copyright (c) 2000 Mark Fletcher
6 */ 4 */
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c
index 0feeb8acb532..60c37bcb938d 100644
--- a/drivers/input/joystick/tmdc.c
+++ b/drivers/input/joystick/tmdc.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: tmdc.c,v 1.31 2002/01/22 20:29:52 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 989483f53160..b6f859869540 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: turbografx.c,v 1.14 2002/01/22 20:30:39 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik 2 * Copyright (c) 1998-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
index 1085c841fec4..3f4ec73c9553 100644
--- a/drivers/input/joystick/twidjoy.c
+++ b/drivers/input/joystick/twidjoy.c
@@ -1,8 +1,4 @@
1/* 1/*
2 * $Id: twidjoy.c,v 1.5 2002/01/22 20:31:53 vojtech Exp $
3 *
4 * derived from CVS-ID "stinger.c,v 1.5 2001/05/29 12:57:18 vojtech Exp"
5 *
6 * Copyright (c) 2001 Arndt Schoenewald 2 * Copyright (c) 2001 Arndt Schoenewald
7 * Copyright (c) 2000-2001 Vojtech Pavlik 3 * Copyright (c) 2000-2001 Vojtech Pavlik
8 * Copyright (c) 2000 Mark Fletcher 4 * Copyright (c) 2000 Mark Fletcher
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index e928b6e3724a..f72c83e15e60 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: warrior.c,v 1.14 2002/01/22 20:32:10 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index b29e3affb805..87d3e7eabffd 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -418,11 +418,11 @@ static void xpad_irq_in(struct urb *urb)
418 case -ESHUTDOWN: 418 case -ESHUTDOWN:
419 /* this urb is terminated, clean up */ 419 /* this urb is terminated, clean up */
420 dbg("%s - urb shutting down with status: %d", 420 dbg("%s - urb shutting down with status: %d",
421 __FUNCTION__, status); 421 __func__, status);
422 return; 422 return;
423 default: 423 default:
424 dbg("%s - nonzero urb status received: %d", 424 dbg("%s - nonzero urb status received: %d",
425 __FUNCTION__, status); 425 __func__, status);
426 goto exit; 426 goto exit;
427 } 427 }
428 428
@@ -441,7 +441,7 @@ exit:
441 retval = usb_submit_urb (urb, GFP_ATOMIC); 441 retval = usb_submit_urb (urb, GFP_ATOMIC);
442 if (retval) 442 if (retval)
443 err ("%s - usb_submit_urb failed with result %d", 443 err ("%s - usb_submit_urb failed with result %d",
444 __FUNCTION__, retval); 444 __func__, retval);
445} 445}
446 446
447static void xpad_bulk_out(struct urb *urb) 447static void xpad_bulk_out(struct urb *urb)
@@ -477,11 +477,11 @@ static void xpad_irq_out(struct urb *urb)
477 case -ESHUTDOWN: 477 case -ESHUTDOWN:
478 /* this urb is terminated, clean up */ 478 /* this urb is terminated, clean up */
479 dbg("%s - urb shutting down with status: %d", 479 dbg("%s - urb shutting down with status: %d",
480 __FUNCTION__, status); 480 __func__, status);
481 return; 481 return;
482 default: 482 default:
483 dbg("%s - nonzero urb status received: %d", 483 dbg("%s - nonzero urb status received: %d",
484 __FUNCTION__, status); 484 __func__, status);
485 goto exit; 485 goto exit;
486 } 486 }
487 487
@@ -489,7 +489,7 @@ exit:
489 retval = usb_submit_urb(urb, GFP_ATOMIC); 489 retval = usb_submit_urb(urb, GFP_ATOMIC);
490 if (retval) 490 if (retval)
491 err("%s - usb_submit_urb failed with result %d", 491 err("%s - usb_submit_urb failed with result %d",
492 __FUNCTION__, retval); 492 __func__, retval);
493} 493}
494 494
495static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) 495static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index 81bf7562aca0..35149ec455a9 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: amikbd.c,v 1.13 2002/02/01 16:02:24 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index af58a6f1e898..b1ce10f50bcf 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -68,7 +68,7 @@ MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and
68 * are loadable via an userland utility. 68 * are loadable via an userland utility.
69 */ 69 */
70 70
71static unsigned char atkbd_set2_keycode[512] = { 71static const unsigned short atkbd_set2_keycode[512] = {
72 72
73#ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES 73#ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES
74 74
@@ -99,7 +99,7 @@ static unsigned char atkbd_set2_keycode[512] = {
99#endif 99#endif
100}; 100};
101 101
102static unsigned char atkbd_set3_keycode[512] = { 102static const unsigned short atkbd_set3_keycode[512] = {
103 103
104 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60, 104 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60,
105 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62, 105 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62,
@@ -115,7 +115,7 @@ static unsigned char atkbd_set3_keycode[512] = {
115 148,149,147,140 115 148,149,147,140
116}; 116};
117 117
118static unsigned char atkbd_unxlate_table[128] = { 118static const unsigned short atkbd_unxlate_table[128] = {
119 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, 119 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
120 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, 120 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
121 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, 121 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42,
@@ -161,7 +161,7 @@ static unsigned char atkbd_unxlate_table[128] = {
161#define ATKBD_SCR_LEFT 249 161#define ATKBD_SCR_LEFT 249
162#define ATKBD_SCR_RIGHT 248 162#define ATKBD_SCR_RIGHT 248
163 163
164#define ATKBD_SPECIAL 248 164#define ATKBD_SPECIAL ATKBD_SCR_RIGHT
165 165
166#define ATKBD_LED_EVENT_BIT 0 166#define ATKBD_LED_EVENT_BIT 0
167#define ATKBD_REP_EVENT_BIT 1 167#define ATKBD_REP_EVENT_BIT 1
@@ -173,7 +173,7 @@ static unsigned char atkbd_unxlate_table[128] = {
173#define ATKBD_XL_HANGEUL 0x10 173#define ATKBD_XL_HANGEUL 0x10
174#define ATKBD_XL_HANJA 0x20 174#define ATKBD_XL_HANJA 0x20
175 175
176static struct { 176static const struct {
177 unsigned char keycode; 177 unsigned char keycode;
178 unsigned char set2; 178 unsigned char set2;
179} atkbd_scroll_keys[] = { 179} atkbd_scroll_keys[] = {
@@ -200,7 +200,7 @@ struct atkbd {
200 char phys[32]; 200 char phys[32];
201 201
202 unsigned short id; 202 unsigned short id;
203 unsigned char keycode[512]; 203 unsigned short keycode[512];
204 DECLARE_BITMAP(force_release_mask, 512); 204 DECLARE_BITMAP(force_release_mask, 512);
205 unsigned char set; 205 unsigned char set;
206 unsigned char translated; 206 unsigned char translated;
@@ -357,7 +357,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
357 unsigned int code = data; 357 unsigned int code = data;
358 int scroll = 0, hscroll = 0, click = -1; 358 int scroll = 0, hscroll = 0, click = -1;
359 int value; 359 int value;
360 unsigned char keycode; 360 unsigned short keycode;
361 361
362#ifdef ATKBD_DEBUG 362#ifdef ATKBD_DEBUG
363 printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); 363 printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags);
@@ -851,6 +851,23 @@ static void atkbd_latitude_keymap_fixup(struct atkbd *atkbd)
851} 851}
852 852
853/* 853/*
854 * Perform fixup for HP system that doesn't generate release
855 * for its video switch
856 */
857static void atkbd_hp_keymap_fixup(struct atkbd *atkbd)
858{
859 const unsigned int forced_release_keys[] = {
860 0x94,
861 };
862 int i;
863
864 if (atkbd->set == 2)
865 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++)
866 __set_bit(forced_release_keys[i],
867 atkbd->force_release_mask);
868}
869
870/*
854 * atkbd_set_keycode_table() initializes keyboard's keycode table 871 * atkbd_set_keycode_table() initializes keyboard's keycode table
855 * according to the selected scancode set 872 * according to the selected scancode set
856 */ 873 */
@@ -961,16 +978,16 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
961 input_dev->evbit[0] |= BIT_MASK(EV_REL); 978 input_dev->evbit[0] |= BIT_MASK(EV_REL);
962 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) | 979 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) |
963 BIT_MASK(REL_HWHEEL); 980 BIT_MASK(REL_HWHEEL);
964 set_bit(BTN_MIDDLE, input_dev->keybit); 981 __set_bit(BTN_MIDDLE, input_dev->keybit);
965 } 982 }
966 983
967 input_dev->keycode = atkbd->keycode; 984 input_dev->keycode = atkbd->keycode;
968 input_dev->keycodesize = sizeof(unsigned char); 985 input_dev->keycodesize = sizeof(unsigned short);
969 input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); 986 input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
970 987
971 for (i = 0; i < 512; i++) 988 for (i = 0; i < 512; i++)
972 if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) 989 if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL)
973 set_bit(atkbd->keycode[i], input_dev->keybit); 990 __set_bit(atkbd->keycode[i], input_dev->keybit);
974} 991}
975 992
976/* 993/*
@@ -1452,6 +1469,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1452 .callback = atkbd_setup_fixup, 1469 .callback = atkbd_setup_fixup,
1453 .driver_data = atkbd_latitude_keymap_fixup, 1470 .driver_data = atkbd_latitude_keymap_fixup,
1454 }, 1471 },
1472 {
1473 .ident = "HP 2133",
1474 .matches = {
1475 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1476 DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"),
1477 },
1478 .callback = atkbd_setup_fixup,
1479 .driver_data = atkbd_hp_keymap_fixup,
1480 },
1455 { } 1481 { }
1456}; 1482};
1457 1483
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index bbd00c3fe98c..be58730e636a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -26,23 +26,54 @@
26 26
27#include <asm/gpio.h> 27#include <asm/gpio.h>
28 28
29struct gpio_button_data {
30 struct gpio_keys_button *button;
31 struct input_dev *input;
32 struct timer_list timer;
33};
34
35struct gpio_keys_drvdata {
36 struct input_dev *input;
37 struct gpio_button_data data[0];
38};
39
40static void gpio_keys_report_event(struct gpio_keys_button *button,
41 struct input_dev *input)
42{
43 unsigned int type = button->type ?: EV_KEY;
44 int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
45
46 input_event(input, type, button->code, !!state);
47 input_sync(input);
48}
49
50static void gpio_check_button(unsigned long _data)
51{
52 struct gpio_button_data *data = (struct gpio_button_data *)_data;
53
54 gpio_keys_report_event(data->button, data->input);
55}
56
29static irqreturn_t gpio_keys_isr(int irq, void *dev_id) 57static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
30{ 58{
31 int i;
32 struct platform_device *pdev = dev_id; 59 struct platform_device *pdev = dev_id;
33 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 60 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
34 struct input_dev *input = platform_get_drvdata(pdev); 61 struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
62 int i;
35 63
36 for (i = 0; i < pdata->nbuttons; i++) { 64 for (i = 0; i < pdata->nbuttons; i++) {
37 struct gpio_keys_button *button = &pdata->buttons[i]; 65 struct gpio_keys_button *button = &pdata->buttons[i];
38 int gpio = button->gpio;
39 66
40 if (irq == gpio_to_irq(gpio)) { 67 if (irq == gpio_to_irq(button->gpio)) {
41 unsigned int type = button->type ?: EV_KEY; 68 struct gpio_button_data *bdata = &ddata->data[i];
42 int state = (gpio_get_value(gpio) ? 1 : 0) ^ button->active_low; 69
70 if (button->debounce_interval)
71 mod_timer(&bdata->timer,
72 jiffies +
73 msecs_to_jiffies(button->debounce_interval));
74 else
75 gpio_keys_report_event(button, bdata->input);
43 76
44 input_event(input, type, button->code, !!state);
45 input_sync(input);
46 return IRQ_HANDLED; 77 return IRQ_HANDLED;
47 } 78 }
48 } 79 }
@@ -53,17 +84,21 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
53static int __devinit gpio_keys_probe(struct platform_device *pdev) 84static int __devinit gpio_keys_probe(struct platform_device *pdev)
54{ 85{
55 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 86 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
87 struct gpio_keys_drvdata *ddata;
56 struct input_dev *input; 88 struct input_dev *input;
57 int i, error; 89 int i, error;
58 int wakeup = 0; 90 int wakeup = 0;
59 91
92 ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
93 pdata->nbuttons * sizeof(struct gpio_button_data),
94 GFP_KERNEL);
60 input = input_allocate_device(); 95 input = input_allocate_device();
61 if (!input) 96 if (!ddata || !input) {
62 return -ENOMEM; 97 error = -ENOMEM;
63 98 goto fail1;
64 platform_set_drvdata(pdev, input); 99 }
65 100
66 input->evbit[0] = BIT_MASK(EV_KEY); 101 platform_set_drvdata(pdev, ddata);
67 102
68 input->name = pdev->name; 103 input->name = pdev->name;
69 input->phys = "gpio-keys/input0"; 104 input->phys = "gpio-keys/input0";
@@ -74,16 +109,23 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
74 input->id.product = 0x0001; 109 input->id.product = 0x0001;
75 input->id.version = 0x0100; 110 input->id.version = 0x0100;
76 111
112 ddata->input = input;
113
77 for (i = 0; i < pdata->nbuttons; i++) { 114 for (i = 0; i < pdata->nbuttons; i++) {
78 struct gpio_keys_button *button = &pdata->buttons[i]; 115 struct gpio_keys_button *button = &pdata->buttons[i];
116 struct gpio_button_data *bdata = &ddata->data[i];
79 int irq; 117 int irq;
80 unsigned int type = button->type ?: EV_KEY; 118 unsigned int type = button->type ?: EV_KEY;
81 119
120 bdata->input = input;
121 setup_timer(&bdata->timer,
122 gpio_check_button, (unsigned long)bdata);
123
82 error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); 124 error = gpio_request(button->gpio, button->desc ?: "gpio_keys");
83 if (error < 0) { 125 if (error < 0) {
84 pr_err("gpio-keys: failed to request GPIO %d," 126 pr_err("gpio-keys: failed to request GPIO %d,"
85 " error %d\n", button->gpio, error); 127 " error %d\n", button->gpio, error);
86 goto fail; 128 goto fail2;
87 } 129 }
88 130
89 error = gpio_direction_input(button->gpio); 131 error = gpio_direction_input(button->gpio);
@@ -92,7 +134,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
92 " direction for GPIO %d, error %d\n", 134 " direction for GPIO %d, error %d\n",
93 button->gpio, error); 135 button->gpio, error);
94 gpio_free(button->gpio); 136 gpio_free(button->gpio);
95 goto fail; 137 goto fail2;
96 } 138 }
97 139
98 irq = gpio_to_irq(button->gpio); 140 irq = gpio_to_irq(button->gpio);
@@ -102,7 +144,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
102 " for GPIO %d, error %d\n", 144 " for GPIO %d, error %d\n",
103 button->gpio, error); 145 button->gpio, error);
104 gpio_free(button->gpio); 146 gpio_free(button->gpio);
105 goto fail; 147 goto fail2;
106 } 148 }
107 149
108 error = request_irq(irq, gpio_keys_isr, 150 error = request_irq(irq, gpio_keys_isr,
@@ -114,7 +156,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
114 pr_err("gpio-keys: Unable to claim irq %d; error %d\n", 156 pr_err("gpio-keys: Unable to claim irq %d; error %d\n",
115 irq, error); 157 irq, error);
116 gpio_free(button->gpio); 158 gpio_free(button->gpio);
117 goto fail; 159 goto fail2;
118 } 160 }
119 161
120 if (button->wakeup) 162 if (button->wakeup)
@@ -127,21 +169,25 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
127 if (error) { 169 if (error) {
128 pr_err("gpio-keys: Unable to register input device, " 170 pr_err("gpio-keys: Unable to register input device, "
129 "error: %d\n", error); 171 "error: %d\n", error);
130 goto fail; 172 goto fail2;
131 } 173 }
132 174
133 device_init_wakeup(&pdev->dev, wakeup); 175 device_init_wakeup(&pdev->dev, wakeup);
134 176
135 return 0; 177 return 0;
136 178
137 fail: 179 fail2:
138 while (--i >= 0) { 180 while (--i >= 0) {
139 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); 181 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev);
182 if (pdata->buttons[i].debounce_interval)
183 del_timer_sync(&ddata->data[i].timer);
140 gpio_free(pdata->buttons[i].gpio); 184 gpio_free(pdata->buttons[i].gpio);
141 } 185 }
142 186
143 platform_set_drvdata(pdev, NULL); 187 platform_set_drvdata(pdev, NULL);
188 fail1:
144 input_free_device(input); 189 input_free_device(input);
190 kfree(ddata);
145 191
146 return error; 192 return error;
147} 193}
@@ -149,7 +195,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
149static int __devexit gpio_keys_remove(struct platform_device *pdev) 195static int __devexit gpio_keys_remove(struct platform_device *pdev)
150{ 196{
151 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 197 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
152 struct input_dev *input = platform_get_drvdata(pdev); 198 struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
199 struct input_dev *input = ddata->input;
153 int i; 200 int i;
154 201
155 device_init_wakeup(&pdev->dev, 0); 202 device_init_wakeup(&pdev->dev, 0);
@@ -157,6 +204,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
157 for (i = 0; i < pdata->nbuttons; i++) { 204 for (i = 0; i < pdata->nbuttons; i++) {
158 int irq = gpio_to_irq(pdata->buttons[i].gpio); 205 int irq = gpio_to_irq(pdata->buttons[i].gpio);
159 free_irq(irq, pdev); 206 free_irq(irq, pdev);
207 if (pdata->buttons[i].debounce_interval)
208 del_timer_sync(&ddata->data[i].timer);
160 gpio_free(pdata->buttons[i].gpio); 209 gpio_free(pdata->buttons[i].gpio);
161 } 210 }
162 211
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
index 32e2c2605d95..4730ef35c732 100644
--- a/drivers/input/keyboard/lkkbd.c
+++ b/drivers/input/keyboard/lkkbd.c
@@ -538,11 +538,11 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
538 switch (code) { 538 switch (code) {
539 case SND_CLICK: 539 case SND_CLICK:
540 if (value == 0) { 540 if (value == 0) {
541 DBG ("%s: Deactivating key clicks\n", __FUNCTION__); 541 DBG ("%s: Deactivating key clicks\n", __func__);
542 lk->serio->write (lk->serio, LK_CMD_DISABLE_KEYCLICK); 542 lk->serio->write (lk->serio, LK_CMD_DISABLE_KEYCLICK);
543 lk->serio->write (lk->serio, LK_CMD_DISABLE_CTRCLICK); 543 lk->serio->write (lk->serio, LK_CMD_DISABLE_CTRCLICK);
544 } else { 544 } else {
545 DBG ("%s: Activating key clicks\n", __FUNCTION__); 545 DBG ("%s: Activating key clicks\n", __func__);
546 lk->serio->write (lk->serio, LK_CMD_ENABLE_KEYCLICK); 546 lk->serio->write (lk->serio, LK_CMD_ENABLE_KEYCLICK);
547 lk->serio->write (lk->serio, volume_to_hw (lk->keyclick_volume)); 547 lk->serio->write (lk->serio, volume_to_hw (lk->keyclick_volume));
548 lk->serio->write (lk->serio, LK_CMD_ENABLE_CTRCLICK); 548 lk->serio->write (lk->serio, LK_CMD_ENABLE_CTRCLICK);
@@ -560,7 +560,7 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
560 560
561 default: 561 default:
562 printk (KERN_ERR "%s (): Got unknown type %d, code %d, value %d\n", 562 printk (KERN_ERR "%s (): Got unknown type %d, code %d, value %d\n",
563 __FUNCTION__, type, code, value); 563 __func__, type, code, value);
564 } 564 }
565 565
566 return -1; 566 return -1;
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 45767e73f071..6f1516f50750 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -105,6 +105,8 @@ struct pxa27x_keypad {
105 struct input_dev *input_dev; 105 struct input_dev *input_dev;
106 void __iomem *mmio_base; 106 void __iomem *mmio_base;
107 107
108 int irq;
109
108 /* matrix key code map */ 110 /* matrix key code map */
109 unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM]; 111 unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM];
110 112
@@ -392,6 +394,10 @@ static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t stat
392 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 394 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
393 395
394 clk_disable(keypad->clk); 396 clk_disable(keypad->clk);
397
398 if (device_may_wakeup(&pdev->dev))
399 enable_irq_wake(keypad->irq);
400
395 return 0; 401 return 0;
396} 402}
397 403
@@ -400,6 +406,9 @@ static int pxa27x_keypad_resume(struct platform_device *pdev)
400 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 406 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
401 struct input_dev *input_dev = keypad->input_dev; 407 struct input_dev *input_dev = keypad->input_dev;
402 408
409 if (device_may_wakeup(&pdev->dev))
410 disable_irq_wake(keypad->irq);
411
403 mutex_lock(&input_dev->mutex); 412 mutex_lock(&input_dev->mutex);
404 413
405 if (input_dev->users) { 414 if (input_dev->users) {
@@ -509,6 +518,8 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
509 goto failed_free_dev; 518 goto failed_free_dev;
510 } 519 }
511 520
521 keypad->irq = irq;
522
512 /* Register the input device */ 523 /* Register the input device */
513 error = input_register_device(input_dev); 524 error = input_register_device(input_dev);
514 if (error) { 525 if (error) {
@@ -516,6 +527,8 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
516 goto failed_free_irq; 527 goto failed_free_irq;
517 } 528 }
518 529
530 device_init_wakeup(&pdev->dev, 1);
531
519 return 0; 532 return 0;
520 533
521failed_free_irq: 534failed_free_irq:
@@ -539,7 +552,7 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)
539 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 552 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
540 struct resource *res; 553 struct resource *res;
541 554
542 free_irq(platform_get_irq(pdev, 0), pdev); 555 free_irq(keypad->irq, pdev);
543 556
544 clk_disable(keypad->clk); 557 clk_disable(keypad->clk);
545 clk_put(keypad->clk); 558 clk_put(keypad->clk);
diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
index be0f5d19d023..9fce6d1e29b2 100644
--- a/drivers/input/keyboard/sunkbd.c
+++ b/drivers/input/keyboard/sunkbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: sunkbd.c,v 1.14 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
index 152a2c070508..37b01d777a4a 100644
--- a/drivers/input/keyboard/xtkbd.c
+++ b/drivers/input/keyboard/xtkbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: xtkbd.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 432699d61c58..e99b7882f382 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -189,6 +189,16 @@ config INPUT_UINPUT
189 To compile this driver as a module, choose M here: the 189 To compile this driver as a module, choose M here: the
190 module will be called uinput. 190 module will be called uinput.
191 191
192config INPUT_SGI_BTNS
193 tristate "SGI Indy/O2 volume button interface"
194 depends on SGI_IP22 || SGI_IP32
195 select INPUT_POLLDEV
196 help
197 Say Y here if you want to support SGI Indy/O2 volume button interface.
198
199 To compile this driver as a module, choose M here: the
200 module will be called sgi_btns.
201
192config HP_SDC_RTC 202config HP_SDC_RTC
193 tristate "HP SDC Real Time Clock" 203 tristate "HP SDC Real Time Clock"
194 depends on GSC || HP300 204 depends on GSC || HP300
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index ebd39f291d25..f48009b52226 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_INPUT_YEALINK) += yealink.o
19obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 19obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
20obj-$(CONFIG_INPUT_UINPUT) += uinput.o 20obj-$(CONFIG_INPUT_UINPUT) += uinput.o
21obj-$(CONFIG_INPUT_APANEL) += apanel.o 21obj-$(CONFIG_INPUT_APANEL) += apanel.o
22obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c
index f3b86c2b0797..debfc1af9d95 100644
--- a/drivers/input/misc/ati_remote.c
+++ b/drivers/input/misc/ati_remote.c
@@ -330,7 +330,7 @@ static int ati_remote_open(struct input_dev *inputdev)
330 ati_remote->irq_urb->dev = ati_remote->udev; 330 ati_remote->irq_urb->dev = ati_remote->udev;
331 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { 331 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) {
332 dev_err(&ati_remote->interface->dev, 332 dev_err(&ati_remote->interface->dev,
333 "%s: usb_submit_urb failed!\n", __FUNCTION__); 333 "%s: usb_submit_urb failed!\n", __func__);
334 return -EIO; 334 return -EIO;
335 } 335 }
336 336
@@ -356,7 +356,7 @@ static void ati_remote_irq_out(struct urb *urb)
356 356
357 if (urb->status) { 357 if (urb->status) {
358 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n", 358 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n",
359 __FUNCTION__, urb->status); 359 __func__, urb->status);
360 return; 360 return;
361 } 361 }
362 362
@@ -601,17 +601,17 @@ static void ati_remote_irq_in(struct urb *urb)
601 case -ENOENT: 601 case -ENOENT:
602 case -ESHUTDOWN: 602 case -ESHUTDOWN:
603 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", 603 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n",
604 __FUNCTION__); 604 __func__);
605 return; 605 return;
606 default: /* error */ 606 default: /* error */
607 dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", 607 dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n",
608 __FUNCTION__, urb->status); 608 __func__, urb->status);
609 } 609 }
610 610
611 retval = usb_submit_urb(urb, GFP_ATOMIC); 611 retval = usb_submit_urb(urb, GFP_ATOMIC);
612 if (retval) 612 if (retval)
613 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", 613 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n",
614 __FUNCTION__, retval); 614 __func__, retval);
615} 615}
616 616
617/* 617/*
@@ -734,7 +734,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
734 int err = -ENOMEM; 734 int err = -ENOMEM;
735 735
736 if (iface_host->desc.bNumEndpoints != 2) { 736 if (iface_host->desc.bNumEndpoints != 2) {
737 err("%s: Unexpected desc.bNumEndpoints\n", __FUNCTION__); 737 err("%s: Unexpected desc.bNumEndpoints\n", __func__);
738 return -ENODEV; 738 return -ENODEV;
739 } 739 }
740 740
@@ -742,11 +742,11 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
742 endpoint_out = &iface_host->endpoint[1].desc; 742 endpoint_out = &iface_host->endpoint[1].desc;
743 743
744 if (!usb_endpoint_is_int_in(endpoint_in)) { 744 if (!usb_endpoint_is_int_in(endpoint_in)) {
745 err("%s: Unexpected endpoint_in\n", __FUNCTION__); 745 err("%s: Unexpected endpoint_in\n", __func__);
746 return -ENODEV; 746 return -ENODEV;
747 } 747 }
748 if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) { 748 if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) {
749 err("%s: endpoint_in message size==0? \n", __FUNCTION__); 749 err("%s: endpoint_in message size==0? \n", __func__);
750 return -ENODEV; 750 return -ENODEV;
751 } 751 }
752 752
@@ -814,7 +814,7 @@ static void ati_remote_disconnect(struct usb_interface *interface)
814 ati_remote = usb_get_intfdata(interface); 814 ati_remote = usb_get_intfdata(interface);
815 usb_set_intfdata(interface, NULL); 815 usb_set_intfdata(interface, NULL);
816 if (!ati_remote) { 816 if (!ati_remote) {
817 warn("%s - null device?\n", __FUNCTION__); 817 warn("%s - null device?\n", __func__);
818 return; 818 return;
819 } 819 }
820 820
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index f2709b82485c..a7fabafbd94c 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -137,14 +137,14 @@ static int ati_remote2_open(struct input_dev *idev)
137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL); 137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
138 if (r) { 138 if (r) {
139 dev_err(&ar2->intf[0]->dev, 139 dev_err(&ar2->intf[0]->dev,
140 "%s: usb_submit_urb() = %d\n", __FUNCTION__, r); 140 "%s: usb_submit_urb() = %d\n", __func__, r);
141 return r; 141 return r;
142 } 142 }
143 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL); 143 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL);
144 if (r) { 144 if (r) {
145 usb_kill_urb(ar2->urb[0]); 145 usb_kill_urb(ar2->urb[0]);
146 dev_err(&ar2->intf[1]->dev, 146 dev_err(&ar2->intf[1]->dev,
147 "%s: usb_submit_urb() = %d\n", __FUNCTION__, r); 147 "%s: usb_submit_urb() = %d\n", __func__, r);
148 return r; 148 return r;
149 } 149 }
150 150
@@ -294,17 +294,17 @@ static void ati_remote2_complete_mouse(struct urb *urb)
294 case -ECONNRESET: 294 case -ECONNRESET:
295 case -ESHUTDOWN: 295 case -ESHUTDOWN:
296 dev_dbg(&ar2->intf[0]->dev, 296 dev_dbg(&ar2->intf[0]->dev,
297 "%s(): urb status = %d\n", __FUNCTION__, urb->status); 297 "%s(): urb status = %d\n", __func__, urb->status);
298 return; 298 return;
299 default: 299 default:
300 dev_err(&ar2->intf[0]->dev, 300 dev_err(&ar2->intf[0]->dev,
301 "%s(): urb status = %d\n", __FUNCTION__, urb->status); 301 "%s(): urb status = %d\n", __func__, urb->status);
302 } 302 }
303 303
304 r = usb_submit_urb(urb, GFP_ATOMIC); 304 r = usb_submit_urb(urb, GFP_ATOMIC);
305 if (r) 305 if (r)
306 dev_err(&ar2->intf[0]->dev, 306 dev_err(&ar2->intf[0]->dev,
307 "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r); 307 "%s(): usb_submit_urb() = %d\n", __func__, r);
308} 308}
309 309
310static void ati_remote2_complete_key(struct urb *urb) 310static void ati_remote2_complete_key(struct urb *urb)
@@ -321,17 +321,17 @@ static void ati_remote2_complete_key(struct urb *urb)
321 case -ECONNRESET: 321 case -ECONNRESET:
322 case -ESHUTDOWN: 322 case -ESHUTDOWN:
323 dev_dbg(&ar2->intf[1]->dev, 323 dev_dbg(&ar2->intf[1]->dev,
324 "%s(): urb status = %d\n", __FUNCTION__, urb->status); 324 "%s(): urb status = %d\n", __func__, urb->status);
325 return; 325 return;
326 default: 326 default:
327 dev_err(&ar2->intf[1]->dev, 327 dev_err(&ar2->intf[1]->dev,
328 "%s(): urb status = %d\n", __FUNCTION__, urb->status); 328 "%s(): urb status = %d\n", __func__, urb->status);
329 } 329 }
330 330
331 r = usb_submit_urb(urb, GFP_ATOMIC); 331 r = usb_submit_urb(urb, GFP_ATOMIC);
332 if (r) 332 if (r)
333 dev_err(&ar2->intf[1]->dev, 333 dev_err(&ar2->intf[1]->dev,
334 "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r); 334 "%s(): usb_submit_urb() = %d\n", __func__, r);
335} 335}
336 336
337static int ati_remote2_input_init(struct ati_remote2 *ar2) 337static int ati_remote2_input_init(struct ati_remote2 *ar2)
@@ -438,7 +438,7 @@ static int ati_remote2_setup(struct ati_remote2 *ar2)
438 channel, 0x0, NULL, 0, USB_CTRL_SET_TIMEOUT); 438 channel, 0x0, NULL, 0, USB_CTRL_SET_TIMEOUT);
439 if (r) { 439 if (r) {
440 dev_err(&ar2->udev->dev, "%s - failed to set channel due to error: %d\n", 440 dev_err(&ar2->udev->dev, "%s - failed to set channel due to error: %d\n",
441 __FUNCTION__, r); 441 __func__, r);
442 return r; 442 return r;
443 } 443 }
444 444
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 952938a8e991..86afdd1fdf9d 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -159,7 +159,7 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed)
159 if (dev->data.pos >= dev->data.len) { 159 if (dev->data.pos >= dev->data.len) {
160 dev_dbg(&dev->udev->dev, 160 dev_dbg(&dev->udev->dev,
161 "%s - Error ran out of data. pos: %d, len: %d\n", 161 "%s - Error ran out of data. pos: %d, len: %d\n",
162 __FUNCTION__, dev->data.pos, dev->data.len); 162 __func__, dev->data.pos, dev->data.len);
163 return -1; 163 return -1;
164 } 164 }
165 165
@@ -267,7 +267,7 @@ static void keyspan_check_data(struct usb_keyspan *remote)
267 remote->data.tester = remote->data.tester >> 6; 267 remote->data.tester = remote->data.tester >> 6;
268 remote->data.bits_left -= 6; 268 remote->data.bits_left -= 6;
269 } else { 269 } else {
270 err("%s - Unknown sequence found in system data.\n", __FUNCTION__); 270 err("%s - Unknown sequence found in system data.\n", __func__);
271 remote->stage = 0; 271 remote->stage = 0;
272 return; 272 return;
273 } 273 }
@@ -286,7 +286,7 @@ static void keyspan_check_data(struct usb_keyspan *remote)
286 remote->data.tester = remote->data.tester >> 6; 286 remote->data.tester = remote->data.tester >> 6;
287 remote->data.bits_left -= 6; 287 remote->data.bits_left -= 6;
288 } else { 288 } else {
289 err("%s - Unknown sequence found in button data.\n", __FUNCTION__); 289 err("%s - Unknown sequence found in button data.\n", __func__);
290 remote->stage = 0; 290 remote->stage = 0;
291 return; 291 return;
292 } 292 }
@@ -302,7 +302,7 @@ static void keyspan_check_data(struct usb_keyspan *remote)
302 remote->data.tester = remote->data.tester >> 6; 302 remote->data.tester = remote->data.tester >> 6;
303 remote->data.bits_left -= 6; 303 remote->data.bits_left -= 6;
304 } else { 304 } else {
305 err("%s - Error in message, invalid toggle.\n", __FUNCTION__); 305 err("%s - Error in message, invalid toggle.\n", __func__);
306 remote->stage = 0; 306 remote->stage = 0;
307 return; 307 return;
308 } 308 }
@@ -317,7 +317,7 @@ static void keyspan_check_data(struct usb_keyspan *remote)
317 317
318 dev_dbg(&remote->udev->dev, 318 dev_dbg(&remote->udev->dev,
319 "%s found valid message: system: %d, button: %d, toggle: %d\n", 319 "%s found valid message: system: %d, button: %d, toggle: %d\n",
320 __FUNCTION__, message.system, message.button, message.toggle); 320 __func__, message.system, message.button, message.toggle);
321 321
322 if (message.toggle != remote->toggle) { 322 if (message.toggle != remote->toggle) {
323 keyspan_report_button(remote, message.button, 1); 323 keyspan_report_button(remote, message.button, 1);
@@ -341,7 +341,7 @@ static int keyspan_setup(struct usb_device* dev)
341 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); 341 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0);
342 if (retval) { 342 if (retval) {
343 dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", 343 dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n",
344 __FUNCTION__, retval); 344 __func__, retval);
345 return(retval); 345 return(retval);
346 } 346 }
347 347
@@ -349,7 +349,7 @@ static int keyspan_setup(struct usb_device* dev)
349 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); 349 0x44, 0x40, 0x0, 0x0, NULL, 0, 0);
350 if (retval) { 350 if (retval) {
351 dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", 351 dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n",
352 __FUNCTION__, retval); 352 __func__, retval);
353 return(retval); 353 return(retval);
354 } 354 }
355 355
@@ -357,11 +357,11 @@ static int keyspan_setup(struct usb_device* dev)
357 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); 357 0x22, 0x40, 0x0, 0x0, NULL, 0, 0);
358 if (retval) { 358 if (retval) {
359 dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", 359 dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n",
360 __FUNCTION__, retval); 360 __func__, retval);
361 return(retval); 361 return(retval);
362 } 362 }
363 363
364 dev_dbg(&dev->dev, "%s - Setup complete.\n", __FUNCTION__); 364 dev_dbg(&dev->dev, "%s - Setup complete.\n", __func__);
365 return(retval); 365 return(retval);
366} 366}
367 367
@@ -397,7 +397,7 @@ static void keyspan_irq_recv(struct urb *urb)
397resubmit: 397resubmit:
398 retval = usb_submit_urb(urb, GFP_ATOMIC); 398 retval = usb_submit_urb(urb, GFP_ATOMIC);
399 if (retval) 399 if (retval)
400 err ("%s - usb_submit_urb failed with result: %d", __FUNCTION__, retval); 400 err ("%s - usb_submit_urb failed with result: %d", __func__, retval);
401} 401}
402 402
403static int keyspan_open(struct input_dev *dev) 403static int keyspan_open(struct input_dev *dev)
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 7a7b8c7b9633..a53c4885fbad 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -96,10 +96,10 @@ static void powermate_irq(struct urb *urb)
96 case -ENOENT: 96 case -ENOENT:
97 case -ESHUTDOWN: 97 case -ESHUTDOWN:
98 /* this urb is terminated, clean up */ 98 /* this urb is terminated, clean up */
99 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 99 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
100 return; 100 return;
101 default: 101 default:
102 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 102 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
103 goto exit; 103 goto exit;
104 } 104 }
105 105
@@ -112,7 +112,7 @@ exit:
112 retval = usb_submit_urb (urb, GFP_ATOMIC); 112 retval = usb_submit_urb (urb, GFP_ATOMIC);
113 if (retval) 113 if (retval)
114 err ("%s - usb_submit_urb failed with result %d", 114 err ("%s - usb_submit_urb failed with result %d",
115 __FUNCTION__, retval); 115 __func__, retval);
116} 116}
117 117
118/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ 118/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c
new file mode 100644
index 000000000000..ce238f59b3c8
--- /dev/null
+++ b/drivers/input/misc/sgi_btns.c
@@ -0,0 +1,178 @@
1/*
2 * SGI Volume Button interface driver
3 *
4 * Copyright (C) 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/init.h>
21#include <linux/input-polldev.h>
22#include <linux/ioport.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25
26#ifdef CONFIG_SGI_IP22
27#include <asm/sgi/ioc.h>
28
29static inline u8 button_status(void)
30{
31 u8 status;
32
33 status = readb(&sgioc->panel) ^ 0xa0;
34 return ((status & 0x80) >> 6) | ((status & 0x20) >> 5);
35}
36#endif
37
38#ifdef CONFIG_SGI_IP32
39#include <asm/ip32/mace.h>
40
41static inline u8 button_status(void)
42{
43 u64 status;
44
45 status = readq(&mace->perif.audio.control);
46 writeq(status & ~(3U << 23), &mace->perif.audio.control);
47
48 return (status >> 23) & 3;
49}
50#endif
51
52#define BUTTONS_POLL_INTERVAL 30 /* msec */
53#define BUTTONS_COUNT_THRESHOLD 3
54
55static const unsigned short sgi_map[] = {
56 KEY_VOLUMEDOWN,
57 KEY_VOLUMEUP
58};
59
60struct buttons_dev {
61 struct input_polled_dev *poll_dev;
62 unsigned short keymap[ARRAY_SIZE(sgi_map)];
63 int count[ARRAY_SIZE(sgi_map)];
64};
65
66static void handle_buttons(struct input_polled_dev *dev)
67{
68 struct buttons_dev *bdev = dev->private;
69 struct input_dev *input = dev->input;
70 u8 status;
71 int i;
72
73 status = button_status();
74
75 for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) {
76 if (status & (1U << i)) {
77 if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) {
78 input_event(input, EV_MSC, MSC_SCAN, i);
79 input_report_key(input, bdev->keymap[i], 1);
80 input_sync(input);
81 }
82 } else {
83 if (bdev->count[i] >= BUTTONS_COUNT_THRESHOLD) {
84 input_event(input, EV_MSC, MSC_SCAN, i);
85 input_report_key(input, bdev->keymap[i], 0);
86 input_sync(input);
87 }
88 bdev->count[i] = 0;
89 }
90 }
91}
92
93static int __devinit sgi_buttons_probe(struct platform_device *pdev)
94{
95 struct buttons_dev *bdev;
96 struct input_polled_dev *poll_dev;
97 struct input_dev *input;
98 int error, i;
99
100 bdev = kzalloc(sizeof(struct buttons_dev), GFP_KERNEL);
101 poll_dev = input_allocate_polled_device();
102 if (!bdev || !poll_dev) {
103 error = -ENOMEM;
104 goto err_free_mem;
105 }
106
107 memcpy(bdev->keymap, sgi_map, sizeof(bdev->keymap));
108
109 poll_dev->private = bdev;
110 poll_dev->poll = handle_buttons;
111 poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
112
113 input = poll_dev->input;
114 input->name = "SGI buttons";
115 input->phys = "sgi/input0";
116 input->id.bustype = BUS_HOST;
117 input->dev.parent = &pdev->dev;
118
119 input->keycode = bdev->keymap;
120 input->keycodemax = ARRAY_SIZE(bdev->keymap);
121 input->keycodesize = sizeof(unsigned short);
122
123 input_set_capability(input, EV_MSC, MSC_SCAN);
124 __set_bit(EV_KEY, input->evbit);
125 for (i = 0; i < ARRAY_SIZE(sgi_map); i++)
126 __set_bit(bdev->keymap[i], input->keybit);
127 __clear_bit(KEY_RESERVED, input->keybit);
128
129 bdev->poll_dev = poll_dev;
130 dev_set_drvdata(&pdev->dev, bdev);
131
132 error = input_register_polled_device(poll_dev);
133 if (error)
134 goto err_free_mem;
135
136 return 0;
137
138 err_free_mem:
139 input_free_polled_device(poll_dev);
140 kfree(bdev);
141 dev_set_drvdata(&pdev->dev, NULL);
142 return error;
143}
144
145static int __devexit sgi_buttons_remove(struct platform_device *pdev)
146{
147 struct device *dev = &pdev->dev;
148 struct buttons_dev *bdev = dev_get_drvdata(dev);
149
150 input_unregister_polled_device(bdev->poll_dev);
151 input_free_polled_device(bdev->poll_dev);
152 kfree(bdev);
153 dev_set_drvdata(dev, NULL);
154
155 return 0;
156}
157
158static struct platform_driver sgi_buttons_driver = {
159 .probe = sgi_buttons_probe,
160 .remove = __devexit_p(sgi_buttons_remove),
161 .driver = {
162 .name = "sgibtns",
163 .owner = THIS_MODULE,
164 },
165};
166
167static int __init sgi_buttons_init(void)
168{
169 return platform_driver_register(&sgi_buttons_driver);
170}
171
172static void __exit sgi_buttons_exit(void)
173{
174 platform_driver_unregister(&sgi_buttons_driver);
175}
176
177module_init(sgi_buttons_init);
178module_exit(sgi_buttons_exit);
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 72176f3d49cb..fe268be3293b 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1186,7 +1186,7 @@ static int wistron_setkeycode(struct input_dev *dev, int scancode, int keycode)
1186 1186
1187static int __devinit setup_input_dev(void) 1187static int __devinit setup_input_dev(void)
1188{ 1188{
1189 const struct key_entry *key; 1189 struct key_entry *key;
1190 struct input_dev *input_dev; 1190 struct input_dev *input_dev;
1191 int error; 1191 int error;
1192 1192
@@ -1219,6 +1219,23 @@ static int __devinit setup_input_dev(void)
1219 set_bit(key->sw.code, input_dev->swbit); 1219 set_bit(key->sw.code, input_dev->swbit);
1220 break; 1220 break;
1221 1221
1222 /* if wifi or bluetooth are not available, create normal keys */
1223 case KE_WIFI:
1224 if (!have_wifi) {
1225 key->type = KE_KEY;
1226 key->keycode = KEY_WLAN;
1227 key--;
1228 }
1229 break;
1230
1231 case KE_BLUETOOTH:
1232 if (!have_bluetooth) {
1233 key->type = KE_KEY;
1234 key->keycode = KEY_BLUETOOTH;
1235 key--;
1236 }
1237 break;
1238
1222 default: 1239 default:
1223 break; 1240 break;
1224 } 1241 }
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 46279ef2b649..facefd3dba29 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -119,6 +119,8 @@ struct yealink_dev {
119 u8 lcdMap[ARRAY_SIZE(lcdMap)]; /* state of LCD, LED ... */ 119 u8 lcdMap[ARRAY_SIZE(lcdMap)]; /* state of LCD, LED ... */
120 int key_code; /* last reported key */ 120 int key_code; /* last reported key */
121 121
122 unsigned int shutdown:1;
123
122 int stat_ix; 124 int stat_ix;
123 union { 125 union {
124 struct yld_status s; 126 struct yld_status s;
@@ -424,10 +426,10 @@ send_update:
424static void urb_irq_callback(struct urb *urb) 426static void urb_irq_callback(struct urb *urb)
425{ 427{
426 struct yealink_dev *yld = urb->context; 428 struct yealink_dev *yld = urb->context;
427 int ret; 429 int ret, status = urb->status;
428 430
429 if (urb->status) 431 if (status)
430 err("%s - urb status %d", __FUNCTION__, urb->status); 432 err("%s - urb status %d", __func__, status);
431 433
432 switch (yld->irq_data->cmd) { 434 switch (yld->irq_data->cmd) {
433 case CMD_KEYPRESS: 435 case CMD_KEYPRESS:
@@ -447,33 +449,38 @@ static void urb_irq_callback(struct urb *urb)
447 449
448 yealink_do_idle_tasks(yld); 450 yealink_do_idle_tasks(yld);
449 451
450 ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 452 if (!yld->shutdown) {
451 if (ret) 453 ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC);
452 err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); 454 if (ret && ret != -EPERM)
455 err("%s - usb_submit_urb failed %d", __func__, ret);
456 }
453} 457}
454 458
455static void urb_ctl_callback(struct urb *urb) 459static void urb_ctl_callback(struct urb *urb)
456{ 460{
457 struct yealink_dev *yld = urb->context; 461 struct yealink_dev *yld = urb->context;
458 int ret; 462 int ret = 0, status = urb->status;
459 463
460 if (urb->status) 464 if (status)
461 err("%s - urb status %d", __FUNCTION__, urb->status); 465 err("%s - urb status %d", __func__, status);
462 466
463 switch (yld->ctl_data->cmd) { 467 switch (yld->ctl_data->cmd) {
464 case CMD_KEYPRESS: 468 case CMD_KEYPRESS:
465 case CMD_SCANCODE: 469 case CMD_SCANCODE:
466 /* ask for a response */ 470 /* ask for a response */
467 ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC); 471 if (!yld->shutdown)
472 ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC);
468 break; 473 break;
469 default: 474 default:
470 /* send new command */ 475 /* send new command */
471 yealink_do_idle_tasks(yld); 476 yealink_do_idle_tasks(yld);
472 ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 477 if (!yld->shutdown)
478 ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC);
479 break;
473 } 480 }
474 481
475 if (ret) 482 if (ret && ret != -EPERM)
476 err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); 483 err("%s - usb_submit_urb failed %d", __func__, ret);
477} 484}
478 485
479/******************************************************************************* 486/*******************************************************************************
@@ -505,7 +512,7 @@ static int input_open(struct input_dev *dev)
505 struct yealink_dev *yld = input_get_drvdata(dev); 512 struct yealink_dev *yld = input_get_drvdata(dev);
506 int i, ret; 513 int i, ret;
507 514
508 dbg("%s", __FUNCTION__); 515 dbg("%s", __func__);
509 516
510 /* force updates to device */ 517 /* force updates to device */
511 for (i = 0; i<sizeof(yld->master); i++) 518 for (i = 0; i<sizeof(yld->master); i++)
@@ -521,7 +528,7 @@ static int input_open(struct input_dev *dev)
521 yld->ctl_data->sum = 0x100-CMD_INIT-10; 528 yld->ctl_data->sum = 0x100-CMD_INIT-10;
522 if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { 529 if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) {
523 dbg("%s - usb_submit_urb failed with result %d", 530 dbg("%s - usb_submit_urb failed with result %d",
524 __FUNCTION__, ret); 531 __func__, ret);
525 return ret; 532 return ret;
526 } 533 }
527 return 0; 534 return 0;
@@ -531,8 +538,18 @@ static void input_close(struct input_dev *dev)
531{ 538{
532 struct yealink_dev *yld = input_get_drvdata(dev); 539 struct yealink_dev *yld = input_get_drvdata(dev);
533 540
541 yld->shutdown = 1;
542 /*
543 * Make sure the flag is seen by other CPUs before we start
544 * killing URBs so new URBs won't be submitted
545 */
546 smp_wmb();
547
534 usb_kill_urb(yld->urb_ctl); 548 usb_kill_urb(yld->urb_ctl);
535 usb_kill_urb(yld->urb_irq); 549 usb_kill_urb(yld->urb_irq);
550
551 yld->shutdown = 0;
552 smp_wmb();
536} 553}
537 554
538/******************************************************************************* 555/*******************************************************************************
@@ -809,9 +826,6 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
809 if (yld == NULL) 826 if (yld == NULL)
810 return err; 827 return err;
811 828
812 usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */
813 usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */
814
815 if (yld->idev) { 829 if (yld->idev) {
816 if (err) 830 if (err)
817 input_free_device(yld->idev); 831 input_free_device(yld->idev);
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index ce6fdec19e14..1f41ae94f26b 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -2,12 +2,13 @@
2 * Apple USB Touchpad (for post-February 2005 PowerBooks and MacBooks) driver 2 * Apple USB Touchpad (for post-February 2005 PowerBooks and MacBooks) driver
3 * 3 *
4 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com) 4 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
5 * Copyright (C) 2005 Johannes Berg (johannes@sipsolutions.net) 5 * Copyright (C) 2005-2008 Johannes Berg (johannes@sipsolutions.net)
6 * Copyright (C) 2005 Stelian Pop (stelian@popies.net) 6 * Copyright (C) 2005 Stelian Pop (stelian@popies.net)
7 * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) 7 * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de)
8 * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) 8 * Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
9 * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch) 9 * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
10 * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch) 10 * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
11 * Copyright (C) 2007-2008 Sven Anders (anders@anduras.de)
11 * 12 *
12 * Thanks to Alex Harper <basilisk@foobox.net> for his inputs. 13 * Thanks to Alex Harper <basilisk@foobox.net> for his inputs.
13 * 14 *
@@ -34,77 +35,64 @@
34#include <linux/module.h> 35#include <linux/module.h>
35#include <linux/usb/input.h> 36#include <linux/usb/input.h>
36 37
37/* Apple has powerbooks which have the keyboard with different Product IDs */ 38/* Type of touchpad */
38#define APPLE_VENDOR_ID 0x05AC 39enum atp_touchpad_type {
39 40 ATP_FOUNTAIN,
40/* These names come from Info.plist in AppleUSBTrackpad.kext */ 41 ATP_GEYSER1,
41#define FOUNTAIN_ANSI_PRODUCT_ID 0x020E 42 ATP_GEYSER2,
42#define FOUNTAIN_ISO_PRODUCT_ID 0x020F 43 ATP_GEYSER3,
43 44 ATP_GEYSER4
44#define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A 45};
45
46#define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
47
48#define GEYSER_ANSI_PRODUCT_ID 0x0214
49#define GEYSER_ISO_PRODUCT_ID 0x0215
50#define GEYSER_JIS_PRODUCT_ID 0x0216
51
52/* MacBook devices */
53#define GEYSER3_ANSI_PRODUCT_ID 0x0217
54#define GEYSER3_ISO_PRODUCT_ID 0x0218
55#define GEYSER3_JIS_PRODUCT_ID 0x0219
56
57/*
58 * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
59 * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
60 */
61#define GEYSER4_ANSI_PRODUCT_ID 0x021A
62#define GEYSER4_ISO_PRODUCT_ID 0x021B
63#define GEYSER4_JIS_PRODUCT_ID 0x021C
64
65#define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
66#define GEYSER4_HF_ISO_PRODUCT_ID 0x022A
67#define GEYSER4_HF_JIS_PRODUCT_ID 0x022B
68 46
69#define ATP_DEVICE(prod) \ 47#define ATP_DEVICE(prod, type) \
48{ \
70 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 49 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
71 USB_DEVICE_ID_MATCH_INT_CLASS | \ 50 USB_DEVICE_ID_MATCH_INT_CLASS | \
72 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 51 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
73 .idVendor = APPLE_VENDOR_ID, \ 52 .idVendor = 0x05ac, /* Apple */ \
74 .idProduct = (prod), \ 53 .idProduct = (prod), \
75 .bInterfaceClass = 0x03, \ 54 .bInterfaceClass = 0x03, \
76 .bInterfaceProtocol = 0x02 55 .bInterfaceProtocol = 0x02, \
56 .driver_info = ATP_ ## type, \
57}
58
59/*
60 * Table of devices (Product IDs) that work with this driver.
61 * (The names come from Info.plist in AppleUSBTrackpad.kext,
62 * According to Info.plist Geyser IV is the same as Geyser III.)
63 */
77 64
78/* table of devices that work with this driver */
79static struct usb_device_id atp_table [] = { 65static struct usb_device_id atp_table [] = {
80 { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) }, 66 /* PowerBooks Feb 2005, iBooks G4 */
81 { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) }, 67 ATP_DEVICE(0x020e, FOUNTAIN), /* FOUNTAIN ANSI */
82 { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) }, 68 ATP_DEVICE(0x020f, FOUNTAIN), /* FOUNTAIN ISO */
83 { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) }, 69 ATP_DEVICE(0x030a, FOUNTAIN), /* FOUNTAIN TP ONLY */
70 ATP_DEVICE(0x030b, GEYSER1), /* GEYSER 1 TP ONLY */
84 71
85 /* PowerBooks Oct 2005 */ 72 /* PowerBooks Oct 2005 */
86 { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) }, 73 ATP_DEVICE(0x0214, GEYSER2), /* GEYSER 2 ANSI */
87 { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) }, 74 ATP_DEVICE(0x0215, GEYSER2), /* GEYSER 2 ISO */
88 { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) }, 75 ATP_DEVICE(0x0216, GEYSER2), /* GEYSER 2 JIS */
89 76
90 /* Core Duo MacBook & MacBook Pro */ 77 /* Core Duo MacBook & MacBook Pro */
91 { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) }, 78 ATP_DEVICE(0x0217, GEYSER3), /* GEYSER 3 ANSI */
92 { ATP_DEVICE(GEYSER3_ISO_PRODUCT_ID) }, 79 ATP_DEVICE(0x0218, GEYSER3), /* GEYSER 3 ISO */
93 { ATP_DEVICE(GEYSER3_JIS_PRODUCT_ID) }, 80 ATP_DEVICE(0x0219, GEYSER3), /* GEYSER 3 JIS */
94 81
95 /* Core2 Duo MacBook & MacBook Pro */ 82 /* Core2 Duo MacBook & MacBook Pro */
96 { ATP_DEVICE(GEYSER4_ANSI_PRODUCT_ID) }, 83 ATP_DEVICE(0x021a, GEYSER4), /* GEYSER 4 ANSI */
97 { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) }, 84 ATP_DEVICE(0x021b, GEYSER4), /* GEYSER 4 ISO */
98 { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) }, 85 ATP_DEVICE(0x021c, GEYSER4), /* GEYSER 4 JIS */
99 86
100 { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) }, 87 /* Core2 Duo MacBook3,1 */
101 { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) }, 88 ATP_DEVICE(0x0229, GEYSER4), /* GEYSER 4 HF ANSI */
102 { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) }, 89 ATP_DEVICE(0x022a, GEYSER4), /* GEYSER 4 HF ISO */
90 ATP_DEVICE(0x022b, GEYSER4), /* GEYSER 4 HF JIS */
103 91
104 /* Terminating entry */ 92 /* Terminating entry */
105 { } 93 { }
106}; 94};
107MODULE_DEVICE_TABLE (usb, atp_table); 95MODULE_DEVICE_TABLE(usb, atp_table);
108 96
109/* 97/*
110 * number of sensors. Note that only 16 instead of 26 X (horizontal) 98 * number of sensors. Note that only 16 instead of 26 X (horizontal)
@@ -124,9 +112,13 @@ MODULE_DEVICE_TABLE (usb, atp_table);
124 * We try to keep the touchpad aspect ratio while still doing only simple 112 * We try to keep the touchpad aspect ratio while still doing only simple
125 * arithmetics. 113 * arithmetics.
126 * The factors below give coordinates like: 114 * The factors below give coordinates like:
127 * 0 <= x < 960 on 12" and 15" Powerbooks 115 *
128 * 0 <= x < 1600 on 17" Powerbooks 116 * 0 <= x < 960 on 12" and 15" Powerbooks
129 * 0 <= y < 646 117 * 0 <= x < 1600 on 17" Powerbooks and 17" MacBook Pro
118 * 0 <= x < 1216 on MacBooks and 15" MacBook Pro
119 *
120 * 0 <= y < 646 on all Powerbooks
121 * 0 <= y < 774 on all MacBooks
130 */ 122 */
131#define ATP_XFACT 64 123#define ATP_XFACT 64
132#define ATP_YFACT 43 124#define ATP_YFACT 43
@@ -147,43 +139,46 @@ MODULE_DEVICE_TABLE (usb, atp_table);
147/* Structure to hold all of our device specific stuff */ 139/* Structure to hold all of our device specific stuff */
148struct atp { 140struct atp {
149 char phys[64]; 141 char phys[64];
150 struct usb_device * udev; /* usb device */ 142 struct usb_device *udev; /* usb device */
151 struct urb * urb; /* usb request block */ 143 struct urb *urb; /* usb request block */
152 signed char * data; /* transferred data */ 144 signed char *data; /* transferred data */
153 struct input_dev * input; /* input dev */ 145 struct input_dev *input; /* input dev */
154 unsigned char open; /* non-zero if opened */ 146 enum atp_touchpad_type type; /* type of touchpad */
155 unsigned char valid; /* are the sensors valid ? */ 147 bool open;
156 unsigned char size_detect_done; 148 bool valid; /* are the samples valid? */
157 unsigned char overflowwarn; /* overflow warning printed? */ 149 bool size_detect_done;
150 bool overflow_warned;
158 int x_old; /* last reported x/y, */ 151 int x_old; /* last reported x/y, */
159 int y_old; /* used for smoothing */ 152 int y_old; /* used for smoothing */
160 /* current value of the sensors */
161 signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; 153 signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS];
162 /* last value of the sensors */
163 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 154 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS];
164 /* accumulated sensors */
165 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 155 int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
166 int datalen; /* size of an USB urb transfer */ 156 int datalen; /* size of USB transfer */
167 int idlecount; /* number of empty packets */ 157 int idlecount; /* number of empty packets */
168 struct work_struct work; 158 struct work_struct work;
169}; 159};
170 160
171#define dbg_dump(msg, tab) \ 161#define dbg_dump(msg, tab) \
172 if (debug > 1) { \ 162 if (debug > 1) { \
173 int i; \ 163 int __i; \
174 printk("appletouch: %s %lld", msg, (long long)jiffies); \ 164 printk(KERN_DEBUG "appletouch: %s", msg); \
175 for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) \ 165 for (__i = 0; __i < ATP_XSENSORS + ATP_YSENSORS; __i++) \
176 printk(" %02x", tab[i]); \ 166 printk(" %02x", tab[__i]); \
177 printk("\n"); \ 167 printk("\n"); \
178 } 168 }
179 169
180#define dprintk(format, a...) \ 170#define dprintk(format, a...) \
181 do { \ 171 do { \
182 if (debug) printk(KERN_DEBUG format, ##a); \ 172 if (debug) \
173 printk(KERN_DEBUG format, ##a); \
183 } while (0) 174 } while (0)
184 175
185MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann"); 176MODULE_AUTHOR("Johannes Berg");
186MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver"); 177MODULE_AUTHOR("Stelian Pop");
178MODULE_AUTHOR("Frank Arnold");
179MODULE_AUTHOR("Michael Hanselmann");
180MODULE_AUTHOR("Sven Anders");
181MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver");
187MODULE_LICENSE("GPL"); 182MODULE_LICENSE("GPL");
188 183
189/* 184/*
@@ -191,46 +186,14 @@ MODULE_LICENSE("GPL");
191 */ 186 */
192static int threshold = ATP_THRESHOLD; 187static int threshold = ATP_THRESHOLD;
193module_param(threshold, int, 0644); 188module_param(threshold, int, 0644);
194MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value"); 189MODULE_PARM_DESC(threshold, "Discard any change in data from a sensor"
190 " (the trackpad has many of these sensors)"
191 " less than this value.");
195 192
196static int debug = 1; 193static int debug;
197module_param(debug, int, 0644); 194module_param(debug, int, 0644);
198MODULE_PARM_DESC(debug, "Activate debugging output"); 195MODULE_PARM_DESC(debug, "Activate debugging output");
199 196
200static inline int atp_is_fountain(struct atp *dev)
201{
202 u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
203
204 return productId == FOUNTAIN_ANSI_PRODUCT_ID ||
205 productId == FOUNTAIN_ISO_PRODUCT_ID ||
206 productId == FOUNTAIN_TP_ONLY_PRODUCT_ID;
207}
208
209/* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */
210static inline int atp_is_geyser_2(struct atp *dev)
211{
212 u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
213
214 return (productId == GEYSER_ANSI_PRODUCT_ID) ||
215 (productId == GEYSER_ISO_PRODUCT_ID) ||
216 (productId == GEYSER_JIS_PRODUCT_ID);
217}
218
219static inline int atp_is_geyser_3(struct atp *dev)
220{
221 u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
222
223 return (productId == GEYSER3_ANSI_PRODUCT_ID) ||
224 (productId == GEYSER3_ISO_PRODUCT_ID) ||
225 (productId == GEYSER3_JIS_PRODUCT_ID) ||
226 (productId == GEYSER4_ANSI_PRODUCT_ID) ||
227 (productId == GEYSER4_ISO_PRODUCT_ID) ||
228 (productId == GEYSER4_JIS_PRODUCT_ID) ||
229 (productId == GEYSER4_HF_ANSI_PRODUCT_ID) ||
230 (productId == GEYSER4_HF_ISO_PRODUCT_ID) ||
231 (productId == GEYSER4_HF_JIS_PRODUCT_ID);
232}
233
234/* 197/*
235 * By default newer Geyser devices send standard USB HID mouse 198 * By default newer Geyser devices send standard USB HID mouse
236 * packets (Report ID 2). This code changes device mode, so it 199 * packets (Report ID 2). This code changes device mode, so it
@@ -240,6 +203,7 @@ static int atp_geyser_init(struct usb_device *udev)
240{ 203{
241 char data[8]; 204 char data[8];
242 int size; 205 int size;
206 int i;
243 207
244 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 208 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
245 ATP_GEYSER_MODE_READ_REQUEST_ID, 209 ATP_GEYSER_MODE_READ_REQUEST_ID,
@@ -248,8 +212,11 @@ static int atp_geyser_init(struct usb_device *udev)
248 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 212 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
249 213
250 if (size != 8) { 214 if (size != 8) {
251 err("Could not do mode read request from device" 215 dprintk("atp_geyser_init: read error\n");
252 " (Geyser Raw mode)"); 216 for (i = 0; i < 8; i++)
217 dprintk("appletouch[%d]: %d\n", i, data[i]);
218
219 err("Failed to read mode from device.");
253 return -EIO; 220 return -EIO;
254 } 221 }
255 222
@@ -263,8 +230,11 @@ static int atp_geyser_init(struct usb_device *udev)
263 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 230 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
264 231
265 if (size != 8) { 232 if (size != 8) {
266 err("Could not do mode write request to device" 233 dprintk("atp_geyser_init: write error\n");
267 " (Geyser Raw mode)"); 234 for (i = 0; i < 8; i++)
235 dprintk("appletouch[%d]: %d\n", i, data[i]);
236
237 err("Failed to request geyser raw mode");
268 return -EIO; 238 return -EIO;
269 } 239 }
270 return 0; 240 return 0;
@@ -280,15 +250,15 @@ static void atp_reinit(struct work_struct *work)
280 struct usb_device *udev = dev->udev; 250 struct usb_device *udev = dev->udev;
281 int retval; 251 int retval;
282 252
253 dprintk("appletouch: putting appletouch to sleep (reinit)\n");
283 dev->idlecount = 0; 254 dev->idlecount = 0;
284 255
285 atp_geyser_init(udev); 256 atp_geyser_init(udev);
286 257
287 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 258 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
288 if (retval) { 259 if (retval)
289 err("%s - usb_submit_urb failed with result %d", 260 err("atp_reinit: usb_submit_urb failed with error %d",
290 __FUNCTION__, retval); 261 retval);
291 }
292} 262}
293 263
294static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, 264static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
@@ -323,7 +293,8 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
323 * 293 *
324 * - Jason Parekh <jasonparekh@gmail.com> 294 * - Jason Parekh <jasonparekh@gmail.com>
325 */ 295 */
326 if (i < 1 || (!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) { 296 if (i < 1 ||
297 (!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) {
327 (*fingers)++; 298 (*fingers)++;
328 is_increasing = 1; 299 is_increasing = 1;
329 } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) { 300 } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) {
@@ -331,11 +302,11 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
331 } 302 }
332 303
333 /* 304 /*
334 * Subtracts threshold so a high sensor that just passes the threshold 305 * Subtracts threshold so a high sensor that just passes the
335 * won't skew the calculated absolute coordinate. Fixes an issue 306 * threshold won't skew the calculated absolute coordinate.
336 * where slowly moving the mouse would occassionaly jump a number of 307 * Fixes an issue where slowly moving the mouse would
337 * pixels (let me restate--slowly moving the mouse makes this issue 308 * occasionally jump a number of pixels (slowly moving the
338 * most apparent). 309 * finger makes this issue most apparent.)
339 */ 310 */
340 pcum += (xy_sensors[i] - threshold) * i; 311 pcum += (xy_sensors[i] - threshold) * i;
341 psum += (xy_sensors[i] - threshold); 312 psum += (xy_sensors[i] - threshold);
@@ -356,7 +327,7 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers)
356 input_report_key(input, BTN_TOOL_TRIPLETAP, fingers > 2); 327 input_report_key(input, BTN_TOOL_TRIPLETAP, fingers > 2);
357} 328}
358 329
359static void atp_complete(struct urb* urb) 330static void atp_complete(struct urb *urb)
360{ 331{
361 int x, y, x_z, y_z, x_f, y_f; 332 int x, y, x_z, y_z, x_f, y_f;
362 int retval, i, j; 333 int retval, i, j;
@@ -368,22 +339,22 @@ static void atp_complete(struct urb* urb)
368 /* success */ 339 /* success */
369 break; 340 break;
370 case -EOVERFLOW: 341 case -EOVERFLOW:
371 if(!dev->overflowwarn) { 342 if (!dev->overflow_warned) {
372 printk(KERN_WARNING "appletouch: OVERFLOW with data " 343 printk(KERN_WARNING "appletouch: OVERFLOW with data "
373 "length %d, actual length is %d\n", 344 "length %d, actual length is %d\n",
374 dev->datalen, dev->urb->actual_length); 345 dev->datalen, dev->urb->actual_length);
375 dev->overflowwarn = 1; 346 dev->overflow_warned = true;
376 } 347 }
377 case -ECONNRESET: 348 case -ECONNRESET:
378 case -ENOENT: 349 case -ENOENT:
379 case -ESHUTDOWN: 350 case -ESHUTDOWN:
380 /* This urb is terminated, clean up */ 351 /* This urb is terminated, clean up */
381 dbg("%s - urb shutting down with status: %d", 352 dbg("atp_complete: urb shutting down with status: %d",
382 __FUNCTION__, urb->status); 353 urb->status);
383 return; 354 return;
384 default: 355 default:
385 dbg("%s - nonzero urb status received: %d", 356 dbg("atp_complete: nonzero urb status received: %d",
386 __FUNCTION__, urb->status); 357 urb->status);
387 goto exit; 358 goto exit;
388 } 359 }
389 360
@@ -396,7 +367,7 @@ static void atp_complete(struct urb* urb)
396 } 367 }
397 368
398 /* reorder the sensors values */ 369 /* reorder the sensors values */
399 if (atp_is_geyser_3(dev)) { 370 if (dev->type == ATP_GEYSER3 || dev->type == ATP_GEYSER4) {
400 memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); 371 memset(dev->xy_cur, 0, sizeof(dev->xy_cur));
401 372
402 /* 373 /*
@@ -415,7 +386,7 @@ static void atp_complete(struct urb* urb)
415 dev->xy_cur[ATP_XSENSORS + i] = dev->data[j + 1]; 386 dev->xy_cur[ATP_XSENSORS + i] = dev->data[j + 1];
416 dev->xy_cur[ATP_XSENSORS + i + 1] = dev->data[j + 2]; 387 dev->xy_cur[ATP_XSENSORS + i + 1] = dev->data[j + 2];
417 } 388 }
418 } else if (atp_is_geyser_2(dev)) { 389 } else if (dev->type == ATP_GEYSER2) {
419 memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); 390 memset(dev->xy_cur, 0, sizeof(dev->xy_cur));
420 391
421 /* 392 /*
@@ -438,7 +409,7 @@ static void atp_complete(struct urb* urb)
438 } else { 409 } else {
439 for (i = 0; i < 8; i++) { 410 for (i = 0; i < 8; i++) {
440 /* X values */ 411 /* X values */
441 dev->xy_cur[i ] = dev->data[5 * i + 2]; 412 dev->xy_cur[i + 0] = dev->data[5 * i + 2];
442 dev->xy_cur[i + 8] = dev->data[5 * i + 4]; 413 dev->xy_cur[i + 8] = dev->data[5 * i + 4];
443 dev->xy_cur[i + 16] = dev->data[5 * i + 42]; 414 dev->xy_cur[i + 16] = dev->data[5 * i + 42];
444 if (i < 2) 415 if (i < 2)
@@ -454,21 +425,22 @@ static void atp_complete(struct urb* urb)
454 425
455 if (!dev->valid) { 426 if (!dev->valid) {
456 /* first sample */ 427 /* first sample */
457 dev->valid = 1; 428 dev->valid = true;
458 dev->x_old = dev->y_old = -1; 429 dev->x_old = dev->y_old = -1;
459 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); 430 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
460 431
461 if (dev->size_detect_done || 432 if (dev->size_detect_done ||
462 atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */ 433 dev->type == ATP_GEYSER3) /* No 17" Macbooks (yet) */
463 goto exit; 434 goto exit;
464 435
465 /* 17" Powerbooks have extra X sensors */ 436 /* 17" Powerbooks have extra X sensors */
466 for (i = (atp_is_geyser_2(dev) ? 15 : 16); i < ATP_XSENSORS; i++) { 437 for (i = (dev->type == ATP_GEYSER2 ? 15 : 16);
438 i < ATP_XSENSORS; i++) {
467 if (!dev->xy_cur[i]) 439 if (!dev->xy_cur[i])
468 continue; 440 continue;
469 441
470 printk(KERN_INFO "appletouch: 17\" model detected.\n"); 442 printk(KERN_INFO "appletouch: 17\" model detected.\n");
471 if (atp_is_geyser_2(dev)) 443 if (dev->type == ATP_GEYSER2)
472 input_set_abs_params(dev->input, ABS_X, 0, 444 input_set_abs_params(dev->input, ABS_X, 0,
473 (20 - 1) * 445 (20 - 1) *
474 ATP_XFACT - 1, 446 ATP_XFACT - 1,
@@ -548,11 +520,15 @@ static void atp_complete(struct urb* urb)
548 * several hundred times a second. Re-initialization does not 520 * several hundred times a second. Re-initialization does not
549 * work on Fountain touchpads. 521 * work on Fountain touchpads.
550 */ 522 */
551 if (!atp_is_fountain(dev)) { 523 if (dev->type != ATP_FOUNTAIN) {
524 /*
525 * Button must not be pressed when entering suspend,
526 * otherwise we will never release the button.
527 */
552 if (!x && !y && !key) { 528 if (!x && !y && !key) {
553 dev->idlecount++; 529 dev->idlecount++;
554 if (dev->idlecount == 10) { 530 if (dev->idlecount == 10) {
555 dev->valid = 0; 531 dev->valid = false;
556 schedule_work(&dev->work); 532 schedule_work(&dev->work);
557 /* Don't resubmit urb here, wait for reinit */ 533 /* Don't resubmit urb here, wait for reinit */
558 return; 534 return;
@@ -561,12 +537,11 @@ static void atp_complete(struct urb* urb)
561 dev->idlecount = 0; 537 dev->idlecount = 0;
562 } 538 }
563 539
564exit: 540 exit:
565 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 541 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
566 if (retval) { 542 if (retval)
567 err("%s - usb_submit_urb failed with result %d", 543 err("atp_complete: usb_submit_urb failed with result %d",
568 __FUNCTION__, retval); 544 retval);
569 }
570} 545}
571 546
572static int atp_open(struct input_dev *input) 547static int atp_open(struct input_dev *input)
@@ -593,7 +568,7 @@ static int atp_handle_geyser(struct atp *dev)
593{ 568{
594 struct usb_device *udev = dev->udev; 569 struct usb_device *udev = dev->udev;
595 570
596 if (!atp_is_fountain(dev)) { 571 if (dev->type != ATP_FOUNTAIN) {
597 /* switch to raw sensor mode */ 572 /* switch to raw sensor mode */
598 if (atp_geyser_init(udev)) 573 if (atp_geyser_init(udev))
599 return -EIO; 574 return -EIO;
@@ -604,7 +579,8 @@ static int atp_handle_geyser(struct atp *dev)
604 return 0; 579 return 0;
605} 580}
606 581
607static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id) 582static int atp_probe(struct usb_interface *iface,
583 const struct usb_device_id *id)
608{ 584{
609 struct atp *dev; 585 struct atp *dev;
610 struct input_dev *input_dev; 586 struct input_dev *input_dev;
@@ -640,13 +616,12 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
640 616
641 dev->udev = udev; 617 dev->udev = udev;
642 dev->input = input_dev; 618 dev->input = input_dev;
643 dev->overflowwarn = 0; 619 dev->type = id->driver_info;
644 if (atp_is_geyser_3(dev)) 620 dev->overflow_warned = false;
645 dev->datalen = 64; 621 if (dev->type == ATP_FOUNTAIN || dev->type == ATP_GEYSER1)
646 else if (atp_is_geyser_2(dev))
647 dev->datalen = 64;
648 else
649 dev->datalen = 81; 622 dev->datalen = 81;
623 else
624 dev->datalen = 64;
650 625
651 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 626 dev->urb = usb_alloc_urb(0, GFP_KERNEL);
652 if (!dev->urb) 627 if (!dev->urb)
@@ -680,7 +655,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
680 655
681 set_bit(EV_ABS, input_dev->evbit); 656 set_bit(EV_ABS, input_dev->evbit);
682 657
683 if (atp_is_geyser_3(dev)) { 658 if (dev->type == ATP_GEYSER3 || dev->type == ATP_GEYSER4) {
684 /* 659 /*
685 * MacBook have 20 X sensors, 10 Y sensors 660 * MacBook have 20 X sensors, 10 Y sensors
686 */ 661 */
@@ -688,7 +663,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
688 ((20 - 1) * ATP_XFACT) - 1, ATP_FUZZ, 0); 663 ((20 - 1) * ATP_XFACT) - 1, ATP_FUZZ, 0);
689 input_set_abs_params(input_dev, ABS_Y, 0, 664 input_set_abs_params(input_dev, ABS_Y, 0,
690 ((10 - 1) * ATP_YFACT) - 1, ATP_FUZZ, 0); 665 ((10 - 1) * ATP_YFACT) - 1, ATP_FUZZ, 0);
691 } else if (atp_is_geyser_2(dev)) { 666 } else if (dev->type == ATP_GEYSER2) {
692 /* 667 /*
693 * Oct 2005 15" PowerBooks have 15 X sensors, 17" are detected 668 * Oct 2005 15" PowerBooks have 15 X sensors, 17" are detected
694 * later. 669 * later.
@@ -703,9 +678,11 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
703 * 17" models are detected later. 678 * 17" models are detected later.
704 */ 679 */
705 input_set_abs_params(input_dev, ABS_X, 0, 680 input_set_abs_params(input_dev, ABS_X, 0,
706 (16 - 1) * ATP_XFACT - 1, ATP_FUZZ, 0); 681 (16 - 1) * ATP_XFACT - 1,
682 ATP_FUZZ, 0);
707 input_set_abs_params(input_dev, ABS_Y, 0, 683 input_set_abs_params(input_dev, ABS_Y, 0,
708 (ATP_YSENSORS - 1) * ATP_YFACT - 1, ATP_FUZZ, 0); 684 (ATP_YSENSORS - 1) * ATP_YFACT - 1,
685 ATP_FUZZ, 0);
709 } 686 }
710 input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0); 687 input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0);
711 688
@@ -774,7 +751,7 @@ static int atp_suspend(struct usb_interface *iface, pm_message_t message)
774 struct atp *dev = usb_get_intfdata(iface); 751 struct atp *dev = usb_get_intfdata(iface);
775 752
776 usb_kill_urb(dev->urb); 753 usb_kill_urb(dev->urb);
777 dev->valid = 0; 754 dev->valid = false;
778 755
779 return 0; 756 return 0;
780} 757}
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index 98a3561d4b05..adf45b3040e9 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -57,15 +57,12 @@ MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
57MODULE_DESCRIPTION("Atari mouse driver"); 57MODULE_DESCRIPTION("Atari mouse driver");
58MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
59 59
60static int mouse_threshold[2] = {2,2}; 60static int mouse_threshold[2] = {2, 2};
61module_param_array(mouse_threshold, int, NULL, 0);
61 62
62#ifdef __MODULE__
63MODULE_PARM(mouse_threshold, "2i");
64#endif
65#ifdef FIXED_ATARI_JOYSTICK 63#ifdef FIXED_ATARI_JOYSTICK
66extern int atari_mouse_buttons; 64extern int atari_mouse_buttons;
67#endif 65#endif
68static int atamouse_used = 0;
69 66
70static struct input_dev *atamouse_dev; 67static struct input_dev *atamouse_dev;
71 68
@@ -97,9 +94,6 @@ static void atamouse_interrupt(char *buf)
97 94
98static int atamouse_open(struct input_dev *dev) 95static int atamouse_open(struct input_dev *dev)
99{ 96{
100 if (atamouse_used++)
101 return 0;
102
103#ifdef FIXED_ATARI_JOYSTICK 97#ifdef FIXED_ATARI_JOYSTICK
104 atari_mouse_buttons = 0; 98 atari_mouse_buttons = 0;
105#endif 99#endif
@@ -107,23 +101,24 @@ static int atamouse_open(struct input_dev *dev)
107 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]); 101 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]);
108 ikbd_mouse_rel_pos(); 102 ikbd_mouse_rel_pos();
109 atari_input_mouse_interrupt_hook = atamouse_interrupt; 103 atari_input_mouse_interrupt_hook = atamouse_interrupt;
104
110 return 0; 105 return 0;
111} 106}
112 107
113static void atamouse_close(struct input_dev *dev) 108static void atamouse_close(struct input_dev *dev)
114{ 109{
115 if (!--atamouse_used) { 110 ikbd_mouse_disable();
116 ikbd_mouse_disable(); 111 atari_mouse_interrupt_hook = NULL;
117 atari_mouse_interrupt_hook = NULL;
118 }
119} 112}
120 113
121static int __init atamouse_init(void) 114static int __init atamouse_init(void)
122{ 115{
116 int error;
117
123 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) 118 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
124 return -ENODEV; 119 return -ENODEV;
125 120
126 if (!(atari_keyb_init())) 121 if (!atari_keyb_init())
127 return -ENODEV; 122 return -ENODEV;
128 123
129 atamouse_dev = input_allocate_device(); 124 atamouse_dev = input_allocate_device();
@@ -141,12 +136,14 @@ static int __init atamouse_init(void)
141 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 136 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
142 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | 137 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
143 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 138 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
139
144 atamouse_dev->open = atamouse_open; 140 atamouse_dev->open = atamouse_open;
145 atamouse_dev->close = atamouse_close; 141 atamouse_dev->close = atamouse_close;
146 142
147 if (input_register_device(atamouse_dev)) { 143 error = input_register_device(atamouse_dev);
144 if (error) {
148 input_free_device(atamouse_dev); 145 input_free_device(atamouse_dev);
149 return -ENOMEM; 146 return error;
150 } 147 }
151 148
152 return 0; 149 return 0;
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c
index 27f88fbb7136..e532c48410ea 100644
--- a/drivers/input/mouse/hil_ptr.c
+++ b/drivers/input/mouse/hil_ptr.c
@@ -247,19 +247,24 @@ static void hil_ptr_disconnect(struct serio *serio)
247 247
248static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) 248static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
249{ 249{
250 struct hil_ptr *ptr; 250 struct hil_ptr *ptr;
251 const char *txt; 251 const char *txt;
252 unsigned int i, naxsets, btntype; 252 unsigned int i, naxsets, btntype;
253 uint8_t did, *idd; 253 uint8_t did, *idd;
254 254 int error;
255 if (!(ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL))) 255
256 ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL);
257 if (!ptr)
256 return -ENOMEM; 258 return -ENOMEM;
257 259
258 ptr->dev = input_allocate_device(); 260 ptr->dev = input_allocate_device();
259 if (!ptr->dev) 261 if (!ptr->dev) {
262 error = -ENOMEM;
260 goto bail0; 263 goto bail0;
264 }
261 265
262 if (serio_open(serio, driver)) 266 error = serio_open(serio, driver);
267 if (error)
263 goto bail1; 268 goto bail1;
264 269
265 serio_set_drvdata(serio, ptr); 270 serio_set_drvdata(serio, ptr);
@@ -297,6 +302,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
297 did = ptr->idd[0]; 302 did = ptr->idd[0];
298 idd = ptr->idd + 1; 303 idd = ptr->idd + 1;
299 txt = "unknown"; 304 txt = "unknown";
305
300 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) { 306 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
301 ptr->dev->evbit[0] = BIT_MASK(EV_REL); 307 ptr->dev->evbit[0] = BIT_MASK(EV_REL);
302 txt = "relative"; 308 txt = "relative";
@@ -306,8 +312,11 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
306 ptr->dev->evbit[0] = BIT_MASK(EV_ABS); 312 ptr->dev->evbit[0] = BIT_MASK(EV_ABS);
307 txt = "absolute"; 313 txt = "absolute";
308 } 314 }
309 if (!ptr->dev->evbit[0]) 315
316 if (!ptr->dev->evbit[0]) {
317 error = -ENODEV;
310 goto bail2; 318 goto bail2;
319 }
311 320
312 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd); 321 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
313 if (ptr->nbtn) 322 if (ptr->nbtn)
@@ -380,13 +389,19 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
380 ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */ 389 ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */
381 ptr->dev->dev.parent = &serio->dev; 390 ptr->dev->dev.parent = &serio->dev;
382 391
383 input_register_device(ptr->dev); 392 error = input_register_device(ptr->dev);
393 if (error) {
394 printk(KERN_INFO PREFIX "Unable to register input device\n");
395 goto bail2;
396 }
397
384 printk(KERN_INFO "input: %s (%s), ID: %d\n", 398 printk(KERN_INFO "input: %s (%s), ID: %d\n",
385 ptr->dev->name, 399 ptr->dev->name,
386 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad", 400 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
387 did); 401 did);
388 402
389 return 0; 403 return 0;
404
390 bail2: 405 bail2:
391 serio_close(serio); 406 serio_close(serio);
392 bail1: 407 bail1:
@@ -394,7 +409,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
394 bail0: 409 bail0:
395 kfree(ptr); 410 kfree(ptr);
396 serio_set_drvdata(serio, NULL); 411 serio_set_drvdata(serio, NULL);
397 return -ENODEV; 412 return error;
398} 413}
399 414
400static struct serio_device_id hil_ptr_ids[] = { 415static struct serio_device_id hil_ptr_ids[] = {
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 06c35fc553c0..3827a22362de 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: inport.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index 9ea895593b27..e2413113df22 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: logibm.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c
index 61cff8374e6c..fd09c8df81f2 100644
--- a/drivers/input/mouse/pc110pad.c
+++ b/drivers/input/mouse/pc110pad.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: pc110pad.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index ed917bfd086a..17ff137b9bd5 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: sermouse.c,v 1.17 2002/03/13 10:03:43 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index ec4b6610f730..27d70d326ff3 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -190,4 +190,14 @@ config SERIO_RAW
190 To compile this driver as a module, choose M here: the 190 To compile this driver as a module, choose M here: the
191 module will be called serio_raw. 191 module will be called serio_raw.
192 192
193config SERIO_XILINX_XPS_PS2
194 tristate "Xilinx XPS PS/2 Controller Support"
195 depends on PPC
196 help
197 This driver supports XPS PS/2 IP from the Xilinx EDK on
198 PowerPC platform.
199
200 To compile this driver as a module, choose M here: the
201 module will be called xilinx_ps2.
202
193endif 203endif
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index 38b886887cbc..9b6c8135955f 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o
21obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o 21obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o
22obj-$(CONFIG_SERIO_LIBPS2) += libps2.o 22obj-$(CONFIG_SERIO_LIBPS2) += libps2.o
23obj-$(CONFIG_SERIO_RAW) += serio_raw.o 23obj-$(CONFIG_SERIO_RAW) += serio_raw.o
24obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c
index 0d35018c23a9..d1380fc72cc6 100644
--- a/drivers/input/serio/ct82c710.c
+++ b/drivers/input/serio/ct82c710.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: ct82c710.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 93a1a6ba216a..37586a68d345 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -76,7 +76,7 @@ static struct timer_list hil_mlcs_kicker;
76static int hil_mlcs_probe; 76static int hil_mlcs_probe;
77 77
78static void hil_mlcs_process(unsigned long unused); 78static void hil_mlcs_process(unsigned long unused);
79DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0); 79static DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
80 80
81 81
82/* #define HIL_MLC_DEBUG */ 82/* #define HIL_MLC_DEBUG */
@@ -459,7 +459,7 @@ static int hilse_operate(hil_mlc *mlc, int repoll)
459#define OUT_LAST(pack) \ 459#define OUT_LAST(pack) \
460{ HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, 460{ HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 },
461 461
462const struct hilse_node hil_mlc_se[HILSEN_END] = { 462static const struct hilse_node hil_mlc_se[HILSEN_END] = {
463 463
464 /* 0 HILSEN_START */ 464 /* 0 HILSEN_START */
465 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) 465 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0)
@@ -784,7 +784,7 @@ static void hil_mlcs_process(unsigned long unused)
784 784
785/************************* Keepalive timer task *********************/ 785/************************* Keepalive timer task *********************/
786 786
787void hil_mlcs_timer(unsigned long data) 787static void hil_mlcs_timer(unsigned long data)
788{ 788{
789 hil_mlcs_probe = 1; 789 hil_mlcs_probe = 1;
790 tasklet_schedule(&hil_mlcs_tasklet); 790 tasklet_schedule(&hil_mlcs_tasklet);
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index edfedd9a166c..7b233a492ad5 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -105,6 +105,10 @@ EXPORT_SYMBOL(__hp_sdc_enqueue_transaction);
105EXPORT_SYMBOL(hp_sdc_enqueue_transaction); 105EXPORT_SYMBOL(hp_sdc_enqueue_transaction);
106EXPORT_SYMBOL(hp_sdc_dequeue_transaction); 106EXPORT_SYMBOL(hp_sdc_dequeue_transaction);
107 107
108static unsigned int hp_sdc_disabled;
109module_param_named(no_hpsdc, hp_sdc_disabled, bool, 0);
110MODULE_PARM_DESC(no_hpsdc, "Do not enable HP SDC driver.");
111
108static hp_i8042_sdc hp_sdc; /* All driver state is kept in here. */ 112static hp_i8042_sdc hp_sdc; /* All driver state is kept in here. */
109 113
110/*************** primitives for use in any context *********************/ 114/*************** primitives for use in any context *********************/
@@ -980,6 +984,11 @@ static int __init hp_sdc_register(void)
980 unsigned char i; 984 unsigned char i;
981#endif 985#endif
982 986
987 if (hp_sdc_disabled) {
988 printk(KERN_WARNING PREFIX "HP SDC driver disabled by no_hpsdc=1.\n");
989 return -ENODEV;
990 }
991
983 hp_sdc.dev = NULL; 992 hp_sdc.dev = NULL;
984 hp_sdc.dev_err = 0; 993 hp_sdc.dev_err = 0;
985#if defined(__hppa__) 994#if defined(__hppa__)
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c
index 587398f5c9df..b587e2d576ac 100644
--- a/drivers/input/serio/hp_sdc_mlc.c
+++ b/drivers/input/serio/hp_sdc_mlc.c
@@ -50,7 +50,7 @@ MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>");
50MODULE_DESCRIPTION("Glue for onboard HIL MLC in HP-PARISC machines"); 50MODULE_DESCRIPTION("Glue for onboard HIL MLC in HP-PARISC machines");
51MODULE_LICENSE("Dual BSD/GPL"); 51MODULE_LICENSE("Dual BSD/GPL");
52 52
53struct hp_sdc_mlc_priv_s { 53static struct hp_sdc_mlc_priv_s {
54 int emtestmode; 54 int emtestmode;
55 hp_sdc_transaction trans; 55 hp_sdc_transaction trans;
56 u8 tseq[16]; 56 u8 tseq[16];
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 78eb7841174c..fe732a574ec2 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -63,13 +63,22 @@ static inline void i8042_write_command(int val)
63 outb(val, I8042_COMMAND_REG); 63 outb(val, I8042_COMMAND_REG);
64} 64}
65 65
66#if defined(__i386__) || defined(__x86_64__) 66#ifdef CONFIG_X86
67 67
68#include <linux/dmi.h> 68#include <linux/dmi.h>
69 69
70static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { 70static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71 { 71 {
72 /* AUX LOOP command does not raise AUX IRQ */ 72 /* AUX LOOP command does not raise AUX IRQ */
73 .ident = "Arima-Rioworks HDAMB",
74 .matches = {
75 DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
76 DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
77 DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
78 },
79 },
80 {
81 /* AUX LOOP command does not raise AUX IRQ */
73 .ident = "ASUS P65UP5", 82 .ident = "ASUS P65UP5",
74 .matches = { 83 .matches = {
75 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 84 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
@@ -118,6 +127,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
118 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"), 127 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
119 }, 128 },
120 }, 129 },
130 {
131 .ident = "Medion MAM 2070",
132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
135 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
136 },
137 },
121 { } 138 { }
122}; 139};
123 140
@@ -291,17 +308,36 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
291 DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), 308 DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
292 }, 309 },
293 }, 310 },
311 {
312 .ident = "Acer Aspire 1360",
313 .matches = {
314 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
315 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
316 },
317 },
318 {
319 .ident = "Gericom Bellagio",
320 .matches = {
321 DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
322 DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
323 },
324 },
294 { } 325 { }
295}; 326};
296 327
297 328#ifdef CONFIG_PNP
298 329static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
330 {
331 .ident = "Intel MBO Desktop D845PESV",
332 .matches = {
333 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
334 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
335 },
336 },
337 { }
338};
299#endif 339#endif
300 340
301#ifdef CONFIG_X86
302
303#include <linux/dmi.h>
304
305/* 341/*
306 * Some Wistron based laptops need us to explicitly enable the 'Dritek 342 * Some Wistron based laptops need us to explicitly enable the 'Dritek
307 * keyboard extension' to make their extra keys start generating scancodes. 343 * keyboard extension' to make their extra keys start generating scancodes.
@@ -331,6 +367,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
331 }, 367 },
332 }, 368 },
333 { 369 {
370 .ident = "Acer Aspire 5720",
371 .matches = {
372 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
373 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
374 },
375 },
376 {
334 .ident = "Acer Aspire 9110", 377 .ident = "Acer Aspire 9110",
335 .matches = { 378 .matches = {
336 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 379 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -356,7 +399,6 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
356 399
357#endif /* CONFIG_X86 */ 400#endif /* CONFIG_X86 */
358 401
359
360#ifdef CONFIG_PNP 402#ifdef CONFIG_PNP
361#include <linux/pnp.h> 403#include <linux/pnp.h>
362 404
@@ -466,6 +508,11 @@ static int __init i8042_pnp_init(void)
466 int pnp_data_busted = 0; 508 int pnp_data_busted = 0;
467 int err; 509 int err;
468 510
511#ifdef CONFIG_X86
512 if (dmi_check_system(i8042_dmi_nopnp_table))
513 i8042_nopnp = 1;
514#endif
515
469 if (i8042_nopnp) { 516 if (i8042_nopnp) {
470 printk(KERN_INFO "i8042: PNP detection disabled\n"); 517 printk(KERN_INFO "i8042: PNP detection disabled\n");
471 return 0; 518 return 0;
@@ -591,15 +638,13 @@ static int __init i8042_platform_init(void)
591 i8042_reset = 1; 638 i8042_reset = 1;
592#endif 639#endif
593 640
594#if defined(__i386__) || defined(__x86_64__) 641#ifdef CONFIG_X86
595 if (dmi_check_system(i8042_dmi_noloop_table)) 642 if (dmi_check_system(i8042_dmi_noloop_table))
596 i8042_noloop = 1; 643 i8042_noloop = 1;
597 644
598 if (dmi_check_system(i8042_dmi_nomux_table)) 645 if (dmi_check_system(i8042_dmi_nomux_table))
599 i8042_nomux = 1; 646 i8042_nomux = 1;
600#endif
601 647
602#ifdef CONFIG_X86
603 if (dmi_check_system(i8042_dmi_dritek_table)) 648 if (dmi_check_system(i8042_dmi_dritek_table))
604 i8042_dritek = 1; 649 i8042_dritek = 1;
605#endif /* CONFIG_X86 */ 650#endif /* CONFIG_X86 */
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index b819239d74dc..2b304c22c200 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -26,15 +26,6 @@ MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>");
26MODULE_DESCRIPTION("PS/2 driver library"); 26MODULE_DESCRIPTION("PS/2 driver library");
27MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
28 28
29/* Work structure to schedule execution of a command */
30struct ps2work {
31 struct work_struct work;
32 struct ps2dev *ps2dev;
33 int command;
34 unsigned char param[0];
35};
36
37
38/* 29/*
39 * ps2_sendbyte() sends a byte to the device and waits for acknowledge. 30 * ps2_sendbyte() sends a byte to the device and waits for acknowledge.
40 * It doesn't handle retransmission, though it could - because if there 31 * It doesn't handle retransmission, though it could - because if there
@@ -246,49 +237,6 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
246EXPORT_SYMBOL(ps2_command); 237EXPORT_SYMBOL(ps2_command);
247 238
248/* 239/*
249 * ps2_execute_scheduled_command() sends a command, previously scheduled by
250 * ps2_schedule_command(), to a PS/2 device (keyboard, mouse, etc.)
251 */
252
253static void ps2_execute_scheduled_command(struct work_struct *work)
254{
255 struct ps2work *ps2work = container_of(work, struct ps2work, work);
256
257 ps2_command(ps2work->ps2dev, ps2work->param, ps2work->command);
258 kfree(ps2work);
259}
260
261/*
262 * ps2_schedule_command() allows to schedule delayed execution of a PS/2
263 * command and can be used to issue a command from an interrupt or softirq
264 * context.
265 */
266
267int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command)
268{
269 struct ps2work *ps2work;
270 int send = (command >> 12) & 0xf;
271 int receive = (command >> 8) & 0xf;
272
273 if (!(ps2work = kmalloc(sizeof(struct ps2work) + max(send, receive), GFP_ATOMIC)))
274 return -1;
275
276 memset(ps2work, 0, sizeof(struct ps2work));
277 ps2work->ps2dev = ps2dev;
278 ps2work->command = command;
279 memcpy(ps2work->param, param, send);
280 INIT_WORK(&ps2work->work, ps2_execute_scheduled_command);
281
282 if (!schedule_work(&ps2work->work)) {
283 kfree(ps2work);
284 return -1;
285 }
286
287 return 0;
288}
289EXPORT_SYMBOL(ps2_schedule_command);
290
291/*
292 * ps2_init() initializes ps2dev structure 240 * ps2_init() initializes ps2dev structure
293 */ 241 */
294 242
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c
index d962a8d78b14..e36a0901646c 100644
--- a/drivers/input/serio/q40kbd.c
+++ b/drivers/input/serio/q40kbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: q40kbd.c,v 1.12 2002/02/02 22:26:44 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * 3 *
6 * Based on the work of: 4 * Based on the work of:
@@ -49,7 +47,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
49MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); 47MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver");
50MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
51 49
52DEFINE_SPINLOCK(q40kbd_lock); 50static DEFINE_SPINLOCK(q40kbd_lock);
53static struct serio *q40kbd_port; 51static struct serio *q40kbd_port;
54static struct platform_device *q40kbd_device; 52static struct platform_device *q40kbd_device;
55 53
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
index 34c59d9c6205..1567b7782478 100644
--- a/drivers/input/serio/rpckbd.c
+++ b/drivers/input/serio/rpckbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: rpckbd.c,v 1.7 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * Copyright (c) 2002 Russell King 3 * Copyright (c) 2002 Russell King
6 */ 4 */
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 7f5293828fbf..78f2abb5c11b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -331,9 +331,10 @@ static void serio_handle_event(void)
331} 331}
332 332
333/* 333/*
334 * Remove all events that have been submitted for a given serio port. 334 * Remove all events that have been submitted for a given
335 * object, be it serio port or driver.
335 */ 336 */
336static void serio_remove_pending_events(struct serio *serio) 337static void serio_remove_pending_events(void *object)
337{ 338{
338 struct list_head *node, *next; 339 struct list_head *node, *next;
339 struct serio_event *event; 340 struct serio_event *event;
@@ -343,7 +344,7 @@ static void serio_remove_pending_events(struct serio *serio)
343 344
344 list_for_each_safe(node, next, &serio_event_list) { 345 list_for_each_safe(node, next, &serio_event_list) {
345 event = list_entry(node, struct serio_event, node); 346 event = list_entry(node, struct serio_event, node);
346 if (event->object == serio) { 347 if (event->object == object) {
347 list_del_init(node); 348 list_del_init(node);
348 serio_free_event(event); 349 serio_free_event(event);
349 } 350 }
@@ -837,7 +838,9 @@ void serio_unregister_driver(struct serio_driver *drv)
837 struct serio *serio; 838 struct serio *serio;
838 839
839 mutex_lock(&serio_mutex); 840 mutex_lock(&serio_mutex);
841
840 drv->manual_bind = 1; /* so serio_find_driver ignores it */ 842 drv->manual_bind = 1; /* so serio_find_driver ignores it */
843 serio_remove_pending_events(drv);
841 844
842start_over: 845start_over:
843 list_for_each_entry(serio, &serio_list, node) { 846 list_for_each_entry(serio, &serio_list, node) {
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
new file mode 100644
index 000000000000..0ed044d5e685
--- /dev/null
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -0,0 +1,380 @@
1/*
2 * Xilinx XPS PS/2 device driver
3 *
4 * (c) 2005 MontaVista Software, Inc.
5 * (c) 2008 Xilinx, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, write to the Free Software Foundation, Inc.,
14 * 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17
18#include <linux/module.h>
19#include <linux/serio.h>
20#include <linux/interrupt.h>
21#include <linux/errno.h>
22#include <linux/init.h>
23#include <linux/list.h>
24#include <linux/io.h>
25
26#include <linux/of_device.h>
27#include <linux/of_platform.h>
28
29#define DRIVER_NAME "xilinx_ps2"
30
31/* Register offsets for the xps2 device */
32#define XPS2_SRST_OFFSET 0x00000000 /* Software Reset register */
33#define XPS2_STATUS_OFFSET 0x00000004 /* Status register */
34#define XPS2_RX_DATA_OFFSET 0x00000008 /* Receive Data register */
35#define XPS2_TX_DATA_OFFSET 0x0000000C /* Transmit Data register */
36#define XPS2_GIER_OFFSET 0x0000002C /* Global Interrupt Enable reg */
37#define XPS2_IPISR_OFFSET 0x00000030 /* Interrupt Status register */
38#define XPS2_IPIER_OFFSET 0x00000038 /* Interrupt Enable register */
39
40/* Reset Register Bit Definitions */
41#define XPS2_SRST_RESET 0x0000000A /* Software Reset */
42
43/* Status Register Bit Positions */
44#define XPS2_STATUS_RX_FULL 0x00000001 /* Receive Full */
45#define XPS2_STATUS_TX_FULL 0x00000002 /* Transmit Full */
46
47/* Bit definitions for ISR/IER registers. Both the registers have the same bit
48 * definitions and are only defined once. */
49#define XPS2_IPIXR_WDT_TOUT 0x00000001 /* Watchdog Timeout Interrupt */
50#define XPS2_IPIXR_TX_NOACK 0x00000002 /* Transmit No ACK Interrupt */
51#define XPS2_IPIXR_TX_ACK 0x00000004 /* Transmit ACK (Data) Interrupt */
52#define XPS2_IPIXR_RX_OVF 0x00000008 /* Receive Overflow Interrupt */
53#define XPS2_IPIXR_RX_ERR 0x00000010 /* Receive Error Interrupt */
54#define XPS2_IPIXR_RX_FULL 0x00000020 /* Receive Data Interrupt */
55
56/* Mask for all the Transmit Interrupts */
57#define XPS2_IPIXR_TX_ALL (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_TX_ACK)
58
59/* Mask for all the Receive Interrupts */
60#define XPS2_IPIXR_RX_ALL (XPS2_IPIXR_RX_OVF | XPS2_IPIXR_RX_ERR | \
61 XPS2_IPIXR_RX_FULL)
62
63/* Mask for all the Interrupts */
64#define XPS2_IPIXR_ALL (XPS2_IPIXR_TX_ALL | XPS2_IPIXR_RX_ALL | \
65 XPS2_IPIXR_WDT_TOUT)
66
67/* Global Interrupt Enable mask */
68#define XPS2_GIER_GIE_MASK 0x80000000
69
70struct xps2data {
71 int irq;
72 u32 phys_addr;
73 u32 remap_size;
74 spinlock_t lock;
75 u8 rxb; /* Rx buffer */
76 void __iomem *base_address; /* virt. address of control registers */
77 unsigned int dfl;
78 struct serio serio; /* serio */
79};
80
81/************************************/
82/* XPS PS/2 data transmission calls */
83/************************************/
84
85/*
86 * xps2_recv() will attempt to receive a byte of data from the PS/2 port.
87 */
88static int xps2_recv(struct xps2data *drvdata, u8 *byte)
89{
90 u32 sr;
91 int status = -1;
92
93 /* If there is data available in the PS/2 receiver, read it */
94 sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
95 if (sr & XPS2_STATUS_RX_FULL) {
96 *byte = in_be32(drvdata->base_address + XPS2_RX_DATA_OFFSET);
97 status = 0;
98 }
99
100 return status;
101}
102
103/*********************/
104/* Interrupt handler */
105/*********************/
106static irqreturn_t xps2_interrupt(int irq, void *dev_id)
107{
108 struct xps2data *drvdata = dev_id;
109 u32 intr_sr;
110 u8 c;
111 int status;
112
113 /* Get the PS/2 interrupts and clear them */
114 intr_sr = in_be32(drvdata->base_address + XPS2_IPISR_OFFSET);
115 out_be32(drvdata->base_address + XPS2_IPISR_OFFSET, intr_sr);
116
117 /* Check which interrupt is active */
118 if (intr_sr & XPS2_IPIXR_RX_OVF)
119 printk(KERN_WARNING "%s: receive overrun error\n",
120 drvdata->serio.name);
121
122 if (intr_sr & XPS2_IPIXR_RX_ERR)
123 drvdata->dfl |= SERIO_PARITY;
124
125 if (intr_sr & (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_WDT_TOUT))
126 drvdata->dfl |= SERIO_TIMEOUT;
127
128 if (intr_sr & XPS2_IPIXR_RX_FULL) {
129 status = xps2_recv(drvdata, &drvdata->rxb);
130
131 /* Error, if a byte is not received */
132 if (status) {
133 printk(KERN_ERR
134 "%s: wrong rcvd byte count (%d)\n",
135 drvdata->serio.name, status);
136 } else {
137 c = drvdata->rxb;
138 serio_interrupt(&drvdata->serio, c, drvdata->dfl);
139 drvdata->dfl = 0;
140 }
141 }
142
143 if (intr_sr & XPS2_IPIXR_TX_ACK)
144 drvdata->dfl = 0;
145
146 return IRQ_HANDLED;
147}
148
149/*******************/
150/* serio callbacks */
151/*******************/
152
153/*
154 * sxps2_write() sends a byte out through the PS/2 interface.
155 */
156static int sxps2_write(struct serio *pserio, unsigned char c)
157{
158 struct xps2data *drvdata = pserio->port_data;
159 unsigned long flags;
160 u32 sr;
161 int status = -1;
162
163 spin_lock_irqsave(&drvdata->lock, flags);
164
165 /* If the PS/2 transmitter is empty send a byte of data */
166 sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
167 if (!(sr & XPS2_STATUS_TX_FULL)) {
168 out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET, c);
169 status = 0;
170 }
171
172 spin_unlock_irqrestore(&drvdata->lock, flags);
173
174 return status;
175}
176
177/*
178 * sxps2_open() is called when a port is open by the higher layer.
179 */
180static int sxps2_open(struct serio *pserio)
181{
182 struct xps2data *drvdata = pserio->port_data;
183 int retval;
184
185 retval = request_irq(drvdata->irq, &xps2_interrupt, 0,
186 DRIVER_NAME, drvdata);
187 if (retval) {
188 printk(KERN_ERR
189 "%s: Couldn't allocate interrupt %d\n",
190 drvdata->serio.name, drvdata->irq);
191 return retval;
192 }
193
194 /* start reception by enabling the interrupts */
195 out_be32(drvdata->base_address + XPS2_GIER_OFFSET, XPS2_GIER_GIE_MASK);
196 out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, XPS2_IPIXR_RX_ALL);
197 (void)xps2_recv(drvdata, &drvdata->rxb);
198
199 return 0; /* success */
200}
201
202/*
203 * sxps2_close() frees the interrupt.
204 */
205static void sxps2_close(struct serio *pserio)
206{
207 struct xps2data *drvdata = pserio->port_data;
208
209 /* Disable the PS2 interrupts */
210 out_be32(drvdata->base_address + XPS2_GIER_OFFSET, 0x00);
211 out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0x00);
212 free_irq(drvdata->irq, drvdata);
213}
214
215/*********************/
216/* Device setup code */
217/*********************/
218
219static int xps2_setup(struct device *dev, struct resource *regs_res,
220 struct resource *irq_res)
221{
222 struct xps2data *drvdata;
223 struct serio *serio;
224 unsigned long remap_size;
225 int retval;
226
227 if (!dev)
228 return -EINVAL;
229
230 if (!regs_res || !irq_res) {
231 dev_err(dev, "IO resource(s) not found\n");
232 return -EINVAL;
233 }
234
235 drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
236 if (!drvdata) {
237 dev_err(dev, "Couldn't allocate device private record\n");
238 return -ENOMEM;
239 }
240
241 dev_set_drvdata(dev, drvdata);
242
243 spin_lock_init(&drvdata->lock);
244 drvdata->irq = irq_res->start;
245
246 remap_size = regs_res->end - regs_res->start + 1;
247 if (!request_mem_region(regs_res->start, remap_size, DRIVER_NAME)) {
248 dev_err(dev, "Couldn't lock memory region at 0x%08X\n",
249 (unsigned int)regs_res->start);
250 retval = -EBUSY;
251 goto failed1;
252 }
253
254 /* Fill in configuration data and add them to the list */
255 drvdata->phys_addr = regs_res->start;
256 drvdata->remap_size = remap_size;
257 drvdata->base_address = ioremap(regs_res->start, remap_size);
258 if (drvdata->base_address == NULL) {
259 dev_err(dev, "Couldn't ioremap memory at 0x%08X\n",
260 (unsigned int)regs_res->start);
261 retval = -EFAULT;
262 goto failed2;
263 }
264
265 /* Disable all the interrupts, just in case */
266 out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0);
267
268 /* Reset the PS2 device and abort any current transaction, to make sure
269 * we have the PS2 in a good state */
270 out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET);
271
272 dev_info(dev, "Xilinx PS2 at 0x%08X mapped to 0x%08X, irq=%d\n",
273 drvdata->phys_addr, (u32)drvdata->base_address, drvdata->irq);
274
275 serio = &drvdata->serio;
276 serio->id.type = SERIO_8042;
277 serio->write = sxps2_write;
278 serio->open = sxps2_open;
279 serio->close = sxps2_close;
280 serio->port_data = drvdata;
281 serio->dev.parent = dev;
282 snprintf(serio->name, sizeof(serio->name),
283 "Xilinx XPS PS/2 at %08X", drvdata->phys_addr);
284 snprintf(serio->phys, sizeof(serio->phys),
285 "xilinxps2/serio at %08X", drvdata->phys_addr);
286 serio_register_port(serio);
287
288 return 0; /* success */
289
290failed2:
291 release_mem_region(regs_res->start, remap_size);
292failed1:
293 kfree(drvdata);
294 dev_set_drvdata(dev, NULL);
295
296 return retval;
297}
298
299/***************************/
300/* OF Platform Bus Support */
301/***************************/
302
303static int __devinit xps2_of_probe(struct of_device *ofdev, const struct
304 of_device_id * match)
305{
306 struct resource r_irq; /* Interrupt resources */
307 struct resource r_mem; /* IO mem resources */
308 int rc = 0;
309
310 printk(KERN_INFO "Device Tree Probing \'%s\'\n",
311 ofdev->node->name);
312
313 /* Get iospace for the device */
314 rc = of_address_to_resource(ofdev->node, 0, &r_mem);
315 if (rc) {
316 dev_err(&ofdev->dev, "invalid address\n");
317 return rc;
318 }
319
320 /* Get IRQ for the device */
321 rc = of_irq_to_resource(ofdev->node, 0, &r_irq);
322 if (rc == NO_IRQ) {
323 dev_err(&ofdev->dev, "no IRQ found\n");
324 return rc;
325 }
326
327 return xps2_setup(&ofdev->dev, &r_mem, &r_irq);
328}
329
330static int __devexit xps2_of_remove(struct of_device *of_dev)
331{
332 struct device *dev = &of_dev->dev;
333 struct xps2data *drvdata;
334
335 if (!dev)
336 return -EINVAL;
337
338 drvdata = dev_get_drvdata(dev);
339
340 serio_unregister_port(&drvdata->serio);
341 iounmap(drvdata->base_address);
342 release_mem_region(drvdata->phys_addr, drvdata->remap_size);
343 kfree(drvdata);
344
345 dev_set_drvdata(dev, NULL);
346
347 return 0; /* success */
348}
349
350/* Match table for of_platform binding */
351static struct of_device_id xps2_of_match[] __devinitdata = {
352 { .compatible = "xlnx,xps-ps2-1.00.a", },
353 { /* end of list */ },
354};
355MODULE_DEVICE_TABLE(of, xps2_of_match);
356
357static struct of_platform_driver xps2_of_driver = {
358 .name = DRIVER_NAME,
359 .match_table = xps2_of_match,
360 .probe = xps2_of_probe,
361 .remove = __devexit_p(xps2_of_remove),
362};
363
364static int __init xps2_init(void)
365{
366 return of_register_platform_driver(&xps2_of_driver);
367}
368
369static void __exit xps2_cleanup(void)
370{
371 of_unregister_platform_driver(&xps2_of_driver);
372}
373
374module_init(xps2_init);
375module_exit(xps2_cleanup);
376
377MODULE_AUTHOR("Xilinx, Inc.");
378MODULE_DESCRIPTION("Xilinx XPS PS/2 driver");
379MODULE_LICENSE("GPL");
380
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index b973d0ef6d16..570e0e83ac46 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -73,10 +73,10 @@ static void usb_acecad_irq(struct urb *urb)
73 case -ENOENT: 73 case -ENOENT:
74 case -ESHUTDOWN: 74 case -ESHUTDOWN:
75 /* this urb is terminated, clean up */ 75 /* this urb is terminated, clean up */
76 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 76 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
77 return; 77 return;
78 default: 78 default:
79 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 79 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
80 goto resubmit; 80 goto resubmit;
81 } 81 }
82 82
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 55c1134d6137..8f037a1d44a6 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -449,12 +449,12 @@ static void aiptek_irq(struct urb *urb)
449 case -ESHUTDOWN: 449 case -ESHUTDOWN:
450 /* This urb is terminated, clean up */ 450 /* This urb is terminated, clean up */
451 dbg("%s - urb shutting down with status: %d", 451 dbg("%s - urb shutting down with status: %d",
452 __FUNCTION__, urb->status); 452 __func__, urb->status);
453 return; 453 return;
454 454
455 default: 455 default:
456 dbg("%s - nonzero urb status received: %d", 456 dbg("%s - nonzero urb status received: %d",
457 __FUNCTION__, urb->status); 457 __func__, urb->status);
458 goto exit; 458 goto exit;
459 } 459 }
460 460
@@ -813,7 +813,7 @@ exit:
813 retval = usb_submit_urb(urb, GFP_ATOMIC); 813 retval = usb_submit_urb(urb, GFP_ATOMIC);
814 if (retval != 0) { 814 if (retval != 0) {
815 err("%s - usb_submit_urb failed with result %d", 815 err("%s - usb_submit_urb failed with result %d",
816 __FUNCTION__, retval); 816 __func__, retval);
817 } 817 }
818} 818}
819 819
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 1e748e46d12e..b9b7a98bc5a5 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -863,7 +863,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
863 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); 863 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL);
864 if (!gtco->urbinfo) { 864 if (!gtco->urbinfo) {
865 err("Failed to allocate URB"); 865 err("Failed to allocate URB");
866 return -ENOMEM; 866 error = -ENOMEM;
867 goto err_free_buf; 867 goto err_free_buf;
868 } 868 }
869 869
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index f23f5a97fb38..d89112fa6e6b 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -56,10 +56,10 @@ static void kbtab_irq(struct urb *urb)
56 case -ENOENT: 56 case -ENOENT:
57 case -ESHUTDOWN: 57 case -ESHUTDOWN:
58 /* this urb is terminated, clean up */ 58 /* this urb is terminated, clean up */
59 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 59 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
60 return; 60 return;
61 default: 61 default:
62 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 62 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
63 goto exit; 63 goto exit;
64 } 64 }
65 65
@@ -88,7 +88,7 @@ static void kbtab_irq(struct urb *urb)
88 retval = usb_submit_urb (urb, GFP_ATOMIC); 88 retval = usb_submit_urb (urb, GFP_ATOMIC);
89 if (retval) 89 if (retval)
90 err ("%s - usb_submit_urb failed with result %d", 90 err ("%s - usb_submit_urb failed with result %d",
91 __FUNCTION__, retval); 91 __func__, retval);
92} 92}
93 93
94static struct usb_device_id kbtab_ids[] = { 94static struct usb_device_id kbtab_ids[] = {
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 706619d06f71..ca62ec639f8f 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -105,7 +105,7 @@ struct wacom {
105 struct urb *irq; 105 struct urb *irq;
106 struct wacom_wac * wacom_wac; 106 struct wacom_wac * wacom_wac;
107 struct mutex lock; 107 struct mutex lock;
108 int open:1; 108 unsigned int open:1;
109 char phys[32]; 109 char phys[32];
110}; 110};
111 111
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 71cc0c140790..5fbc463baf5a 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -56,10 +56,10 @@ static void wacom_sys_irq(struct urb *urb)
56 case -ENOENT: 56 case -ENOENT:
57 case -ESHUTDOWN: 57 case -ESHUTDOWN:
58 /* this urb is terminated, clean up */ 58 /* this urb is terminated, clean up */
59 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 59 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
60 return; 60 return;
61 default: 61 default:
62 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 62 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
63 goto exit; 63 goto exit;
64 } 64 }
65 65
@@ -74,7 +74,7 @@ static void wacom_sys_irq(struct urb *urb)
74 retval = usb_submit_urb (urb, GFP_ATOMIC); 74 retval = usb_submit_urb (urb, GFP_ATOMIC);
75 if (retval) 75 if (retval)
76 err ("%s - usb_submit_urb failed with result %d", 76 err ("%s - usb_submit_urb failed with result %d",
77 __FUNCTION__, retval); 77 __func__, retval);
78} 78}
79 79
80void wacom_report_key(void *wcombo, unsigned int key_type, int key_data) 80void wacom_report_key(void *wcombo, unsigned int key_type, int key_data)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 192513e1f04c..bf3d9a8b2c1b 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -56,7 +56,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
56static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) 56static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
57{ 57{
58 unsigned char *data = wacom->data; 58 unsigned char *data = wacom->data;
59 int prox, id, pressure; 59 int prox, pressure;
60 60
61 if (data[0] != 2) { 61 if (data[0] != 2) {
62 dbg("wacom_pl_irq: received unknown report #%d", data[0]); 62 dbg("wacom_pl_irq: received unknown report #%d", data[0]);
@@ -65,7 +65,7 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
65 65
66 prox = data[1] & 0x40; 66 prox = data[1] & 0x40;
67 67
68 id = ERASER_DEVICE_ID; 68 wacom->id[0] = ERASER_DEVICE_ID;
69 if (prox) { 69 if (prox) {
70 70
71 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 71 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
@@ -99,10 +99,10 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
99 if (wacom->tool[1] != BTN_TOOL_RUBBER) { 99 if (wacom->tool[1] != BTN_TOOL_RUBBER) {
100 /* Unknown tool selected default to pen tool */ 100 /* Unknown tool selected default to pen tool */
101 wacom->tool[1] = BTN_TOOL_PEN; 101 wacom->tool[1] = BTN_TOOL_PEN;
102 id = STYLUS_DEVICE_ID; 102 wacom->id[0] = STYLUS_DEVICE_ID;
103 } 103 }
104 wacom_report_key(wcombo, wacom->tool[1], prox); /* report in proximity for tool */ 104 wacom_report_key(wcombo, wacom->tool[1], prox); /* report in proximity for tool */
105 wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 105 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
106 wacom_report_abs(wcombo, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 106 wacom_report_abs(wcombo, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
107 wacom_report_abs(wcombo, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 107 wacom_report_abs(wcombo, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
108 wacom_report_abs(wcombo, ABS_PRESSURE, pressure); 108 wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
@@ -127,7 +127,6 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
127static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) 127static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
128{ 128{
129 unsigned char *data = wacom->data; 129 unsigned char *data = wacom->data;
130 int id;
131 130
132 if (data[0] != 2) { 131 if (data[0] != 2) {
133 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); 132 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
@@ -137,13 +136,13 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
137 if (data[1] & 0x04) { 136 if (data[1] & 0x04) {
138 wacom_report_key(wcombo, BTN_TOOL_RUBBER, data[1] & 0x20); 137 wacom_report_key(wcombo, BTN_TOOL_RUBBER, data[1] & 0x20);
139 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x08); 138 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x08);
140 id = ERASER_DEVICE_ID; 139 wacom->id[0] = ERASER_DEVICE_ID;
141 } else { 140 } else {
142 wacom_report_key(wcombo, BTN_TOOL_PEN, data[1] & 0x20); 141 wacom_report_key(wcombo, BTN_TOOL_PEN, data[1] & 0x20);
143 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01); 142 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01);
144 id = STYLUS_DEVICE_ID; 143 wacom->id[0] = STYLUS_DEVICE_ID;
145 } 144 }
146 wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 145 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
147 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); 146 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
148 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); 147 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
149 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6])); 148 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
@@ -155,27 +154,26 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
155static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) 154static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
156{ 155{
157 unsigned char *data = wacom->data; 156 unsigned char *data = wacom->data;
158 int x, y, id, rw; 157 int x, y, rw;
159 158
160 if (data[0] != 2) { 159 if (data[0] != 2) {
161 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 160 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
162 return 0; 161 return 0;
163 } 162 }
164 163
165 id = STYLUS_DEVICE_ID; 164 if (data[1] & 0x80) {
166 if ((data[1] & 0x80) && ((data[1] & 0x07) || data[2] || data[3] || data[4]
167 || data[5] || data[6] || (data[7] & 0x07))) {
168 /* in prox and not a pad data */ 165 /* in prox and not a pad data */
169 166
170 switch ((data[1] >> 5) & 3) { 167 switch ((data[1] >> 5) & 3) {
171 168
172 case 0: /* Pen */ 169 case 0: /* Pen */
173 wacom->tool[0] = BTN_TOOL_PEN; 170 wacom->tool[0] = BTN_TOOL_PEN;
171 wacom->id[0] = STYLUS_DEVICE_ID;
174 break; 172 break;
175 173
176 case 1: /* Rubber */ 174 case 1: /* Rubber */
177 wacom->tool[0] = BTN_TOOL_RUBBER; 175 wacom->tool[0] = BTN_TOOL_RUBBER;
178 id = ERASER_DEVICE_ID; 176 wacom->id[0] = ERASER_DEVICE_ID;
179 break; 177 break;
180 178
181 case 2: /* Mouse with wheel */ 179 case 2: /* Mouse with wheel */
@@ -190,7 +188,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
190 188
191 case 3: /* Mouse without wheel */ 189 case 3: /* Mouse without wheel */
192 wacom->tool[0] = BTN_TOOL_MOUSE; 190 wacom->tool[0] = BTN_TOOL_MOUSE;
193 id = CURSOR_DEVICE_ID; 191 wacom->id[0] = CURSOR_DEVICE_ID;
194 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); 192 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
195 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); 193 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
196 if (wacom->features->type == WACOM_G4 || 194 if (wacom->features->type == WACOM_G4 ||
@@ -210,9 +208,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
210 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 208 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
211 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); 209 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04);
212 } 210 }
213 wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 211 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
214 wacom_report_key(wcombo, wacom->tool[0], 1); 212 wacom_report_key(wcombo, wacom->tool[0], 1);
215 } else if (!(data[1] & 0x90)) { 213 } else if (wacom->id[0]) {
216 wacom_report_abs(wcombo, ABS_X, 0); 214 wacom_report_abs(wcombo, ABS_X, 0);
217 wacom_report_abs(wcombo, ABS_Y, 0); 215 wacom_report_abs(wcombo, ABS_Y, 0);
218 if (wacom->tool[0] == BTN_TOOL_MOUSE) { 216 if (wacom->tool[0] == BTN_TOOL_MOUSE) {
@@ -225,6 +223,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
225 wacom_report_key(wcombo, BTN_STYLUS, 0); 223 wacom_report_key(wcombo, BTN_STYLUS, 0);
226 wacom_report_key(wcombo, BTN_STYLUS2, 0); 224 wacom_report_key(wcombo, BTN_STYLUS2, 0);
227 } 225 }
226 wacom->id[0] = 0;
228 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 227 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
229 wacom_report_key(wcombo, wacom->tool[0], 0); 228 wacom_report_key(wcombo, wacom->tool[0], 0);
230 } 229 }
@@ -234,13 +233,13 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
234 case WACOM_G4: 233 case WACOM_G4:
235 if (data[7] & 0xf8) { 234 if (data[7] & 0xf8) {
236 wacom_input_sync(wcombo); /* sync last event */ 235 wacom_input_sync(wcombo); /* sync last event */
237 wacom->id[1] = 1; 236 wacom->id[1] = PAD_DEVICE_ID;
238 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); 237 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
239 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); 238 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
240 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); 239 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
241 wacom_report_rel(wcombo, REL_WHEEL, rw); 240 wacom_report_rel(wcombo, REL_WHEEL, rw);
242 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 241 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
243 wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); 242 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
244 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 243 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
245 } else if (wacom->id[1]) { 244 } else if (wacom->id[1]) {
246 wacom_input_sync(wcombo); /* sync last event */ 245 wacom_input_sync(wcombo); /* sync last event */
@@ -255,14 +254,14 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
255 case WACOM_MO: 254 case WACOM_MO:
256 if ((data[7] & 0xf8) || (data[8] & 0xff)) { 255 if ((data[7] & 0xf8) || (data[8] & 0xff)) {
257 wacom_input_sync(wcombo); /* sync last event */ 256 wacom_input_sync(wcombo); /* sync last event */
258 wacom->id[1] = 1; 257 wacom->id[1] = PAD_DEVICE_ID;
259 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); 258 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
260 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); 259 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
261 wacom_report_key(wcombo, BTN_4, (data[7] & 0x10)); 260 wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
262 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40)); 261 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
263 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f)); 262 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
264 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 263 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
265 wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); 264 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
266 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 265 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
267 } else if (wacom->id[1]) { 266 } else if (wacom->id[1]) {
268 wacom_input_sync(wcombo); /* sync last event */ 267 wacom_input_sync(wcombo); /* sync last event */
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 565ec711c2ee..e57366521572 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -103,6 +103,18 @@ config TOUCHSCREEN_MTOUCH
103 To compile this driver as a module, choose M here: the 103 To compile this driver as a module, choose M here: the
104 module will be called mtouch. 104 module will be called mtouch.
105 105
106config TOUCHSCREEN_INEXIO
107 tristate "iNexio serial touchscreens"
108 select SERIO
109 help
110 Say Y here if you have an iNexio serial touchscreen connected to
111 your system.
112
113 If unsure, say N.
114
115 To compile this driver as a module, choose M here: the
116 module will be called inexio.
117
106config TOUCHSCREEN_MK712 118config TOUCHSCREEN_MK712
107 tristate "ICS MicroClock MK712 touchscreen" 119 tristate "ICS MicroClock MK712 touchscreen"
108 help 120 help
@@ -134,6 +146,18 @@ config TOUCHSCREEN_HP7XX
134 To compile this driver as a module, choose M here: the 146 To compile this driver as a module, choose M here: the
135 module will be called jornada720_ts. 147 module will be called jornada720_ts.
136 148
149config TOUCHSCREEN_HTCPEN
150 tristate "HTC Shift X9500 touchscreen"
151 depends on ISA
152 help
153 Say Y here if you have an HTC Shift UMPC also known as HTC X9500
154 Clio / Shangrila and want to support the built-in touchscreen.
155
156 If unsure, say N.
157
158 To compile this driver as a module, choose M here: the
159 module will be called htcpen.
160
137config TOUCHSCREEN_PENMOUNT 161config TOUCHSCREEN_PENMOUNT
138 tristate "Penmount serial touchscreen" 162 tristate "Penmount serial touchscreen"
139 select SERIO 163 select SERIO
@@ -146,6 +170,17 @@ config TOUCHSCREEN_PENMOUNT
146 To compile this driver as a module, choose M here: the 170 To compile this driver as a module, choose M here: the
147 module will be called penmount. 171 module will be called penmount.
148 172
173config TOUCHSCREEN_MIGOR
174 tristate "Renesas MIGO-R touchscreen"
175 depends on SH_MIGOR && I2C
176 help
177 Say Y here to enable MIGO-R touchscreen support.
178
179 If unsure, say N.
180
181 To compile this driver as a module, choose M here: the
182 module will be called migor_ts.
183
149config TOUCHSCREEN_TOUCHRIGHT 184config TOUCHSCREEN_TOUCHRIGHT
150 tristate "Touchright serial touchscreen" 185 tristate "Touchright serial touchscreen"
151 select SERIO 186 select SERIO
@@ -316,4 +351,15 @@ config TOUCHSCREEN_USB_GOTOP
316 bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED 351 bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED
317 depends on TOUCHSCREEN_USB_COMPOSITE 352 depends on TOUCHSCREEN_USB_COMPOSITE
318 353
354config TOUCHSCREEN_TOUCHIT213
355 tristate "Sahara TouchIT-213 touchscreen"
356 select SERIO
357 help
358 Say Y here if you have a Sahara TouchIT-213 Tablet PC.
359
360 If unsure, say N.
361
362 To compile this driver as a module, choose M here: the
363 module will be called touchit213.
364
319endif 365endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 3c096d75651d..39a804cd80f1 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -12,12 +12,16 @@ obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
12obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 12obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
13obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o 13obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
14obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o 14obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o
15obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o
16obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o
15obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o 17obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
16obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o 18obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o
17obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o 19obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
18obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o 20obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o
21obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o
19obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o 22obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o
20obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o 23obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o
24obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o
21obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o 25obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
22obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o 26obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
23obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o 27obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index a48a15868c4a..a54f90e02ab6 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: gunze.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 */ 3 */
6 4
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index 28ae15ed12c5..4f86081dc7fc 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $
3 *
4 * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com 2 * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com
5 * 3 *
6 * Sponsored by Transvirtual Technology. 4 * Sponsored by Transvirtual Technology.
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c
new file mode 100644
index 000000000000..62811de6f18f
--- /dev/null
+++ b/drivers/input/touchscreen/htcpen.c
@@ -0,0 +1,255 @@
1/*
2 * HTC Shift touchscreen driver
3 *
4 * Copyright (C) 2008 Pau Oliva Fora <pof@eslack.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#include <linux/errno.h>
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/input.h>
15#include <linux/interrupt.h>
16#include <linux/io.h>
17#include <linux/init.h>
18#include <linux/irq.h>
19#include <linux/isa.h>
20#include <linux/ioport.h>
21#include <linux/dmi.h>
22
23MODULE_AUTHOR("Pau Oliva Fora <pau@eslack.org>");
24MODULE_DESCRIPTION("HTC Shift touchscreen driver");
25MODULE_LICENSE("GPL");
26
27#define HTCPEN_PORT_IRQ_CLEAR 0x068
28#define HTCPEN_PORT_INIT 0x06c
29#define HTCPEN_PORT_INDEX 0x0250
30#define HTCPEN_PORT_DATA 0x0251
31#define HTCPEN_IRQ 3
32
33#define DEVICE_ENABLE 0xa2
34#define DEVICE_DISABLE 0xa3
35
36#define X_INDEX 3
37#define Y_INDEX 5
38#define TOUCH_INDEX 0xb
39#define LSB_XY_INDEX 0xc
40#define X_AXIS_MAX 2040
41#define Y_AXIS_MAX 2040
42
43static int invert_x;
44module_param(invert_x, bool, 0644);
45MODULE_PARM_DESC(invert_x, "If set, X axis is inverted");
46static int invert_y;
47module_param(invert_y, bool, 0644);
48MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted");
49
50static struct pnp_device_id pnp_ids[] = {
51 { .id = "PNP0cc0" },
52 { .id = "" }
53};
54MODULE_DEVICE_TABLE(pnp, pnp_ids);
55
56static irqreturn_t htcpen_interrupt(int irq, void *handle)
57{
58 struct input_dev *htcpen_dev = handle;
59 unsigned short x, y, xy;
60
61 /* 0 = press; 1 = release */
62 outb_p(TOUCH_INDEX, HTCPEN_PORT_INDEX);
63
64 if (inb_p(HTCPEN_PORT_DATA)) {
65 input_report_key(htcpen_dev, BTN_TOUCH, 0);
66 } else {
67 outb_p(X_INDEX, HTCPEN_PORT_INDEX);
68 x = inb_p(HTCPEN_PORT_DATA);
69
70 outb_p(Y_INDEX, HTCPEN_PORT_INDEX);
71 y = inb_p(HTCPEN_PORT_DATA);
72
73 outb_p(LSB_XY_INDEX, HTCPEN_PORT_INDEX);
74 xy = inb_p(HTCPEN_PORT_DATA);
75
76 /* get high resolution value of X and Y using LSB */
77 x = X_AXIS_MAX - ((x * 8) + ((xy >> 4) & 0xf));
78 y = (y * 8) + (xy & 0xf);
79 if (invert_x)
80 x = X_AXIS_MAX - x;
81 if (invert_y)
82 y = Y_AXIS_MAX - y;
83
84 if (x != X_AXIS_MAX && x != 0) {
85 input_report_key(htcpen_dev, BTN_TOUCH, 1);
86 input_report_abs(htcpen_dev, ABS_X, x);
87 input_report_abs(htcpen_dev, ABS_Y, y);
88 }
89 }
90
91 input_sync(htcpen_dev);
92
93 inb_p(HTCPEN_PORT_IRQ_CLEAR);
94
95 return IRQ_HANDLED;
96}
97
98static int htcpen_open(struct input_dev *dev)
99{
100 outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT);
101
102 return 0;
103}
104
105static void htcpen_close(struct input_dev *dev)
106{
107 outb_p(DEVICE_DISABLE, HTCPEN_PORT_INIT);
108 synchronize_irq(HTCPEN_IRQ);
109}
110
111static int __devinit htcpen_isa_probe(struct device *dev, unsigned int id)
112{
113 struct input_dev *htcpen_dev;
114 int err = -EBUSY;
115
116 if (!request_region(HTCPEN_PORT_IRQ_CLEAR, 1, "htcpen")) {
117 printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n",
118 HTCPEN_PORT_IRQ_CLEAR);
119 goto request_region1_failed;
120 }
121
122 if (!request_region(HTCPEN_PORT_INIT, 1, "htcpen")) {
123 printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n",
124 HTCPEN_PORT_INIT);
125 goto request_region2_failed;
126 }
127
128 if (!request_region(HTCPEN_PORT_INDEX, 2, "htcpen")) {
129 printk(KERN_ERR "htcpen: unable to get IO region 0x%x\n",
130 HTCPEN_PORT_INDEX);
131 goto request_region3_failed;
132 }
133
134 htcpen_dev = input_allocate_device();
135 if (!htcpen_dev) {
136 printk(KERN_ERR "htcpen: can't allocate device\n");
137 err = -ENOMEM;
138 goto input_alloc_failed;
139 }
140
141 htcpen_dev->name = "HTC Shift EC TouchScreen";
142 htcpen_dev->id.bustype = BUS_ISA;
143
144 htcpen_dev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
145 htcpen_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
146 input_set_abs_params(htcpen_dev, ABS_X, 0, X_AXIS_MAX, 0, 0);
147 input_set_abs_params(htcpen_dev, ABS_Y, 0, Y_AXIS_MAX, 0, 0);
148
149 htcpen_dev->open = htcpen_open;
150 htcpen_dev->close = htcpen_close;
151
152 err = request_irq(HTCPEN_IRQ, htcpen_interrupt, 0, "htcpen",
153 htcpen_dev);
154 if (err) {
155 printk(KERN_ERR "htcpen: irq busy\n");
156 goto request_irq_failed;
157 }
158
159 inb_p(HTCPEN_PORT_IRQ_CLEAR);
160
161 err = input_register_device(htcpen_dev);
162 if (err)
163 goto input_register_failed;
164
165 dev_set_drvdata(dev, htcpen_dev);
166
167 return 0;
168
169 input_register_failed:
170 free_irq(HTCPEN_IRQ, htcpen_dev);
171 request_irq_failed:
172 input_free_device(htcpen_dev);
173 input_alloc_failed:
174 release_region(HTCPEN_PORT_INDEX, 2);
175 request_region3_failed:
176 release_region(HTCPEN_PORT_INIT, 1);
177 request_region2_failed:
178 release_region(HTCPEN_PORT_IRQ_CLEAR, 1);
179 request_region1_failed:
180 return err;
181}
182
183static int __devexit htcpen_isa_remove(struct device *dev, unsigned int id)
184{
185 struct input_dev *htcpen_dev = dev_get_drvdata(dev);
186
187 input_unregister_device(htcpen_dev);
188
189 free_irq(HTCPEN_IRQ, htcpen_dev);
190
191 release_region(HTCPEN_PORT_INDEX, 2);
192 release_region(HTCPEN_PORT_INIT, 1);
193 release_region(HTCPEN_PORT_IRQ_CLEAR, 1);
194
195 dev_set_drvdata(dev, NULL);
196
197 return 0;
198}
199
200#ifdef CONFIG_PM
201static int htcpen_isa_suspend(struct device *dev, unsigned int n,
202 pm_message_t state)
203{
204 outb_p(DEVICE_DISABLE, HTCPEN_PORT_INIT);
205
206 return 0;
207}
208
209static int htcpen_isa_resume(struct device *dev, unsigned int n)
210{
211 outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT);
212
213 return 0;
214}
215#endif
216
217static struct isa_driver htcpen_isa_driver = {
218 .probe = htcpen_isa_probe,
219 .remove = __devexit_p(htcpen_isa_remove),
220#ifdef CONFIG_PM
221 .suspend = htcpen_isa_suspend,
222 .resume = htcpen_isa_resume,
223#endif
224 .driver = {
225 .owner = THIS_MODULE,
226 .name = "htcpen",
227 }
228};
229
230static struct dmi_system_id __initdata htcshift_dmi_table[] = {
231 {
232 .ident = "Shift",
233 .matches = {
234 DMI_MATCH(DMI_SYS_VENDOR, "High Tech Computer Corp"),
235 DMI_MATCH(DMI_PRODUCT_NAME, "Shift"),
236 },
237 },
238 { }
239};
240
241static int __init htcpen_isa_init(void)
242{
243 if (!dmi_check_system(htcshift_dmi_table))
244 return -ENODEV;
245
246 return isa_register_driver(&htcpen_isa_driver, 1);
247}
248
249static void __exit htcpen_isa_exit(void)
250{
251 isa_unregister_driver(&htcpen_isa_driver);
252}
253
254module_init(htcpen_isa_init);
255module_exit(htcpen_isa_exit);
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
new file mode 100644
index 000000000000..192ade0a0fb9
--- /dev/null
+++ b/drivers/input/touchscreen/inexio.c
@@ -0,0 +1,207 @@
1/*
2 * iNexio serial touchscreen driver
3 *
4 * Copyright (c) 2008 Richard Lemon
5 * Based on the mtouch driver (c) Vojtech Pavlik and Dan Streetman
6 *
7 */
8
9/*
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 */
14
15/*
16 * 2008/06/19 Richard Lemon <richard@codelemon.com>
17 * Copied mtouch.c and edited for iNexio protocol
18 */
19
20#include <linux/errno.h>
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/slab.h>
24#include <linux/input.h>
25#include <linux/serio.h>
26#include <linux/init.h>
27
28#define DRIVER_DESC "iNexio serial touchscreen driver"
29
30MODULE_AUTHOR("Richard Lemon <richard@codelemon.com>");
31MODULE_DESCRIPTION(DRIVER_DESC);
32MODULE_LICENSE("GPL");
33
34/*
35 * Definitions & global arrays.
36 */
37
38#define INEXIO_FORMAT_TOUCH_BIT 0x01
39#define INEXIO_FORMAT_LENGTH 5
40#define INEXIO_RESPONSE_BEGIN_BYTE 0x80
41
42/* todo: check specs for max length of all responses */
43#define INEXIO_MAX_LENGTH 16
44
45#define INEXIO_MIN_XC 0
46#define INEXIO_MAX_XC 0x3fff
47#define INEXIO_MIN_YC 0
48#define INEXIO_MAX_YC 0x3fff
49
50#define INEXIO_GET_XC(data) (((data[1])<<7) | data[2])
51#define INEXIO_GET_YC(data) (((data[3])<<7) | data[4])
52#define INEXIO_GET_TOUCHED(data) (INEXIO_FORMAT_TOUCH_BIT & data[0])
53
54/*
55 * Per-touchscreen data.
56 */
57
58struct inexio {
59 struct input_dev *dev;
60 struct serio *serio;
61 int idx;
62 unsigned char data[INEXIO_MAX_LENGTH];
63 char phys[32];
64};
65
66static void inexio_process_data(struct inexio *pinexio)
67{
68 struct input_dev *dev = pinexio->dev;
69
70 if (INEXIO_FORMAT_LENGTH == ++pinexio->idx) {
71 input_report_abs(dev, ABS_X, INEXIO_GET_XC(pinexio->data));
72 input_report_abs(dev, ABS_Y, INEXIO_GET_YC(pinexio->data));
73 input_report_key(dev, BTN_TOUCH, INEXIO_GET_TOUCHED(pinexio->data));
74 input_sync(dev);
75
76 pinexio->idx = 0;
77 }
78}
79
80static irqreturn_t inexio_interrupt(struct serio *serio,
81 unsigned char data, unsigned int flags)
82{
83 struct inexio* pinexio = serio_get_drvdata(serio);
84
85 pinexio->data[pinexio->idx] = data;
86
87 if (INEXIO_RESPONSE_BEGIN_BYTE&pinexio->data[0])
88 inexio_process_data(pinexio);
89 else
90 printk(KERN_DEBUG "inexio.c: unknown/unsynchronized data from device, byte %x\n",pinexio->data[0]);
91
92 return IRQ_HANDLED;
93}
94
95/*
96 * inexio_disconnect() is the opposite of inexio_connect()
97 */
98
99static void inexio_disconnect(struct serio *serio)
100{
101 struct inexio* pinexio = serio_get_drvdata(serio);
102
103 input_get_device(pinexio->dev);
104 input_unregister_device(pinexio->dev);
105 serio_close(serio);
106 serio_set_drvdata(serio, NULL);
107 input_put_device(pinexio->dev);
108 kfree(pinexio);
109}
110
111/*
112 * inexio_connect() is the routine that is called when someone adds a
113 * new serio device that supports iNexio protocol and registers it as
114 * an input device. This is usually accomplished using inputattach.
115 */
116
117static int inexio_connect(struct serio *serio, struct serio_driver *drv)
118{
119 struct inexio *pinexio;
120 struct input_dev *input_dev;
121 int err;
122
123 pinexio = kzalloc(sizeof(struct inexio), GFP_KERNEL);
124 input_dev = input_allocate_device();
125 if (!pinexio || !input_dev) {
126 err = -ENOMEM;
127 goto fail1;
128 }
129
130 pinexio->serio = serio;
131 pinexio->dev = input_dev;
132 snprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys);
133
134 input_dev->name = "iNexio Serial TouchScreen";
135 input_dev->phys = pinexio->phys;
136 input_dev->id.bustype = BUS_RS232;
137 input_dev->id.vendor = SERIO_INEXIO;
138 input_dev->id.product = 0;
139 input_dev->id.version = 0x0001;
140 input_dev->dev.parent = &serio->dev;
141 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
142 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
143 input_set_abs_params(pinexio->dev, ABS_X, INEXIO_MIN_XC, INEXIO_MAX_XC, 0, 0);
144 input_set_abs_params(pinexio->dev, ABS_Y, INEXIO_MIN_YC, INEXIO_MAX_YC, 0, 0);
145
146 serio_set_drvdata(serio, pinexio);
147
148 err = serio_open(serio, drv);
149 if (err)
150 goto fail2;
151
152 err = input_register_device(pinexio->dev);
153 if (err)
154 goto fail3;
155
156 return 0;
157
158 fail3: serio_close(serio);
159 fail2: serio_set_drvdata(serio, NULL);
160 fail1: input_free_device(input_dev);
161 kfree(pinexio);
162 return err;
163}
164
165/*
166 * The serio driver structure.
167 */
168
169static struct serio_device_id inexio_serio_ids[] = {
170 {
171 .type = SERIO_RS232,
172 .proto = SERIO_INEXIO,
173 .id = SERIO_ANY,
174 .extra = SERIO_ANY,
175 },
176 { 0 }
177};
178
179MODULE_DEVICE_TABLE(serio, inexio_serio_ids);
180
181static struct serio_driver inexio_drv = {
182 .driver = {
183 .name = "inexio",
184 },
185 .description = DRIVER_DESC,
186 .id_table = inexio_serio_ids,
187 .interrupt = inexio_interrupt,
188 .connect = inexio_connect,
189 .disconnect = inexio_disconnect,
190};
191
192/*
193 * The functions for inserting/removing us as a module.
194 */
195
196static int __init inexio_init(void)
197{
198 return serio_register_driver(&inexio_drv);
199}
200
201static void __exit inexio_exit(void)
202{
203 serio_unregister_driver(&inexio_drv);
204}
205
206module_init(inexio_init);
207module_exit(inexio_exit);
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c
new file mode 100644
index 000000000000..c1cd99d58981
--- /dev/null
+++ b/drivers/input/touchscreen/migor_ts.c
@@ -0,0 +1,250 @@
1/*
2 * Touch Screen driver for Renesas MIGO-R Platform
3 *
4 * Copyright (c) 2008 Magnus Damm
5 * Copyright (c) 2007 Ujjwal Pande <ujjwal@kenati.com>,
6 * Kenati Technologies Pvt Ltd.
7 *
8 * This file is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This file is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/input.h>
25#include <linux/interrupt.h>
26#include <asm/io.h>
27#include <linux/i2c.h>
28#include <linux/timer.h>
29
30#define EVENT_PENDOWN 1
31#define EVENT_REPEAT 2
32#define EVENT_PENUP 3
33
34struct migor_ts_priv {
35 struct i2c_client *client;
36 struct input_dev *input;
37 struct delayed_work work;
38 int irq;
39};
40
41static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11,
42 0x01, 0x06, 0x07, };
43static const u_int8_t migor_ts_dis_seq[17] = { };
44
45static void migor_ts_poscheck(struct work_struct *work)
46{
47 struct migor_ts_priv *priv = container_of(work,
48 struct migor_ts_priv,
49 work.work);
50 unsigned short xpos, ypos;
51 unsigned char event;
52 u_int8_t buf[16];
53
54 memset(buf, 0, sizeof(buf));
55
56 /* Set Index 0 */
57 buf[0] = 0;
58 if (i2c_master_send(priv->client, buf, 1) != 1) {
59 dev_err(&priv->client->dev, "Unable to write i2c index\n");
60 goto out;
61 }
62
63 /* Now do Page Read */
64 if (i2c_master_recv(priv->client, buf, sizeof(buf)) != sizeof(buf)) {
65 dev_err(&priv->client->dev, "Unable to read i2c page\n");
66 goto out;
67 }
68
69 ypos = ((buf[9] & 0x03) << 8 | buf[8]);
70 xpos = ((buf[11] & 0x03) << 8 | buf[10]);
71 event = buf[12];
72
73 if (event == EVENT_PENDOWN || event == EVENT_REPEAT) {
74 input_report_key(priv->input, BTN_TOUCH, 1);
75 input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/
76 input_report_abs(priv->input, ABS_Y, xpos);
77 input_sync(priv->input);
78 } else if (event == EVENT_PENUP) {
79 input_report_key(priv->input, BTN_TOUCH, 0);
80 input_sync(priv->input);
81 }
82 out:
83 enable_irq(priv->irq);
84}
85
86static irqreturn_t migor_ts_isr(int irq, void *dev_id)
87{
88 struct migor_ts_priv *priv = dev_id;
89
90 /* the touch screen controller chip is hooked up to the cpu
91 * using i2c and a single interrupt line. the interrupt line
92 * is pulled low whenever someone taps the screen. to deassert
93 * the interrupt line we need to acknowledge the interrupt by
94 * communicating with the controller over the slow i2c bus.
95 *
96 * we can't acknowledge from interrupt context since the i2c
97 * bus controller may sleep, so we just disable the interrupt
98 * here and handle the acknowledge using delayed work.
99 */
100
101 disable_irq_nosync(irq);
102 schedule_delayed_work(&priv->work, HZ / 20);
103
104 return IRQ_HANDLED;
105}
106
107
108static int migor_ts_open(struct input_dev *dev)
109{
110 struct migor_ts_priv *priv = input_get_drvdata(dev);
111 struct i2c_client *client = priv->client;
112 int count;
113
114 /* enable controller */
115 count = i2c_master_send(client, migor_ts_ena_seq,
116 sizeof(migor_ts_ena_seq));
117 if (count != sizeof(migor_ts_ena_seq)) {
118 dev_err(&client->dev, "Unable to enable touchscreen.\n");
119 return -ENXIO;
120 }
121
122 return 0;
123}
124
125static void migor_ts_close(struct input_dev *dev)
126{
127 struct migor_ts_priv *priv = input_get_drvdata(dev);
128 struct i2c_client *client = priv->client;
129
130 disable_irq(priv->irq);
131
132 /* cancel pending work and wait for migor_ts_poscheck() to finish */
133 if (cancel_delayed_work_sync(&priv->work)) {
134 /*
135 * if migor_ts_poscheck was canceled we need to enable IRQ
136 * here to balance disable done in migor_ts_isr.
137 */
138 enable_irq(priv->irq);
139 }
140
141 /* disable controller */
142 i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq));
143
144 enable_irq(priv->irq);
145}
146
147static int migor_ts_probe(struct i2c_client *client,
148 const struct i2c_device_id *idp)
149{
150 struct migor_ts_priv *priv;
151 struct input_dev *input;
152 int error;
153
154 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
155 if (!priv) {
156 dev_err(&client->dev, "failed to allocate driver data\n");
157 error = -ENOMEM;
158 goto err0;
159 }
160
161 dev_set_drvdata(&client->dev, priv);
162
163 input = input_allocate_device();
164 if (!input) {
165 dev_err(&client->dev, "Failed to allocate input device.\n");
166 error = -ENOMEM;
167 goto err1;
168 }
169
170 input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
171 input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
172
173 input_set_abs_params(input, ABS_X, 95, 955, 0, 0);
174 input_set_abs_params(input, ABS_Y, 85, 935, 0, 0);
175
176 input->name = client->driver_name;
177 input->id.bustype = BUS_I2C;
178 input->dev.parent = &client->dev;
179
180 input->open = migor_ts_open;
181 input->close = migor_ts_close;
182
183 input_set_drvdata(input, priv);
184
185 priv->client = client;
186 priv->input = input;
187 INIT_DELAYED_WORK(&priv->work, migor_ts_poscheck);
188 priv->irq = client->irq;
189
190 error = input_register_device(input);
191 if (error)
192 goto err1;
193
194 error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW,
195 client->driver_name, priv);
196 if (error) {
197 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
198 goto err2;
199 }
200
201 return 0;
202
203 err2:
204 input_unregister_device(input);
205 input = NULL; /* so we dont try to free it below */
206 err1:
207 input_free_device(input);
208 kfree(priv);
209 err0:
210 dev_set_drvdata(&client->dev, NULL);
211 return error;
212}
213
214static int migor_ts_remove(struct i2c_client *client)
215{
216 struct migor_ts_priv *priv = dev_get_drvdata(&client->dev);
217
218 free_irq(priv->irq, priv);
219 input_unregister_device(priv->input);
220 kfree(priv);
221
222 dev_set_drvdata(&client->dev, NULL);
223
224 return 0;
225}
226
227static struct i2c_driver migor_ts_driver = {
228 .driver = {
229 .name = "migor_ts",
230 },
231 .probe = migor_ts_probe,
232 .remove = migor_ts_remove,
233};
234
235static int __init migor_ts_init(void)
236{
237 return i2c_add_driver(&migor_ts_driver);
238}
239
240static void __exit migor_ts_exit(void)
241{
242 i2c_del_driver(&migor_ts_driver);
243}
244
245MODULE_DESCRIPTION("MigoR Touchscreen driver");
246MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
247MODULE_LICENSE("GPL");
248
249module_init(migor_ts_init);
250module_exit(migor_ts_exit);
diff --git a/drivers/input/touchscreen/touchit213.c b/drivers/input/touchscreen/touchit213.c
new file mode 100644
index 000000000000..d1297ba19daf
--- /dev/null
+++ b/drivers/input/touchscreen/touchit213.c
@@ -0,0 +1,234 @@
1/*
2 * Sahara TouchIT-213 serial touchscreen driver
3 *
4 * Copyright (c) 2007-2008 Claudio Nieder <private@claudio.ch>
5 *
6 * Based on Touchright driver (drivers/input/touchscreen/touchright.c)
7 * Copyright (c) 2006 Rick Koch <n1gp@hotmail.com>
8 * Copyright (c) 2004 Vojtech Pavlik
9 * and Dan Streetman <ddstreet@ieee.org>
10 */
11
12/*
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation.
16 */
17
18#include <linux/errno.h>
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/slab.h>
22#include <linux/input.h>
23#include <linux/serio.h>
24#include <linux/init.h>
25
26#define DRIVER_DESC "Sahara TouchIT-213 serial touchscreen driver"
27
28MODULE_AUTHOR("Claudio Nieder <private@claudio.ch>");
29MODULE_DESCRIPTION(DRIVER_DESC);
30MODULE_LICENSE("GPL");
31
32/*
33 * Definitions & global arrays.
34 */
35
36/*
37 * Data is received through COM1 at 9600bit/s,8bit,no parity in packets
38 * of 5 byte each.
39 *
40 * +--------+ +--------+ +--------+ +--------+ +--------+
41 * |1000000p| |0xxxxxxx| |0xxxxxxx| |0yyyyyyy| |0yyyyyyy|
42 * +--------+ +--------+ +--------+ +--------+ +--------+
43 * MSB LSB MSB LSB
44 *
45 * The value of p is 1 as long as the screen is touched and 0 when
46 * reporting the location where touching stopped, e.g. where the pen was
47 * lifted from the screen.
48 *
49 * When holding the screen in landscape mode as the BIOS text output is
50 * presented, x is the horizontal axis with values growing from left to
51 * right and y is the vertical axis with values growing from top to
52 * bottom.
53 *
54 * When holding the screen in portrait mode with the Sahara logo in its
55 * correct position, x ist the vertical axis with values growing from
56 * top to bottom and y is the horizontal axis with values growing from
57 * right to left.
58 */
59
60#define T213_FORMAT_TOUCH_BIT 0x01
61#define T213_FORMAT_STATUS_BYTE 0x80
62#define T213_FORMAT_STATUS_MASK ~T213_FORMAT_TOUCH_BIT
63
64/*
65 * On my Sahara Touch-IT 213 I have observed x values from 0 to 0x7f0
66 * and y values from 0x1d to 0x7e9, so the actual measurement is
67 * probably done with an 11 bit precision.
68 */
69#define T213_MIN_XC 0
70#define T213_MAX_XC 0x07ff
71#define T213_MIN_YC 0
72#define T213_MAX_YC 0x07ff
73
74/*
75 * Per-touchscreen data.
76 */
77
78struct touchit213 {
79 struct input_dev *dev;
80 struct serio *serio;
81 int idx;
82 unsigned char csum;
83 unsigned char data[5];
84 char phys[32];
85};
86
87static irqreturn_t touchit213_interrupt(struct serio *serio,
88 unsigned char data, unsigned int flags)
89{
90 struct touchit213 *touchit213 = serio_get_drvdata(serio);
91 struct input_dev *dev = touchit213->dev;
92
93 touchit213->data[touchit213->idx] = data;
94
95 switch (touchit213->idx++) {
96 case 0:
97 if ((touchit213->data[0] & T213_FORMAT_STATUS_MASK) !=
98 T213_FORMAT_STATUS_BYTE) {
99 pr_debug("unsynchronized data: 0x%02x\n", data);
100 touchit213->idx = 0;
101 }
102 break;
103
104 case 4:
105 touchit213->idx = 0;
106 input_report_abs(dev, ABS_X,
107 (touchit213->data[1] << 7) | touchit213->data[2]);
108 input_report_abs(dev, ABS_Y,
109 (touchit213->data[3] << 7) | touchit213->data[4]);
110 input_report_key(dev, BTN_TOUCH,
111 touchit213->data[0] & T213_FORMAT_TOUCH_BIT);
112 input_sync(dev);
113 break;
114 }
115
116 return IRQ_HANDLED;
117}
118
119/*
120 * touchit213_disconnect() is the opposite of touchit213_connect()
121 */
122
123static void touchit213_disconnect(struct serio *serio)
124{
125 struct touchit213 *touchit213 = serio_get_drvdata(serio);
126
127 input_get_device(touchit213->dev);
128 input_unregister_device(touchit213->dev);
129 serio_close(serio);
130 serio_set_drvdata(serio, NULL);
131 input_put_device(touchit213->dev);
132 kfree(touchit213);
133}
134
135/*
136 * touchit213_connect() is the routine that is called when someone adds a
137 * new serio device that supports the Touchright protocol and registers it as
138 * an input device.
139 */
140
141static int touchit213_connect(struct serio *serio, struct serio_driver *drv)
142{
143 struct touchit213 *touchit213;
144 struct input_dev *input_dev;
145 int err;
146
147 touchit213 = kzalloc(sizeof(struct touchit213), GFP_KERNEL);
148 input_dev = input_allocate_device();
149 if (!touchit213 || !input_dev) {
150 err = -ENOMEM;
151 goto fail1;
152 }
153
154 touchit213->serio = serio;
155 touchit213->dev = input_dev;
156 snprintf(touchit213->phys, sizeof(touchit213->phys),
157 "%s/input0", serio->phys);
158
159 input_dev->name = "Sahara Touch-iT213 Serial TouchScreen";
160 input_dev->phys = touchit213->phys;
161 input_dev->id.bustype = BUS_RS232;
162 input_dev->id.vendor = SERIO_TOUCHIT213;
163 input_dev->id.product = 0;
164 input_dev->id.version = 0x0100;
165 input_dev->dev.parent = &serio->dev;
166 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
167 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
168 input_set_abs_params(touchit213->dev, ABS_X,
169 T213_MIN_XC, T213_MAX_XC, 0, 0);
170 input_set_abs_params(touchit213->dev, ABS_Y,
171 T213_MIN_YC, T213_MAX_YC, 0, 0);
172
173 serio_set_drvdata(serio, touchit213);
174
175 err = serio_open(serio, drv);
176 if (err)
177 goto fail2;
178
179 err = input_register_device(touchit213->dev);
180 if (err)
181 goto fail3;
182
183 return 0;
184
185 fail3: serio_close(serio);
186 fail2: serio_set_drvdata(serio, NULL);
187 fail1: input_free_device(input_dev);
188 kfree(touchit213);
189 return err;
190}
191
192/*
193 * The serio driver structure.
194 */
195
196static struct serio_device_id touchit213_serio_ids[] = {
197 {
198 .type = SERIO_RS232,
199 .proto = SERIO_TOUCHIT213,
200 .id = SERIO_ANY,
201 .extra = SERIO_ANY,
202 },
203 { 0 }
204};
205
206MODULE_DEVICE_TABLE(serio, touchit213_serio_ids);
207
208static struct serio_driver touchit213_drv = {
209 .driver = {
210 .name = "touchit213",
211 },
212 .description = DRIVER_DESC,
213 .id_table = touchit213_serio_ids,
214 .interrupt = touchit213_interrupt,
215 .connect = touchit213_connect,
216 .disconnect = touchit213_disconnect,
217};
218
219/*
220 * The functions for inserting/removing us as a module.
221 */
222
223static int __init touchit213_init(void)
224{
225 return serio_register_driver(&touchit213_drv);
226}
227
228static void __exit touchit213_exit(void)
229{
230 serio_unregister_driver(&touchit213_drv);
231}
232
233module_init(touchit213_init);
234module_exit(touchit213_exit);
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 3a0a8ca57076..fdd645c214a2 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -49,6 +49,7 @@
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/usb.h> 50#include <linux/usb.h>
51#include <linux/usb/input.h> 51#include <linux/usb/input.h>
52#include <linux/hid.h>
52 53
53 54
54#define DRIVER_VERSION "v0.6" 55#define DRIVER_VERSION "v0.6"
@@ -101,7 +102,7 @@ struct usbtouch_usb {
101 102
102/* device types */ 103/* device types */
103enum { 104enum {
104 DEVTPYE_DUMMY = -1, 105 DEVTYPE_IGNORE = -1,
105 DEVTYPE_EGALAX, 106 DEVTYPE_EGALAX,
106 DEVTYPE_PANJIT, 107 DEVTYPE_PANJIT,
107 DEVTYPE_3M, 108 DEVTYPE_3M,
@@ -115,8 +116,21 @@ enum {
115 DEVTYPE_GOTOP, 116 DEVTYPE_GOTOP,
116}; 117};
117 118
119#define USB_DEVICE_HID_CLASS(vend, prod) \
120 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \
121 | USB_DEVICE_ID_MATCH_DEVICE, \
122 .idVendor = (vend), \
123 .idProduct = (prod), \
124 .bInterfaceClass = USB_INTERFACE_CLASS_HID, \
125 .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE
126
118static struct usb_device_id usbtouch_devices[] = { 127static struct usb_device_id usbtouch_devices[] = {
119#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 128#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
129 /* ignore the HID capable devices, handled by usbhid */
130 {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
131 {USB_DEVICE_HID_CLASS(0x0eef, 0x0002), .driver_info = DEVTYPE_IGNORE},
132
133 /* normal device IDs */
120 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, 134 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
121 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX}, 135 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
122 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, 136 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
@@ -262,7 +276,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
262 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 276 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
263 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); 277 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
264 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", 278 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
265 __FUNCTION__, ret); 279 __func__, ret);
266 if (ret < 0) 280 if (ret < 0)
267 return ret; 281 return ret;
268 msleep(150); 282 msleep(150);
@@ -273,7 +287,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
273 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 287 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
274 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); 288 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
275 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", 289 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
276 __FUNCTION__, ret); 290 __func__, ret);
277 if (ret >= 0) 291 if (ret >= 0)
278 break; 292 break;
279 if (ret != -EPIPE) 293 if (ret != -EPIPE)
@@ -793,18 +807,18 @@ static void usbtouch_irq(struct urb *urb)
793 case -ETIME: 807 case -ETIME:
794 /* this urb is timing out */ 808 /* this urb is timing out */
795 dbg("%s - urb timed out - was the device unplugged?", 809 dbg("%s - urb timed out - was the device unplugged?",
796 __FUNCTION__); 810 __func__);
797 return; 811 return;
798 case -ECONNRESET: 812 case -ECONNRESET:
799 case -ENOENT: 813 case -ENOENT:
800 case -ESHUTDOWN: 814 case -ESHUTDOWN:
801 /* this urb is terminated, clean up */ 815 /* this urb is terminated, clean up */
802 dbg("%s - urb shutting down with status: %d", 816 dbg("%s - urb shutting down with status: %d",
803 __FUNCTION__, urb->status); 817 __func__, urb->status);
804 return; 818 return;
805 default: 819 default:
806 dbg("%s - nonzero urb status received: %d", 820 dbg("%s - nonzero urb status received: %d",
807 __FUNCTION__, urb->status); 821 __func__, urb->status);
808 goto exit; 822 goto exit;
809 } 823 }
810 824
@@ -814,7 +828,7 @@ exit:
814 retval = usb_submit_urb(urb, GFP_ATOMIC); 828 retval = usb_submit_urb(urb, GFP_ATOMIC);
815 if (retval) 829 if (retval)
816 err("%s - usb_submit_urb failed with result: %d", 830 err("%s - usb_submit_urb failed with result: %d",
817 __FUNCTION__, retval); 831 __func__, retval);
818} 832}
819 833
820static int usbtouch_open(struct input_dev *input) 834static int usbtouch_open(struct input_dev *input)
@@ -857,6 +871,10 @@ static int usbtouch_probe(struct usb_interface *intf,
857 struct usbtouch_device_info *type; 871 struct usbtouch_device_info *type;
858 int err = -ENOMEM; 872 int err = -ENOMEM;
859 873
874 /* some devices are ignored */
875 if (id->driver_info == DEVTYPE_IGNORE)
876 return -ENODEV;
877
860 interface = intf->cur_altsetting; 878 interface = intf->cur_altsetting;
861 endpoint = &interface->endpoint[0].desc; 879 endpoint = &interface->endpoint[0].desc;
862 880
@@ -883,7 +901,7 @@ static int usbtouch_probe(struct usb_interface *intf,
883 901
884 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); 902 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL);
885 if (!usbtouch->irq) { 903 if (!usbtouch->irq) {
886 dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__); 904 dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__);
887 goto out_free_buffers; 905 goto out_free_buffers;
888 } 906 }
889 907
@@ -939,14 +957,14 @@ static int usbtouch_probe(struct usb_interface *intf,
939 if (type->init) { 957 if (type->init) {
940 err = type->init(usbtouch); 958 err = type->init(usbtouch);
941 if (err) { 959 if (err) {
942 dbg("%s - type->init() failed, err: %d", __FUNCTION__, err); 960 dbg("%s - type->init() failed, err: %d", __func__, err);
943 goto out_free_buffers; 961 goto out_free_buffers;
944 } 962 }
945 } 963 }
946 964
947 err = input_register_device(usbtouch->input); 965 err = input_register_device(usbtouch->input);
948 if (err) { 966 if (err) {
949 dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err); 967 dbg("%s - input_register_device failed, err: %d", __func__, err);
950 goto out_free_buffers; 968 goto out_free_buffers;
951 } 969 }
952 970
@@ -966,12 +984,12 @@ static void usbtouch_disconnect(struct usb_interface *intf)
966{ 984{
967 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); 985 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
968 986
969 dbg("%s - called", __FUNCTION__); 987 dbg("%s - called", __func__);
970 988
971 if (!usbtouch) 989 if (!usbtouch)
972 return; 990 return;
973 991
974 dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__); 992 dbg("%s - usbtouch is initialized, cleaning up", __func__);
975 usb_set_intfdata(intf, NULL); 993 usb_set_intfdata(intf, NULL);
976 usb_kill_urb(usbtouch->irq); 994 usb_kill_urb(usbtouch->irq);
977 input_unregister_device(usbtouch->input); 995 input_unregister_device(usbtouch->input);
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c
index 0b6e4cfa6a21..4c5d85a249ae 100644
--- a/drivers/input/touchscreen/wm9712.c
+++ b/drivers/input/touchscreen/wm9712.c
@@ -168,6 +168,18 @@ static void wm9712_phy_init(struct wm97xx *wm)
168 64000 / rpu); 168 64000 / rpu);
169 } 169 }
170 170
171 /* WM9712 five wire */
172 if (five_wire) {
173 dig2 |= WM9712_45W;
174 dev_dbg(wm->dev, "setting 5-wire touchscreen mode.");
175
176 if (pil) {
177 dev_warn(wm->dev, "pressure measurement is not "
178 "supported in 5-wire mode\n");
179 pil = 0;
180 }
181 }
182
171 /* touchpanel pressure current*/ 183 /* touchpanel pressure current*/
172 if (pil == 2) { 184 if (pil == 2) {
173 dig2 |= WM9712_PIL; 185 dig2 |= WM9712_PIL;
@@ -179,12 +191,6 @@ static void wm9712_phy_init(struct wm97xx *wm)
179 if (!pil) 191 if (!pil)
180 pressure = 0; 192 pressure = 0;
181 193
182 /* WM9712 five wire */
183 if (five_wire) {
184 dig2 |= WM9712_45W;
185 dev_dbg(wm->dev, "setting 5-wire touchscreen mode.");
186 }
187
188 /* polling mode sample settling delay */ 194 /* polling mode sample settling delay */
189 if (delay < 0 || delay > 15) { 195 if (delay < 0 || delay > 15) {
190 dev_dbg(wm->dev, "supplied delay out of range."); 196 dev_dbg(wm->dev, "supplied delay out of range.");