Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (48 commits)
Input: add switch for dock events
Input: add microphone insert switch definition
Input: i8042 - add Arima-Rioworks HDAMB board to noloop list
Input: sgi_btns - add support for SGI Indy volume buttons
Input: add option to disable HP SDC driver
Input: serio - trivial documentation fix
Input: add new serio driver for Xilinx XPS PS2 IP
Input: add driver for Tabletkiosk Sahara TouchIT-213 touchscreen
Input: new driver for SGI O2 volume buttons
Input: yealink - reliably kill urbs
Input: q40kbd - make q40kbd_lock static
Input: gtco - eliminate early return
Input: i8042 - add Dritek quirk for Acer Aspire 5720
Input: usbtouchscreen - ignore eGalax screens supporting HID protocol
Input: i8042 - add Medion NAM 2070 to noloop blacklist
Input: i8042 - add Gericom Bellagio to nomux blacklist
Input: i8042 - add Acer Aspire 1360 to nomux blacklist
Input: hp_sdc_mlc.c - make a struct static
Input: hil_mlc.c - make code static
Input: wistron - generate normal key event if bluetooth or wifi not present
...

+2282 -549
-2
Documentation/input/gameport-programming.txt
··· 1 - $Id: gameport-programming.txt,v 1.3 2001/04/24 13:51:37 vojtech Exp $ 2 - 3 1 Programming gameport drivers 4 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 3
-1
Documentation/input/input.txt
··· 1 1 Linux Input drivers v1.0 2 2 (c) 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> 3 3 Sponsored by SuSE 4 - $Id: input.txt,v 1.8 2002/05/29 03:15:01 bradleym Exp $ 5 4 ---------------------------------------------------------------------------- 6 5 7 6 0. Disclaimer
-2
Documentation/input/joystick-api.txt
··· 5 5 6 6 7 Aug 1998 7 7 8 - $Id: joystick-api.txt,v 1.2 2001/05/08 21:21:23 vojtech Exp $ 9 - 10 8 1. Initialization 11 9 ~~~~~~~~~~~~~~~~~ 12 10
-1
Documentation/input/joystick-parport.txt
··· 2 2 (c) 1998-2000 Vojtech Pavlik <vojtech@ucw.cz> 3 3 (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de> 4 4 Sponsored by SuSE 5 - $Id: joystick-parport.txt,v 1.6 2001/09/25 09:31:32 vojtech Exp $ 6 5 ---------------------------------------------------------------------------- 7 6 8 7 0. Disclaimer
-1
Documentation/input/joystick.txt
··· 1 1 Linux Joystick driver v2.0.0 2 2 (c) 1996-2000 Vojtech Pavlik <vojtech@ucw.cz> 3 3 Sponsored by SuSE 4 - $Id: joystick.txt,v 1.12 2002/03/03 12:13:07 jdeneux Exp $ 5 4 ---------------------------------------------------------------------------- 6 5 7 6 0. Disclaimer
+6
MAINTAINERS
··· 1988 1988 W: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi 1989 1989 S: Maintained 1990 1990 1991 + HTCPEN TOUCHSCREEN DRIVER 1992 + P: Pau Oliva Fora 1993 + M: pof@eslack.org 1994 + L: linux-input@vger.kernel.org 1995 + S: Maintained 1996 + 1991 1997 HUGETLB FILESYSTEM 1992 1998 P: William Irwin 1993 1999 M: wli@holomorphy.com
+2
drivers/char/keyboard.c
··· 46 46 47 47 extern void ctrl_alt_del(void); 48 48 49 + #define to_handle_h(n) container_of(n, struct input_handle, h_node) 50 + 49 51 /* 50 52 * Exported functions/variables 51 53 */
+2
drivers/hwmon/hdaps.c
··· 581 581 /* initialize the input class */ 582 582 idev = hdaps_idev->input; 583 583 idev->name = "hdaps"; 584 + idev->phys = "isa1600/input0"; 585 + idev->id.bustype = BUS_ISA; 584 586 idev->dev.parent = &pdev->dev; 585 587 idev->evbit[0] = BIT_MASK(EV_ABS); 586 588 input_set_abs_params(idev, ABS_X,
+7 -5
drivers/input/evbug.c
··· 1 1 /* 2 - * $Id: evbug.c,v 1.10 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4 ··· 39 41 static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) 40 42 { 41 43 printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", 42 - handle->dev->phys, type, code, value); 44 + handle->dev->dev.bus_id, type, code, value); 43 45 } 44 46 45 47 static int evbug_connect(struct input_handler *handler, struct input_dev *dev, ··· 64 66 if (error) 65 67 goto err_unregister_handle; 66 68 67 - printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); 69 + printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n", 70 + dev->dev.bus_id, 71 + dev->name ?: "unknown", 72 + dev->phys ?: "unknown"); 68 73 69 74 return 0; 70 75 ··· 80 79 81 80 static void evbug_disconnect(struct input_handle *handle) 82 81 { 83 - printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); 82 + printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", 83 + handle->dev->dev.bus_id); 84 84 85 85 input_close_device(handle); 86 86 input_unregister_handle(handle);
+90 -11
drivers/input/evdev.c
··· 300 300 __s32 value; 301 301 }; 302 302 303 + struct 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 + 316 + struct 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 332 /* Note to the author of this code: did it ever occur to 304 333 you why the ifdefs are needed? Think about it again. -AK */ 305 334 #ifdef CONFIG_X86_64 ··· 397 368 return 0; 398 369 } 399 370 371 + static int evdev_ff_effect_from_user(const char __user *buffer, size_t size, 372 + struct ff_effect *effect) 373 + { 374 + if (COMPAT_TEST) { 375 + struct ff_effect_compat *compat_effect; 376 + 377 + if (size != sizeof(struct ff_effect_compat)) 378 + return -EINVAL; 379 + 380 + /* 381 + * It so happens that the pointer which needs to be changed 382 + * is the last field in the structure, so we can copy the 383 + * whole thing and replace just the pointer. 384 + */ 385 + 386 + compat_effect = (struct ff_effect_compat *)effect; 387 + 388 + if (copy_from_user(compat_effect, buffer, 389 + sizeof(struct ff_effect_compat))) 390 + return -EFAULT; 391 + 392 + if (compat_effect->type == FF_PERIODIC && 393 + compat_effect->u.periodic.waveform == FF_CUSTOM) 394 + effect->u.periodic.custom_data = 395 + compat_ptr(compat_effect->u.periodic.custom_data); 396 + } else { 397 + if (size != sizeof(struct ff_effect)) 398 + return -EINVAL; 399 + 400 + if (copy_from_user(effect, buffer, sizeof(struct ff_effect))) 401 + return -EFAULT; 402 + } 403 + 404 + return 0; 405 + } 406 + 400 407 #else 401 408 402 409 static inline size_t evdev_event_size(void) ··· 453 388 const struct input_event *event) 454 389 { 455 390 if (copy_to_user(buffer, event, sizeof(struct input_event))) 391 + return -EFAULT; 392 + 393 + return 0; 394 + } 395 + 396 + static int evdev_ff_effect_from_user(const char __user *buffer, size_t size, 397 + struct ff_effect *effect) 398 + { 399 + if (size != sizeof(struct ff_effect)) 400 + return -EINVAL; 401 + 402 + if (copy_from_user(effect, buffer, sizeof(struct ff_effect))) 456 403 return -EFAULT; 457 404 458 405 return 0; ··· 710 633 711 634 return input_set_keycode(dev, t, v); 712 635 713 - case EVIOCSFF: 714 - if (copy_from_user(&effect, p, sizeof(effect))) 715 - return -EFAULT; 716 - 717 - error = input_ff_upload(dev, &effect, file); 718 - 719 - if (put_user(effect.id, &(((struct ff_effect __user *)p)->id))) 720 - return -EFAULT; 721 - 722 - return error; 723 - 724 636 case EVIOCRMFF: 725 637 return input_ff_erase(dev, (int)(unsigned long) p, file); 726 638 ··· 798 732 } 799 733 800 734 if (_IOC_DIR(cmd) == _IOC_WRITE) { 735 + 736 + if (_IOC_NR(cmd) == _IOC_NR(EVIOCSFF)) { 737 + 738 + if (evdev_ff_effect_from_user(p, _IOC_SIZE(cmd), &effect)) 739 + return -EFAULT; 740 + 741 + error = input_ff_upload(dev, &effect, file); 742 + 743 + if (put_user(effect.id, &(((struct ff_effect __user *)p)->id))) 744 + return -EFAULT; 745 + 746 + return error; 747 + } 801 748 802 749 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { 803 750
+2 -2
drivers/input/ff-memless.c
··· 247 247 * in s8, this should be changed to something more generic 248 248 */ 249 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 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 253 break; 254 254 255 255 case FF_RUMBLE:
-2
drivers/input/gameport/emu10k1-gp.c
··· 1 1 /* 2 - * $Id: emu10k1-gp.c,v 1.8 2002/01/22 20:40:46 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2001 Vojtech Pavlik 5 3 */ 6 4
-22
drivers/input/gameport/gameport.c
··· 36 36 EXPORT_SYMBOL(gameport_unregister_driver); 37 37 EXPORT_SYMBOL(gameport_open); 38 38 EXPORT_SYMBOL(gameport_close); 39 - EXPORT_SYMBOL(gameport_rescan); 40 39 EXPORT_SYMBOL(gameport_set_phys); 41 40 EXPORT_SYMBOL(gameport_start_polling); 42 41 EXPORT_SYMBOL(gameport_stop_polling); ··· 229 230 */ 230 231 231 232 enum gameport_event_type { 232 - GAMEPORT_RESCAN, 233 - GAMEPORT_RECONNECT, 234 233 GAMEPORT_REGISTER_PORT, 235 234 GAMEPORT_REGISTER_DRIVER, 236 235 }; ··· 360 363 switch (event->type) { 361 364 case GAMEPORT_REGISTER_PORT: 362 365 gameport_add_port(event->object); 363 - break; 364 - 365 - case GAMEPORT_RECONNECT: 366 - gameport_reconnect_port(event->object); 367 - break; 368 - 369 - case GAMEPORT_RESCAN: 370 - gameport_disconnect_port(event->object); 371 - gameport_find_driver(event->object); 372 366 break; 373 367 374 368 case GAMEPORT_REGISTER_DRIVER: ··· 637 649 * Ok, no children left, now disconnect this port 638 650 */ 639 651 device_release_driver(&gameport->dev); 640 - } 641 - 642 - void gameport_rescan(struct gameport *gameport) 643 - { 644 - gameport_queue_event(gameport, NULL, GAMEPORT_RESCAN); 645 - } 646 - 647 - void gameport_reconnect(struct gameport *gameport) 648 - { 649 - gameport_queue_event(gameport, NULL, GAMEPORT_RECONNECT); 650 652 } 651 653 652 654 /*
-2
drivers/input/gameport/lightning.c
··· 1 1 /* 2 - * $Id: lightning.c,v 1.20 2002/01/22 20:41:31 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/gameport/ns558.c
··· 1 1 /* 2 - * $Id: ns558.c,v 1.43 2002/01/24 19:23:21 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * Copyright (c) 1999 Brian Gerst 6 4 */
+1 -1
drivers/input/input.c
··· 242 242 break; 243 243 } 244 244 245 - if (type != EV_SYN) 245 + if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) 246 246 dev->sync = 0; 247 247 248 248 if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
-2
drivers/input/joystick/a3d.c
··· 1 1 /* 2 - * $Id: a3d.c,v 1.21 2002/01/22 20:11:50 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/amijoy.c
··· 1 1 /* 2 - * $Id: amijoy.c,v 1.13 2002/01/22 20:26:32 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/cobra.c
··· 1 1 /* 2 - * $Id: cobra.c,v 1.19 2002/01/22 20:26:52 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/db9.c
··· 1 1 /* 2 - * $Id: db9.c,v 1.13 2002/04/07 20:13:37 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/joystick/gf2k.c
··· 1 1 /* 2 - * $Id: gf2k.c,v 1.19 2002/01/22 20:27:43 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/grip.c
··· 1 1 /* 2 - * $Id: grip.c,v 1.21 2002/01/22 20:27:57 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/grip_mp.c
··· 1 1 /* 2 - * $Id: grip_mp.c,v 1.9 2002/07/20 19:28:45 bonnland Exp $ 3 - * 4 2 * Driver for the Gravis Grip Multiport, a gamepad "hub" that 5 3 * connects up to four 9-pin digital gamepads/joysticks. 6 4 * Driver tested on SMP and UP kernel versions 2.4.18-4 and 2.4.18-5.
-2
drivers/input/joystick/guillemot.c
··· 1 1 /* 2 - * $Id: guillemot.c,v 1.10 2002/01/22 20:28:12 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/iforce/iforce-ff.c
··· 1 1 /* 2 - * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 *
-2
drivers/input/joystick/iforce/iforce-main.c
··· 1 1 /* 2 - * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 *
-2
drivers/input/joystick/iforce/iforce-packets.c
··· 1 1 /* 2 - * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 *
-2
drivers/input/joystick/iforce/iforce-serio.c
··· 1 1 /* 2 - * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 *
+3 -5
drivers/input/joystick/iforce/iforce-usb.c
··· 1 1 /* 2 - * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 * ··· 87 89 case -ESHUTDOWN: 88 90 /* this urb is terminated, clean up */ 89 91 dbg("%s - urb shutting down with status: %d", 90 - __FUNCTION__, urb->status); 92 + __func__, urb->status); 91 93 return; 92 94 default: 93 - dbg("%s - urb has status of: %d", __FUNCTION__, urb->status); 95 + dbg("%s - urb has status of: %d", __func__, urb->status); 94 96 goto exit; 95 97 } 96 98 ··· 101 103 status = usb_submit_urb (urb, GFP_ATOMIC); 102 104 if (status) 103 105 err ("%s - usb_submit_urb failed with result %d", 104 - __FUNCTION__, status); 106 + __func__, status); 105 107 } 106 108 107 109 static void iforce_usb_out(struct urb *urb)
-2
drivers/input/joystick/iforce/iforce.h
··· 1 1 /* 2 - * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ 3 - * 4 2 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 5 3 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> 6 4 *
-2
drivers/input/joystick/interact.c
··· 1 1 /* 2 - * $Id: interact.c,v 1.16 2002/01/22 20:28:25 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/joystick/joydump.c
··· 1 1 /* 2 - * $Id: joydump.c,v 1.1 2002/01/23 06:56:16 jsimmons Exp $ 3 - * 4 2 * Copyright (c) 1996-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/magellan.c
··· 1 1 /* 2 - * $Id: magellan.c,v 1.16 2002/01/22 20:28:39 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/joystick/spaceball.c
··· 1 1 /* 2 - * $Id: spaceball.c,v 1.17 2002/01/22 20:29:03 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/joystick/spaceorb.c
··· 1 1 /* 2 - * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/joystick/stinger.c
··· 1 1 /* 2 - * $Id: stinger.c,v 1.10 2002/01/22 20:29:31 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 * Copyright (c) 2000 Mark Fletcher 6 4 */
-2
drivers/input/joystick/tmdc.c
··· 1 1 /* 2 - * $Id: tmdc.c,v 1.31 2002/01/22 20:29:52 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/joystick/turbografx.c
··· 1 1 /* 2 - * $Id: turbografx.c,v 1.14 2002/01/22 20:30:39 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1998-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-4
drivers/input/joystick/twidjoy.c
··· 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 2 * Copyright (c) 2001 Arndt Schoenewald 7 3 * Copyright (c) 2000-2001 Vojtech Pavlik 8 4 * Copyright (c) 2000 Mark Fletcher
-2
drivers/input/joystick/warrior.c
··· 1 1 /* 2 - * $Id: warrior.c,v 1.14 2002/01/22 20:32:10 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
+6 -6
drivers/input/joystick/xpad.c
··· 418 418 case -ESHUTDOWN: 419 419 /* this urb is terminated, clean up */ 420 420 dbg("%s - urb shutting down with status: %d", 421 - __FUNCTION__, status); 421 + __func__, status); 422 422 return; 423 423 default: 424 424 dbg("%s - nonzero urb status received: %d", 425 - __FUNCTION__, status); 425 + __func__, status); 426 426 goto exit; 427 427 } 428 428 ··· 441 441 retval = usb_submit_urb (urb, GFP_ATOMIC); 442 442 if (retval) 443 443 err ("%s - usb_submit_urb failed with result %d", 444 - __FUNCTION__, retval); 444 + __func__, retval); 445 445 } 446 446 447 447 static void xpad_bulk_out(struct urb *urb) ··· 477 477 case -ESHUTDOWN: 478 478 /* this urb is terminated, clean up */ 479 479 dbg("%s - urb shutting down with status: %d", 480 - __FUNCTION__, status); 480 + __func__, status); 481 481 return; 482 482 default: 483 483 dbg("%s - nonzero urb status received: %d", 484 - __FUNCTION__, status); 484 + __func__, status); 485 485 goto exit; 486 486 } 487 487 ··· 489 489 retval = usb_submit_urb(urb, GFP_ATOMIC); 490 490 if (retval) 491 491 err("%s - usb_submit_urb failed with result %d", 492 - __FUNCTION__, retval); 492 + __func__, retval); 493 493 } 494 494 495 495 static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
-2
drivers/input/keyboard/amikbd.c
··· 1 1 /* 2 - * $Id: amikbd.c,v 1.13 2002/02/01 16:02:24 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
+36 -10
drivers/input/keyboard/atkbd.c
··· 68 68 * are loadable via an userland utility. 69 69 */ 70 70 71 - static unsigned char atkbd_set2_keycode[512] = { 71 + static const unsigned short atkbd_set2_keycode[512] = { 72 72 73 73 #ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES 74 74 ··· 99 99 #endif 100 100 }; 101 101 102 - static unsigned char atkbd_set3_keycode[512] = { 102 + static const unsigned short atkbd_set3_keycode[512] = { 103 103 104 104 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60, 105 105 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62, ··· 115 115 148,149,147,140 116 116 }; 117 117 118 - static unsigned char atkbd_unxlate_table[128] = { 118 + static const unsigned short atkbd_unxlate_table[128] = { 119 119 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, 120 120 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, 121 121 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, ··· 161 161 #define ATKBD_SCR_LEFT 249 162 162 #define ATKBD_SCR_RIGHT 248 163 163 164 - #define ATKBD_SPECIAL 248 164 + #define ATKBD_SPECIAL ATKBD_SCR_RIGHT 165 165 166 166 #define ATKBD_LED_EVENT_BIT 0 167 167 #define ATKBD_REP_EVENT_BIT 1 ··· 173 173 #define ATKBD_XL_HANGEUL 0x10 174 174 #define ATKBD_XL_HANJA 0x20 175 175 176 - static struct { 176 + static const struct { 177 177 unsigned char keycode; 178 178 unsigned char set2; 179 179 } atkbd_scroll_keys[] = { ··· 200 200 char phys[32]; 201 201 202 202 unsigned short id; 203 - unsigned char keycode[512]; 203 + unsigned short keycode[512]; 204 204 DECLARE_BITMAP(force_release_mask, 512); 205 205 unsigned char set; 206 206 unsigned char translated; ··· 357 357 unsigned int code = data; 358 358 int scroll = 0, hscroll = 0, click = -1; 359 359 int value; 360 - unsigned char keycode; 360 + unsigned short keycode; 361 361 362 362 #ifdef ATKBD_DEBUG 363 363 printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); ··· 851 851 } 852 852 853 853 /* 854 + * Perform fixup for HP system that doesn't generate release 855 + * for its video switch 856 + */ 857 + static 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 871 * atkbd_set_keycode_table() initializes keyboard's keycode table 855 872 * according to the selected scancode set 856 873 */ ··· 978 961 input_dev->evbit[0] |= BIT_MASK(EV_REL); 979 962 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) | 980 963 BIT_MASK(REL_HWHEEL); 981 - set_bit(BTN_MIDDLE, input_dev->keybit); 964 + __set_bit(BTN_MIDDLE, input_dev->keybit); 982 965 } 983 966 984 967 input_dev->keycode = atkbd->keycode; 985 - input_dev->keycodesize = sizeof(unsigned char); 968 + input_dev->keycodesize = sizeof(unsigned short); 986 969 input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); 987 970 988 971 for (i = 0; i < 512; i++) 989 972 if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) 990 - set_bit(atkbd->keycode[i], input_dev->keybit); 973 + __set_bit(atkbd->keycode[i], input_dev->keybit); 991 974 } 992 975 993 976 /* ··· 1468 1451 }, 1469 1452 .callback = atkbd_setup_fixup, 1470 1453 .driver_data = atkbd_latitude_keymap_fixup, 1454 + }, 1455 + { 1456 + .ident = "HP 2133", 1457 + .matches = { 1458 + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1459 + DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"), 1460 + }, 1461 + .callback = atkbd_setup_fixup, 1462 + .driver_data = atkbd_hp_keymap_fixup, 1471 1463 }, 1472 1464 { } 1473 1465 };
+69 -20
drivers/input/keyboard/gpio_keys.c
··· 26 26 27 27 #include <asm/gpio.h> 28 28 29 + struct gpio_button_data { 30 + struct gpio_keys_button *button; 31 + struct input_dev *input; 32 + struct timer_list timer; 33 + }; 34 + 35 + struct gpio_keys_drvdata { 36 + struct input_dev *input; 37 + struct gpio_button_data data[0]; 38 + }; 39 + 40 + static 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 + 50 + static 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 + 29 57 static irqreturn_t gpio_keys_isr(int irq, void *dev_id) 30 58 { 31 - int i; 32 59 struct platform_device *pdev = dev_id; 33 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 64 for (i = 0; i < pdata->nbuttons; i++) { 37 65 struct gpio_keys_button *button = &pdata->buttons[i]; 38 - int gpio = button->gpio; 39 66 40 - if (irq == gpio_to_irq(gpio)) { 41 - unsigned int type = button->type ?: EV_KEY; 42 - int state = (gpio_get_value(gpio) ? 1 : 0) ^ button->active_low; 67 + if (irq == gpio_to_irq(button->gpio)) { 68 + struct gpio_button_data *bdata = &ddata->data[i]; 43 69 44 - input_event(input, type, button->code, !!state); 45 - input_sync(input); 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); 76 + 46 77 return IRQ_HANDLED; 47 78 } 48 79 } ··· 84 53 static int __devinit gpio_keys_probe(struct platform_device *pdev) 85 54 { 86 55 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 56 + struct gpio_keys_drvdata *ddata; 87 57 struct input_dev *input; 88 58 int i, error; 89 59 int wakeup = 0; 90 60 61 + ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + 62 + pdata->nbuttons * sizeof(struct gpio_button_data), 63 + GFP_KERNEL); 91 64 input = input_allocate_device(); 92 - if (!input) 93 - return -ENOMEM; 65 + if (!ddata || !input) { 66 + error = -ENOMEM; 67 + goto fail1; 68 + } 94 69 95 - platform_set_drvdata(pdev, input); 96 - 97 - input->evbit[0] = BIT_MASK(EV_KEY); 70 + platform_set_drvdata(pdev, ddata); 98 71 99 72 input->name = pdev->name; 100 73 input->phys = "gpio-keys/input0"; ··· 109 74 input->id.product = 0x0001; 110 75 input->id.version = 0x0100; 111 76 77 + ddata->input = input; 78 + 112 79 for (i = 0; i < pdata->nbuttons; i++) { 113 80 struct gpio_keys_button *button = &pdata->buttons[i]; 81 + struct gpio_button_data *bdata = &ddata->data[i]; 114 82 int irq; 115 83 unsigned int type = button->type ?: EV_KEY; 84 + 85 + bdata->input = input; 86 + setup_timer(&bdata->timer, 87 + gpio_check_button, (unsigned long)bdata); 116 88 117 89 error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); 118 90 if (error < 0) { 119 91 pr_err("gpio-keys: failed to request GPIO %d," 120 92 " error %d\n", button->gpio, error); 121 - goto fail; 93 + goto fail2; 122 94 } 123 95 124 96 error = gpio_direction_input(button->gpio); ··· 134 92 " direction for GPIO %d, error %d\n", 135 93 button->gpio, error); 136 94 gpio_free(button->gpio); 137 - goto fail; 95 + goto fail2; 138 96 } 139 97 140 98 irq = gpio_to_irq(button->gpio); ··· 144 102 " for GPIO %d, error %d\n", 145 103 button->gpio, error); 146 104 gpio_free(button->gpio); 147 - goto fail; 105 + goto fail2; 148 106 } 149 107 150 108 error = request_irq(irq, gpio_keys_isr, ··· 156 114 pr_err("gpio-keys: Unable to claim irq %d; error %d\n", 157 115 irq, error); 158 116 gpio_free(button->gpio); 159 - goto fail; 117 + goto fail2; 160 118 } 161 119 162 120 if (button->wakeup) ··· 169 127 if (error) { 170 128 pr_err("gpio-keys: Unable to register input device, " 171 129 "error: %d\n", error); 172 - goto fail; 130 + goto fail2; 173 131 } 174 132 175 133 device_init_wakeup(&pdev->dev, wakeup); 176 134 177 135 return 0; 178 136 179 - fail: 137 + fail2: 180 138 while (--i >= 0) { 181 139 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); 140 + if (pdata->buttons[i].debounce_interval) 141 + del_timer_sync(&ddata->data[i].timer); 182 142 gpio_free(pdata->buttons[i].gpio); 183 143 } 184 144 185 145 platform_set_drvdata(pdev, NULL); 146 + fail1: 186 147 input_free_device(input); 148 + kfree(ddata); 187 149 188 150 return error; 189 151 } ··· 195 149 static int __devexit gpio_keys_remove(struct platform_device *pdev) 196 150 { 197 151 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 198 - struct input_dev *input = platform_get_drvdata(pdev); 152 + struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); 153 + struct input_dev *input = ddata->input; 199 154 int i; 200 155 201 156 device_init_wakeup(&pdev->dev, 0); ··· 204 157 for (i = 0; i < pdata->nbuttons; i++) { 205 158 int irq = gpio_to_irq(pdata->buttons[i].gpio); 206 159 free_irq(irq, pdev); 160 + if (pdata->buttons[i].debounce_interval) 161 + del_timer_sync(&ddata->data[i].timer); 207 162 gpio_free(pdata->buttons[i].gpio); 208 163 } 209 164
+3 -3
drivers/input/keyboard/lkkbd.c
··· 538 538 switch (code) { 539 539 case SND_CLICK: 540 540 if (value == 0) { 541 - DBG ("%s: Deactivating key clicks\n", __FUNCTION__); 541 + DBG ("%s: Deactivating key clicks\n", __func__); 542 542 lk->serio->write (lk->serio, LK_CMD_DISABLE_KEYCLICK); 543 543 lk->serio->write (lk->serio, LK_CMD_DISABLE_CTRCLICK); 544 544 } else { 545 - DBG ("%s: Activating key clicks\n", __FUNCTION__); 545 + DBG ("%s: Activating key clicks\n", __func__); 546 546 lk->serio->write (lk->serio, LK_CMD_ENABLE_KEYCLICK); 547 547 lk->serio->write (lk->serio, volume_to_hw (lk->keyclick_volume)); 548 548 lk->serio->write (lk->serio, LK_CMD_ENABLE_CTRCLICK); ··· 560 560 561 561 default: 562 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 566 return -1;
+14 -1
drivers/input/keyboard/pxa27x_keypad.c
··· 105 105 struct input_dev *input_dev; 106 106 void __iomem *mmio_base; 107 107 108 + int irq; 109 + 108 110 /* matrix key code map */ 109 111 unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM]; 110 112 ··· 394 392 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 395 393 396 394 clk_disable(keypad->clk); 395 + 396 + if (device_may_wakeup(&pdev->dev)) 397 + enable_irq_wake(keypad->irq); 398 + 397 399 return 0; 398 400 } 399 401 ··· 405 399 { 406 400 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 407 401 struct input_dev *input_dev = keypad->input_dev; 402 + 403 + if (device_may_wakeup(&pdev->dev)) 404 + disable_irq_wake(keypad->irq); 408 405 409 406 mutex_lock(&input_dev->mutex); 410 407 ··· 518 509 goto failed_free_dev; 519 510 } 520 511 512 + keypad->irq = irq; 513 + 521 514 /* Register the input device */ 522 515 error = input_register_device(input_dev); 523 516 if (error) { 524 517 dev_err(&pdev->dev, "failed to register input device\n"); 525 518 goto failed_free_irq; 526 519 } 520 + 521 + device_init_wakeup(&pdev->dev, 1); 527 522 528 523 return 0; 529 524 ··· 552 539 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 553 540 struct resource *res; 554 541 555 - free_irq(platform_get_irq(pdev, 0), pdev); 542 + free_irq(keypad->irq, pdev); 556 543 557 544 clk_disable(keypad->clk); 558 545 clk_put(keypad->clk);
-2
drivers/input/keyboard/sunkbd.c
··· 1 1 /* 2 - * $Id: sunkbd.c,v 1.14 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/keyboard/xtkbd.c
··· 1 1 /* 2 - * $Id: xtkbd.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
+10
drivers/input/misc/Kconfig
··· 189 189 To compile this driver as a module, choose M here: the 190 190 module will be called uinput. 191 191 192 + config 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 + 192 202 config HP_SDC_RTC 193 203 tristate "HP SDC Real Time Clock" 194 204 depends on GSC || HP300
+1
drivers/input/misc/Makefile
··· 19 19 obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 20 20 obj-$(CONFIG_INPUT_UINPUT) += uinput.o 21 21 obj-$(CONFIG_INPUT_APANEL) += apanel.o 22 + obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
+9 -9
drivers/input/misc/ati_remote.c
··· 330 330 ati_remote->irq_urb->dev = ati_remote->udev; 331 331 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { 332 332 dev_err(&ati_remote->interface->dev, 333 - "%s: usb_submit_urb failed!\n", __FUNCTION__); 333 + "%s: usb_submit_urb failed!\n", __func__); 334 334 return -EIO; 335 335 } 336 336 ··· 356 356 357 357 if (urb->status) { 358 358 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n", 359 - __FUNCTION__, urb->status); 359 + __func__, urb->status); 360 360 return; 361 361 } 362 362 ··· 601 601 case -ENOENT: 602 602 case -ESHUTDOWN: 603 603 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", 604 - __FUNCTION__); 604 + __func__); 605 605 return; 606 606 default: /* error */ 607 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 611 retval = usb_submit_urb(urb, GFP_ATOMIC); 612 612 if (retval) 613 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 734 int err = -ENOMEM; 735 735 736 736 if (iface_host->desc.bNumEndpoints != 2) { 737 - err("%s: Unexpected desc.bNumEndpoints\n", __FUNCTION__); 737 + err("%s: Unexpected desc.bNumEndpoints\n", __func__); 738 738 return -ENODEV; 739 739 } 740 740 ··· 742 742 endpoint_out = &iface_host->endpoint[1].desc; 743 743 744 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 746 return -ENODEV; 747 747 } 748 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 750 return -ENODEV; 751 751 } 752 752 ··· 814 814 ati_remote = usb_get_intfdata(interface); 815 815 usb_set_intfdata(interface, NULL); 816 816 if (!ati_remote) { 817 - warn("%s - null device?\n", __FUNCTION__); 817 + warn("%s - null device?\n", __func__); 818 818 return; 819 819 } 820 820
+9 -9
drivers/input/misc/ati_remote2.c
··· 137 137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL); 138 138 if (r) { 139 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 141 return r; 142 142 } 143 143 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL); 144 144 if (r) { 145 145 usb_kill_urb(ar2->urb[0]); 146 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 148 return r; 149 149 } 150 150 ··· 294 294 case -ECONNRESET: 295 295 case -ESHUTDOWN: 296 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 298 return; 299 299 default: 300 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 304 r = usb_submit_urb(urb, GFP_ATOMIC); 305 305 if (r) 306 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 310 310 static void ati_remote2_complete_key(struct urb *urb) ··· 321 321 case -ECONNRESET: 322 322 case -ESHUTDOWN: 323 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 325 return; 326 326 default: 327 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 331 r = usb_submit_urb(urb, GFP_ATOMIC); 332 332 if (r) 333 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 337 337 static int ati_remote2_input_init(struct ati_remote2 *ar2) ··· 438 438 channel, 0x0, NULL, 0, USB_CTRL_SET_TIMEOUT); 439 439 if (r) { 440 440 dev_err(&ar2->udev->dev, "%s - failed to set channel due to error: %d\n", 441 - __FUNCTION__, r); 441 + __func__, r); 442 442 return r; 443 443 } 444 444
+10 -10
drivers/input/misc/keyspan_remote.c
··· 159 159 if (dev->data.pos >= dev->data.len) { 160 160 dev_dbg(&dev->udev->dev, 161 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 163 return -1; 164 164 } 165 165 ··· 267 267 remote->data.tester = remote->data.tester >> 6; 268 268 remote->data.bits_left -= 6; 269 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 271 remote->stage = 0; 272 272 return; 273 273 } ··· 286 286 remote->data.tester = remote->data.tester >> 6; 287 287 remote->data.bits_left -= 6; 288 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 290 remote->stage = 0; 291 291 return; 292 292 } ··· 302 302 remote->data.tester = remote->data.tester >> 6; 303 303 remote->data.bits_left -= 6; 304 304 } else { 305 - err("%s - Error in message, invalid toggle.\n", __FUNCTION__); 305 + err("%s - Error in message, invalid toggle.\n", __func__); 306 306 remote->stage = 0; 307 307 return; 308 308 } ··· 317 317 318 318 dev_dbg(&remote->udev->dev, 319 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 322 if (message.toggle != remote->toggle) { 323 323 keyspan_report_button(remote, message.button, 1); ··· 341 341 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); 342 342 if (retval) { 343 343 dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", 344 - __FUNCTION__, retval); 344 + __func__, retval); 345 345 return(retval); 346 346 } 347 347 ··· 349 349 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); 350 350 if (retval) { 351 351 dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", 352 - __FUNCTION__, retval); 352 + __func__, retval); 353 353 return(retval); 354 354 } 355 355 ··· 357 357 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); 358 358 if (retval) { 359 359 dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", 360 - __FUNCTION__, retval); 360 + __func__, retval); 361 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 365 return(retval); 366 366 } 367 367 ··· 397 397 resubmit: 398 398 retval = usb_submit_urb(urb, GFP_ATOMIC); 399 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 403 403 static int keyspan_open(struct input_dev *dev)
+3 -3
drivers/input/misc/powermate.c
··· 96 96 case -ENOENT: 97 97 case -ESHUTDOWN: 98 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 100 return; 101 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 103 goto exit; 104 104 } 105 105 ··· 112 112 retval = usb_submit_urb (urb, GFP_ATOMIC); 113 113 if (retval) 114 114 err ("%s - usb_submit_urb failed with result %d", 115 - __FUNCTION__, retval); 115 + __func__, retval); 116 116 } 117 117 118 118 /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */
+178
drivers/input/misc/sgi_btns.c
··· 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 + 29 + static 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 + 41 + static 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 + 55 + static const unsigned short sgi_map[] = { 56 + KEY_VOLUMEDOWN, 57 + KEY_VOLUMEUP 58 + }; 59 + 60 + struct 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 + 66 + static 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 + 93 + static 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 + 145 + static 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 + 158 + static 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 + 167 + static int __init sgi_buttons_init(void) 168 + { 169 + return platform_driver_register(&sgi_buttons_driver); 170 + } 171 + 172 + static void __exit sgi_buttons_exit(void) 173 + { 174 + platform_driver_unregister(&sgi_buttons_driver); 175 + } 176 + 177 + module_init(sgi_buttons_init); 178 + module_exit(sgi_buttons_exit);
+18 -1
drivers/input/misc/wistron_btns.c
··· 1186 1186 1187 1187 static int __devinit setup_input_dev(void) 1188 1188 { 1189 - const struct key_entry *key; 1189 + struct key_entry *key; 1190 1190 struct input_dev *input_dev; 1191 1191 int error; 1192 1192 ··· 1217 1217 case KE_SW: 1218 1218 set_bit(EV_SW, input_dev->evbit); 1219 1219 set_bit(key->sw.code, input_dev->swbit); 1220 + break; 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 + } 1220 1237 break; 1221 1238 1222 1239 default:
+32 -18
drivers/input/misc/yealink.c
··· 119 119 u8 lcdMap[ARRAY_SIZE(lcdMap)]; /* state of LCD, LED ... */ 120 120 int key_code; /* last reported key */ 121 121 122 + unsigned int shutdown:1; 123 + 122 124 int stat_ix; 123 125 union { 124 126 struct yld_status s; ··· 426 424 static void urb_irq_callback(struct urb *urb) 427 425 { 428 426 struct yealink_dev *yld = urb->context; 429 - int ret; 427 + int ret, status = urb->status; 430 428 431 - if (urb->status) 432 - err("%s - urb status %d", __FUNCTION__, urb->status); 429 + if (status) 430 + err("%s - urb status %d", __func__, status); 433 431 434 432 switch (yld->irq_data->cmd) { 435 433 case CMD_KEYPRESS: ··· 449 447 450 448 yealink_do_idle_tasks(yld); 451 449 452 - ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 453 - if (ret) 454 - err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); 450 + if (!yld->shutdown) { 451 + ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 452 + if (ret && ret != -EPERM) 453 + err("%s - usb_submit_urb failed %d", __func__, ret); 454 + } 455 455 } 456 456 457 457 static void urb_ctl_callback(struct urb *urb) 458 458 { 459 459 struct yealink_dev *yld = urb->context; 460 - int ret; 460 + int ret = 0, status = urb->status; 461 461 462 - if (urb->status) 463 - err("%s - urb status %d", __FUNCTION__, urb->status); 462 + if (status) 463 + err("%s - urb status %d", __func__, status); 464 464 465 465 switch (yld->ctl_data->cmd) { 466 466 case CMD_KEYPRESS: 467 467 case CMD_SCANCODE: 468 468 /* ask for a response */ 469 - ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC); 469 + if (!yld->shutdown) 470 + ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC); 470 471 break; 471 472 default: 472 473 /* send new command */ 473 474 yealink_do_idle_tasks(yld); 474 - ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 475 + if (!yld->shutdown) 476 + ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); 477 + break; 475 478 } 476 479 477 - if (ret) 478 - err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); 480 + if (ret && ret != -EPERM) 481 + err("%s - usb_submit_urb failed %d", __func__, ret); 479 482 } 480 483 481 484 /******************************************************************************* ··· 512 505 struct yealink_dev *yld = input_get_drvdata(dev); 513 506 int i, ret; 514 507 515 - dbg("%s", __FUNCTION__); 508 + dbg("%s", __func__); 516 509 517 510 /* force updates to device */ 518 511 for (i = 0; i<sizeof(yld->master); i++) ··· 528 521 yld->ctl_data->sum = 0x100-CMD_INIT-10; 529 522 if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { 530 523 dbg("%s - usb_submit_urb failed with result %d", 531 - __FUNCTION__, ret); 524 + __func__, ret); 532 525 return ret; 533 526 } 534 527 return 0; ··· 538 531 { 539 532 struct yealink_dev *yld = input_get_drvdata(dev); 540 533 534 + yld->shutdown = 1; 535 + /* 536 + * Make sure the flag is seen by other CPUs before we start 537 + * killing URBs so new URBs won't be submitted 538 + */ 539 + smp_wmb(); 540 + 541 541 usb_kill_urb(yld->urb_ctl); 542 542 usb_kill_urb(yld->urb_irq); 543 + 544 + yld->shutdown = 0; 545 + smp_wmb(); 543 546 } 544 547 545 548 /******************************************************************************* ··· 825 808 { 826 809 if (yld == NULL) 827 810 return err; 828 - 829 - usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */ 830 - usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */ 831 811 832 812 if (yld->idev) { 833 813 if (err)
+138 -161
drivers/input/mouse/appletouch.c
··· 2 2 * Apple USB Touchpad (for post-February 2005 PowerBooks and MacBooks) driver 3 3 * 4 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 6 * Copyright (C) 2005 Stelian Pop (stelian@popies.net) 7 7 * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) 8 8 * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) 9 9 * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch) 10 10 * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch) 11 + * Copyright (C) 2007-2008 Sven Anders (anders@anduras.de) 11 12 * 12 13 * Thanks to Alex Harper <basilisk@foobox.net> for his inputs. 13 14 * ··· 35 34 #include <linux/module.h> 36 35 #include <linux/usb/input.h> 37 36 38 - /* Apple has powerbooks which have the keyboard with different Product IDs */ 39 - #define APPLE_VENDOR_ID 0x05AC 37 + /* Type of touchpad */ 38 + enum atp_touchpad_type { 39 + ATP_FOUNTAIN, 40 + ATP_GEYSER1, 41 + ATP_GEYSER2, 42 + ATP_GEYSER3, 43 + ATP_GEYSER4 44 + }; 40 45 41 - /* These names come from Info.plist in AppleUSBTrackpad.kext */ 42 - #define FOUNTAIN_ANSI_PRODUCT_ID 0x020E 43 - #define FOUNTAIN_ISO_PRODUCT_ID 0x020F 44 - 45 - #define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A 46 - 47 - #define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B 48 - 49 - #define GEYSER_ANSI_PRODUCT_ID 0x0214 50 - #define GEYSER_ISO_PRODUCT_ID 0x0215 51 - #define GEYSER_JIS_PRODUCT_ID 0x0216 52 - 53 - /* MacBook devices */ 54 - #define GEYSER3_ANSI_PRODUCT_ID 0x0217 55 - #define GEYSER3_ISO_PRODUCT_ID 0x0218 56 - #define GEYSER3_JIS_PRODUCT_ID 0x0219 57 - 58 - /* 59 - * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext 60 - * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables 61 - */ 62 - #define GEYSER4_ANSI_PRODUCT_ID 0x021A 63 - #define GEYSER4_ISO_PRODUCT_ID 0x021B 64 - #define GEYSER4_JIS_PRODUCT_ID 0x021C 65 - 66 - #define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229 67 - #define GEYSER4_HF_ISO_PRODUCT_ID 0x022A 68 - #define GEYSER4_HF_JIS_PRODUCT_ID 0x022B 69 - 70 - #define ATP_DEVICE(prod) \ 46 + #define ATP_DEVICE(prod, type) \ 47 + { \ 71 48 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 72 49 USB_DEVICE_ID_MATCH_INT_CLASS | \ 73 50 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 74 - .idVendor = APPLE_VENDOR_ID, \ 51 + .idVendor = 0x05ac, /* Apple */ \ 75 52 .idProduct = (prod), \ 76 53 .bInterfaceClass = 0x03, \ 77 - .bInterfaceProtocol = 0x02 54 + .bInterfaceProtocol = 0x02, \ 55 + .driver_info = ATP_ ## type, \ 56 + } 78 57 79 - /* table of devices that work with this driver */ 58 + /* 59 + * Table of devices (Product IDs) that work with this driver. 60 + * (The names come from Info.plist in AppleUSBTrackpad.kext, 61 + * According to Info.plist Geyser IV is the same as Geyser III.) 62 + */ 63 + 80 64 static struct usb_device_id atp_table [] = { 81 - { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) }, 82 - { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) }, 83 - { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) }, 84 - { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) }, 65 + /* PowerBooks Feb 2005, iBooks G4 */ 66 + ATP_DEVICE(0x020e, FOUNTAIN), /* FOUNTAIN ANSI */ 67 + ATP_DEVICE(0x020f, FOUNTAIN), /* FOUNTAIN ISO */ 68 + ATP_DEVICE(0x030a, FOUNTAIN), /* FOUNTAIN TP ONLY */ 69 + ATP_DEVICE(0x030b, GEYSER1), /* GEYSER 1 TP ONLY */ 85 70 86 71 /* PowerBooks Oct 2005 */ 87 - { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) }, 88 - { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) }, 89 - { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) }, 72 + ATP_DEVICE(0x0214, GEYSER2), /* GEYSER 2 ANSI */ 73 + ATP_DEVICE(0x0215, GEYSER2), /* GEYSER 2 ISO */ 74 + ATP_DEVICE(0x0216, GEYSER2), /* GEYSER 2 JIS */ 90 75 91 76 /* Core Duo MacBook & MacBook Pro */ 92 - { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) }, 93 - { ATP_DEVICE(GEYSER3_ISO_PRODUCT_ID) }, 94 - { ATP_DEVICE(GEYSER3_JIS_PRODUCT_ID) }, 77 + ATP_DEVICE(0x0217, GEYSER3), /* GEYSER 3 ANSI */ 78 + ATP_DEVICE(0x0218, GEYSER3), /* GEYSER 3 ISO */ 79 + ATP_DEVICE(0x0219, GEYSER3), /* GEYSER 3 JIS */ 95 80 96 81 /* Core2 Duo MacBook & MacBook Pro */ 97 - { ATP_DEVICE(GEYSER4_ANSI_PRODUCT_ID) }, 98 - { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) }, 99 - { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) }, 82 + ATP_DEVICE(0x021a, GEYSER4), /* GEYSER 4 ANSI */ 83 + ATP_DEVICE(0x021b, GEYSER4), /* GEYSER 4 ISO */ 84 + ATP_DEVICE(0x021c, GEYSER4), /* GEYSER 4 JIS */ 100 85 101 - { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) }, 102 - { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) }, 103 - { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) }, 86 + /* Core2 Duo MacBook3,1 */ 87 + ATP_DEVICE(0x0229, GEYSER4), /* GEYSER 4 HF ANSI */ 88 + ATP_DEVICE(0x022a, GEYSER4), /* GEYSER 4 HF ISO */ 89 + ATP_DEVICE(0x022b, GEYSER4), /* GEYSER 4 HF JIS */ 104 90 105 91 /* Terminating entry */ 106 92 { } 107 93 }; 108 - MODULE_DEVICE_TABLE (usb, atp_table); 94 + MODULE_DEVICE_TABLE(usb, atp_table); 109 95 110 96 /* 111 97 * number of sensors. Note that only 16 instead of 26 X (horizontal) ··· 112 124 * We try to keep the touchpad aspect ratio while still doing only simple 113 125 * arithmetics. 114 126 * The factors below give coordinates like: 115 - * 0 <= x < 960 on 12" and 15" Powerbooks 116 - * 0 <= x < 1600 on 17" Powerbooks 117 - * 0 <= y < 646 127 + * 128 + * 0 <= x < 960 on 12" and 15" Powerbooks 129 + * 0 <= x < 1600 on 17" Powerbooks and 17" MacBook Pro 130 + * 0 <= x < 1216 on MacBooks and 15" MacBook Pro 131 + * 132 + * 0 <= y < 646 on all Powerbooks 133 + * 0 <= y < 774 on all MacBooks 118 134 */ 119 135 #define ATP_XFACT 64 120 136 #define ATP_YFACT 43 ··· 139 147 /* Structure to hold all of our device specific stuff */ 140 148 struct atp { 141 149 char phys[64]; 142 - struct usb_device * udev; /* usb device */ 143 - struct urb * urb; /* usb request block */ 144 - signed char * data; /* transferred data */ 145 - struct input_dev * input; /* input dev */ 146 - unsigned char open; /* non-zero if opened */ 147 - unsigned char valid; /* are the sensors valid ? */ 148 - unsigned char size_detect_done; 149 - unsigned char overflowwarn; /* overflow warning printed? */ 150 + struct usb_device *udev; /* usb device */ 151 + struct urb *urb; /* usb request block */ 152 + signed char *data; /* transferred data */ 153 + struct input_dev *input; /* input dev */ 154 + enum atp_touchpad_type type; /* type of touchpad */ 155 + bool open; 156 + bool valid; /* are the samples valid? */ 157 + bool size_detect_done; 158 + bool overflow_warned; 150 159 int x_old; /* last reported x/y, */ 151 160 int y_old; /* used for smoothing */ 152 - /* current value of the sensors */ 153 161 signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; 154 - /* last value of the sensors */ 155 162 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 156 - /* accumulated sensors */ 157 163 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 158 - int datalen; /* size of an USB urb transfer */ 159 - int idlecount; /* number of empty packets */ 160 - struct work_struct work; 164 + int datalen; /* size of USB transfer */ 165 + int idlecount; /* number of empty packets */ 166 + struct work_struct work; 161 167 }; 162 168 163 169 #define dbg_dump(msg, tab) \ 164 170 if (debug > 1) { \ 165 - int i; \ 166 - printk("appletouch: %s %lld", msg, (long long)jiffies); \ 167 - for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) \ 168 - printk(" %02x", tab[i]); \ 171 + int __i; \ 172 + printk(KERN_DEBUG "appletouch: %s", msg); \ 173 + for (__i = 0; __i < ATP_XSENSORS + ATP_YSENSORS; __i++) \ 174 + printk(" %02x", tab[__i]); \ 169 175 printk("\n"); \ 170 176 } 171 177 172 178 #define dprintk(format, a...) \ 173 179 do { \ 174 - if (debug) printk(KERN_DEBUG format, ##a); \ 180 + if (debug) \ 181 + printk(KERN_DEBUG format, ##a); \ 175 182 } while (0) 176 183 177 - MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann"); 178 - MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver"); 184 + MODULE_AUTHOR("Johannes Berg"); 185 + MODULE_AUTHOR("Stelian Pop"); 186 + MODULE_AUTHOR("Frank Arnold"); 187 + MODULE_AUTHOR("Michael Hanselmann"); 188 + MODULE_AUTHOR("Sven Anders"); 189 + MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver"); 179 190 MODULE_LICENSE("GPL"); 180 191 181 192 /* ··· 186 191 */ 187 192 static int threshold = ATP_THRESHOLD; 188 193 module_param(threshold, int, 0644); 189 - MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value"); 194 + MODULE_PARM_DESC(threshold, "Discard any change in data from a sensor" 195 + " (the trackpad has many of these sensors)" 196 + " less than this value."); 190 197 191 - static int debug = 1; 198 + static int debug; 192 199 module_param(debug, int, 0644); 193 200 MODULE_PARM_DESC(debug, "Activate debugging output"); 194 - 195 - static inline int atp_is_fountain(struct atp *dev) 196 - { 197 - u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct); 198 - 199 - return productId == FOUNTAIN_ANSI_PRODUCT_ID || 200 - productId == FOUNTAIN_ISO_PRODUCT_ID || 201 - productId == FOUNTAIN_TP_ONLY_PRODUCT_ID; 202 - } 203 - 204 - /* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */ 205 - static inline int atp_is_geyser_2(struct atp *dev) 206 - { 207 - u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct); 208 - 209 - return (productId == GEYSER_ANSI_PRODUCT_ID) || 210 - (productId == GEYSER_ISO_PRODUCT_ID) || 211 - (productId == GEYSER_JIS_PRODUCT_ID); 212 - } 213 - 214 - static inline int atp_is_geyser_3(struct atp *dev) 215 - { 216 - u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct); 217 - 218 - return (productId == GEYSER3_ANSI_PRODUCT_ID) || 219 - (productId == GEYSER3_ISO_PRODUCT_ID) || 220 - (productId == GEYSER3_JIS_PRODUCT_ID) || 221 - (productId == GEYSER4_ANSI_PRODUCT_ID) || 222 - (productId == GEYSER4_ISO_PRODUCT_ID) || 223 - (productId == GEYSER4_JIS_PRODUCT_ID) || 224 - (productId == GEYSER4_HF_ANSI_PRODUCT_ID) || 225 - (productId == GEYSER4_HF_ISO_PRODUCT_ID) || 226 - (productId == GEYSER4_HF_JIS_PRODUCT_ID); 227 - } 228 201 229 202 /* 230 203 * By default newer Geyser devices send standard USB HID mouse ··· 203 240 { 204 241 char data[8]; 205 242 int size; 243 + int i; 206 244 207 245 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 208 246 ATP_GEYSER_MODE_READ_REQUEST_ID, ··· 212 248 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 213 249 214 250 if (size != 8) { 215 - err("Could not do mode read request from device" 216 - " (Geyser Raw mode)"); 251 + dprintk("atp_geyser_init: read error\n"); 252 + for (i = 0; i < 8; i++) 253 + dprintk("appletouch[%d]: %d\n", i, data[i]); 254 + 255 + err("Failed to read mode from device."); 217 256 return -EIO; 218 257 } 219 258 ··· 230 263 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 231 264 232 265 if (size != 8) { 233 - err("Could not do mode write request to device" 234 - " (Geyser Raw mode)"); 266 + dprintk("atp_geyser_init: write error\n"); 267 + for (i = 0; i < 8; i++) 268 + dprintk("appletouch[%d]: %d\n", i, data[i]); 269 + 270 + err("Failed to request geyser raw mode"); 235 271 return -EIO; 236 272 } 237 273 return 0; ··· 250 280 struct usb_device *udev = dev->udev; 251 281 int retval; 252 282 283 + dprintk("appletouch: putting appletouch to sleep (reinit)\n"); 253 284 dev->idlecount = 0; 254 285 255 286 atp_geyser_init(udev); 256 287 257 288 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 258 - if (retval) { 259 - err("%s - usb_submit_urb failed with result %d", 260 - __FUNCTION__, retval); 261 - } 289 + if (retval) 290 + err("atp_reinit: usb_submit_urb failed with error %d", 291 + retval); 262 292 } 263 293 264 294 static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, ··· 293 323 * 294 324 * - Jason Parekh <jasonparekh@gmail.com> 295 325 */ 296 - if (i < 1 || (!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) { 326 + if (i < 1 || 327 + (!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) { 297 328 (*fingers)++; 298 329 is_increasing = 1; 299 330 } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) { ··· 302 331 } 303 332 304 333 /* 305 - * Subtracts threshold so a high sensor that just passes the threshold 306 - * won't skew the calculated absolute coordinate. Fixes an issue 307 - * where slowly moving the mouse would occassionaly jump a number of 308 - * pixels (let me restate--slowly moving the mouse makes this issue 309 - * most apparent). 334 + * Subtracts threshold so a high sensor that just passes the 335 + * threshold won't skew the calculated absolute coordinate. 336 + * Fixes an issue where slowly moving the mouse would 337 + * occasionally jump a number of pixels (slowly moving the 338 + * finger makes this issue most apparent.) 310 339 */ 311 340 pcum += (xy_sensors[i] - threshold) * i; 312 341 psum += (xy_sensors[i] - threshold); ··· 327 356 input_report_key(input, BTN_TOOL_TRIPLETAP, fingers > 2); 328 357 } 329 358 330 - static void atp_complete(struct urb* urb) 359 + static void atp_complete(struct urb *urb) 331 360 { 332 361 int x, y, x_z, y_z, x_f, y_f; 333 362 int retval, i, j; ··· 339 368 /* success */ 340 369 break; 341 370 case -EOVERFLOW: 342 - if(!dev->overflowwarn) { 371 + if (!dev->overflow_warned) { 343 372 printk(KERN_WARNING "appletouch: OVERFLOW with data " 344 373 "length %d, actual length is %d\n", 345 374 dev->datalen, dev->urb->actual_length); 346 - dev->overflowwarn = 1; 375 + dev->overflow_warned = true; 347 376 } 348 377 case -ECONNRESET: 349 378 case -ENOENT: 350 379 case -ESHUTDOWN: 351 380 /* This urb is terminated, clean up */ 352 - dbg("%s - urb shutting down with status: %d", 353 - __FUNCTION__, urb->status); 381 + dbg("atp_complete: urb shutting down with status: %d", 382 + urb->status); 354 383 return; 355 384 default: 356 - dbg("%s - nonzero urb status received: %d", 357 - __FUNCTION__, urb->status); 385 + dbg("atp_complete: nonzero urb status received: %d", 386 + urb->status); 358 387 goto exit; 359 388 } 360 389 ··· 367 396 } 368 397 369 398 /* reorder the sensors values */ 370 - if (atp_is_geyser_3(dev)) { 399 + if (dev->type == ATP_GEYSER3 || dev->type == ATP_GEYSER4) { 371 400 memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); 372 401 373 402 /* ··· 386 415 dev->xy_cur[ATP_XSENSORS + i] = dev->data[j + 1]; 387 416 dev->xy_cur[ATP_XSENSORS + i + 1] = dev->data[j + 2]; 388 417 } 389 - } else if (atp_is_geyser_2(dev)) { 418 + } else if (dev->type == ATP_GEYSER2) { 390 419 memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); 391 420 392 421 /* ··· 409 438 } else { 410 439 for (i = 0; i < 8; i++) { 411 440 /* X values */ 412 - dev->xy_cur[i ] = dev->data[5 * i + 2]; 441 + dev->xy_cur[i + 0] = dev->data[5 * i + 2]; 413 442 dev->xy_cur[i + 8] = dev->data[5 * i + 4]; 414 443 dev->xy_cur[i + 16] = dev->data[5 * i + 42]; 415 444 if (i < 2) ··· 425 454 426 455 if (!dev->valid) { 427 456 /* first sample */ 428 - dev->valid = 1; 457 + dev->valid = true; 429 458 dev->x_old = dev->y_old = -1; 430 459 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); 431 460 432 461 if (dev->size_detect_done || 433 - atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */ 462 + dev->type == ATP_GEYSER3) /* No 17" Macbooks (yet) */ 434 463 goto exit; 435 464 436 465 /* 17" Powerbooks have extra X sensors */ 437 - for (i = (atp_is_geyser_2(dev) ? 15 : 16); i < ATP_XSENSORS; i++) { 466 + for (i = (dev->type == ATP_GEYSER2 ? 15 : 16); 467 + i < ATP_XSENSORS; i++) { 438 468 if (!dev->xy_cur[i]) 439 469 continue; 440 470 441 471 printk(KERN_INFO "appletouch: 17\" model detected.\n"); 442 - if (atp_is_geyser_2(dev)) 472 + if (dev->type == ATP_GEYSER2) 443 473 input_set_abs_params(dev->input, ABS_X, 0, 444 474 (20 - 1) * 445 475 ATP_XFACT - 1, ··· 520 548 * several hundred times a second. Re-initialization does not 521 549 * work on Fountain touchpads. 522 550 */ 523 - if (!atp_is_fountain(dev)) { 551 + if (dev->type != ATP_FOUNTAIN) { 552 + /* 553 + * Button must not be pressed when entering suspend, 554 + * otherwise we will never release the button. 555 + */ 524 556 if (!x && !y && !key) { 525 557 dev->idlecount++; 526 558 if (dev->idlecount == 10) { 527 - dev->valid = 0; 559 + dev->valid = false; 528 560 schedule_work(&dev->work); 529 561 /* Don't resubmit urb here, wait for reinit */ 530 562 return; ··· 537 561 dev->idlecount = 0; 538 562 } 539 563 540 - exit: 564 + exit: 541 565 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 542 - if (retval) { 543 - err("%s - usb_submit_urb failed with result %d", 544 - __FUNCTION__, retval); 545 - } 566 + if (retval) 567 + err("atp_complete: usb_submit_urb failed with result %d", 568 + retval); 546 569 } 547 570 548 571 static int atp_open(struct input_dev *input) ··· 568 593 { 569 594 struct usb_device *udev = dev->udev; 570 595 571 - if (!atp_is_fountain(dev)) { 596 + if (dev->type != ATP_FOUNTAIN) { 572 597 /* switch to raw sensor mode */ 573 598 if (atp_geyser_init(udev)) 574 599 return -EIO; ··· 579 604 return 0; 580 605 } 581 606 582 - static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id) 607 + static int atp_probe(struct usb_interface *iface, 608 + const struct usb_device_id *id) 583 609 { 584 610 struct atp *dev; 585 611 struct input_dev *input_dev; ··· 616 640 617 641 dev->udev = udev; 618 642 dev->input = input_dev; 619 - dev->overflowwarn = 0; 620 - if (atp_is_geyser_3(dev)) 621 - dev->datalen = 64; 622 - else if (atp_is_geyser_2(dev)) 623 - dev->datalen = 64; 624 - else 643 + dev->type = id->driver_info; 644 + dev->overflow_warned = false; 645 + if (dev->type == ATP_FOUNTAIN || dev->type == ATP_GEYSER1) 625 646 dev->datalen = 81; 647 + else 648 + dev->datalen = 64; 626 649 627 650 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 628 651 if (!dev->urb) ··· 655 680 656 681 set_bit(EV_ABS, input_dev->evbit); 657 682 658 - if (atp_is_geyser_3(dev)) { 683 + if (dev->type == ATP_GEYSER3 || dev->type == ATP_GEYSER4) { 659 684 /* 660 685 * MacBook have 20 X sensors, 10 Y sensors 661 686 */ ··· 663 688 ((20 - 1) * ATP_XFACT) - 1, ATP_FUZZ, 0); 664 689 input_set_abs_params(input_dev, ABS_Y, 0, 665 690 ((10 - 1) * ATP_YFACT) - 1, ATP_FUZZ, 0); 666 - } else if (atp_is_geyser_2(dev)) { 691 + } else if (dev->type == ATP_GEYSER2) { 667 692 /* 668 693 * Oct 2005 15" PowerBooks have 15 X sensors, 17" are detected 669 694 * later. ··· 678 703 * 17" models are detected later. 679 704 */ 680 705 input_set_abs_params(input_dev, ABS_X, 0, 681 - (16 - 1) * ATP_XFACT - 1, ATP_FUZZ, 0); 706 + (16 - 1) * ATP_XFACT - 1, 707 + ATP_FUZZ, 0); 682 708 input_set_abs_params(input_dev, ABS_Y, 0, 683 - (ATP_YSENSORS - 1) * ATP_YFACT - 1, ATP_FUZZ, 0); 709 + (ATP_YSENSORS - 1) * ATP_YFACT - 1, 710 + ATP_FUZZ, 0); 684 711 } 685 712 input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0); 686 713 ··· 751 774 struct atp *dev = usb_get_intfdata(iface); 752 775 753 776 usb_kill_urb(dev->urb); 754 - dev->valid = 0; 777 + dev->valid = false; 755 778 756 779 return 0; 757 780 }
+12 -15
drivers/input/mouse/atarimouse.c
··· 57 57 MODULE_DESCRIPTION("Atari mouse driver"); 58 58 MODULE_LICENSE("GPL"); 59 59 60 - static int mouse_threshold[2] = {2,2}; 60 + static int mouse_threshold[2] = {2, 2}; 61 + module_param_array(mouse_threshold, int, NULL, 0); 61 62 62 - #ifdef __MODULE__ 63 - MODULE_PARM(mouse_threshold, "2i"); 64 - #endif 65 63 #ifdef FIXED_ATARI_JOYSTICK 66 64 extern int atari_mouse_buttons; 67 65 #endif 68 - static int atamouse_used = 0; 69 66 70 67 static struct input_dev *atamouse_dev; 71 68 ··· 94 97 95 98 static int atamouse_open(struct input_dev *dev) 96 99 { 97 - if (atamouse_used++) 98 - return 0; 99 - 100 100 #ifdef FIXED_ATARI_JOYSTICK 101 101 atari_mouse_buttons = 0; 102 102 #endif ··· 101 107 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]); 102 108 ikbd_mouse_rel_pos(); 103 109 atari_input_mouse_interrupt_hook = atamouse_interrupt; 110 + 104 111 return 0; 105 112 } 106 113 107 114 static void atamouse_close(struct input_dev *dev) 108 115 { 109 - if (!--atamouse_used) { 110 - ikbd_mouse_disable(); 111 - atari_mouse_interrupt_hook = NULL; 112 - } 116 + ikbd_mouse_disable(); 117 + atari_mouse_interrupt_hook = NULL; 113 118 } 114 119 115 120 static int __init atamouse_init(void) 116 121 { 122 + int error; 123 + 117 124 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) 118 125 return -ENODEV; 119 126 120 - if (!(atari_keyb_init())) 127 + if (!atari_keyb_init()) 121 128 return -ENODEV; 122 129 123 130 atamouse_dev = input_allocate_device(); ··· 136 141 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 137 142 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | 138 143 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 144 + 139 145 atamouse_dev->open = atamouse_open; 140 146 atamouse_dev->close = atamouse_close; 141 147 142 - if (input_register_device(atamouse_dev)) { 148 + error = input_register_device(atamouse_dev); 149 + if (error) { 143 150 input_free_device(atamouse_dev); 144 - return -ENOMEM; 151 + return error; 145 152 } 146 153 147 154 return 0;
+25 -10
drivers/input/mouse/hil_ptr.c
··· 247 247 248 248 static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) 249 249 { 250 - struct hil_ptr *ptr; 251 - const char *txt; 252 - unsigned int i, naxsets, btntype; 253 - uint8_t did, *idd; 250 + struct hil_ptr *ptr; 251 + const char *txt; 252 + unsigned int i, naxsets, btntype; 253 + uint8_t did, *idd; 254 + int error; 254 255 255 - if (!(ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL))) 256 + ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL); 257 + if (!ptr) 256 258 return -ENOMEM; 257 259 258 260 ptr->dev = input_allocate_device(); 259 - if (!ptr->dev) 261 + if (!ptr->dev) { 262 + error = -ENOMEM; 260 263 goto bail0; 264 + } 261 265 262 - if (serio_open(serio, driver)) 266 + error = serio_open(serio, driver); 267 + if (error) 263 268 goto bail1; 264 269 265 270 serio_set_drvdata(serio, ptr); ··· 302 297 did = ptr->idd[0]; 303 298 idd = ptr->idd + 1; 304 299 txt = "unknown"; 300 + 305 301 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) { 306 302 ptr->dev->evbit[0] = BIT_MASK(EV_REL); 307 303 txt = "relative"; ··· 312 306 ptr->dev->evbit[0] = BIT_MASK(EV_ABS); 313 307 txt = "absolute"; 314 308 } 315 - if (!ptr->dev->evbit[0]) 309 + 310 + if (!ptr->dev->evbit[0]) { 311 + error = -ENODEV; 316 312 goto bail2; 313 + } 317 314 318 315 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd); 319 316 if (ptr->nbtn) ··· 389 380 ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */ 390 381 ptr->dev->dev.parent = &serio->dev; 391 382 392 - input_register_device(ptr->dev); 383 + error = input_register_device(ptr->dev); 384 + if (error) { 385 + printk(KERN_INFO PREFIX "Unable to register input device\n"); 386 + goto bail2; 387 + } 388 + 393 389 printk(KERN_INFO "input: %s (%s), ID: %d\n", 394 390 ptr->dev->name, 395 391 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad", 396 392 did); 397 393 398 394 return 0; 395 + 399 396 bail2: 400 397 serio_close(serio); 401 398 bail1: ··· 409 394 bail0: 410 395 kfree(ptr); 411 396 serio_set_drvdata(serio, NULL); 412 - return -ENODEV; 397 + return error; 413 398 } 414 399 415 400 static struct serio_device_id hil_ptr_ids[] = {
-2
drivers/input/mouse/inport.c
··· 1 1 /* 2 - * $Id: inport.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/mouse/logibm.c
··· 1 1 /* 2 - * $Id: logibm.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/mouse/pc110pad.c
··· 1 1 /* 2 - * $Id: pc110pad.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of:
-2
drivers/input/mouse/sermouse.c
··· 1 1 /* 2 - * $Id: sermouse.c,v 1.17 2002/03/13 10:03:43 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
+10
drivers/input/serio/Kconfig
··· 190 190 To compile this driver as a module, choose M here: the 191 191 module will be called serio_raw. 192 192 193 + config 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 + 193 203 endif
+1
drivers/input/serio/Makefile
··· 21 21 obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o 22 22 obj-$(CONFIG_SERIO_LIBPS2) += libps2.o 23 23 obj-$(CONFIG_SERIO_RAW) += serio_raw.o 24 + obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
-2
drivers/input/serio/ct82c710.c
··· 1 1 /* 2 - * $Id: ct82c710.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 1999-2001 Vojtech Pavlik 5 3 */ 6 4
+3 -3
drivers/input/serio/hil_mlc.c
··· 76 76 static int hil_mlcs_probe; 77 77 78 78 static void hil_mlcs_process(unsigned long unused); 79 - DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0); 79 + static DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0); 80 80 81 81 82 82 /* #define HIL_MLC_DEBUG */ ··· 459 459 #define OUT_LAST(pack) \ 460 460 { HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, 461 461 462 - const struct hilse_node hil_mlc_se[HILSEN_END] = { 462 + static const struct hilse_node hil_mlc_se[HILSEN_END] = { 463 463 464 464 /* 0 HILSEN_START */ 465 465 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) ··· 784 784 785 785 /************************* Keepalive timer task *********************/ 786 786 787 - void hil_mlcs_timer(unsigned long data) 787 + static void hil_mlcs_timer(unsigned long data) 788 788 { 789 789 hil_mlcs_probe = 1; 790 790 tasklet_schedule(&hil_mlcs_tasklet);
+9
drivers/input/serio/hp_sdc.c
··· 105 105 EXPORT_SYMBOL(hp_sdc_enqueue_transaction); 106 106 EXPORT_SYMBOL(hp_sdc_dequeue_transaction); 107 107 108 + static unsigned int hp_sdc_disabled; 109 + module_param_named(no_hpsdc, hp_sdc_disabled, bool, 0); 110 + MODULE_PARM_DESC(no_hpsdc, "Do not enable HP SDC driver."); 111 + 108 112 static hp_i8042_sdc hp_sdc; /* All driver state is kept in here. */ 109 113 110 114 /*************** primitives for use in any context *********************/ ··· 983 979 mm_segment_t fs; 984 980 unsigned char i; 985 981 #endif 982 + 983 + if (hp_sdc_disabled) { 984 + printk(KERN_WARNING PREFIX "HP SDC driver disabled by no_hpsdc=1.\n"); 985 + return -ENODEV; 986 + } 986 987 987 988 hp_sdc.dev = NULL; 988 989 hp_sdc.dev_err = 0;
+1 -1
drivers/input/serio/hp_sdc_mlc.c
··· 50 50 MODULE_DESCRIPTION("Glue for onboard HIL MLC in HP-PARISC machines"); 51 51 MODULE_LICENSE("Dual BSD/GPL"); 52 52 53 - struct hp_sdc_mlc_priv_s { 53 + static struct hp_sdc_mlc_priv_s { 54 54 int emtestmode; 55 55 hp_sdc_transaction trans; 56 56 u8 tseq[16];
+56 -11
drivers/input/serio/i8042-x86ia64io.h
··· 63 63 outb(val, I8042_COMMAND_REG); 64 64 } 65 65 66 - #if defined(__i386__) || defined(__x86_64__) 66 + #ifdef CONFIG_X86 67 67 68 68 #include <linux/dmi.h> 69 69 70 70 static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { 71 + { 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 + }, 71 80 { 72 81 /* AUX LOOP command does not raise AUX IRQ */ 73 82 .ident = "ASUS P65UP5", ··· 125 116 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 126 117 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), 127 118 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"), 119 + }, 120 + }, 121 + { 122 + .ident = "Medion MAM 2070", 123 + .matches = { 124 + DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), 125 + DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"), 126 + DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), 128 127 }, 129 128 }, 130 129 { } ··· 308 291 DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), 309 292 }, 310 293 }, 294 + { 295 + .ident = "Acer Aspire 1360", 296 + .matches = { 297 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 298 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"), 299 + }, 300 + }, 301 + { 302 + .ident = "Gericom Bellagio", 303 + .matches = { 304 + DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), 305 + DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"), 306 + }, 307 + }, 311 308 { } 312 309 }; 313 310 314 - 315 - 311 + #ifdef CONFIG_PNP 312 + static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = { 313 + { 314 + .ident = "Intel MBO Desktop D845PESV", 315 + .matches = { 316 + DMI_MATCH(DMI_BOARD_NAME, "D845PESV"), 317 + DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), 318 + }, 319 + }, 320 + { } 321 + }; 316 322 #endif 317 - 318 - #ifdef CONFIG_X86 319 - 320 - #include <linux/dmi.h> 321 323 322 324 /* 323 325 * Some Wistron based laptops need us to explicitly enable the 'Dritek ··· 367 331 }, 368 332 }, 369 333 { 334 + .ident = "Acer Aspire 5720", 335 + .matches = { 336 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 337 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"), 338 + }, 339 + }, 340 + { 370 341 .ident = "Acer Aspire 9110", 371 342 .matches = { 372 343 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ··· 398 355 }; 399 356 400 357 #endif /* CONFIG_X86 */ 401 - 402 358 403 359 #ifdef CONFIG_PNP 404 360 #include <linux/pnp.h> ··· 507 465 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; 508 466 int pnp_data_busted = 0; 509 467 int err; 468 + 469 + #ifdef CONFIG_X86 470 + if (dmi_check_system(i8042_dmi_nopnp_table)) 471 + i8042_nopnp = 1; 472 + #endif 510 473 511 474 if (i8042_nopnp) { 512 475 printk(KERN_INFO "i8042: PNP detection disabled\n"); ··· 638 591 i8042_reset = 1; 639 592 #endif 640 593 641 - #if defined(__i386__) || defined(__x86_64__) 594 + #ifdef CONFIG_X86 642 595 if (dmi_check_system(i8042_dmi_noloop_table)) 643 596 i8042_noloop = 1; 644 597 645 598 if (dmi_check_system(i8042_dmi_nomux_table)) 646 599 i8042_nomux = 1; 647 - #endif 648 600 649 - #ifdef CONFIG_X86 650 601 if (dmi_check_system(i8042_dmi_dritek_table)) 651 602 i8042_dritek = 1; 652 603 #endif /* CONFIG_X86 */
-52
drivers/input/serio/libps2.c
··· 26 26 MODULE_DESCRIPTION("PS/2 driver library"); 27 27 MODULE_LICENSE("GPL"); 28 28 29 - /* Work structure to schedule execution of a command */ 30 - struct ps2work { 31 - struct work_struct work; 32 - struct ps2dev *ps2dev; 33 - int command; 34 - unsigned char param[0]; 35 - }; 36 - 37 - 38 29 /* 39 30 * ps2_sendbyte() sends a byte to the device and waits for acknowledge. 40 31 * It doesn't handle retransmission, though it could - because if there ··· 235 244 return rc; 236 245 } 237 246 EXPORT_SYMBOL(ps2_command); 238 - 239 - /* 240 - * ps2_execute_scheduled_command() sends a command, previously scheduled by 241 - * ps2_schedule_command(), to a PS/2 device (keyboard, mouse, etc.) 242 - */ 243 - 244 - static void ps2_execute_scheduled_command(struct work_struct *work) 245 - { 246 - struct ps2work *ps2work = container_of(work, struct ps2work, work); 247 - 248 - ps2_command(ps2work->ps2dev, ps2work->param, ps2work->command); 249 - kfree(ps2work); 250 - } 251 - 252 - /* 253 - * ps2_schedule_command() allows to schedule delayed execution of a PS/2 254 - * command and can be used to issue a command from an interrupt or softirq 255 - * context. 256 - */ 257 - 258 - int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command) 259 - { 260 - struct ps2work *ps2work; 261 - int send = (command >> 12) & 0xf; 262 - int receive = (command >> 8) & 0xf; 263 - 264 - if (!(ps2work = kmalloc(sizeof(struct ps2work) + max(send, receive), GFP_ATOMIC))) 265 - return -1; 266 - 267 - memset(ps2work, 0, sizeof(struct ps2work)); 268 - ps2work->ps2dev = ps2dev; 269 - ps2work->command = command; 270 - memcpy(ps2work->param, param, send); 271 - INIT_WORK(&ps2work->work, ps2_execute_scheduled_command); 272 - 273 - if (!schedule_work(&ps2work->work)) { 274 - kfree(ps2work); 275 - return -1; 276 - } 277 - 278 - return 0; 279 - } 280 - EXPORT_SYMBOL(ps2_schedule_command); 281 247 282 248 /* 283 249 * ps2_init() initializes ps2dev structure
+1 -3
drivers/input/serio/q40kbd.c
··· 1 1 /* 2 - * $Id: q40kbd.c,v 1.12 2002/02/02 22:26:44 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 * 6 4 * Based on the work of: ··· 47 49 MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); 48 50 MODULE_LICENSE("GPL"); 49 51 50 - DEFINE_SPINLOCK(q40kbd_lock); 52 + static DEFINE_SPINLOCK(q40kbd_lock); 51 53 static struct serio *q40kbd_port; 52 54 static struct platform_device *q40kbd_device; 53 55
-2
drivers/input/serio/rpckbd.c
··· 1 1 /* 2 - * $Id: rpckbd.c,v 1.7 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 * Copyright (c) 2002 Russell King 6 4 */
+6 -3
drivers/input/serio/serio.c
··· 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 */ 336 - static void serio_remove_pending_events(struct serio *serio) 337 + static void serio_remove_pending_events(void *object) 337 338 { 338 339 struct list_head *node, *next; 339 340 struct serio_event *event; ··· 344 343 345 344 list_for_each_safe(node, next, &serio_event_list) { 346 345 event = list_entry(node, struct serio_event, node); 347 - if (event->object == serio) { 346 + if (event->object == object) { 348 347 list_del_init(node); 349 348 serio_free_event(event); 350 349 } ··· 838 837 struct serio *serio; 839 838 840 839 mutex_lock(&serio_mutex); 840 + 841 841 drv->manual_bind = 1; /* so serio_find_driver ignores it */ 842 + serio_remove_pending_events(drv); 842 843 843 844 start_over: 844 845 list_for_each_entry(serio, &serio_list, node) {
+380
drivers/input/serio/xilinx_ps2.c
··· 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 + 70 + struct 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 + */ 88 + static 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 + /*********************/ 106 + static 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 + */ 156 + static 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 + */ 180 + static 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 + */ 205 + static 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 + 219 + static 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 + 290 + failed2: 291 + release_mem_region(regs_res->start, remap_size); 292 + failed1: 293 + kfree(drvdata); 294 + dev_set_drvdata(dev, NULL); 295 + 296 + return retval; 297 + } 298 + 299 + /***************************/ 300 + /* OF Platform Bus Support */ 301 + /***************************/ 302 + 303 + static 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 + 330 + static 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 */ 351 + static struct of_device_id xps2_of_match[] __devinitdata = { 352 + { .compatible = "xlnx,xps-ps2-1.00.a", }, 353 + { /* end of list */ }, 354 + }; 355 + MODULE_DEVICE_TABLE(of, xps2_of_match); 356 + 357 + static 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 + 364 + static int __init xps2_init(void) 365 + { 366 + return of_register_platform_driver(&xps2_of_driver); 367 + } 368 + 369 + static void __exit xps2_cleanup(void) 370 + { 371 + of_unregister_platform_driver(&xps2_of_driver); 372 + } 373 + 374 + module_init(xps2_init); 375 + module_exit(xps2_cleanup); 376 + 377 + MODULE_AUTHOR("Xilinx, Inc."); 378 + MODULE_DESCRIPTION("Xilinx XPS PS/2 driver"); 379 + MODULE_LICENSE("GPL"); 380 +
+2 -2
drivers/input/tablet/acecad.c
··· 73 73 case -ENOENT: 74 74 case -ESHUTDOWN: 75 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 77 return; 78 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 80 goto resubmit; 81 81 } 82 82
+3 -3
drivers/input/tablet/aiptek.c
··· 449 449 case -ESHUTDOWN: 450 450 /* This urb is terminated, clean up */ 451 451 dbg("%s - urb shutting down with status: %d", 452 - __FUNCTION__, urb->status); 452 + __func__, urb->status); 453 453 return; 454 454 455 455 default: 456 456 dbg("%s - nonzero urb status received: %d", 457 - __FUNCTION__, urb->status); 457 + __func__, urb->status); 458 458 goto exit; 459 459 } 460 460 ··· 813 813 retval = usb_submit_urb(urb, GFP_ATOMIC); 814 814 if (retval != 0) { 815 815 err("%s - usb_submit_urb failed with result %d", 816 - __FUNCTION__, retval); 816 + __func__, retval); 817 817 } 818 818 } 819 819
+1 -1
drivers/input/tablet/gtco.c
··· 863 863 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); 864 864 if (!gtco->urbinfo) { 865 865 err("Failed to allocate URB"); 866 - return -ENOMEM; 866 + error = -ENOMEM; 867 867 goto err_free_buf; 868 868 } 869 869
+3 -3
drivers/input/tablet/kbtab.c
··· 56 56 case -ENOENT: 57 57 case -ESHUTDOWN: 58 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 60 return; 61 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 63 goto exit; 64 64 } 65 65 ··· 88 88 retval = usb_submit_urb (urb, GFP_ATOMIC); 89 89 if (retval) 90 90 err ("%s - usb_submit_urb failed with result %d", 91 - __FUNCTION__, retval); 91 + __func__, retval); 92 92 } 93 93 94 94 static struct usb_device_id kbtab_ids[] = {
+1 -1
drivers/input/tablet/wacom.h
··· 105 105 struct urb *irq; 106 106 struct wacom_wac * wacom_wac; 107 107 struct mutex lock; 108 - int open:1; 108 + unsigned int open:1; 109 109 char phys[32]; 110 110 }; 111 111
+3 -3
drivers/input/tablet/wacom_sys.c
··· 56 56 case -ENOENT: 57 57 case -ESHUTDOWN: 58 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 60 return; 61 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 63 goto exit; 64 64 } 65 65 ··· 74 74 retval = usb_submit_urb (urb, GFP_ATOMIC); 75 75 if (retval) 76 76 err ("%s - usb_submit_urb failed with result %d", 77 - __FUNCTION__, retval); 77 + __func__, retval); 78 78 } 79 79 80 80 void wacom_report_key(void *wcombo, unsigned int key_type, int key_data)
+19 -20
drivers/input/tablet/wacom_wac.c
··· 56 56 static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) 57 57 { 58 58 unsigned char *data = wacom->data; 59 - int prox, id, pressure; 59 + int prox, pressure; 60 60 61 61 if (data[0] != 2) { 62 62 dbg("wacom_pl_irq: received unknown report #%d", data[0]); ··· 65 65 66 66 prox = data[1] & 0x40; 67 67 68 - id = ERASER_DEVICE_ID; 68 + wacom->id[0] = ERASER_DEVICE_ID; 69 69 if (prox) { 70 70 71 71 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); ··· 99 99 if (wacom->tool[1] != BTN_TOOL_RUBBER) { 100 100 /* Unknown tool selected default to pen tool */ 101 101 wacom->tool[1] = BTN_TOOL_PEN; 102 - id = STYLUS_DEVICE_ID; 102 + wacom->id[0] = STYLUS_DEVICE_ID; 103 103 } 104 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 106 wacom_report_abs(wcombo, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 107 107 wacom_report_abs(wcombo, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 108 108 wacom_report_abs(wcombo, ABS_PRESSURE, pressure); ··· 127 127 static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) 128 128 { 129 129 unsigned char *data = wacom->data; 130 - int id; 131 130 132 131 if (data[0] != 2) { 133 132 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); ··· 136 137 if (data[1] & 0x04) { 137 138 wacom_report_key(wcombo, BTN_TOOL_RUBBER, data[1] & 0x20); 138 139 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x08); 139 - id = ERASER_DEVICE_ID; 140 + wacom->id[0] = ERASER_DEVICE_ID; 140 141 } else { 141 142 wacom_report_key(wcombo, BTN_TOOL_PEN, data[1] & 0x20); 142 143 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01); 143 - id = STYLUS_DEVICE_ID; 144 + wacom->id[0] = STYLUS_DEVICE_ID; 144 145 } 145 - wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 146 + wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */ 146 147 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); 147 148 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); 148 149 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6])); ··· 154 155 static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) 155 156 { 156 157 unsigned char *data = wacom->data; 157 - int x, y, id, rw; 158 + int x, y, rw; 158 159 159 160 if (data[0] != 2) { 160 161 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 161 162 return 0; 162 163 } 163 164 164 - id = STYLUS_DEVICE_ID; 165 - if ((data[1] & 0x80) && ((data[1] & 0x07) || data[2] || data[3] || data[4] 166 - || data[5] || data[6] || (data[7] & 0x07))) { 165 + if (data[1] & 0x80) { 167 166 /* in prox and not a pad data */ 168 167 169 168 switch ((data[1] >> 5) & 3) { 170 169 171 170 case 0: /* Pen */ 172 171 wacom->tool[0] = BTN_TOOL_PEN; 172 + wacom->id[0] = STYLUS_DEVICE_ID; 173 173 break; 174 174 175 175 case 1: /* Rubber */ 176 176 wacom->tool[0] = BTN_TOOL_RUBBER; 177 - id = ERASER_DEVICE_ID; 177 + wacom->id[0] = ERASER_DEVICE_ID; 178 178 break; 179 179 180 180 case 2: /* Mouse with wheel */ ··· 188 190 189 191 case 3: /* Mouse without wheel */ 190 192 wacom->tool[0] = BTN_TOOL_MOUSE; 191 - id = CURSOR_DEVICE_ID; 193 + wacom->id[0] = CURSOR_DEVICE_ID; 192 194 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); 193 195 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); 194 196 if (wacom->features->type == WACOM_G4 || ··· 208 210 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 209 211 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); 210 212 } 211 - wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 213 + wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */ 212 214 wacom_report_key(wcombo, wacom->tool[0], 1); 213 - } else if (!(data[1] & 0x90)) { 215 + } else if (wacom->id[0]) { 214 216 wacom_report_abs(wcombo, ABS_X, 0); 215 217 wacom_report_abs(wcombo, ABS_Y, 0); 216 218 if (wacom->tool[0] == BTN_TOOL_MOUSE) { ··· 223 225 wacom_report_key(wcombo, BTN_STYLUS, 0); 224 226 wacom_report_key(wcombo, BTN_STYLUS2, 0); 225 227 } 228 + wacom->id[0] = 0; 226 229 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 227 230 wacom_report_key(wcombo, wacom->tool[0], 0); 228 231 } ··· 233 234 case WACOM_G4: 234 235 if (data[7] & 0xf8) { 235 236 wacom_input_sync(wcombo); /* sync last event */ 236 - wacom->id[1] = 1; 237 + wacom->id[1] = PAD_DEVICE_ID; 237 238 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); 238 239 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); 239 240 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); 240 241 wacom_report_rel(wcombo, REL_WHEEL, rw); 241 242 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 242 - wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); 243 + wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 243 244 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 244 245 } else if (wacom->id[1]) { 245 246 wacom_input_sync(wcombo); /* sync last event */ ··· 254 255 case WACOM_MO: 255 256 if ((data[7] & 0xf8) || (data[8] & 0xff)) { 256 257 wacom_input_sync(wcombo); /* sync last event */ 257 - wacom->id[1] = 1; 258 + wacom->id[1] = PAD_DEVICE_ID; 258 259 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); 259 260 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); 260 261 wacom_report_key(wcombo, BTN_4, (data[7] & 0x10)); 261 262 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40)); 262 263 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f)); 263 264 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 264 - wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); 265 + wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 265 266 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 266 267 } else if (wacom->id[1]) { 267 268 wacom_input_sync(wcombo); /* sync last event */
+46
drivers/input/touchscreen/Kconfig
··· 103 103 To compile this driver as a module, choose M here: the 104 104 module will be called mtouch. 105 105 106 + config 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 + 106 118 config TOUCHSCREEN_MK712 107 119 tristate "ICS MicroClock MK712 touchscreen" 108 120 help ··· 146 134 To compile this driver as a module, choose M here: the 147 135 module will be called jornada720_ts. 148 136 137 + config TOUCHSCREEN_HTCPEN 138 + tristate "HTC Shift X9500 touchscreen" 139 + depends on ISA 140 + help 141 + Say Y here if you have an HTC Shift UMPC also known as HTC X9500 142 + Clio / Shangrila and want to support the built-in touchscreen. 143 + 144 + If unsure, say N. 145 + 146 + To compile this driver as a module, choose M here: the 147 + module will be called htcpen. 148 + 149 149 config TOUCHSCREEN_PENMOUNT 150 150 tristate "Penmount serial touchscreen" 151 151 select SERIO ··· 169 145 170 146 To compile this driver as a module, choose M here: the 171 147 module will be called penmount. 148 + 149 + config TOUCHSCREEN_MIGOR 150 + tristate "Renesas MIGO-R touchscreen" 151 + depends on SH_MIGOR && I2C 152 + help 153 + Say Y here to enable MIGO-R touchscreen support. 154 + 155 + If unsure, say N. 156 + 157 + To compile this driver as a module, choose M here: the 158 + module will be called migor_ts. 172 159 173 160 config TOUCHSCREEN_TOUCHRIGHT 174 161 tristate "Touchright serial touchscreen" ··· 350 315 default y 351 316 bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED 352 317 depends on TOUCHSCREEN_USB_COMPOSITE 318 + 319 + config TOUCHSCREEN_TOUCHIT213 320 + tristate "Sahara TouchIT-213 touchscreen" 321 + select SERIO 322 + help 323 + Say Y here if you have a Sahara TouchIT-213 Tablet PC. 324 + 325 + If unsure, say N. 326 + 327 + To compile this driver as a module, choose M here: the 328 + module will be called touchit213. 353 329 354 330 endif
+4
drivers/input/touchscreen/Makefile
··· 12 12 obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 13 13 obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o 14 14 obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o 15 + obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o 16 + obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o 15 17 obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o 16 18 obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o 17 19 obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o 18 20 obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o 21 + obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o 19 22 obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o 20 23 obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o 24 + obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o 21 25 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o 22 26 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o 23 27 obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
-2
drivers/input/touchscreen/gunze.c
··· 1 1 /* 2 - * $Id: gunze.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $ 3 - * 4 2 * Copyright (c) 2000-2001 Vojtech Pavlik 5 3 */ 6 4
-2
drivers/input/touchscreen/h3600_ts_input.c
··· 1 1 /* 2 - * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $ 3 - * 4 2 * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com 5 3 * 6 4 * Sponsored by Transvirtual Technology.
+255
drivers/input/touchscreen/htcpen.c
··· 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 + 23 + MODULE_AUTHOR("Pau Oliva Fora <pau@eslack.org>"); 24 + MODULE_DESCRIPTION("HTC Shift touchscreen driver"); 25 + MODULE_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 + 43 + static int invert_x; 44 + module_param(invert_x, bool, 0644); 45 + MODULE_PARM_DESC(invert_x, "If set, X axis is inverted"); 46 + static int invert_y; 47 + module_param(invert_y, bool, 0644); 48 + MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); 49 + 50 + static struct pnp_device_id pnp_ids[] = { 51 + { .id = "PNP0cc0" }, 52 + { .id = "" } 53 + }; 54 + MODULE_DEVICE_TABLE(pnp, pnp_ids); 55 + 56 + static 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 + 98 + static int htcpen_open(struct input_dev *dev) 99 + { 100 + outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT); 101 + 102 + return 0; 103 + } 104 + 105 + static void htcpen_close(struct input_dev *dev) 106 + { 107 + outb_p(DEVICE_DISABLE, HTCPEN_PORT_INIT); 108 + synchronize_irq(HTCPEN_IRQ); 109 + } 110 + 111 + static 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 + 183 + static 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 201 + static 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 + 209 + static 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 + 217 + static 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 + 230 + static 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 + 241 + static 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 + 249 + static void __exit htcpen_isa_exit(void) 250 + { 251 + isa_unregister_driver(&htcpen_isa_driver); 252 + } 253 + 254 + module_init(htcpen_isa_init); 255 + module_exit(htcpen_isa_exit);
+207
drivers/input/touchscreen/inexio.c
··· 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 + 30 + MODULE_AUTHOR("Richard Lemon <richard@codelemon.com>"); 31 + MODULE_DESCRIPTION(DRIVER_DESC); 32 + MODULE_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 + 58 + struct 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 + 66 + static 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 + 80 + static 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 + 99 + static 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 + 117 + static 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 + 169 + static 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 + 179 + MODULE_DEVICE_TABLE(serio, inexio_serio_ids); 180 + 181 + static 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 + 196 + static int __init inexio_init(void) 197 + { 198 + return serio_register_driver(&inexio_drv); 199 + } 200 + 201 + static void __exit inexio_exit(void) 202 + { 203 + serio_unregister_driver(&inexio_drv); 204 + } 205 + 206 + module_init(inexio_init); 207 + module_exit(inexio_exit);
+250
drivers/input/touchscreen/migor_ts.c
··· 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 + 34 + struct migor_ts_priv { 35 + struct i2c_client *client; 36 + struct input_dev *input; 37 + struct delayed_work work; 38 + int irq; 39 + }; 40 + 41 + static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11, 42 + 0x01, 0x06, 0x07, }; 43 + static const u_int8_t migor_ts_dis_seq[17] = { }; 44 + 45 + static 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 + 86 + static 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 + 108 + static 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 + 125 + static 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 + 147 + static 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 + 214 + static 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 + 227 + static 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 + 235 + static int __init migor_ts_init(void) 236 + { 237 + return i2c_add_driver(&migor_ts_driver); 238 + } 239 + 240 + static void __exit migor_ts_exit(void) 241 + { 242 + i2c_del_driver(&migor_ts_driver); 243 + } 244 + 245 + MODULE_DESCRIPTION("MigoR Touchscreen driver"); 246 + MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); 247 + MODULE_LICENSE("GPL"); 248 + 249 + module_init(migor_ts_init); 250 + module_exit(migor_ts_exit);
+234
drivers/input/touchscreen/touchit213.c
··· 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 + 28 + MODULE_AUTHOR("Claudio Nieder <private@claudio.ch>"); 29 + MODULE_DESCRIPTION(DRIVER_DESC); 30 + MODULE_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 + 78 + struct 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 + 87 + static 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 + 123 + static 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 + 141 + static 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 + 196 + static 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 + 206 + MODULE_DEVICE_TABLE(serio, touchit213_serio_ids); 207 + 208 + static 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 + 223 + static int __init touchit213_init(void) 224 + { 225 + return serio_register_driver(&touchit213_drv); 226 + } 227 + 228 + static void __exit touchit213_exit(void) 229 + { 230 + serio_unregister_driver(&touchit213_drv); 231 + } 232 + 233 + module_init(touchit213_init); 234 + module_exit(touchit213_exit);
+30 -12
drivers/input/touchscreen/usbtouchscreen.c
··· 49 49 #include <linux/init.h> 50 50 #include <linux/usb.h> 51 51 #include <linux/usb/input.h> 52 + #include <linux/hid.h> 52 53 53 54 54 55 #define DRIVER_VERSION "v0.6" ··· 102 101 103 102 /* device types */ 104 103 enum { 105 - DEVTPYE_DUMMY = -1, 104 + DEVTYPE_IGNORE = -1, 106 105 DEVTYPE_EGALAX, 107 106 DEVTYPE_PANJIT, 108 107 DEVTYPE_3M, ··· 116 115 DEVTYPE_GOTOP, 117 116 }; 118 117 118 + #define USB_DEVICE_HID_CLASS(vend, prod) \ 119 + .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ 120 + | USB_DEVICE_ID_MATCH_DEVICE, \ 121 + .idVendor = (vend), \ 122 + .idProduct = (prod), \ 123 + .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ 124 + .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE 125 + 119 126 static struct usb_device_id usbtouch_devices[] = { 120 127 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 128 + /* ignore the HID capable devices, handled by usbhid */ 129 + {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, 130 + {USB_DEVICE_HID_CLASS(0x0eef, 0x0002), .driver_info = DEVTYPE_IGNORE}, 131 + 132 + /* normal device IDs */ 121 133 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, 122 134 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX}, 123 135 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, ··· 276 262 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 277 263 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); 278 264 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", 279 - __FUNCTION__, ret); 265 + __func__, ret); 280 266 if (ret < 0) 281 267 return ret; 282 268 msleep(150); ··· 287 273 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 288 274 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); 289 275 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", 290 - __FUNCTION__, ret); 276 + __func__, ret); 291 277 if (ret >= 0) 292 278 break; 293 279 if (ret != -EPIPE) ··· 807 793 case -ETIME: 808 794 /* this urb is timing out */ 809 795 dbg("%s - urb timed out - was the device unplugged?", 810 - __FUNCTION__); 796 + __func__); 811 797 return; 812 798 case -ECONNRESET: 813 799 case -ENOENT: 814 800 case -ESHUTDOWN: 815 801 /* this urb is terminated, clean up */ 816 802 dbg("%s - urb shutting down with status: %d", 817 - __FUNCTION__, urb->status); 803 + __func__, urb->status); 818 804 return; 819 805 default: 820 806 dbg("%s - nonzero urb status received: %d", 821 - __FUNCTION__, urb->status); 807 + __func__, urb->status); 822 808 goto exit; 823 809 } 824 810 ··· 828 814 retval = usb_submit_urb(urb, GFP_ATOMIC); 829 815 if (retval) 830 816 err("%s - usb_submit_urb failed with result: %d", 831 - __FUNCTION__, retval); 817 + __func__, retval); 832 818 } 833 819 834 820 static int usbtouch_open(struct input_dev *input) ··· 871 857 struct usbtouch_device_info *type; 872 858 int err = -ENOMEM; 873 859 860 + /* some devices are ignored */ 861 + if (id->driver_info == DEVTYPE_IGNORE) 862 + return -ENODEV; 863 + 874 864 interface = intf->cur_altsetting; 875 865 endpoint = &interface->endpoint[0].desc; 876 866 ··· 901 883 902 884 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); 903 885 if (!usbtouch->irq) { 904 - dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__); 886 + dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); 905 887 goto out_free_buffers; 906 888 } 907 889 ··· 957 939 if (type->init) { 958 940 err = type->init(usbtouch); 959 941 if (err) { 960 - dbg("%s - type->init() failed, err: %d", __FUNCTION__, err); 942 + dbg("%s - type->init() failed, err: %d", __func__, err); 961 943 goto out_free_buffers; 962 944 } 963 945 } 964 946 965 947 err = input_register_device(usbtouch->input); 966 948 if (err) { 967 - dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err); 949 + dbg("%s - input_register_device failed, err: %d", __func__, err); 968 950 goto out_free_buffers; 969 951 } 970 952 ··· 984 966 { 985 967 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); 986 968 987 - dbg("%s - called", __FUNCTION__); 969 + dbg("%s - called", __func__); 988 970 989 971 if (!usbtouch) 990 972 return; 991 973 992 - dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__); 974 + dbg("%s - usbtouch is initialized, cleaning up", __func__); 993 975 usb_set_intfdata(intf, NULL); 994 976 usb_kill_urb(usbtouch->irq); 995 977 input_unregister_device(usbtouch->input);
+12 -6
drivers/input/touchscreen/wm9712.c
··· 168 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 183 /* touchpanel pressure current*/ 172 184 if (pil == 2) { 173 185 dig2 |= WM9712_PIL; ··· 190 178 "setting pressure measurement current to 200uA."); 191 179 if (!pil) 192 180 pressure = 0; 193 - 194 - /* WM9712 five wire */ 195 - if (five_wire) { 196 - dig2 |= WM9712_45W; 197 - dev_dbg(wm->dev, "setting 5-wire touchscreen mode."); 198 - } 199 181 200 182 /* polling mode sample settling delay */ 201 183 if (delay < 0 || delay > 15) {
+51 -10
drivers/macintosh/adbhid.c
··· 219 219 int flags; 220 220 }; 221 221 222 - #define FLAG_FN_KEY_PRESSED 0x00000001 223 - #define FLAG_POWER_FROM_FN 0x00000002 224 - #define FLAG_EMU_FWDEL_DOWN 0x00000004 225 - #define FLAG_CAPSLOCK_TRANSLATE 0x00000008 226 - #define FLAG_CAPSLOCK_DOWN 0x00000010 222 + #define FLAG_FN_KEY_PRESSED 0x00000001 223 + #define FLAG_POWER_FROM_FN 0x00000002 224 + #define FLAG_EMU_FWDEL_DOWN 0x00000004 225 + #define FLAG_CAPSLOCK_TRANSLATE 0x00000008 226 + #define FLAG_CAPSLOCK_DOWN 0x00000010 227 + #define FLAG_CAPSLOCK_IGNORE_NEXT 0x00000020 228 + #define FLAG_POWER_KEY_PRESSED 0x00000040 227 229 228 230 static struct adbhid *adbhid[16]; 229 231 ··· 293 291 if (keycode == ADB_KEY_CAPSLOCK && !up_flag) { 294 292 /* Key pressed, turning on the CapsLock LED. 295 293 * The next 0xff will be interpreted as a release. */ 296 - ahid->flags |= FLAG_CAPSLOCK_TRANSLATE 294 + if (ahid->flags & FLAG_CAPSLOCK_IGNORE_NEXT) { 295 + /* Throw away this key event if it happens 296 + * just after resume. */ 297 + ahid->flags &= ~FLAG_CAPSLOCK_IGNORE_NEXT; 298 + return; 299 + } else { 300 + ahid->flags |= FLAG_CAPSLOCK_TRANSLATE 297 301 | FLAG_CAPSLOCK_DOWN; 298 - } else if (scancode == 0xff) { 302 + } 303 + } else if (scancode == 0xff && 304 + !(ahid->flags & FLAG_POWER_KEY_PRESSED)) { 299 305 /* Scancode 0xff usually signifies that the capslock 300 - * key was either pressed or released. */ 306 + * key was either pressed or released, or that the 307 + * power button was released. */ 301 308 if (ahid->flags & FLAG_CAPSLOCK_TRANSLATE) { 302 309 keycode = ADB_KEY_CAPSLOCK; 303 310 if (ahid->flags & FLAG_CAPSLOCK_DOWN) { ··· 320 309 } 321 310 } else { 322 311 printk(KERN_INFO "Spurious caps lock event " 323 - "(scancode 0xff)."); 312 + "(scancode 0xff).\n"); 324 313 } 325 314 } 326 315 } ··· 347 336 } 348 337 break; 349 338 case ADB_KEY_POWER: 339 + /* Keep track of the power key state */ 340 + if (up_flag) 341 + ahid->flags &= ~FLAG_POWER_KEY_PRESSED; 342 + else 343 + ahid->flags |= FLAG_POWER_KEY_PRESSED; 344 + 350 345 /* Fn + Command will produce a bogus "power" keycode */ 351 346 if (ahid->flags & FLAG_FN_KEY_PRESSED) { 352 347 keycode = ADB_KEY_CMD; ··· 698 681 return -1; 699 682 } 700 683 684 + static void 685 + adbhid_kbd_capslock_remember(void) 686 + { 687 + struct adbhid *ahid; 688 + int i; 689 + 690 + for (i = 1; i < 16; i++) { 691 + ahid = adbhid[i]; 692 + 693 + if (ahid && ahid->id == ADB_KEYBOARD) 694 + if (ahid->flags & FLAG_CAPSLOCK_TRANSLATE) 695 + ahid->flags |= FLAG_CAPSLOCK_IGNORE_NEXT; 696 + } 697 + } 698 + 701 699 static int 702 700 adb_message_handler(struct notifier_block *this, unsigned long code, void *x) 703 701 { ··· 729 697 } 730 698 731 699 /* Stop pending led requests */ 732 - while(leds_req_pending) 700 + while (leds_req_pending) 733 701 adb_poll(); 702 + 703 + /* After resume, and if the capslock LED is on, the PMU will 704 + * send a "capslock down" key event. This confuses the 705 + * restore_capslock_events logic. Remember if the capslock 706 + * LED was on before suspend so the unwanted key event can 707 + * be ignored after resume. */ 708 + if (restore_capslock_events) 709 + adbhid_kbd_capslock_remember(); 710 + 734 711 break; 735 712 736 713 case ADB_MSG_POST_RESET:
-1
include/linux/gameport.h
··· 68 68 69 69 int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode); 70 70 void gameport_close(struct gameport *gameport); 71 - void gameport_rescan(struct gameport *gameport); 72 71 73 72 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 74 73
+1
include/linux/gpio_keys.h
··· 9 9 char *desc; 10 10 int type; /* input event type (EV_KEY, EV_SW) */ 11 11 int wakeup; /* configure the button as a wake-up source */ 12 + int debounce_interval; /* debounce ticks interval in msecs */ 12 13 }; 13 14 14 15 struct gpio_keys_platform_data {
+4 -5
include/linux/input.h
··· 373 373 374 374 #define KEY_WIMAX 246 375 375 376 + /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ 377 + 376 378 #define BTN_MISC 0x100 377 379 #define BTN_0 0x100 378 380 #define BTN_1 0x101 ··· 642 640 #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" 643 641 set = radio enabled */ 644 642 #define SW_RADIO SW_RFKILL_ALL /* deprecated */ 643 + #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ 644 + #define SW_DOCK 0x05 /* set = plugged into dock */ 645 645 #define SW_MAX 0x0f 646 646 #define SW_CNT (SW_MAX+1) 647 647 ··· 1218 1214 struct list_head d_node; 1219 1215 struct list_head h_node; 1220 1216 }; 1221 - 1222 - #define to_dev(n) container_of(n, struct input_dev, node) 1223 - #define to_handler(n) container_of(n, struct input_handler, node) 1224 - #define to_handle(n) container_of(n, struct input_handle, d_node) 1225 - #define to_handle_h(n) container_of(n, struct input_handle, h_node) 1226 1217 1227 1218 struct input_dev *input_allocate_device(void); 1228 1219 void input_free_device(struct input_dev *dev);
-2
include/linux/joystick.h
··· 2 2 #define _LINUX_JOYSTICK_H 3 3 4 4 /* 5 - * $Id: joystick.h,v 1.3 2000/11/30 11:07:05 vojtech Exp $ 6 - * 7 5 * Copyright (C) 1996-2000 Vojtech Pavlik 8 6 * 9 7 * Sponsored by SuSE
-1
include/linux/libps2.h
··· 43 43 int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 44 44 void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 45 45 int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 46 - int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command); 47 46 int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 48 47 int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 49 48 void ps2_cmd_aborted(struct ps2dev *ps2dev);
+3 -1
include/linux/serio.h
··· 175 175 #define SERIO_8042_XL 0x06 176 176 177 177 /* 178 - * Serio types 178 + * Serio protocols 179 179 */ 180 180 #define SERIO_UNKNOWN 0x00 181 181 #define SERIO_MSC 0x01 ··· 212 212 #define SERIO_TAOSEVM 0x34 213 213 #define SERIO_FUJITSU 0x35 214 214 #define SERIO_ZHENHUA 0x36 215 + #define SERIO_INEXIO 0x37 216 + #define SERIO_TOUCHIT213 0x37 215 217 216 218 #endif