diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 20:14:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 20:14:01 -0500 |
commit | db30c70575822cc84d87b5613c19cac24734b99f (patch) | |
tree | 82945ad5813bfe6633698233981d270b5f0a310b /drivers/input/mouse | |
parent | c861ea2cb2c25c1698734d9b0540a09e253690a1 (diff) | |
parent | 9334e90d5ac5ee1fa6d8b75acb7c64a8907787d1 (diff) |
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: (29 commits)
Input: i8042 - add Dell Vostro 1510 to nomux list
Input: gtco - use USB endpoint API
Input: add support for Maple controller as a joystick
Input: atkbd - broaden the Dell DMI signatures
Input: HIL drivers - add MODULE_ALIAS()
Input: map_to_7segment.h - convert to __inline__ for userspace
Input: add support for enhanced rotary controller on pxa930 and pxa935
Input: add support for trackball on pxa930 and pxa935
Input: add da9034 touchscreen support
Input: ads7846 - strict_strtoul takes unsigned long
Input: make some variables and functions static
Input: add tsc2007 based touchscreen driver
Input: psmouse - add module parameters to control OLPC touchpad delays
Input: i8042 - add Gigabyte M912 netbook to noloop exception table
Input: atkbd - Samsung NC10 key repeat fix
Input: atkbd - add keyboard quirk for HP Pavilion ZV6100 laptop
Input: libps2 - handle 0xfc responses from devices
Input: add support for Wacom W8001 penabled serial touchscreen
Input: synaptics - report multi-taps only if supported by the device
Input: add joystick driver for Walkera WK-0701 RC transmitter
...
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/Kconfig | 6 | ||||
-rw-r--r-- | drivers/input/mouse/Makefile | 27 | ||||
-rw-r--r-- | drivers/input/mouse/appletouch.c | 274 | ||||
-rw-r--r-- | drivers/input/mouse/gpio_mouse.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/hgpk.c | 32 | ||||
-rw-r--r-- | drivers/input/mouse/hil_ptr.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/pxa930_trkball.c | 269 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 16 |
8 files changed, 465 insertions, 163 deletions
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 4e9934259775..093c8c1bca74 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -286,4 +286,10 @@ config MOUSE_GPIO | |||
286 | To compile this driver as a module, choose M here: the | 286 | To compile this driver as a module, choose M here: the |
287 | module will be called gpio_mouse. | 287 | module will be called gpio_mouse. |
288 | 288 | ||
289 | config MOUSE_PXA930_TRKBALL | ||
290 | tristate "PXA930 Trackball mouse" | ||
291 | depends on CPU_PXA930 || CPU_PXA935 | ||
292 | help | ||
293 | Say Y here to support PXA930 Trackball mouse. | ||
294 | |||
289 | endif | 295 | endif |
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 96f1dd8037f8..8c8a1f236e28 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile | |||
@@ -4,19 +4,20 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o | 7 | obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o |
8 | obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o | 8 | obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o |
9 | obj-$(CONFIG_MOUSE_BCM5974) += bcm5974.o | 9 | obj-$(CONFIG_MOUSE_BCM5974) += bcm5974.o |
10 | obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o | 10 | obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o |
11 | obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o | 11 | obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o |
12 | obj-$(CONFIG_MOUSE_INPORT) += inport.o | 12 | obj-$(CONFIG_MOUSE_INPORT) += inport.o |
13 | obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o | 13 | obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o |
14 | obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o | 14 | obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o |
15 | obj-$(CONFIG_MOUSE_PS2) += psmouse.o | 15 | obj-$(CONFIG_MOUSE_PS2) += psmouse.o |
16 | obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o | 16 | obj-$(CONFIG_MOUSE_PXA930_TRKBALL) += pxa930_trkball.o |
17 | obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o | 17 | obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o |
18 | obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o | 18 | obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o |
19 | obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o | 19 | obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o |
20 | obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o | ||
20 | 21 | ||
21 | psmouse-objs := psmouse-base.o synaptics.o | 22 | psmouse-objs := psmouse-base.o synaptics.o |
22 | 23 | ||
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 079816e6b23b..454b96112f03 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com) | 4 | * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com) |
5 | * Copyright (C) 2005-2008 Johannes Berg (johannes@sipsolutions.net) | 5 | * Copyright (C) 2005-2008 Johannes Berg (johannes@sipsolutions.net) |
6 | * Copyright (C) 2005 Stelian Pop (stelian@popies.net) | 6 | * Copyright (C) 2005-2008 Stelian Pop (stelian@popies.net) |
7 | * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) | 7 | * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) |
8 | * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) | 8 | * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) |
9 | * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch) | 9 | * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch) |
@@ -35,16 +35,74 @@ | |||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/usb/input.h> | 36 | #include <linux/usb/input.h> |
37 | 37 | ||
38 | /* Type of touchpad */ | 38 | /* |
39 | enum atp_touchpad_type { | 39 | * Note: We try to keep the touchpad aspect ratio while still doing only |
40 | ATP_FOUNTAIN, | 40 | * simple arithmetics: |
41 | ATP_GEYSER1, | 41 | * 0 <= x <= (xsensors - 1) * xfact |
42 | ATP_GEYSER2, | 42 | * 0 <= y <= (ysensors - 1) * yfact |
43 | ATP_GEYSER3, | 43 | */ |
44 | ATP_GEYSER4 | 44 | struct atp_info { |
45 | int xsensors; /* number of X sensors */ | ||
46 | int xsensors_17; /* 17" models have more sensors */ | ||
47 | int ysensors; /* number of Y sensors */ | ||
48 | int xfact; /* X multiplication factor */ | ||
49 | int yfact; /* Y multiplication factor */ | ||
50 | int datalen; /* size of USB transfers */ | ||
51 | void (*callback)(struct urb *); /* callback function */ | ||
52 | }; | ||
53 | |||
54 | static void atp_complete_geyser_1_2(struct urb *urb); | ||
55 | static void atp_complete_geyser_3_4(struct urb *urb); | ||
56 | |||
57 | static const struct atp_info fountain_info = { | ||
58 | .xsensors = 16, | ||
59 | .xsensors_17 = 26, | ||
60 | .ysensors = 16, | ||
61 | .xfact = 64, | ||
62 | .yfact = 43, | ||
63 | .datalen = 81, | ||
64 | .callback = atp_complete_geyser_1_2, | ||
65 | }; | ||
66 | |||
67 | static const struct atp_info geyser1_info = { | ||
68 | .xsensors = 16, | ||
69 | .xsensors_17 = 26, | ||
70 | .ysensors = 16, | ||
71 | .xfact = 64, | ||
72 | .yfact = 43, | ||
73 | .datalen = 81, | ||
74 | .callback = atp_complete_geyser_1_2, | ||
75 | }; | ||
76 | |||
77 | static const struct atp_info geyser2_info = { | ||
78 | .xsensors = 15, | ||
79 | .xsensors_17 = 20, | ||
80 | .ysensors = 9, | ||
81 | .xfact = 64, | ||
82 | .yfact = 43, | ||
83 | .datalen = 64, | ||
84 | .callback = atp_complete_geyser_1_2, | ||
85 | }; | ||
86 | |||
87 | static const struct atp_info geyser3_info = { | ||
88 | .xsensors = 20, | ||
89 | .ysensors = 10, | ||
90 | .xfact = 64, | ||
91 | .yfact = 64, | ||
92 | .datalen = 64, | ||
93 | .callback = atp_complete_geyser_3_4, | ||
45 | }; | 94 | }; |
46 | 95 | ||
47 | #define ATP_DEVICE(prod, type) \ | 96 | static const struct atp_info geyser4_info = { |
97 | .xsensors = 20, | ||
98 | .ysensors = 10, | ||
99 | .xfact = 64, | ||
100 | .yfact = 64, | ||
101 | .datalen = 64, | ||
102 | .callback = atp_complete_geyser_3_4, | ||
103 | }; | ||
104 | |||
105 | #define ATP_DEVICE(prod, info) \ | ||
48 | { \ | 106 | { \ |
49 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 107 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
50 | USB_DEVICE_ID_MATCH_INT_CLASS | \ | 108 | USB_DEVICE_ID_MATCH_INT_CLASS | \ |
@@ -53,7 +111,7 @@ enum atp_touchpad_type { | |||
53 | .idProduct = (prod), \ | 111 | .idProduct = (prod), \ |
54 | .bInterfaceClass = 0x03, \ | 112 | .bInterfaceClass = 0x03, \ |
55 | .bInterfaceProtocol = 0x02, \ | 113 | .bInterfaceProtocol = 0x02, \ |
56 | .driver_info = ATP_ ## type, \ | 114 | .driver_info = (unsigned long) &info, \ |
57 | } | 115 | } |
58 | 116 | ||
59 | /* | 117 | /* |
@@ -62,43 +120,39 @@ enum atp_touchpad_type { | |||
62 | * According to Info.plist Geyser IV is the same as Geyser III.) | 120 | * According to Info.plist Geyser IV is the same as Geyser III.) |
63 | */ | 121 | */ |
64 | 122 | ||
65 | static struct usb_device_id atp_table [] = { | 123 | static struct usb_device_id atp_table[] = { |
66 | /* PowerBooks Feb 2005, iBooks G4 */ | 124 | /* PowerBooks Feb 2005, iBooks G4 */ |
67 | ATP_DEVICE(0x020e, FOUNTAIN), /* FOUNTAIN ANSI */ | 125 | ATP_DEVICE(0x020e, fountain_info), /* FOUNTAIN ANSI */ |
68 | ATP_DEVICE(0x020f, FOUNTAIN), /* FOUNTAIN ISO */ | 126 | ATP_DEVICE(0x020f, fountain_info), /* FOUNTAIN ISO */ |
69 | ATP_DEVICE(0x030a, FOUNTAIN), /* FOUNTAIN TP ONLY */ | 127 | ATP_DEVICE(0x030a, fountain_info), /* FOUNTAIN TP ONLY */ |
70 | ATP_DEVICE(0x030b, GEYSER1), /* GEYSER 1 TP ONLY */ | 128 | ATP_DEVICE(0x030b, geyser1_info), /* GEYSER 1 TP ONLY */ |
71 | 129 | ||
72 | /* PowerBooks Oct 2005 */ | 130 | /* PowerBooks Oct 2005 */ |
73 | ATP_DEVICE(0x0214, GEYSER2), /* GEYSER 2 ANSI */ | 131 | ATP_DEVICE(0x0214, geyser2_info), /* GEYSER 2 ANSI */ |
74 | ATP_DEVICE(0x0215, GEYSER2), /* GEYSER 2 ISO */ | 132 | ATP_DEVICE(0x0215, geyser2_info), /* GEYSER 2 ISO */ |
75 | ATP_DEVICE(0x0216, GEYSER2), /* GEYSER 2 JIS */ | 133 | ATP_DEVICE(0x0216, geyser2_info), /* GEYSER 2 JIS */ |
76 | 134 | ||
77 | /* Core Duo MacBook & MacBook Pro */ | 135 | /* Core Duo MacBook & MacBook Pro */ |
78 | ATP_DEVICE(0x0217, GEYSER3), /* GEYSER 3 ANSI */ | 136 | ATP_DEVICE(0x0217, geyser3_info), /* GEYSER 3 ANSI */ |
79 | ATP_DEVICE(0x0218, GEYSER3), /* GEYSER 3 ISO */ | 137 | ATP_DEVICE(0x0218, geyser3_info), /* GEYSER 3 ISO */ |
80 | ATP_DEVICE(0x0219, GEYSER3), /* GEYSER 3 JIS */ | 138 | ATP_DEVICE(0x0219, geyser3_info), /* GEYSER 3 JIS */ |
81 | 139 | ||
82 | /* Core2 Duo MacBook & MacBook Pro */ | 140 | /* Core2 Duo MacBook & MacBook Pro */ |
83 | ATP_DEVICE(0x021a, GEYSER4), /* GEYSER 4 ANSI */ | 141 | ATP_DEVICE(0x021a, geyser4_info), /* GEYSER 4 ANSI */ |
84 | ATP_DEVICE(0x021b, GEYSER4), /* GEYSER 4 ISO */ | 142 | ATP_DEVICE(0x021b, geyser4_info), /* GEYSER 4 ISO */ |
85 | ATP_DEVICE(0x021c, GEYSER4), /* GEYSER 4 JIS */ | 143 | ATP_DEVICE(0x021c, geyser4_info), /* GEYSER 4 JIS */ |
86 | 144 | ||
87 | /* Core2 Duo MacBook3,1 */ | 145 | /* Core2 Duo MacBook3,1 */ |
88 | ATP_DEVICE(0x0229, GEYSER4), /* GEYSER 4 HF ANSI */ | 146 | ATP_DEVICE(0x0229, geyser4_info), /* GEYSER 4 HF ANSI */ |
89 | ATP_DEVICE(0x022a, GEYSER4), /* GEYSER 4 HF ISO */ | 147 | ATP_DEVICE(0x022a, geyser4_info), /* GEYSER 4 HF ISO */ |
90 | ATP_DEVICE(0x022b, GEYSER4), /* GEYSER 4 HF JIS */ | 148 | ATP_DEVICE(0x022b, geyser4_info), /* GEYSER 4 HF JIS */ |
91 | 149 | ||
92 | /* Terminating entry */ | 150 | /* Terminating entry */ |
93 | { } | 151 | { } |
94 | }; | 152 | }; |
95 | MODULE_DEVICE_TABLE(usb, atp_table); | 153 | MODULE_DEVICE_TABLE(usb, atp_table); |
96 | 154 | ||
97 | /* | 155 | /* maximum number of sensors */ |
98 | * number of sensors. Note that only 16 instead of 26 X (horizontal) | ||
99 | * sensors exist on 12" and 15" PowerBooks. All models have 16 Y | ||
100 | * (vertical) sensors. | ||
101 | */ | ||
102 | #define ATP_XSENSORS 26 | 156 | #define ATP_XSENSORS 26 |
103 | #define ATP_YSENSORS 16 | 157 | #define ATP_YSENSORS 16 |
104 | 158 | ||
@@ -107,21 +161,6 @@ MODULE_DEVICE_TABLE(usb, atp_table); | |||
107 | 161 | ||
108 | /* maximum pressure this driver will report */ | 162 | /* maximum pressure this driver will report */ |
109 | #define ATP_PRESSURE 300 | 163 | #define ATP_PRESSURE 300 |
110 | /* | ||
111 | * multiplication factor for the X and Y coordinates. | ||
112 | * We try to keep the touchpad aspect ratio while still doing only simple | ||
113 | * arithmetics. | ||
114 | * The factors below give coordinates like: | ||
115 | * | ||
116 | * 0 <= x < 960 on 12" and 15" Powerbooks | ||
117 | * 0 <= x < 1600 on 17" Powerbooks and 17" MacBook Pro | ||
118 | * 0 <= x < 1216 on MacBooks and 15" MacBook Pro | ||
119 | * | ||
120 | * 0 <= y < 646 on all Powerbooks | ||
121 | * 0 <= y < 774 on all MacBooks | ||
122 | */ | ||
123 | #define ATP_XFACT 64 | ||
124 | #define ATP_YFACT 43 | ||
125 | 164 | ||
126 | /* | 165 | /* |
127 | * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is | 166 | * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is |
@@ -159,7 +198,7 @@ struct atp { | |||
159 | struct urb *urb; /* usb request block */ | 198 | struct urb *urb; /* usb request block */ |
160 | u8 *data; /* transferred data */ | 199 | u8 *data; /* transferred data */ |
161 | struct input_dev *input; /* input dev */ | 200 | struct input_dev *input; /* input dev */ |
162 | enum atp_touchpad_type type; /* type of touchpad */ | 201 | const struct atp_info *info; /* touchpad model */ |
163 | bool open; | 202 | bool open; |
164 | bool valid; /* are the samples valid? */ | 203 | bool valid; /* are the samples valid? */ |
165 | bool size_detect_done; | 204 | bool size_detect_done; |
@@ -169,7 +208,6 @@ struct atp { | |||
169 | signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; | 208 | signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; |
170 | signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; | 209 | signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; |
171 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; | 210 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; |
172 | int datalen; /* size of USB transfer */ | ||
173 | int idlecount; /* number of empty packets */ | 211 | int idlecount; /* number of empty packets */ |
174 | struct work_struct work; | 212 | struct work_struct work; |
175 | }; | 213 | }; |
@@ -359,7 +397,7 @@ static int atp_status_check(struct urb *urb) | |||
359 | if (!dev->overflow_warned) { | 397 | if (!dev->overflow_warned) { |
360 | printk(KERN_WARNING "appletouch: OVERFLOW with data " | 398 | printk(KERN_WARNING "appletouch: OVERFLOW with data " |
361 | "length %d, actual length is %d\n", | 399 | "length %d, actual length is %d\n", |
362 | dev->datalen, dev->urb->actual_length); | 400 | dev->info->datalen, dev->urb->actual_length); |
363 | dev->overflow_warned = true; | 401 | dev->overflow_warned = true; |
364 | } | 402 | } |
365 | case -ECONNRESET: | 403 | case -ECONNRESET: |
@@ -377,7 +415,7 @@ static int atp_status_check(struct urb *urb) | |||
377 | } | 415 | } |
378 | 416 | ||
379 | /* drop incomplete datasets */ | 417 | /* drop incomplete datasets */ |
380 | if (dev->urb->actual_length != dev->datalen) { | 418 | if (dev->urb->actual_length != dev->info->datalen) { |
381 | dprintk("appletouch: incomplete data package" | 419 | dprintk("appletouch: incomplete data package" |
382 | " (first byte: %d, length: %d).\n", | 420 | " (first byte: %d, length: %d).\n", |
383 | dev->data[0], dev->urb->actual_length); | 421 | dev->data[0], dev->urb->actual_length); |
@@ -387,6 +425,25 @@ static int atp_status_check(struct urb *urb) | |||
387 | return ATP_URB_STATUS_SUCCESS; | 425 | return ATP_URB_STATUS_SUCCESS; |
388 | } | 426 | } |
389 | 427 | ||
428 | static void atp_detect_size(struct atp *dev) | ||
429 | { | ||
430 | int i; | ||
431 | |||
432 | /* 17" Powerbooks have extra X sensors */ | ||
433 | for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { | ||
434 | if (dev->xy_cur[i]) { | ||
435 | |||
436 | printk(KERN_INFO "appletouch: 17\" model detected.\n"); | ||
437 | |||
438 | input_set_abs_params(dev->input, ABS_X, 0, | ||
439 | (dev->info->xsensors_17 - 1) * | ||
440 | dev->info->xfact - 1, | ||
441 | ATP_FUZZ, 0); | ||
442 | break; | ||
443 | } | ||
444 | } | ||
445 | } | ||
446 | |||
390 | /* | 447 | /* |
391 | * USB interrupt callback functions | 448 | * USB interrupt callback functions |
392 | */ | 449 | */ |
@@ -407,7 +464,7 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
407 | goto exit; | 464 | goto exit; |
408 | 465 | ||
409 | /* reorder the sensors values */ | 466 | /* reorder the sensors values */ |
410 | if (dev->type == ATP_GEYSER2) { | 467 | if (dev->info == &geyser2_info) { |
411 | memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); | 468 | memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); |
412 | 469 | ||
413 | /* | 470 | /* |
@@ -437,8 +494,8 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
437 | dev->xy_cur[i + 24] = dev->data[5 * i + 44]; | 494 | dev->xy_cur[i + 24] = dev->data[5 * i + 44]; |
438 | 495 | ||
439 | /* Y values */ | 496 | /* Y values */ |
440 | dev->xy_cur[i + 26] = dev->data[5 * i + 1]; | 497 | dev->xy_cur[ATP_XSENSORS + i] = dev->data[5 * i + 1]; |
441 | dev->xy_cur[i + 34] = dev->data[5 * i + 3]; | 498 | dev->xy_cur[ATP_XSENSORS + i + 8] = dev->data[5 * i + 3]; |
442 | } | 499 | } |
443 | } | 500 | } |
444 | 501 | ||
@@ -453,32 +510,8 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
453 | memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); | 510 | memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); |
454 | 511 | ||
455 | /* Perform size detection, if not done already */ | 512 | /* Perform size detection, if not done already */ |
456 | if (!dev->size_detect_done) { | 513 | if (unlikely(!dev->size_detect_done)) { |
457 | 514 | atp_detect_size(dev); | |
458 | /* 17" Powerbooks have extra X sensors */ | ||
459 | for (i = (dev->type == ATP_GEYSER2 ? 15 : 16); | ||
460 | i < ATP_XSENSORS; i++) { | ||
461 | if (!dev->xy_cur[i]) | ||
462 | continue; | ||
463 | |||
464 | printk(KERN_INFO | ||
465 | "appletouch: 17\" model detected.\n"); | ||
466 | |||
467 | if (dev->type == ATP_GEYSER2) | ||
468 | input_set_abs_params(dev->input, ABS_X, | ||
469 | 0, | ||
470 | (20 - 1) * | ||
471 | ATP_XFACT - 1, | ||
472 | ATP_FUZZ, 0); | ||
473 | else | ||
474 | input_set_abs_params(dev->input, ABS_X, | ||
475 | 0, | ||
476 | (26 - 1) * | ||
477 | ATP_XFACT - 1, | ||
478 | ATP_FUZZ, 0); | ||
479 | break; | ||
480 | } | ||
481 | |||
482 | dev->size_detect_done = 1; | 515 | dev->size_detect_done = 1; |
483 | goto exit; | 516 | goto exit; |
484 | } | 517 | } |
@@ -499,10 +532,10 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
499 | dbg_dump("accumulator", dev->xy_acc); | 532 | dbg_dump("accumulator", dev->xy_acc); |
500 | 533 | ||
501 | x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, | 534 | x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, |
502 | ATP_XFACT, &x_z, &x_f); | 535 | dev->info->xfact, &x_z, &x_f); |
503 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, | 536 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, |
504 | ATP_YFACT, &y_z, &y_f); | 537 | dev->info->yfact, &y_z, &y_f); |
505 | key = dev->data[dev->datalen - 1] & ATP_STATUS_BUTTON; | 538 | key = dev->data[dev->info->datalen - 1] & ATP_STATUS_BUTTON; |
506 | 539 | ||
507 | if (x && y) { | 540 | if (x && y) { |
508 | if (dev->x_old != -1) { | 541 | if (dev->x_old != -1) { |
@@ -583,7 +616,7 @@ static void atp_complete_geyser_3_4(struct urb *urb) | |||
583 | dbg_dump("sample", dev->xy_cur); | 616 | dbg_dump("sample", dev->xy_cur); |
584 | 617 | ||
585 | /* Just update the base values (i.e. touchpad in untouched state) */ | 618 | /* Just update the base values (i.e. touchpad in untouched state) */ |
586 | if (dev->data[dev->datalen - 1] & ATP_STATUS_BASE_UPDATE) { | 619 | if (dev->data[dev->info->datalen - 1] & ATP_STATUS_BASE_UPDATE) { |
587 | 620 | ||
588 | dprintk(KERN_DEBUG "appletouch: updated base values\n"); | 621 | dprintk(KERN_DEBUG "appletouch: updated base values\n"); |
589 | 622 | ||
@@ -610,10 +643,10 @@ static void atp_complete_geyser_3_4(struct urb *urb) | |||
610 | dbg_dump("accumulator", dev->xy_acc); | 643 | dbg_dump("accumulator", dev->xy_acc); |
611 | 644 | ||
612 | x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, | 645 | x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, |
613 | ATP_XFACT, &x_z, &x_f); | 646 | dev->info->xfact, &x_z, &x_f); |
614 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, | 647 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, |
615 | ATP_YFACT, &y_z, &y_f); | 648 | dev->info->yfact, &y_z, &y_f); |
616 | key = dev->data[dev->datalen - 1] & ATP_STATUS_BUTTON; | 649 | key = dev->data[dev->info->datalen - 1] & ATP_STATUS_BUTTON; |
617 | 650 | ||
618 | if (x && y) { | 651 | if (x && y) { |
619 | if (dev->x_old != -1) { | 652 | if (dev->x_old != -1) { |
@@ -705,7 +738,7 @@ static int atp_handle_geyser(struct atp *dev) | |||
705 | { | 738 | { |
706 | struct usb_device *udev = dev->udev; | 739 | struct usb_device *udev = dev->udev; |
707 | 740 | ||
708 | if (dev->type != ATP_FOUNTAIN) { | 741 | if (dev->info != &fountain_info) { |
709 | /* switch to raw sensor mode */ | 742 | /* switch to raw sensor mode */ |
710 | if (atp_geyser_init(udev)) | 743 | if (atp_geyser_init(udev)) |
711 | return -EIO; | 744 | return -EIO; |
@@ -726,6 +759,7 @@ static int atp_probe(struct usb_interface *iface, | |||
726 | struct usb_endpoint_descriptor *endpoint; | 759 | struct usb_endpoint_descriptor *endpoint; |
727 | int int_in_endpointAddr = 0; | 760 | int int_in_endpointAddr = 0; |
728 | int i, error = -ENOMEM; | 761 | int i, error = -ENOMEM; |
762 | const struct atp_info *info = (const struct atp_info *)id->driver_info; | ||
729 | 763 | ||
730 | /* set up the endpoint information */ | 764 | /* set up the endpoint information */ |
731 | /* use only the first interrupt-in endpoint */ | 765 | /* use only the first interrupt-in endpoint */ |
@@ -753,35 +787,22 @@ static int atp_probe(struct usb_interface *iface, | |||
753 | 787 | ||
754 | dev->udev = udev; | 788 | dev->udev = udev; |
755 | dev->input = input_dev; | 789 | dev->input = input_dev; |
756 | dev->type = id->driver_info; | 790 | dev->info = info; |
757 | dev->overflow_warned = false; | 791 | dev->overflow_warned = false; |
758 | if (dev->type == ATP_FOUNTAIN || dev->type == ATP_GEYSER1) | ||
759 | dev->datalen = 81; | ||
760 | else | ||
761 | dev->datalen = 64; | ||
762 | 792 | ||
763 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); | 793 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); |
764 | if (!dev->urb) | 794 | if (!dev->urb) |
765 | goto err_free_devs; | 795 | goto err_free_devs; |
766 | 796 | ||
767 | dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, | 797 | dev->data = usb_buffer_alloc(dev->udev, dev->info->datalen, GFP_KERNEL, |
768 | &dev->urb->transfer_dma); | 798 | &dev->urb->transfer_dma); |
769 | if (!dev->data) | 799 | if (!dev->data) |
770 | goto err_free_urb; | 800 | goto err_free_urb; |
771 | 801 | ||
772 | /* Select the USB complete (callback) function */ | 802 | usb_fill_int_urb(dev->urb, udev, |
773 | if (dev->type == ATP_FOUNTAIN || | 803 | usb_rcvintpipe(udev, int_in_endpointAddr), |
774 | dev->type == ATP_GEYSER1 || | 804 | dev->data, dev->info->datalen, |
775 | dev->type == ATP_GEYSER2) | 805 | dev->info->callback, dev, 1); |
776 | usb_fill_int_urb(dev->urb, udev, | ||
777 | usb_rcvintpipe(udev, int_in_endpointAddr), | ||
778 | dev->data, dev->datalen, | ||
779 | atp_complete_geyser_1_2, dev, 1); | ||
780 | else | ||
781 | usb_fill_int_urb(dev->urb, udev, | ||
782 | usb_rcvintpipe(udev, int_in_endpointAddr), | ||
783 | dev->data, dev->datalen, | ||
784 | atp_complete_geyser_3_4, dev, 1); | ||
785 | 806 | ||
786 | error = atp_handle_geyser(dev); | 807 | error = atp_handle_geyser(dev); |
787 | if (error) | 808 | if (error) |
@@ -802,35 +823,12 @@ static int atp_probe(struct usb_interface *iface, | |||
802 | 823 | ||
803 | set_bit(EV_ABS, input_dev->evbit); | 824 | set_bit(EV_ABS, input_dev->evbit); |
804 | 825 | ||
805 | if (dev->type == ATP_GEYSER3 || dev->type == ATP_GEYSER4) { | 826 | input_set_abs_params(input_dev, ABS_X, 0, |
806 | /* | 827 | (dev->info->xsensors - 1) * dev->info->xfact - 1, |
807 | * MacBook have 20 X sensors, 10 Y sensors | 828 | ATP_FUZZ, 0); |
808 | */ | 829 | input_set_abs_params(input_dev, ABS_Y, 0, |
809 | input_set_abs_params(input_dev, ABS_X, 0, | 830 | (dev->info->ysensors - 1) * dev->info->yfact - 1, |
810 | ((20 - 1) * ATP_XFACT) - 1, ATP_FUZZ, 0); | 831 | ATP_FUZZ, 0); |
811 | input_set_abs_params(input_dev, ABS_Y, 0, | ||
812 | ((10 - 1) * ATP_YFACT) - 1, ATP_FUZZ, 0); | ||
813 | } else if (dev->type == ATP_GEYSER2) { | ||
814 | /* | ||
815 | * Oct 2005 15" PowerBooks have 15 X sensors, 17" are detected | ||
816 | * later. | ||
817 | */ | ||
818 | input_set_abs_params(input_dev, ABS_X, 0, | ||
819 | ((15 - 1) * ATP_XFACT) - 1, ATP_FUZZ, 0); | ||
820 | input_set_abs_params(input_dev, ABS_Y, 0, | ||
821 | ((9 - 1) * ATP_YFACT) - 1, ATP_FUZZ, 0); | ||
822 | } else { | ||
823 | /* | ||
824 | * 12" and 15" Powerbooks only have 16 x sensors, | ||
825 | * 17" models are detected later. | ||
826 | */ | ||
827 | input_set_abs_params(input_dev, ABS_X, 0, | ||
828 | (16 - 1) * ATP_XFACT - 1, | ||
829 | ATP_FUZZ, 0); | ||
830 | input_set_abs_params(input_dev, ABS_Y, 0, | ||
831 | (ATP_YSENSORS - 1) * ATP_YFACT - 1, | ||
832 | ATP_FUZZ, 0); | ||
833 | } | ||
834 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0); | 832 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0); |
835 | 833 | ||
836 | set_bit(EV_KEY, input_dev->evbit); | 834 | set_bit(EV_KEY, input_dev->evbit); |
@@ -852,7 +850,7 @@ static int atp_probe(struct usb_interface *iface, | |||
852 | return 0; | 850 | return 0; |
853 | 851 | ||
854 | err_free_buffer: | 852 | err_free_buffer: |
855 | usb_buffer_free(dev->udev, dev->datalen, | 853 | usb_buffer_free(dev->udev, dev->info->datalen, |
856 | dev->data, dev->urb->transfer_dma); | 854 | dev->data, dev->urb->transfer_dma); |
857 | err_free_urb: | 855 | err_free_urb: |
858 | usb_free_urb(dev->urb); | 856 | usb_free_urb(dev->urb); |
@@ -871,7 +869,7 @@ static void atp_disconnect(struct usb_interface *iface) | |||
871 | if (dev) { | 869 | if (dev) { |
872 | usb_kill_urb(dev->urb); | 870 | usb_kill_urb(dev->urb); |
873 | input_unregister_device(dev->input); | 871 | input_unregister_device(dev->input); |
874 | usb_buffer_free(dev->udev, dev->datalen, | 872 | usb_buffer_free(dev->udev, dev->info->datalen, |
875 | dev->data, dev->urb->transfer_dma); | 873 | dev->data, dev->urb->transfer_dma); |
876 | usb_free_urb(dev->urb); | 874 | usb_free_urb(dev->urb); |
877 | kfree(dev); | 875 | kfree(dev); |
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 72cf5e33790e..0db8d16c5edd 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -173,7 +173,7 @@ static int __devexit gpio_mouse_remove(struct platform_device *pdev) | |||
173 | /* work with hotplug and coldplug */ | 173 | /* work with hotplug and coldplug */ |
174 | MODULE_ALIAS("platform:gpio_mouse"); | 174 | MODULE_ALIAS("platform:gpio_mouse"); |
175 | 175 | ||
176 | struct platform_driver gpio_mouse_device_driver = { | 176 | static struct platform_driver gpio_mouse_device_driver = { |
177 | .remove = __devexit_p(gpio_mouse_remove), | 177 | .remove = __devexit_p(gpio_mouse_remove), |
178 | .driver = { | 178 | .driver = { |
179 | .name = "gpio_mouse", | 179 | .name = "gpio_mouse", |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 88f04bf2ad6c..81e6ebf323e9 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -48,6 +48,30 @@ module_param(recalib_delta, int, 0644); | |||
48 | MODULE_PARM_DESC(recalib_delta, | 48 | MODULE_PARM_DESC(recalib_delta, |
49 | "packets containing a delta this large will cause a recalibration."); | 49 | "packets containing a delta this large will cause a recalibration."); |
50 | 50 | ||
51 | static int jumpy_delay = 1000; | ||
52 | module_param(jumpy_delay, int, 0644); | ||
53 | MODULE_PARM_DESC(jumpy_delay, | ||
54 | "delay (ms) before recal after jumpiness detected"); | ||
55 | |||
56 | static int spew_delay = 1000; | ||
57 | module_param(spew_delay, int, 0644); | ||
58 | MODULE_PARM_DESC(spew_delay, | ||
59 | "delay (ms) before recal after packet spew detected"); | ||
60 | |||
61 | static int recal_guard_time = 2000; | ||
62 | module_param(recal_guard_time, int, 0644); | ||
63 | MODULE_PARM_DESC(recal_guard_time, | ||
64 | "interval (ms) during which recal will be restarted if packet received"); | ||
65 | |||
66 | static int post_interrupt_delay = 1000; | ||
67 | module_param(post_interrupt_delay, int, 0644); | ||
68 | MODULE_PARM_DESC(post_interrupt_delay, | ||
69 | "delay (ms) before recal after recal interrupt detected"); | ||
70 | |||
71 | static int autorecal = 1; | ||
72 | module_param(autorecal, int, 0644); | ||
73 | MODULE_PARM_DESC(autorecal, "enable recalibration in the driver"); | ||
74 | |||
51 | /* | 75 | /* |
52 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" | 76 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" |
53 | * above the pad and still have it send packets. This causes a jump cursor | 77 | * above the pad and still have it send packets. This causes a jump cursor |
@@ -66,7 +90,7 @@ static void hgpk_jumpy_hack(struct psmouse *psmouse, int x, int y) | |||
66 | /* My car gets forty rods to the hogshead and that's the | 90 | /* My car gets forty rods to the hogshead and that's the |
67 | * way I likes it! */ | 91 | * way I likes it! */ |
68 | psmouse_queue_work(psmouse, &priv->recalib_wq, | 92 | psmouse_queue_work(psmouse, &priv->recalib_wq, |
69 | msecs_to_jiffies(1000)); | 93 | msecs_to_jiffies(jumpy_delay)); |
70 | } | 94 | } |
71 | } | 95 | } |
72 | 96 | ||
@@ -103,7 +127,7 @@ static void hgpk_spewing_hack(struct psmouse *psmouse, | |||
103 | hgpk_dbg(psmouse, "packet spew detected (%d,%d)\n", | 127 | hgpk_dbg(psmouse, "packet spew detected (%d,%d)\n", |
104 | priv->x_tally, priv->y_tally); | 128 | priv->x_tally, priv->y_tally); |
105 | psmouse_queue_work(psmouse, &priv->recalib_wq, | 129 | psmouse_queue_work(psmouse, &priv->recalib_wq, |
106 | msecs_to_jiffies(1000)); | 130 | msecs_to_jiffies(spew_delay)); |
107 | } | 131 | } |
108 | /* reset every 100 packets */ | 132 | /* reset every 100 packets */ |
109 | priv->count = 0; | 133 | priv->count = 0; |
@@ -181,7 +205,7 @@ static psmouse_ret_t hgpk_process_byte(struct psmouse *psmouse) | |||
181 | "packet inside calibration window, " | 205 | "packet inside calibration window, " |
182 | "queueing another recalibration\n"); | 206 | "queueing another recalibration\n"); |
183 | psmouse_queue_work(psmouse, &priv->recalib_wq, | 207 | psmouse_queue_work(psmouse, &priv->recalib_wq, |
184 | msecs_to_jiffies(1000)); | 208 | msecs_to_jiffies(post_interrupt_delay)); |
185 | } | 209 | } |
186 | priv->recalib_window = 0; | 210 | priv->recalib_window = 0; |
187 | } | 211 | } |
@@ -231,7 +255,7 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse) | |||
231 | * If someone's finger *was* on the touchpad, it's probably | 255 | * If someone's finger *was* on the touchpad, it's probably |
232 | * miscalibrated. So, we should schedule another recalibration | 256 | * miscalibrated. So, we should schedule another recalibration |
233 | */ | 257 | */ |
234 | priv->recalib_window = jiffies + msecs_to_jiffies(2000); | 258 | priv->recalib_window = jiffies + msecs_to_jiffies(recal_guard_time); |
235 | 259 | ||
236 | return 0; | 260 | return 0; |
237 | } | 261 | } |
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c index e532c48410ea..3263ce083bf0 100644 --- a/drivers/input/mouse/hil_ptr.c +++ b/drivers/input/mouse/hil_ptr.c | |||
@@ -46,7 +46,7 @@ | |||
46 | MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); | 46 | MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); |
47 | MODULE_DESCRIPTION(HIL_GENERIC_NAME " driver"); | 47 | MODULE_DESCRIPTION(HIL_GENERIC_NAME " driver"); |
48 | MODULE_LICENSE("Dual BSD/GPL"); | 48 | MODULE_LICENSE("Dual BSD/GPL"); |
49 | 49 | MODULE_ALIAS("serio:ty03pr25id0Fex*"); | |
50 | 50 | ||
51 | #define TABLET_SIMULATES_MOUSE /* allow tablet to be used as mouse */ | 51 | #define TABLET_SIMULATES_MOUSE /* allow tablet to be used as mouse */ |
52 | #undef TABLET_AUTOADJUST /* auto-adjust valid tablet ranges */ | 52 | #undef TABLET_AUTOADJUST /* auto-adjust valid tablet ranges */ |
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c new file mode 100644 index 000000000000..a0f45c4fc198 --- /dev/null +++ b/drivers/input/mouse/pxa930_trkball.c | |||
@@ -0,0 +1,269 @@ | |||
1 | /* | ||
2 | * PXA930 track ball mouse driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Marvell International Ltd. | ||
5 | * 2008-02-28: Yong Yao <yaoyong@marvell.com> | ||
6 | * initial version | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/input.h> | ||
15 | #include <linux/version.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/io.h> | ||
21 | |||
22 | #include <mach/hardware.h> | ||
23 | #include <mach/pxa930_trkball.h> | ||
24 | |||
25 | /* Trackball Controller Register Definitions */ | ||
26 | #define TBCR (0x000C) | ||
27 | #define TBCNTR (0x0010) | ||
28 | #define TBSBC (0x0014) | ||
29 | |||
30 | #define TBCR_TBRST (1 << 1) | ||
31 | #define TBCR_TBSB (1 << 10) | ||
32 | |||
33 | #define TBCR_Y_FLT(n) (((n) & 0xf) << 6) | ||
34 | #define TBCR_X_FLT(n) (((n) & 0xf) << 2) | ||
35 | |||
36 | #define TBCNTR_YM(n) (((n) >> 24) & 0xff) | ||
37 | #define TBCNTR_YP(n) (((n) >> 16) & 0xff) | ||
38 | #define TBCNTR_XM(n) (((n) >> 8) & 0xff) | ||
39 | #define TBCNTR_XP(n) ((n) & 0xff) | ||
40 | |||
41 | #define TBSBC_TBSBC (0x1) | ||
42 | |||
43 | struct pxa930_trkball { | ||
44 | struct pxa930_trkball_platform_data *pdata; | ||
45 | |||
46 | /* Memory Mapped Register */ | ||
47 | struct resource *mem; | ||
48 | void __iomem *mmio_base; | ||
49 | |||
50 | struct input_dev *input; | ||
51 | }; | ||
52 | |||
53 | static irqreturn_t pxa930_trkball_interrupt(int irq, void *dev_id) | ||
54 | { | ||
55 | struct pxa930_trkball *trkball = dev_id; | ||
56 | struct input_dev *input = trkball->input; | ||
57 | int tbcntr, x, y; | ||
58 | |||
59 | /* According to the spec software must read TBCNTR twice: | ||
60 | * if the read value is the same, the reading is valid | ||
61 | */ | ||
62 | tbcntr = __raw_readl(trkball->mmio_base + TBCNTR); | ||
63 | |||
64 | if (tbcntr == __raw_readl(trkball->mmio_base + TBCNTR)) { | ||
65 | x = (TBCNTR_XP(tbcntr) - TBCNTR_XM(tbcntr)) / 2; | ||
66 | y = (TBCNTR_YP(tbcntr) - TBCNTR_YM(tbcntr)) / 2; | ||
67 | |||
68 | input_report_rel(input, REL_X, x); | ||
69 | input_report_rel(input, REL_Y, y); | ||
70 | input_sync(input); | ||
71 | } | ||
72 | |||
73 | __raw_writel(TBSBC_TBSBC, trkball->mmio_base + TBSBC); | ||
74 | __raw_writel(0, trkball->mmio_base + TBSBC); | ||
75 | |||
76 | return IRQ_HANDLED; | ||
77 | } | ||
78 | |||
79 | /* For TBCR, we need to wait for a while to make sure it has been modified. */ | ||
80 | static int write_tbcr(struct pxa930_trkball *trkball, int v) | ||
81 | { | ||
82 | int i = 100; | ||
83 | |||
84 | __raw_writel(v, trkball->mmio_base + TBCR); | ||
85 | |||
86 | while (i--) { | ||
87 | if (__raw_readl(trkball->mmio_base + TBCR) == v) | ||
88 | break; | ||
89 | msleep(1); | ||
90 | } | ||
91 | |||
92 | if (i == 0) { | ||
93 | pr_err("%s: timed out writing TBCR(%x)!\n", __func__, v); | ||
94 | return -ETIMEDOUT; | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static void pxa930_trkball_config(struct pxa930_trkball *trkball) | ||
101 | { | ||
102 | uint32_t tbcr; | ||
103 | |||
104 | /* According to spec, need to write the filters of x,y to 0xf first! */ | ||
105 | tbcr = __raw_readl(trkball->mmio_base + TBCR); | ||
106 | write_tbcr(trkball, tbcr | TBCR_X_FLT(0xf) | TBCR_Y_FLT(0xf)); | ||
107 | write_tbcr(trkball, TBCR_X_FLT(trkball->pdata->x_filter) | | ||
108 | TBCR_Y_FLT(trkball->pdata->y_filter)); | ||
109 | |||
110 | /* According to spec, set TBCR_TBRST first, before clearing it! */ | ||
111 | tbcr = __raw_readl(trkball->mmio_base + TBCR); | ||
112 | write_tbcr(trkball, tbcr | TBCR_TBRST); | ||
113 | write_tbcr(trkball, tbcr & ~TBCR_TBRST); | ||
114 | |||
115 | __raw_writel(TBSBC_TBSBC, trkball->mmio_base + TBSBC); | ||
116 | __raw_writel(0, trkball->mmio_base + TBSBC); | ||
117 | |||
118 | pr_debug("%s: final TBCR=%x!\n", __func__, | ||
119 | __raw_readl(trkball->mmio_base + TBCR)); | ||
120 | } | ||
121 | |||
122 | static int pxa930_trkball_open(struct input_dev *dev) | ||
123 | { | ||
124 | struct pxa930_trkball *trkball = input_get_drvdata(dev); | ||
125 | |||
126 | pxa930_trkball_config(trkball); | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static void pxa930_trkball_disable(struct pxa930_trkball *trkball) | ||
132 | { | ||
133 | uint32_t tbcr = __raw_readl(trkball->mmio_base + TBCR); | ||
134 | |||
135 | /* Held in reset, gate the 32-KHz input clock off */ | ||
136 | write_tbcr(trkball, tbcr | TBCR_TBRST); | ||
137 | } | ||
138 | |||
139 | static void pxa930_trkball_close(struct input_dev *dev) | ||
140 | { | ||
141 | struct pxa930_trkball *trkball = input_get_drvdata(dev); | ||
142 | |||
143 | pxa930_trkball_disable(trkball); | ||
144 | } | ||
145 | |||
146 | static int __devinit pxa930_trkball_probe(struct platform_device *pdev) | ||
147 | { | ||
148 | struct pxa930_trkball *trkball; | ||
149 | struct input_dev *input; | ||
150 | struct resource *res; | ||
151 | int irq, error; | ||
152 | |||
153 | irq = platform_get_irq(pdev, 0); | ||
154 | if (irq < 0) { | ||
155 | dev_err(&pdev->dev, "failed to get trkball irq\n"); | ||
156 | return -ENXIO; | ||
157 | } | ||
158 | |||
159 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
160 | if (!res) { | ||
161 | dev_err(&pdev->dev, "failed to get register memory\n"); | ||
162 | return -ENXIO; | ||
163 | } | ||
164 | |||
165 | trkball = kzalloc(sizeof(struct pxa930_trkball), GFP_KERNEL); | ||
166 | if (!trkball) | ||
167 | return -ENOMEM; | ||
168 | |||
169 | trkball->pdata = pdev->dev.platform_data; | ||
170 | if (!trkball->pdata) { | ||
171 | dev_err(&pdev->dev, "no platform data defined\n"); | ||
172 | error = -EINVAL; | ||
173 | goto failed; | ||
174 | } | ||
175 | |||
176 | trkball->mmio_base = ioremap_nocache(res->start, resource_size(res)); | ||
177 | if (!trkball->mmio_base) { | ||
178 | dev_err(&pdev->dev, "failed to ioremap registers\n"); | ||
179 | error = -ENXIO; | ||
180 | goto failed; | ||
181 | } | ||
182 | |||
183 | /* held the module in reset, will be enabled in open() */ | ||
184 | pxa930_trkball_disable(trkball); | ||
185 | |||
186 | error = request_irq(irq, pxa930_trkball_interrupt, IRQF_DISABLED, | ||
187 | pdev->name, trkball); | ||
188 | if (error) { | ||
189 | dev_err(&pdev->dev, "failed to request irq: %d\n", ret); | ||
190 | goto failed_free_io; | ||
191 | } | ||
192 | |||
193 | platform_set_drvdata(pdev, trkball); | ||
194 | |||
195 | input = input_allocate_device(); | ||
196 | if (!input) { | ||
197 | dev_err(&pdev->dev, "failed to allocate input device\n"); | ||
198 | error = -ENOMEM; | ||
199 | goto failed_free_irq; | ||
200 | } | ||
201 | |||
202 | input->name = pdev->name; | ||
203 | input->id.bustype = BUS_HOST; | ||
204 | input->open = pxa930_trkball_open; | ||
205 | input->close = pxa930_trkball_close; | ||
206 | input->dev.parent = &pdev->dev; | ||
207 | input_set_drvdata(input, trkball); | ||
208 | |||
209 | trkball->input = input; | ||
210 | |||
211 | input_set_capability(input, EV_REL, REL_X); | ||
212 | input_set_capability(input, EV_REL, REL_Y); | ||
213 | |||
214 | error = input_register_device(input); | ||
215 | if (error) { | ||
216 | dev_err(&pdev->dev, "unable to register input device\n"); | ||
217 | goto failed_free_input; | ||
218 | } | ||
219 | |||
220 | return 0; | ||
221 | |||
222 | failed_free_input: | ||
223 | input_free_device(input); | ||
224 | failed_free_irq: | ||
225 | free_irq(irq, trkball); | ||
226 | failed_free_io: | ||
227 | iounmap(trkball->mmio_base); | ||
228 | failed: | ||
229 | kfree(trkball); | ||
230 | return ret; | ||
231 | } | ||
232 | |||
233 | static int __devexit pxa930_trkball_remove(struct platform_device *pdev) | ||
234 | { | ||
235 | struct pxa930_trkball *trkball = platform_get_drvdata(pdev); | ||
236 | int irq = platform_get_irq(pdev, 0); | ||
237 | |||
238 | input_unregister_device(trkball->input); | ||
239 | free_irq(irq, trkball); | ||
240 | iounmap(trkball->mmio_base); | ||
241 | kfree(trkball); | ||
242 | |||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | static struct platform_driver pxa930_trkball_driver = { | ||
247 | .driver = { | ||
248 | .name = "pxa930-trkball", | ||
249 | }, | ||
250 | .probe = pxa930_trkball_probe, | ||
251 | .remove = __devexit_p(pxa930_trkball_remove), | ||
252 | }; | ||
253 | |||
254 | static int __init pxa930_trkball_init(void) | ||
255 | { | ||
256 | return platform_driver_register(&pxa930_trkball_driver); | ||
257 | } | ||
258 | |||
259 | static void __exit pxa930_trkball_exit(void) | ||
260 | { | ||
261 | platform_driver_unregister(&pxa930_trkball_driver); | ||
262 | } | ||
263 | |||
264 | module_init(pxa930_trkball_init); | ||
265 | module_exit(pxa930_trkball_exit); | ||
266 | |||
267 | MODULE_AUTHOR("Yong Yao <yaoyong@marvell.com>"); | ||
268 | MODULE_DESCRIPTION("PXA930 Trackball Mouse Driver"); | ||
269 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index d349c4a5e3e8..865fc69e9bc3 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -445,12 +445,14 @@ static void synaptics_process_packet(struct psmouse *psmouse) | |||
445 | 445 | ||
446 | input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); | 446 | input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); |
447 | input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); | 447 | input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); |
448 | input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); | ||
449 | input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); | ||
450 | |||
451 | input_report_key(dev, BTN_LEFT, hw.left); | 448 | input_report_key(dev, BTN_LEFT, hw.left); |
452 | input_report_key(dev, BTN_RIGHT, hw.right); | 449 | input_report_key(dev, BTN_RIGHT, hw.right); |
453 | 450 | ||
451 | if (SYN_CAP_MULTIFINGER(priv->capabilities)) { | ||
452 | input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); | ||
453 | input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); | ||
454 | } | ||
455 | |||
454 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) | 456 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) |
455 | input_report_key(dev, BTN_MIDDLE, hw.middle); | 457 | input_report_key(dev, BTN_MIDDLE, hw.middle); |
456 | 458 | ||
@@ -543,12 +545,14 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
543 | set_bit(EV_KEY, dev->evbit); | 545 | set_bit(EV_KEY, dev->evbit); |
544 | set_bit(BTN_TOUCH, dev->keybit); | 546 | set_bit(BTN_TOUCH, dev->keybit); |
545 | set_bit(BTN_TOOL_FINGER, dev->keybit); | 547 | set_bit(BTN_TOOL_FINGER, dev->keybit); |
546 | set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); | ||
547 | set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); | ||
548 | |||
549 | set_bit(BTN_LEFT, dev->keybit); | 548 | set_bit(BTN_LEFT, dev->keybit); |
550 | set_bit(BTN_RIGHT, dev->keybit); | 549 | set_bit(BTN_RIGHT, dev->keybit); |
551 | 550 | ||
551 | if (SYN_CAP_MULTIFINGER(priv->capabilities)) { | ||
552 | set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); | ||
553 | set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); | ||
554 | } | ||
555 | |||
552 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) | 556 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) |
553 | set_bit(BTN_MIDDLE, dev->keybit); | 557 | set_bit(BTN_MIDDLE, dev->keybit); |
554 | 558 | ||