diff options
27 files changed, 670 insertions, 530 deletions
diff --git a/Documentation/input/sentelic.txt b/Documentation/input/sentelic.txt index f7160a2fb6a2..b35affd5c649 100644 --- a/Documentation/input/sentelic.txt +++ b/Documentation/input/sentelic.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Copyright (C) 2002-2008 Sentelic Corporation. | 1 | Copyright (C) 2002-2010 Sentelic Corporation. |
2 | Last update: Oct-31-2008 | 2 | Last update: Jan-13-2010 |
3 | 3 | ||
4 | ============================================================================== | 4 | ============================================================================== |
5 | * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons) | 5 | * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons) |
@@ -44,7 +44,7 @@ B) MSID 6: Horizontal and Vertical scrolling. | |||
44 | Packet 1 | 44 | Packet 1 |
45 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | 45 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 |
46 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | 46 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| |
47 | 1 |Y|X|y|x|1|M|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 | | |B|F|l|r|u|d| | 47 | 1 |Y|X|y|x|1|M|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 | | |B|F|r|l|u|d| |
48 | |---------------| |---------------| |---------------| |---------------| | 48 | |---------------| |---------------| |---------------| |---------------| |
49 | 49 | ||
50 | Byte 1: Bit7 => Y overflow | 50 | Byte 1: Bit7 => Y overflow |
@@ -59,15 +59,15 @@ Byte 2: X Movement(9-bit 2's complement integers) | |||
59 | Byte 3: Y Movement(9-bit 2's complement integers) | 59 | Byte 3: Y Movement(9-bit 2's complement integers) |
60 | Byte 4: Bit0 => the Vertical scrolling movement downward. | 60 | Byte 4: Bit0 => the Vertical scrolling movement downward. |
61 | Bit1 => the Vertical scrolling movement upward. | 61 | Bit1 => the Vertical scrolling movement upward. |
62 | Bit2 => the Vertical scrolling movement rightward. | 62 | Bit2 => the Horizontal scrolling movement leftward. |
63 | Bit3 => the Vertical scrolling movement leftward. | 63 | Bit3 => the Horizontal scrolling movement rightward. |
64 | Bit4 => 1 = 4th mouse button is pressed, Forward one page. | 64 | Bit4 => 1 = 4th mouse button is pressed, Forward one page. |
65 | 0 = 4th mouse button is not pressed. | 65 | 0 = 4th mouse button is not pressed. |
66 | Bit5 => 1 = 5th mouse button is pressed, Backward one page. | 66 | Bit5 => 1 = 5th mouse button is pressed, Backward one page. |
67 | 0 = 5th mouse button is not pressed. | 67 | 0 = 5th mouse button is not pressed. |
68 | 68 | ||
69 | C) MSID 7: | 69 | C) MSID 7: |
70 | # FSP uses 2 packets(8 Bytes) data to represent Absolute Position | 70 | # FSP uses 2 packets (8 Bytes) to represent Absolute Position. |
71 | so we have PACKET NUMBER to identify packets. | 71 | so we have PACKET NUMBER to identify packets. |
72 | If PACKET NUMBER is 0, the packet is Packet 1. | 72 | If PACKET NUMBER is 0, the packet is Packet 1. |
73 | If PACKET NUMBER is 1, the packet is Packet 2. | 73 | If PACKET NUMBER is 1, the packet is Packet 2. |
@@ -129,7 +129,7 @@ Byte 3: Message Type => 0x00 (Disabled) | |||
129 | Byte 4: Bit7~Bit0 => Don't Care | 129 | Byte 4: Bit7~Bit0 => Don't Care |
130 | 130 | ||
131 | ============================================================================== | 131 | ============================================================================== |
132 | * Absolute position for STL3888-A0. | 132 | * Absolute position for STL3888-Ax. |
133 | ============================================================================== | 133 | ============================================================================== |
134 | Packet 1 (ABSOLUTE POSITION) | 134 | Packet 1 (ABSOLUTE POSITION) |
135 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | 135 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 |
@@ -179,14 +179,14 @@ Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0]) | |||
179 | Bit5~Bit4 => y2_g | 179 | Bit5~Bit4 => y2_g |
180 | Bit7~Bit6 => x2_g | 180 | Bit7~Bit6 => x2_g |
181 | 181 | ||
182 | Notify Packet for STL3888-A0 | 182 | Notify Packet for STL3888-Ax |
183 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | 183 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 |
184 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | 184 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| |
185 | 1 |1|0|1|P|1|M|R|L| 2 |C|C|C|C|C|C|C|C| 3 |0|0|F|F|0|0|0|i| 4 |r|l|d|u|0|0|0|0| | 185 | 1 |1|0|1|P|1|M|R|L| 2 |C|C|C|C|C|C|C|C| 3 |0|0|F|F|0|0|0|i| 4 |r|l|d|u|0|0|0|0| |
186 | |---------------| |---------------| |---------------| |---------------| | 186 | |---------------| |---------------| |---------------| |---------------| |
187 | 187 | ||
188 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 188 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
189 | => 01, Absolute coordination packet | 189 | => 01, Absolute coordinates packet |
190 | => 10, Notify packet | 190 | => 10, Notify packet |
191 | Bit5 => 1 | 191 | Bit5 => 1 |
192 | Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1): | 192 | Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1): |
@@ -205,15 +205,106 @@ Byte 4: Bit7 => scroll right button | |||
205 | Bit6 => scroll left button | 205 | Bit6 => scroll left button |
206 | Bit5 => scroll down button | 206 | Bit5 => scroll down button |
207 | Bit4 => scroll up button | 207 | Bit4 => scroll up button |
208 | * Note that if gesture and additional button (Bit4~Bit7) | 208 | * Note that if gesture and additional buttoni (Bit4~Bit7) |
209 | happen at the same time, the button information will not | 209 | happen at the same time, the button information will not |
210 | be sent. | 210 | be sent. |
211 | Bit3~Bit0 => Reserved | ||
212 | |||
213 | Sample sequence of Multi-finger, Multi-coordinate mode: | ||
214 | |||
215 | notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1, | ||
216 | abs pkt 2, ..., notify packet (valid bit == 0) | ||
217 | |||
218 | ============================================================================== | ||
219 | * Absolute position for STL3888-B0. | ||
220 | ============================================================================== | ||
221 | Packet 1(ABSOLUTE POSITION) | ||
222 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
223 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
224 | 1 |0|1|V|F|1|0|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 |r|l|u|d|X|X|Y|Y| | ||
225 | |---------------| |---------------| |---------------| |---------------| | ||
226 | |||
227 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
228 | => 01, Absolute coordinates packet | ||
229 | => 10, Notify packet | ||
230 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | ||
231 | When both fingers are up, the last two reports have zero valid | ||
232 | bit. | ||
233 | Bit4 => finger up/down information. 1: finger down, 0: finger up. | ||
234 | Bit3 => 1 | ||
235 | Bit2 => finger index, 0 is the first finger, 1 is the second finger. | ||
236 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
237 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
238 | Byte 2: X coordinate (xpos[9:2]) | ||
239 | Byte 3: Y coordinate (ypos[9:2]) | ||
240 | Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0]) | ||
241 | Bit3~Bit2 => X coordinate (ypos[1:0]) | ||
242 | Bit4 => scroll down button | ||
243 | Bit5 => scroll up button | ||
244 | Bit6 => scroll left button | ||
245 | Bit7 => scroll right button | ||
246 | |||
247 | Packet 2 (ABSOLUTE POSITION) | ||
248 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
249 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
250 | 1 |0|1|V|F|1|1|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 |r|l|u|d|X|X|Y|Y| | ||
251 | |---------------| |---------------| |---------------| |---------------| | ||
252 | |||
253 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
254 | => 01, Absolute coordination packet | ||
255 | => 10, Notify packet | ||
256 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | ||
257 | When both fingers are up, the last two reports have zero valid | ||
258 | bit. | ||
259 | Bit4 => finger up/down information. 1: finger down, 0: finger up. | ||
260 | Bit3 => 1 | ||
261 | Bit2 => finger index, 0 is the first finger, 1 is the second finger. | ||
262 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
263 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
264 | Byte 2: X coordinate (xpos[9:2]) | ||
265 | Byte 3: Y coordinate (ypos[9:2]) | ||
266 | Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0]) | ||
267 | Bit3~Bit2 => X coordinate (ypos[1:0]) | ||
268 | Bit4 => scroll down button | ||
269 | Bit5 => scroll up button | ||
270 | Bit6 => scroll left button | ||
271 | Bit7 => scroll right button | ||
272 | |||
273 | Notify Packet for STL3888-B0 | ||
274 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
275 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
276 | 1 |1|0|1|P|1|M|R|L| 2 |C|C|C|C|C|C|C|C| 3 |0|0|F|F|0|0|0|i| 4 |r|l|u|d|0|0|0|0| | ||
277 | |---------------| |---------------| |---------------| |---------------| | ||
278 | |||
279 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
280 | => 01, Absolute coordination packet | ||
281 | => 10, Notify packet | ||
282 | Bit5 => 1 | ||
283 | Bit4 => when in absolute coordinate mode (valid when EN_PKT_GO is 1): | ||
284 | 0: left button is generated by the on-pad command | ||
285 | 1: left button is generated by the external button | ||
286 | Bit3 => 1 | ||
287 | Bit2 => Middle Button, 1 is pressed, 0 is not pressed. | ||
288 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
289 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
290 | Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode) | ||
291 | Byte 3: Bit7~Bit6 => Don't care | ||
292 | Bit5~Bit4 => Number of fingers | ||
293 | Bit3~Bit1 => Reserved | ||
294 | Bit0 => 1: enter gesture mode; 0: leaving gesture mode | ||
295 | Byte 4: Bit7 => scroll right button | ||
296 | Bit6 => scroll left button | ||
297 | Bit5 => scroll up button | ||
298 | Bit4 => scroll down button | ||
299 | * Note that if gesture and additional button(Bit4~Bit7) | ||
300 | happen at the same time, the button information will not | ||
301 | be sent. | ||
211 | Bit3~Bit0 => Reserved | 302 | Bit3~Bit0 => Reserved |
212 | 303 | ||
213 | Sample sequence of Multi-finger, Multi-coordinate mode: | 304 | Sample sequence of Multi-finger, Multi-coordinate mode: |
214 | 305 | ||
215 | notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1, | 306 | notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1, |
216 | abs pkt 2, ..., notify packet(valid bit == 0) | 307 | abs pkt 2, ..., notify packet (valid bit == 0) |
217 | 308 | ||
218 | ============================================================================== | 309 | ============================================================================== |
219 | * FSP Enable/Disable packet | 310 | * FSP Enable/Disable packet |
@@ -409,7 +500,8 @@ offset width default r/w name | |||
409 | 0: read only, 1: read/write enable | 500 | 0: read only, 1: read/write enable |
410 | (Note that following registers does not require clock gating being | 501 | (Note that following registers does not require clock gating being |
411 | enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e | 502 | enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e |
412 | 40 41 42 43.) | 503 | 40 41 42 43. In addition to that, this bit must be 1 when gesture |
504 | mode is enabled) | ||
413 | 505 | ||
414 | 0x31 RW on-pad command detection | 506 | 0x31 RW on-pad command detection |
415 | bit7 0 RW on-pad command left button down tag | 507 | bit7 0 RW on-pad command left button down tag |
@@ -463,6 +555,10 @@ offset width default r/w name | |||
463 | absolute coordinates; otherwise, host only receives packets with | 555 | absolute coordinates; otherwise, host only receives packets with |
464 | relative coordinate.) | 556 | relative coordinate.) |
465 | 557 | ||
558 | bit7 0 RW EN_PS2_F2: PS/2 gesture mode 2nd | ||
559 | finger packet enable | ||
560 | 0: disable, 1: enable | ||
561 | |||
466 | 0x43 RW on-pad control | 562 | 0x43 RW on-pad control |
467 | bit0 0 RW on-pad control enable | 563 | bit0 0 RW on-pad control enable |
468 | 0: disable, 1: enable | 564 | 0: disable, 1: enable |
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h b/arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h index 62d17421e48c..1e2f4e97f428 100644 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #ifndef __ASM_ARCH_EP93XX_KEYPAD_H | 5 | #ifndef __ASM_ARCH_EP93XX_KEYPAD_H |
6 | #define __ASM_ARCH_EP93XX_KEYPAD_H | 6 | #define __ASM_ARCH_EP93XX_KEYPAD_H |
7 | 7 | ||
8 | struct matrix_keymap_data; | ||
9 | |||
8 | /* flags for the ep93xx_keypad driver */ | 10 | /* flags for the ep93xx_keypad driver */ |
9 | #define EP93XX_KEYPAD_DISABLE_3_KEY (1<<0) /* disable 3-key reset */ | 11 | #define EP93XX_KEYPAD_DISABLE_3_KEY (1<<0) /* disable 3-key reset */ |
10 | #define EP93XX_KEYPAD_DIAG_MODE (1<<1) /* diagnostic mode */ | 12 | #define EP93XX_KEYPAD_DIAG_MODE (1<<1) /* diagnostic mode */ |
@@ -15,15 +17,13 @@ | |||
15 | 17 | ||
16 | /** | 18 | /** |
17 | * struct ep93xx_keypad_platform_data - platform specific device structure | 19 | * struct ep93xx_keypad_platform_data - platform specific device structure |
18 | * @matrix_key_map: array of keycodes defining the keypad matrix | 20 | * @keymap_data: pointer to &matrix_keymap_data |
19 | * @matrix_key_map_size: ARRAY_SIZE(matrix_key_map) | 21 | * @debounce: debounce start count; terminal count is 0xff |
20 | * @debounce: debounce start count; terminal count is 0xff | 22 | * @prescale: row/column counter pre-scaler load value |
21 | * @prescale: row/column counter pre-scaler load value | 23 | * @flags: see above |
22 | * @flags: see above | ||
23 | */ | 24 | */ |
24 | struct ep93xx_keypad_platform_data { | 25 | struct ep93xx_keypad_platform_data { |
25 | unsigned int *matrix_key_map; | 26 | struct matrix_keymap_data *keymap_data; |
26 | int matrix_key_map_size; | ||
27 | unsigned int debounce; | 27 | unsigned int debounce; |
28 | unsigned int prescale; | 28 | unsigned int prescale; |
29 | unsigned int flags; | 29 | unsigned int flags; |
diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index b04930f7ea7d..7392992da424 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c | |||
@@ -46,7 +46,7 @@ struct emu { | |||
46 | int size; | 46 | int size; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static struct pci_device_id emu_tbl[] = { | 49 | static const struct pci_device_id emu_tbl[] = { |
50 | 50 | ||
51 | { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ | 51 | { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ |
52 | { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ | 52 | { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ |
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 8a1810f88b9e..14d3f3e208a2 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c | |||
@@ -140,7 +140,7 @@ static void __devexit fm801_gp_remove(struct pci_dev *pci) | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | static struct pci_device_id fm801_gp_id_table[] = { | 143 | static const struct pci_device_id fm801_gp_id_table[] = { |
144 | { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 144 | { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
145 | { 0 } | 145 | { 0 } |
146 | }; | 146 | }; |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index ac11be08585e..7e18bcf05a66 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * the Free Software Foundation. | 11 | * the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/stddef.h> | 16 | #include <linux/stddef.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive | |||
190 | 192 | ||
191 | error = device_bind_driver(&gameport->dev); | 193 | error = device_bind_driver(&gameport->dev); |
192 | if (error) { | 194 | if (error) { |
193 | printk(KERN_WARNING | 195 | dev_warn(&gameport->dev, |
194 | "gameport: device_bind_driver() failed " | 196 | "device_bind_driver() failed for %s (%s) and %s, error: %d\n", |
195 | "for %s (%s) and %s, error: %d\n", | ||
196 | gameport->phys, gameport->name, | 197 | gameport->phys, gameport->name, |
197 | drv->description, error); | 198 | drv->description, error); |
198 | drv->disconnect(gameport); | 199 | drv->disconnect(gameport); |
@@ -209,9 +210,9 @@ static void gameport_find_driver(struct gameport *gameport) | |||
209 | 210 | ||
210 | error = device_attach(&gameport->dev); | 211 | error = device_attach(&gameport->dev); |
211 | if (error < 0) | 212 | if (error < 0) |
212 | printk(KERN_WARNING | 213 | dev_warn(&gameport->dev, |
213 | "gameport: device_attach() failed for %s (%s), error: %d\n", | 214 | "device_attach() failed for %s (%s), error: %d\n", |
214 | gameport->phys, gameport->name, error); | 215 | gameport->phys, gameport->name, error); |
215 | } | 216 | } |
216 | 217 | ||
217 | 218 | ||
@@ -262,17 +263,14 @@ static int gameport_queue_event(void *object, struct module *owner, | |||
262 | 263 | ||
263 | event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); | 264 | event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); |
264 | if (!event) { | 265 | if (!event) { |
265 | printk(KERN_ERR | 266 | pr_err("Not enough memory to queue event %d\n", event_type); |
266 | "gameport: Not enough memory to queue event %d\n", | ||
267 | event_type); | ||
268 | retval = -ENOMEM; | 267 | retval = -ENOMEM; |
269 | goto out; | 268 | goto out; |
270 | } | 269 | } |
271 | 270 | ||
272 | if (!try_module_get(owner)) { | 271 | if (!try_module_get(owner)) { |
273 | printk(KERN_WARNING | 272 | pr_warning("Can't get module reference, dropping event %d\n", |
274 | "gameport: Can't get module reference, dropping event %d\n", | 273 | event_type); |
275 | event_type); | ||
276 | kfree(event); | 274 | kfree(event); |
277 | retval = -EINVAL; | 275 | retval = -EINVAL; |
278 | goto out; | 276 | goto out; |
@@ -298,14 +296,12 @@ static void gameport_free_event(struct gameport_event *event) | |||
298 | 296 | ||
299 | static void gameport_remove_duplicate_events(struct gameport_event *event) | 297 | static void gameport_remove_duplicate_events(struct gameport_event *event) |
300 | { | 298 | { |
301 | struct list_head *node, *next; | 299 | struct gameport_event *e, *next; |
302 | struct gameport_event *e; | ||
303 | unsigned long flags; | 300 | unsigned long flags; |
304 | 301 | ||
305 | spin_lock_irqsave(&gameport_event_lock, flags); | 302 | spin_lock_irqsave(&gameport_event_lock, flags); |
306 | 303 | ||
307 | list_for_each_safe(node, next, &gameport_event_list) { | 304 | list_for_each_entry_safe(e, next, &gameport_event_list, node) { |
308 | e = list_entry(node, struct gameport_event, node); | ||
309 | if (event->object == e->object) { | 305 | if (event->object == e->object) { |
310 | /* | 306 | /* |
311 | * If this event is of different type we should not | 307 | * If this event is of different type we should not |
@@ -315,7 +311,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
315 | if (event->type != e->type) | 311 | if (event->type != e->type) |
316 | break; | 312 | break; |
317 | 313 | ||
318 | list_del_init(node); | 314 | list_del_init(&e->node); |
319 | gameport_free_event(e); | 315 | gameport_free_event(e); |
320 | } | 316 | } |
321 | } | 317 | } |
@@ -325,23 +321,18 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
325 | 321 | ||
326 | static struct gameport_event *gameport_get_event(void) | 322 | static struct gameport_event *gameport_get_event(void) |
327 | { | 323 | { |
328 | struct gameport_event *event; | 324 | struct gameport_event *event = NULL; |
329 | struct list_head *node; | ||
330 | unsigned long flags; | 325 | unsigned long flags; |
331 | 326 | ||
332 | spin_lock_irqsave(&gameport_event_lock, flags); | 327 | spin_lock_irqsave(&gameport_event_lock, flags); |
333 | 328 | ||
334 | if (list_empty(&gameport_event_list)) { | 329 | if (!list_empty(&gameport_event_list)) { |
335 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 330 | event = list_first_entry(&gameport_event_list, |
336 | return NULL; | 331 | struct gameport_event, node); |
332 | list_del_init(&event->node); | ||
337 | } | 333 | } |
338 | 334 | ||
339 | node = gameport_event_list.next; | ||
340 | event = list_entry(node, struct gameport_event, node); | ||
341 | list_del_init(node); | ||
342 | |||
343 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 335 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
344 | |||
345 | return event; | 336 | return event; |
346 | } | 337 | } |
347 | 338 | ||
@@ -360,16 +351,14 @@ static void gameport_handle_event(void) | |||
360 | if ((event = gameport_get_event())) { | 351 | if ((event = gameport_get_event())) { |
361 | 352 | ||
362 | switch (event->type) { | 353 | switch (event->type) { |
363 | case GAMEPORT_REGISTER_PORT: | ||
364 | gameport_add_port(event->object); | ||
365 | break; | ||
366 | 354 | ||
367 | case GAMEPORT_ATTACH_DRIVER: | 355 | case GAMEPORT_REGISTER_PORT: |
368 | gameport_attach_driver(event->object); | 356 | gameport_add_port(event->object); |
369 | break; | 357 | break; |
370 | 358 | ||
371 | default: | 359 | case GAMEPORT_ATTACH_DRIVER: |
372 | break; | 360 | gameport_attach_driver(event->object); |
361 | break; | ||
373 | } | 362 | } |
374 | 363 | ||
375 | gameport_remove_duplicate_events(event); | 364 | gameport_remove_duplicate_events(event); |
@@ -385,16 +374,14 @@ static void gameport_handle_event(void) | |||
385 | */ | 374 | */ |
386 | static void gameport_remove_pending_events(void *object) | 375 | static void gameport_remove_pending_events(void *object) |
387 | { | 376 | { |
388 | struct list_head *node, *next; | 377 | struct gameport_event *event, *next; |
389 | struct gameport_event *event; | ||
390 | unsigned long flags; | 378 | unsigned long flags; |
391 | 379 | ||
392 | spin_lock_irqsave(&gameport_event_lock, flags); | 380 | spin_lock_irqsave(&gameport_event_lock, flags); |
393 | 381 | ||
394 | list_for_each_safe(node, next, &gameport_event_list) { | 382 | list_for_each_entry_safe(event, next, &gameport_event_list, node) { |
395 | event = list_entry(node, struct gameport_event, node); | ||
396 | if (event->object == object) { | 383 | if (event->object == object) { |
397 | list_del_init(node); | 384 | list_del_init(&event->node); |
398 | gameport_free_event(event); | 385 | gameport_free_event(event); |
399 | } | 386 | } |
400 | } | 387 | } |
@@ -441,7 +428,6 @@ static int gameport_thread(void *nothing) | |||
441 | kthread_should_stop() || !list_empty(&gameport_event_list)); | 428 | kthread_should_stop() || !list_empty(&gameport_event_list)); |
442 | } while (!kthread_should_stop()); | 429 | } while (!kthread_should_stop()); |
443 | 430 | ||
444 | printk(KERN_DEBUG "gameport: kgameportd exiting\n"); | ||
445 | return 0; | 431 | return 0; |
446 | } | 432 | } |
447 | 433 | ||
@@ -453,6 +439,7 @@ static int gameport_thread(void *nothing) | |||
453 | static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) | 439 | static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) |
454 | { | 440 | { |
455 | struct gameport *gameport = to_gameport_port(dev); | 441 | struct gameport *gameport = to_gameport_port(dev); |
442 | |||
456 | return sprintf(buf, "%s\n", gameport->name); | 443 | return sprintf(buf, "%s\n", gameport->name); |
457 | } | 444 | } |
458 | 445 | ||
@@ -521,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport) | |||
521 | 508 | ||
522 | mutex_init(&gameport->drv_mutex); | 509 | mutex_init(&gameport->drv_mutex); |
523 | device_initialize(&gameport->dev); | 510 | device_initialize(&gameport->dev); |
524 | dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); | 511 | dev_set_name(&gameport->dev, "gameport%lu", |
512 | (unsigned long)atomic_inc_return(&gameport_no) - 1); | ||
525 | gameport->dev.bus = &gameport_bus; | 513 | gameport->dev.bus = &gameport_bus; |
526 | gameport->dev.release = gameport_release_port; | 514 | gameport->dev.release = gameport_release_port; |
527 | if (gameport->parent) | 515 | if (gameport->parent) |
@@ -550,19 +538,17 @@ static void gameport_add_port(struct gameport *gameport) | |||
550 | list_add_tail(&gameport->node, &gameport_list); | 538 | list_add_tail(&gameport->node, &gameport_list); |
551 | 539 | ||
552 | if (gameport->io) | 540 | if (gameport->io) |
553 | printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n", | 541 | dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n", |
554 | gameport->name, gameport->phys, gameport->io, gameport->speed); | 542 | gameport->name, gameport->phys, gameport->io, gameport->speed); |
555 | else | 543 | else |
556 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", | 544 | dev_info(&gameport->dev, "%s is %s, speed %dkHz\n", |
557 | gameport->name, gameport->phys, gameport->speed); | 545 | gameport->name, gameport->phys, gameport->speed); |
558 | 546 | ||
559 | error = device_add(&gameport->dev); | 547 | error = device_add(&gameport->dev); |
560 | if (error) | 548 | if (error) |
561 | printk(KERN_ERR | 549 | dev_err(&gameport->dev, |
562 | "gameport: device_add() failed for %s (%s), error: %d\n", | 550 | "device_add() failed for %s (%s), error: %d\n", |
563 | gameport->phys, gameport->name, error); | 551 | gameport->phys, gameport->name, error); |
564 | else | ||
565 | gameport->registered = 1; | ||
566 | } | 552 | } |
567 | 553 | ||
568 | /* | 554 | /* |
@@ -584,10 +570,8 @@ static void gameport_destroy_port(struct gameport *gameport) | |||
584 | gameport->parent = NULL; | 570 | gameport->parent = NULL; |
585 | } | 571 | } |
586 | 572 | ||
587 | if (gameport->registered) { | 573 | if (device_is_registered(&gameport->dev)) |
588 | device_del(&gameport->dev); | 574 | device_del(&gameport->dev); |
589 | gameport->registered = 0; | ||
590 | } | ||
591 | 575 | ||
592 | list_del_init(&gameport->node); | 576 | list_del_init(&gameport->node); |
593 | 577 | ||
@@ -705,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv) | |||
705 | 689 | ||
706 | error = driver_attach(&drv->driver); | 690 | error = driver_attach(&drv->driver); |
707 | if (error) | 691 | if (error) |
708 | printk(KERN_ERR | 692 | pr_err("driver_attach() failed for %s, error: %d\n", |
709 | "gameport: driver_attach() failed for %s, error: %d\n", | ||
710 | drv->driver.name, error); | 693 | drv->driver.name, error); |
711 | } | 694 | } |
712 | 695 | ||
@@ -727,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner | |||
727 | 710 | ||
728 | error = driver_register(&drv->driver); | 711 | error = driver_register(&drv->driver); |
729 | if (error) { | 712 | if (error) { |
730 | printk(KERN_ERR | 713 | pr_err("driver_register() failed for %s, error: %d\n", |
731 | "gameport: driver_register() failed for %s, error: %d\n", | ||
732 | drv->driver.name, error); | 714 | drv->driver.name, error); |
733 | return error; | 715 | return error; |
734 | } | 716 | } |
@@ -828,7 +810,7 @@ static int __init gameport_init(void) | |||
828 | 810 | ||
829 | error = bus_register(&gameport_bus); | 811 | error = bus_register(&gameport_bus); |
830 | if (error) { | 812 | if (error) { |
831 | printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); | 813 | pr_err("failed to register gameport bus, error: %d\n", error); |
832 | return error; | 814 | return error; |
833 | } | 815 | } |
834 | 816 | ||
@@ -836,7 +818,7 @@ static int __init gameport_init(void) | |||
836 | if (IS_ERR(gameport_task)) { | 818 | if (IS_ERR(gameport_task)) { |
837 | bus_unregister(&gameport_bus); | 819 | bus_unregister(&gameport_bus); |
838 | error = PTR_ERR(gameport_task); | 820 | error = PTR_ERR(gameport_task); |
839 | printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); | 821 | pr_err("Failed to start kgameportd, error: %d\n", error); |
840 | return error; | 822 | return error; |
841 | } | 823 | } |
842 | 824 | ||
diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index db556b71ddda..7c217848613e 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c | |||
@@ -166,7 +166,7 @@ static int ns558_isa_probe(int io) | |||
166 | 166 | ||
167 | #ifdef CONFIG_PNP | 167 | #ifdef CONFIG_PNP |
168 | 168 | ||
169 | static struct pnp_device_id pnp_devids[] = { | 169 | static const struct pnp_device_id pnp_devids[] = { |
170 | { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */ | 170 | { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */ |
171 | { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */ | 171 | { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */ |
172 | { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */ | 172 | { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */ |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 30b503b8d67b..6c161e220868 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -614,12 +614,12 @@ static int input_default_setkeycode(struct input_dev *dev, | |||
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | clear_bit(old_keycode, dev->keybit); | 617 | __clear_bit(old_keycode, dev->keybit); |
618 | set_bit(keycode, dev->keybit); | 618 | __set_bit(keycode, dev->keybit); |
619 | 619 | ||
620 | for (i = 0; i < dev->keycodemax; i++) { | 620 | for (i = 0; i < dev->keycodemax; i++) { |
621 | if (input_fetch_keycode(dev, i) == old_keycode) { | 621 | if (input_fetch_keycode(dev, i) == old_keycode) { |
622 | set_bit(old_keycode, dev->keybit); | 622 | __set_bit(old_keycode, dev->keybit); |
623 | break; /* Setting the bit twice is useless, so break */ | 623 | break; /* Setting the bit twice is useless, so break */ |
624 | } | 624 | } |
625 | } | 625 | } |
@@ -677,6 +677,9 @@ int input_set_keycode(struct input_dev *dev, int scancode, int keycode) | |||
677 | if (retval) | 677 | if (retval) |
678 | goto out; | 678 | goto out; |
679 | 679 | ||
680 | /* Make sure KEY_RESERVED did not get enabled. */ | ||
681 | __clear_bit(KEY_RESERVED, dev->keybit); | ||
682 | |||
680 | /* | 683 | /* |
681 | * Simulate keyup event if keycode is not present | 684 | * Simulate keyup event if keycode is not present |
682 | * in the keymap anymore | 685 | * in the keymap anymore |
@@ -1550,6 +1553,25 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int | |||
1550 | } | 1553 | } |
1551 | EXPORT_SYMBOL(input_set_capability); | 1554 | EXPORT_SYMBOL(input_set_capability); |
1552 | 1555 | ||
1556 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ | ||
1557 | do { \ | ||
1558 | if (!test_bit(EV_##type, dev->evbit)) \ | ||
1559 | memset(dev->bits##bit, 0, \ | ||
1560 | sizeof(dev->bits##bit)); \ | ||
1561 | } while (0) | ||
1562 | |||
1563 | static void input_cleanse_bitmasks(struct input_dev *dev) | ||
1564 | { | ||
1565 | INPUT_CLEANSE_BITMASK(dev, KEY, key); | ||
1566 | INPUT_CLEANSE_BITMASK(dev, REL, rel); | ||
1567 | INPUT_CLEANSE_BITMASK(dev, ABS, abs); | ||
1568 | INPUT_CLEANSE_BITMASK(dev, MSC, msc); | ||
1569 | INPUT_CLEANSE_BITMASK(dev, LED, led); | ||
1570 | INPUT_CLEANSE_BITMASK(dev, SND, snd); | ||
1571 | INPUT_CLEANSE_BITMASK(dev, FF, ff); | ||
1572 | INPUT_CLEANSE_BITMASK(dev, SW, sw); | ||
1573 | } | ||
1574 | |||
1553 | /** | 1575 | /** |
1554 | * input_register_device - register device with input core | 1576 | * input_register_device - register device with input core |
1555 | * @dev: device to be registered | 1577 | * @dev: device to be registered |
@@ -1569,13 +1591,19 @@ int input_register_device(struct input_dev *dev) | |||
1569 | const char *path; | 1591 | const char *path; |
1570 | int error; | 1592 | int error; |
1571 | 1593 | ||
1594 | /* Every input device generates EV_SYN/SYN_REPORT events. */ | ||
1572 | __set_bit(EV_SYN, dev->evbit); | 1595 | __set_bit(EV_SYN, dev->evbit); |
1573 | 1596 | ||
1597 | /* KEY_RESERVED is not supposed to be transmitted to userspace. */ | ||
1598 | __clear_bit(KEY_RESERVED, dev->keybit); | ||
1599 | |||
1600 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ | ||
1601 | input_cleanse_bitmasks(dev); | ||
1602 | |||
1574 | /* | 1603 | /* |
1575 | * If delay and period are pre-set by the driver, then autorepeating | 1604 | * If delay and period are pre-set by the driver, then autorepeating |
1576 | * is handled by the driver itself and we don't do it in input.c. | 1605 | * is handled by the driver itself and we don't do it in input.c. |
1577 | */ | 1606 | */ |
1578 | |||
1579 | init_timer(&dev->timer); | 1607 | init_timer(&dev->timer); |
1580 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { | 1608 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { |
1581 | dev->timer.data = (long) dev; | 1609 | dev->timer.data = (long) dev; |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 8a28fb7846dc..66be6901619d 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -86,9 +86,8 @@ | |||
86 | 86 | ||
87 | /* xbox d-pads should map to buttons, as is required for DDR pads | 87 | /* xbox d-pads should map to buttons, as is required for DDR pads |
88 | but we map them to axes when possible to simplify things */ | 88 | but we map them to axes when possible to simplify things */ |
89 | #define MAP_DPAD_TO_BUTTONS 0 | 89 | #define MAP_DPAD_TO_BUTTONS (1 << 0) |
90 | #define MAP_DPAD_TO_AXES 1 | 90 | #define MAP_TRIGGERS_TO_BUTTONS (1 << 1) |
91 | #define MAP_DPAD_UNKNOWN 2 | ||
92 | 91 | ||
93 | #define XTYPE_XBOX 0 | 92 | #define XTYPE_XBOX 0 |
94 | #define XTYPE_XBOX360 1 | 93 | #define XTYPE_XBOX360 1 |
@@ -99,57 +98,61 @@ static int dpad_to_buttons; | |||
99 | module_param(dpad_to_buttons, bool, S_IRUGO); | 98 | module_param(dpad_to_buttons, bool, S_IRUGO); |
100 | MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads"); | 99 | MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads"); |
101 | 100 | ||
101 | static int triggers_to_buttons; | ||
102 | module_param(triggers_to_buttons, bool, S_IRUGO); | ||
103 | MODULE_PARM_DESC(triggers_to_buttons, "Map triggers to buttons rather than axes for unknown pads"); | ||
104 | |||
102 | static const struct xpad_device { | 105 | static const struct xpad_device { |
103 | u16 idVendor; | 106 | u16 idVendor; |
104 | u16 idProduct; | 107 | u16 idProduct; |
105 | char *name; | 108 | char *name; |
106 | u8 dpad_mapping; | 109 | u8 mapping; |
107 | u8 xtype; | 110 | u8 xtype; |
108 | } xpad_device[] = { | 111 | } xpad_device[] = { |
109 | { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 112 | { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, |
110 | { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 113 | { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, |
111 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 114 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, |
112 | { 0x045e, 0x0287, "Microsoft Xbox Controller S", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 115 | { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, |
113 | { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, | 116 | { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, |
114 | { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 117 | { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
115 | { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 118 | { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, |
116 | { 0x046d, 0xc242, "Logitech Chillstream Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 119 | { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, |
117 | { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 120 | { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, |
118 | { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 121 | { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, |
119 | { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 122 | { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, |
120 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 123 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, |
121 | { 0x0738, 0x4516, "Mad Catz Control Pad", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 124 | { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, |
122 | { 0x0738, 0x4522, "Mad Catz LumiCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 125 | { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX }, |
123 | { 0x0738, 0x4526, "Mad Catz Control Pad Pro", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 126 | { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX }, |
124 | { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 127 | { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX }, |
125 | { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 128 | { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
126 | { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 129 | { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX }, |
127 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 130 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, |
128 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 131 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
129 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 132 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
130 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 133 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
131 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 134 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, |
132 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 135 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
133 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 136 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, |
134 | { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 137 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, |
135 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 138 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, |
136 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 139 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, |
137 | { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 140 | { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX }, |
138 | { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 141 | { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, |
139 | { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 142 | { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, |
140 | { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 143 | { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, |
141 | { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 144 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, |
142 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 145 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, |
143 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 146 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, |
144 | { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 147 | { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
145 | { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 148 | { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 }, |
146 | { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 149 | { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
147 | { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 150 | { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, |
148 | { 0x045e, 0x028e, "Microsoft X-Box 360 pad", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 151 | { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, |
149 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 152 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
150 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 153 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
151 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 154 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, |
152 | { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN } | 155 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } |
153 | }; | 156 | }; |
154 | 157 | ||
155 | /* buttons shared with xbox and xbox360 */ | 158 | /* buttons shared with xbox and xbox360 */ |
@@ -165,13 +168,20 @@ static const signed short xpad_btn[] = { | |||
165 | -1 /* terminating entry */ | 168 | -1 /* terminating entry */ |
166 | }; | 169 | }; |
167 | 170 | ||
168 | /* only used if MAP_DPAD_TO_BUTTONS */ | 171 | /* used when dpad is mapped to nuttons */ |
169 | static const signed short xpad_btn_pad[] = { | 172 | static const signed short xpad_btn_pad[] = { |
170 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ | 173 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ |
171 | BTN_0, BTN_1, /* d-pad up, down (XXX names??) */ | 174 | BTN_0, BTN_1, /* d-pad up, down (XXX names??) */ |
172 | -1 /* terminating entry */ | 175 | -1 /* terminating entry */ |
173 | }; | 176 | }; |
174 | 177 | ||
178 | /* used when triggers are mapped to buttons */ | ||
179 | static const signed short xpad_btn_triggers[] = { | ||
180 | BTN_TL2, BTN_TR2, /* triggers left/right */ | ||
181 | -1 | ||
182 | }; | ||
183 | |||
184 | |||
175 | static const signed short xpad360_btn[] = { /* buttons for x360 controller */ | 185 | static const signed short xpad360_btn[] = { /* buttons for x360 controller */ |
176 | BTN_TL, BTN_TR, /* Button LB/RB */ | 186 | BTN_TL, BTN_TR, /* Button LB/RB */ |
177 | BTN_MODE, /* The big X button */ | 187 | BTN_MODE, /* The big X button */ |
@@ -181,16 +191,21 @@ static const signed short xpad360_btn[] = { /* buttons for x360 controller */ | |||
181 | static const signed short xpad_abs[] = { | 191 | static const signed short xpad_abs[] = { |
182 | ABS_X, ABS_Y, /* left stick */ | 192 | ABS_X, ABS_Y, /* left stick */ |
183 | ABS_RX, ABS_RY, /* right stick */ | 193 | ABS_RX, ABS_RY, /* right stick */ |
184 | ABS_Z, ABS_RZ, /* triggers left/right */ | ||
185 | -1 /* terminating entry */ | 194 | -1 /* terminating entry */ |
186 | }; | 195 | }; |
187 | 196 | ||
188 | /* only used if MAP_DPAD_TO_AXES */ | 197 | /* used when dpad is mapped to axes */ |
189 | static const signed short xpad_abs_pad[] = { | 198 | static const signed short xpad_abs_pad[] = { |
190 | ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */ | 199 | ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */ |
191 | -1 /* terminating entry */ | 200 | -1 /* terminating entry */ |
192 | }; | 201 | }; |
193 | 202 | ||
203 | /* used when triggers are mapped to axes */ | ||
204 | static const signed short xpad_abs_triggers[] = { | ||
205 | ABS_Z, ABS_RZ, /* triggers left/right */ | ||
206 | -1 | ||
207 | }; | ||
208 | |||
194 | /* Xbox 360 has a vendor-specific class, so we cannot match it with only | 209 | /* Xbox 360 has a vendor-specific class, so we cannot match it with only |
195 | * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we | 210 | * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we |
196 | * match against vendor id as well. Wired Xbox 360 devices have protocol 1, | 211 | * match against vendor id as well. Wired Xbox 360 devices have protocol 1, |
@@ -246,7 +261,7 @@ struct usb_xpad { | |||
246 | 261 | ||
247 | char phys[64]; /* physical device path */ | 262 | char phys[64]; /* physical device path */ |
248 | 263 | ||
249 | int dpad_mapping; /* map d-pad to buttons or to axes */ | 264 | int mapping; /* map d-pad to buttons or to axes */ |
250 | int xtype; /* type of xbox device */ | 265 | int xtype; /* type of xbox device */ |
251 | }; | 266 | }; |
252 | 267 | ||
@@ -277,20 +292,25 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d | |||
277 | ~(__s16) le16_to_cpup((__le16 *)(data + 18))); | 292 | ~(__s16) le16_to_cpup((__le16 *)(data + 18))); |
278 | 293 | ||
279 | /* triggers left/right */ | 294 | /* triggers left/right */ |
280 | input_report_abs(dev, ABS_Z, data[10]); | 295 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { |
281 | input_report_abs(dev, ABS_RZ, data[11]); | 296 | input_report_key(dev, BTN_TL2, data[10]); |
297 | input_report_key(dev, BTN_TR2, data[11]); | ||
298 | } else { | ||
299 | input_report_abs(dev, ABS_Z, data[10]); | ||
300 | input_report_abs(dev, ABS_RZ, data[11]); | ||
301 | } | ||
282 | 302 | ||
283 | /* digital pad */ | 303 | /* digital pad */ |
284 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) { | 304 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { |
285 | input_report_abs(dev, ABS_HAT0X, | ||
286 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
287 | input_report_abs(dev, ABS_HAT0Y, | ||
288 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
289 | } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ { | ||
290 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); | 305 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); |
291 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); | 306 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); |
292 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ | 307 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ |
293 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ | 308 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ |
309 | } else { | ||
310 | input_report_abs(dev, ABS_HAT0X, | ||
311 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
312 | input_report_abs(dev, ABS_HAT0Y, | ||
313 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
294 | } | 314 | } |
295 | 315 | ||
296 | /* start/back buttons and stick press left/right */ | 316 | /* start/back buttons and stick press left/right */ |
@@ -328,17 +348,17 @@ static void xpad360_process_packet(struct usb_xpad *xpad, | |||
328 | struct input_dev *dev = xpad->dev; | 348 | struct input_dev *dev = xpad->dev; |
329 | 349 | ||
330 | /* digital pad */ | 350 | /* digital pad */ |
331 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) { | 351 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { |
332 | input_report_abs(dev, ABS_HAT0X, | ||
333 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
334 | input_report_abs(dev, ABS_HAT0Y, | ||
335 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
336 | } else if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) { | ||
337 | /* dpad as buttons (right, left, down, up) */ | 352 | /* dpad as buttons (right, left, down, up) */ |
338 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); | 353 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); |
339 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); | 354 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); |
340 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ | 355 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ |
341 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ | 356 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ |
357 | } else { | ||
358 | input_report_abs(dev, ABS_HAT0X, | ||
359 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
360 | input_report_abs(dev, ABS_HAT0Y, | ||
361 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
342 | } | 362 | } |
343 | 363 | ||
344 | /* start/back buttons */ | 364 | /* start/back buttons */ |
@@ -371,8 +391,13 @@ static void xpad360_process_packet(struct usb_xpad *xpad, | |||
371 | ~(__s16) le16_to_cpup((__le16 *)(data + 12))); | 391 | ~(__s16) le16_to_cpup((__le16 *)(data + 12))); |
372 | 392 | ||
373 | /* triggers left/right */ | 393 | /* triggers left/right */ |
374 | input_report_abs(dev, ABS_Z, data[4]); | 394 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { |
375 | input_report_abs(dev, ABS_RZ, data[5]); | 395 | input_report_key(dev, BTN_TL2, data[4]); |
396 | input_report_key(dev, BTN_TR2, data[5]); | ||
397 | } else { | ||
398 | input_report_abs(dev, ABS_Z, data[4]); | ||
399 | input_report_abs(dev, ABS_RZ, data[5]); | ||
400 | } | ||
376 | 401 | ||
377 | input_sync(dev); | 402 | input_sync(dev); |
378 | } | 403 | } |
@@ -712,11 +737,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) | |||
712 | input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128); | 737 | input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128); |
713 | break; | 738 | break; |
714 | case ABS_Z: | 739 | case ABS_Z: |
715 | case ABS_RZ: /* the triggers */ | 740 | case ABS_RZ: /* the triggers (if mapped to axes) */ |
716 | input_set_abs_params(input_dev, abs, 0, 255, 0, 0); | 741 | input_set_abs_params(input_dev, abs, 0, 255, 0, 0); |
717 | break; | 742 | break; |
718 | case ABS_HAT0X: | 743 | case ABS_HAT0X: |
719 | case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */ | 744 | case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */ |
720 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0); | 745 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0); |
721 | break; | 746 | break; |
722 | } | 747 | } |
@@ -752,10 +777,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
752 | goto fail2; | 777 | goto fail2; |
753 | 778 | ||
754 | xpad->udev = udev; | 779 | xpad->udev = udev; |
755 | xpad->dpad_mapping = xpad_device[i].dpad_mapping; | 780 | xpad->mapping = xpad_device[i].mapping; |
756 | xpad->xtype = xpad_device[i].xtype; | 781 | xpad->xtype = xpad_device[i].xtype; |
757 | if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN) | 782 | |
758 | xpad->dpad_mapping = !dpad_to_buttons; | ||
759 | if (xpad->xtype == XTYPE_UNKNOWN) { | 783 | if (xpad->xtype == XTYPE_UNKNOWN) { |
760 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { | 784 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { |
761 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) | 785 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) |
@@ -764,7 +788,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
764 | xpad->xtype = XTYPE_XBOX360; | 788 | xpad->xtype = XTYPE_XBOX360; |
765 | } else | 789 | } else |
766 | xpad->xtype = XTYPE_XBOX; | 790 | xpad->xtype = XTYPE_XBOX; |
791 | |||
792 | if (dpad_to_buttons) | ||
793 | xpad->mapping |= MAP_DPAD_TO_BUTTONS; | ||
794 | if (triggers_to_buttons) | ||
795 | xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS; | ||
767 | } | 796 | } |
797 | |||
768 | xpad->dev = input_dev; | 798 | xpad->dev = input_dev; |
769 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); | 799 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); |
770 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); | 800 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); |
@@ -781,25 +811,37 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
781 | 811 | ||
782 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 812 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
783 | 813 | ||
784 | /* set up buttons */ | 814 | /* set up standard buttons and axes */ |
785 | for (i = 0; xpad_common_btn[i] >= 0; i++) | 815 | for (i = 0; xpad_common_btn[i] >= 0; i++) |
786 | set_bit(xpad_common_btn[i], input_dev->keybit); | 816 | __set_bit(xpad_common_btn[i], input_dev->keybit); |
787 | if ((xpad->xtype == XTYPE_XBOX360) || (xpad->xtype == XTYPE_XBOX360W)) | ||
788 | for (i = 0; xpad360_btn[i] >= 0; i++) | ||
789 | set_bit(xpad360_btn[i], input_dev->keybit); | ||
790 | else | ||
791 | for (i = 0; xpad_btn[i] >= 0; i++) | ||
792 | set_bit(xpad_btn[i], input_dev->keybit); | ||
793 | if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) | ||
794 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | ||
795 | set_bit(xpad_btn_pad[i], input_dev->keybit); | ||
796 | 817 | ||
797 | /* set up axes */ | ||
798 | for (i = 0; xpad_abs[i] >= 0; i++) | 818 | for (i = 0; xpad_abs[i] >= 0; i++) |
799 | xpad_set_up_abs(input_dev, xpad_abs[i]); | 819 | xpad_set_up_abs(input_dev, xpad_abs[i]); |
800 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) | 820 | |
821 | /* Now set up model-specific ones */ | ||
822 | if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) { | ||
823 | for (i = 0; xpad360_btn[i] >= 0; i++) | ||
824 | __set_bit(xpad360_btn[i], input_dev->keybit); | ||
825 | } else { | ||
826 | for (i = 0; xpad_btn[i] >= 0; i++) | ||
827 | __set_bit(xpad_btn[i], input_dev->keybit); | ||
828 | } | ||
829 | |||
830 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { | ||
831 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | ||
832 | __set_bit(xpad_btn_pad[i], input_dev->keybit); | ||
833 | } else { | ||
801 | for (i = 0; xpad_abs_pad[i] >= 0; i++) | 834 | for (i = 0; xpad_abs_pad[i] >= 0; i++) |
802 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); | 835 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); |
836 | } | ||
837 | |||
838 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { | ||
839 | for (i = 0; xpad_btn_triggers[i] >= 0; i++) | ||
840 | __set_bit(xpad_btn_triggers[i], input_dev->keybit); | ||
841 | } else { | ||
842 | for (i = 0; xpad_abs_triggers[i] >= 0; i++) | ||
843 | xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); | ||
844 | } | ||
803 | 845 | ||
804 | error = xpad_init_output(intf, xpad); | 846 | error = xpad_init_output(intf, xpad); |
805 | if (error) | 847 | if (error) |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 02c836e11813..c72283c6916f 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -35,10 +35,10 @@ config KEYBOARD_ADP5520 | |||
35 | be called adp5520-keys. | 35 | be called adp5520-keys. |
36 | 36 | ||
37 | config KEYBOARD_ADP5588 | 37 | config KEYBOARD_ADP5588 |
38 | tristate "ADP5588 I2C QWERTY Keypad and IO Expander" | 38 | tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander" |
39 | depends on I2C | 39 | depends on I2C |
40 | help | 40 | help |
41 | Say Y here if you want to use a ADP5588 attached to your | 41 | Say Y here if you want to use a ADP5588/87 attached to your |
42 | system I2C bus. | 42 | system I2C bus. |
43 | 43 | ||
44 | To compile this driver as a module, choose M here: the | 44 | To compile this driver as a module, choose M here: the |
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 1edb596d927b..b5142d2d5112 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/input/keyboard/adp5588_keys.c | 2 | * File: drivers/input/keyboard/adp5588_keys.c |
3 | * Description: keypad driver for ADP5588 I2C QWERTY Keypad and IO Expander | 3 | * Description: keypad driver for ADP5588 and ADP5587 |
4 | * I2C QWERTY Keypad and IO Expander | ||
4 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | 5 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
5 | * | 6 | * |
6 | * Copyright (C) 2008-2009 Analog Devices Inc. | 7 | * Copyright (C) 2008-2009 Analog Devices Inc. |
@@ -327,6 +328,7 @@ static const struct dev_pm_ops adp5588_dev_pm_ops = { | |||
327 | 328 | ||
328 | static const struct i2c_device_id adp5588_id[] = { | 329 | static const struct i2c_device_id adp5588_id[] = { |
329 | { KBUILD_MODNAME, 0 }, | 330 | { KBUILD_MODNAME, 0 }, |
331 | { "adp5587-keys", 0 }, | ||
330 | { } | 332 | { } |
331 | }; | 333 | }; |
332 | MODULE_DEVICE_TABLE(i2c, adp5588_id); | 334 | MODULE_DEVICE_TABLE(i2c, adp5588_id); |
@@ -357,5 +359,5 @@ module_exit(adp5588_exit); | |||
357 | 359 | ||
358 | MODULE_LICENSE("GPL"); | 360 | MODULE_LICENSE("GPL"); |
359 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 361 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
360 | MODULE_DESCRIPTION("ADP5588 Keypad driver"); | 362 | MODULE_DESCRIPTION("ADP5588/87 Keypad driver"); |
361 | MODULE_ALIAS("platform:adp5588-keys"); | 363 | MODULE_ALIAS("platform:adp5588-keys"); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 7b4056292eaf..326875be192e 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -40,26 +40,26 @@ module_param_named(set, atkbd_set, int, 0); | |||
40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); | 40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); |
41 | 41 | ||
42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) | 42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) |
43 | static int atkbd_reset; | 43 | static bool atkbd_reset; |
44 | #else | 44 | #else |
45 | static int atkbd_reset = 1; | 45 | static bool atkbd_reset = true; |
46 | #endif | 46 | #endif |
47 | module_param_named(reset, atkbd_reset, bool, 0); | 47 | module_param_named(reset, atkbd_reset, bool, 0); |
48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); | 48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); |
49 | 49 | ||
50 | static int atkbd_softrepeat; | 50 | static bool atkbd_softrepeat; |
51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); | 51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); |
52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); | 52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); |
53 | 53 | ||
54 | static int atkbd_softraw = 1; | 54 | static bool atkbd_softraw = true; |
55 | module_param_named(softraw, atkbd_softraw, bool, 0); | 55 | module_param_named(softraw, atkbd_softraw, bool, 0); |
56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); | 56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); |
57 | 57 | ||
58 | static int atkbd_scroll; | 58 | static bool atkbd_scroll; |
59 | module_param_named(scroll, atkbd_scroll, bool, 0); | 59 | module_param_named(scroll, atkbd_scroll, bool, 0); |
60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); | 60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); |
61 | 61 | ||
62 | static int atkbd_extra; | 62 | static bool atkbd_extra; |
63 | module_param_named(extra, atkbd_extra, bool, 0); | 63 | module_param_named(extra, atkbd_extra, bool, 0); |
64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); | 64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); |
65 | 65 | ||
@@ -206,18 +206,18 @@ struct atkbd { | |||
206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; | 206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; |
207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); | 207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); |
208 | unsigned char set; | 208 | unsigned char set; |
209 | unsigned char translated; | 209 | bool translated; |
210 | unsigned char extra; | 210 | bool extra; |
211 | unsigned char write; | 211 | bool write; |
212 | unsigned char softrepeat; | 212 | bool softrepeat; |
213 | unsigned char softraw; | 213 | bool softraw; |
214 | unsigned char scroll; | 214 | bool scroll; |
215 | unsigned char enabled; | 215 | bool enabled; |
216 | 216 | ||
217 | /* Accessed only from interrupt */ | 217 | /* Accessed only from interrupt */ |
218 | unsigned char emul; | 218 | unsigned char emul; |
219 | unsigned char resend; | 219 | bool resend; |
220 | unsigned char release; | 220 | bool release; |
221 | unsigned long xl_bit; | 221 | unsigned long xl_bit; |
222 | unsigned int last; | 222 | unsigned int last; |
223 | unsigned long time; | 223 | unsigned long time; |
@@ -301,18 +301,18 @@ static const unsigned int xl_table[] = { | |||
301 | * Checks if we should mangle the scancode to extract 'release' bit | 301 | * Checks if we should mangle the scancode to extract 'release' bit |
302 | * in translated mode. | 302 | * in translated mode. |
303 | */ | 303 | */ |
304 | static int atkbd_need_xlate(unsigned long xl_bit, unsigned char code) | 304 | static bool atkbd_need_xlate(unsigned long xl_bit, unsigned char code) |
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | 307 | ||
308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) | 308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) |
309 | return 0; | 309 | return false; |
310 | 310 | ||
311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) | 311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) |
312 | if (code == xl_table[i]) | 312 | if (code == xl_table[i]) |
313 | return test_bit(i, &xl_bit); | 313 | return test_bit(i, &xl_bit); |
314 | 314 | ||
315 | return 1; | 315 | return true; |
316 | } | 316 | } |
317 | 317 | ||
318 | /* | 318 | /* |
@@ -359,7 +359,7 @@ static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code | |||
359 | */ | 359 | */ |
360 | 360 | ||
361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | 361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, |
362 | unsigned int flags) | 362 | unsigned int flags) |
363 | { | 363 | { |
364 | struct atkbd *atkbd = serio_get_drvdata(serio); | 364 | struct atkbd *atkbd = serio_get_drvdata(serio); |
365 | struct input_dev *dev = atkbd->dev; | 365 | struct input_dev *dev = atkbd->dev; |
@@ -368,20 +368,18 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
368 | int value; | 368 | int value; |
369 | unsigned short keycode; | 369 | unsigned short keycode; |
370 | 370 | ||
371 | #ifdef ATKBD_DEBUG | 371 | dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags); |
372 | printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); | ||
373 | #endif | ||
374 | 372 | ||
375 | #if !defined(__i386__) && !defined (__x86_64__) | 373 | #if !defined(__i386__) && !defined (__x86_64__) |
376 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { | 374 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { |
377 | printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); | 375 | dev_warn(&serio->dev, "Frame/parity error: %02x\n", flags); |
378 | serio_write(serio, ATKBD_CMD_RESEND); | 376 | serio_write(serio, ATKBD_CMD_RESEND); |
379 | atkbd->resend = 1; | 377 | atkbd->resend = true; |
380 | goto out; | 378 | goto out; |
381 | } | 379 | } |
382 | 380 | ||
383 | if (!flags && data == ATKBD_RET_ACK) | 381 | if (!flags && data == ATKBD_RET_ACK) |
384 | atkbd->resend = 0; | 382 | atkbd->resend = false; |
385 | #endif | 383 | #endif |
386 | 384 | ||
387 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) | 385 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) |
@@ -412,32 +410,32 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
412 | } | 410 | } |
413 | 411 | ||
414 | switch (code) { | 412 | switch (code) { |
415 | case ATKBD_RET_BAT: | 413 | case ATKBD_RET_BAT: |
416 | atkbd->enabled = 0; | 414 | atkbd->enabled = false; |
417 | serio_reconnect(atkbd->ps2dev.serio); | 415 | serio_reconnect(atkbd->ps2dev.serio); |
418 | goto out; | 416 | goto out; |
419 | case ATKBD_RET_EMUL0: | 417 | case ATKBD_RET_EMUL0: |
420 | atkbd->emul = 1; | 418 | atkbd->emul = 1; |
421 | goto out; | 419 | goto out; |
422 | case ATKBD_RET_EMUL1: | 420 | case ATKBD_RET_EMUL1: |
423 | atkbd->emul = 2; | 421 | atkbd->emul = 2; |
424 | goto out; | 422 | goto out; |
425 | case ATKBD_RET_RELEASE: | 423 | case ATKBD_RET_RELEASE: |
426 | atkbd->release = 1; | 424 | atkbd->release = true; |
427 | goto out; | 425 | goto out; |
428 | case ATKBD_RET_ACK: | 426 | case ATKBD_RET_ACK: |
429 | case ATKBD_RET_NAK: | 427 | case ATKBD_RET_NAK: |
430 | if (printk_ratelimit()) | 428 | if (printk_ratelimit()) |
431 | printk(KERN_WARNING "atkbd.c: Spurious %s on %s. " | 429 | dev_warn(&serio->dev, |
432 | "Some program might be trying access hardware directly.\n", | 430 | "Spurious %s on %s. " |
433 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); | 431 | "Some program might be trying access hardware directly.\n", |
434 | goto out; | 432 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); |
435 | case ATKBD_RET_ERR: | 433 | goto out; |
436 | atkbd->err_count++; | 434 | case ATKBD_RET_ERR: |
437 | #ifdef ATKBD_DEBUG | 435 | atkbd->err_count++; |
438 | printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); | 436 | dev_dbg(&serio->dev, "Keyboard on %s reports too many keys pressed.\n", |
439 | #endif | 437 | serio->phys); |
440 | goto out; | 438 | goto out; |
441 | } | 439 | } |
442 | 440 | ||
443 | code = atkbd_compat_scancode(atkbd, code); | 441 | code = atkbd_compat_scancode(atkbd, code); |
@@ -451,71 +449,72 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
451 | input_event(dev, EV_MSC, MSC_SCAN, code); | 449 | input_event(dev, EV_MSC, MSC_SCAN, code); |
452 | 450 | ||
453 | switch (keycode) { | 451 | switch (keycode) { |
454 | case ATKBD_KEY_NULL: | 452 | case ATKBD_KEY_NULL: |
455 | break; | 453 | break; |
456 | case ATKBD_KEY_UNKNOWN: | 454 | case ATKBD_KEY_UNKNOWN: |
457 | printk(KERN_WARNING | 455 | dev_warn(&serio->dev, |
458 | "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n", | 456 | "Unknown key %s (%s set %d, code %#x on %s).\n", |
459 | atkbd->release ? "released" : "pressed", | 457 | atkbd->release ? "released" : "pressed", |
460 | atkbd->translated ? "translated" : "raw", | 458 | atkbd->translated ? "translated" : "raw", |
461 | atkbd->set, code, serio->phys); | 459 | atkbd->set, code, serio->phys); |
462 | printk(KERN_WARNING | 460 | dev_warn(&serio->dev, |
463 | "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n", | 461 | "Use 'setkeycodes %s%02x <keycode>' to make it known.\n", |
464 | code & 0x80 ? "e0" : "", code & 0x7f); | 462 | code & 0x80 ? "e0" : "", code & 0x7f); |
465 | input_sync(dev); | 463 | input_sync(dev); |
466 | break; | 464 | break; |
467 | case ATKBD_SCR_1: | 465 | case ATKBD_SCR_1: |
468 | scroll = 1 - atkbd->release * 2; | 466 | scroll = 1; |
469 | break; | 467 | break; |
470 | case ATKBD_SCR_2: | 468 | case ATKBD_SCR_2: |
471 | scroll = 2 - atkbd->release * 4; | 469 | scroll = 2; |
472 | break; | 470 | break; |
473 | case ATKBD_SCR_4: | 471 | case ATKBD_SCR_4: |
474 | scroll = 4 - atkbd->release * 8; | 472 | scroll = 4; |
475 | break; | 473 | break; |
476 | case ATKBD_SCR_8: | 474 | case ATKBD_SCR_8: |
477 | scroll = 8 - atkbd->release * 16; | 475 | scroll = 8; |
478 | break; | 476 | break; |
479 | case ATKBD_SCR_CLICK: | 477 | case ATKBD_SCR_CLICK: |
480 | click = !atkbd->release; | 478 | click = !atkbd->release; |
481 | break; | 479 | break; |
482 | case ATKBD_SCR_LEFT: | 480 | case ATKBD_SCR_LEFT: |
483 | hscroll = -1; | 481 | hscroll = -1; |
484 | break; | 482 | break; |
485 | case ATKBD_SCR_RIGHT: | 483 | case ATKBD_SCR_RIGHT: |
486 | hscroll = 1; | 484 | hscroll = 1; |
487 | break; | 485 | break; |
488 | default: | 486 | default: |
489 | if (atkbd->release) { | 487 | if (atkbd->release) { |
490 | value = 0; | 488 | value = 0; |
491 | atkbd->last = 0; | 489 | atkbd->last = 0; |
492 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { | 490 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { |
493 | /* Workaround Toshiba laptop multiple keypress */ | 491 | /* Workaround Toshiba laptop multiple keypress */ |
494 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; | 492 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; |
495 | } else { | 493 | } else { |
496 | value = 1; | 494 | value = 1; |
497 | atkbd->last = code; | 495 | atkbd->last = code; |
498 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; | 496 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; |
499 | } | 497 | } |
500 | 498 | ||
501 | input_event(dev, EV_KEY, keycode, value); | 499 | input_event(dev, EV_KEY, keycode, value); |
502 | input_sync(dev); | 500 | input_sync(dev); |
503 | 501 | ||
504 | if (value && test_bit(code, atkbd->force_release_mask)) { | 502 | if (value && test_bit(code, atkbd->force_release_mask)) { |
505 | input_report_key(dev, keycode, 0); | 503 | input_report_key(dev, keycode, 0); |
506 | input_sync(dev); | 504 | input_sync(dev); |
507 | } | 505 | } |
508 | } | 506 | } |
509 | 507 | ||
510 | if (atkbd->scroll) { | 508 | if (atkbd->scroll) { |
511 | if (click != -1) | 509 | if (click != -1) |
512 | input_report_key(dev, BTN_MIDDLE, click); | 510 | input_report_key(dev, BTN_MIDDLE, click); |
513 | input_report_rel(dev, REL_WHEEL, scroll); | 511 | input_report_rel(dev, REL_WHEEL, |
512 | atkbd->release ? -scroll : scroll); | ||
514 | input_report_rel(dev, REL_HWHEEL, hscroll); | 513 | input_report_rel(dev, REL_HWHEEL, hscroll); |
515 | input_sync(dev); | 514 | input_sync(dev); |
516 | } | 515 | } |
517 | 516 | ||
518 | atkbd->release = 0; | 517 | atkbd->release = false; |
519 | out: | 518 | out: |
520 | return IRQ_HANDLED; | 519 | return IRQ_HANDLED; |
521 | } | 520 | } |
@@ -634,17 +633,18 @@ static int atkbd_event(struct input_dev *dev, | |||
634 | 633 | ||
635 | switch (type) { | 634 | switch (type) { |
636 | 635 | ||
637 | case EV_LED: | 636 | case EV_LED: |
638 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); | 637 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); |
639 | return 0; | 638 | return 0; |
640 | 639 | ||
641 | case EV_REP: | 640 | case EV_REP: |
642 | if (!atkbd->softrepeat) | 641 | if (!atkbd->softrepeat) |
643 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); | 642 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); |
644 | return 0; | 643 | return 0; |
645 | } | ||
646 | 644 | ||
647 | return -1; | 645 | default: |
646 | return -1; | ||
647 | } | ||
648 | } | 648 | } |
649 | 649 | ||
650 | /* | 650 | /* |
@@ -655,7 +655,7 @@ static int atkbd_event(struct input_dev *dev, | |||
655 | static inline void atkbd_enable(struct atkbd *atkbd) | 655 | static inline void atkbd_enable(struct atkbd *atkbd) |
656 | { | 656 | { |
657 | serio_pause_rx(atkbd->ps2dev.serio); | 657 | serio_pause_rx(atkbd->ps2dev.serio); |
658 | atkbd->enabled = 1; | 658 | atkbd->enabled = true; |
659 | serio_continue_rx(atkbd->ps2dev.serio); | 659 | serio_continue_rx(atkbd->ps2dev.serio); |
660 | } | 660 | } |
661 | 661 | ||
@@ -667,7 +667,7 @@ static inline void atkbd_enable(struct atkbd *atkbd) | |||
667 | static inline void atkbd_disable(struct atkbd *atkbd) | 667 | static inline void atkbd_disable(struct atkbd *atkbd) |
668 | { | 668 | { |
669 | serio_pause_rx(atkbd->ps2dev.serio); | 669 | serio_pause_rx(atkbd->ps2dev.serio); |
670 | atkbd->enabled = 0; | 670 | atkbd->enabled = false; |
671 | serio_continue_rx(atkbd->ps2dev.serio); | 671 | serio_continue_rx(atkbd->ps2dev.serio); |
672 | } | 672 | } |
673 | 673 | ||
@@ -688,7 +688,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
688 | 688 | ||
689 | if (atkbd_reset) | 689 | if (atkbd_reset) |
690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) | 690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) |
691 | printk(KERN_WARNING "atkbd.c: keyboard reset failed on %s\n", ps2dev->serio->phys); | 691 | dev_warn(&ps2dev->serio->dev, |
692 | "keyboard reset failed on %s\n", | ||
693 | ps2dev->serio->phys); | ||
692 | 694 | ||
693 | /* | 695 | /* |
694 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. | 696 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. |
@@ -718,8 +720,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
718 | atkbd->id = (param[0] << 8) | param[1]; | 720 | atkbd->id = (param[0] << 8) | param[1]; |
719 | 721 | ||
720 | if (atkbd->id == 0xaca1 && atkbd->translated) { | 722 | if (atkbd->id == 0xaca1 && atkbd->translated) { |
721 | printk(KERN_ERR "atkbd.c: NCD terminal keyboards are only supported on non-translating\n"); | 723 | dev_err(&ps2dev->serio->dev, |
722 | printk(KERN_ERR "atkbd.c: controllers. Use i8042.direct=1 to disable translation.\n"); | 724 | "NCD terminal keyboards are only supported on non-translating controlelrs. " |
725 | "Use i8042.direct=1 to disable translation.\n"); | ||
723 | return -1; | 726 | return -1; |
724 | } | 727 | } |
725 | 728 | ||
@@ -737,7 +740,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
737 | struct ps2dev *ps2dev = &atkbd->ps2dev; | 740 | struct ps2dev *ps2dev = &atkbd->ps2dev; |
738 | unsigned char param[2]; | 741 | unsigned char param[2]; |
739 | 742 | ||
740 | atkbd->extra = 0; | 743 | atkbd->extra = false; |
741 | /* | 744 | /* |
742 | * For known special keyboards we can go ahead and set the correct set. | 745 | * For known special keyboards we can go ahead and set the correct set. |
743 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and | 746 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and |
@@ -756,7 +759,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
756 | if (allow_extra) { | 759 | if (allow_extra) { |
757 | param[0] = 0x71; | 760 | param[0] = 0x71; |
758 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { | 761 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { |
759 | atkbd->extra = 1; | 762 | atkbd->extra = true; |
760 | return 2; | 763 | return 2; |
761 | } | 764 | } |
762 | } | 765 | } |
@@ -821,7 +824,8 @@ static int atkbd_activate(struct atkbd *atkbd) | |||
821 | */ | 824 | */ |
822 | 825 | ||
823 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { | 826 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { |
824 | printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n", | 827 | dev_err(&ps2dev->serio->dev, |
828 | "Failed to enable keyboard on %s\n", | ||
825 | ps2dev->serio->phys); | 829 | ps2dev->serio->phys); |
826 | return -1; | 830 | return -1; |
827 | } | 831 | } |
@@ -1100,12 +1104,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1100 | 1104 | ||
1101 | switch (serio->id.type) { | 1105 | switch (serio->id.type) { |
1102 | 1106 | ||
1103 | case SERIO_8042_XL: | 1107 | case SERIO_8042_XL: |
1104 | atkbd->translated = 1; | 1108 | atkbd->translated = true; |
1105 | case SERIO_8042: | 1109 | /* Fall through */ |
1106 | if (serio->write) | 1110 | |
1107 | atkbd->write = 1; | 1111 | case SERIO_8042: |
1108 | break; | 1112 | if (serio->write) |
1113 | atkbd->write = true; | ||
1114 | break; | ||
1109 | } | 1115 | } |
1110 | 1116 | ||
1111 | atkbd->softraw = atkbd_softraw; | 1117 | atkbd->softraw = atkbd_softraw; |
@@ -1113,7 +1119,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1113 | atkbd->scroll = atkbd_scroll; | 1119 | atkbd->scroll = atkbd_scroll; |
1114 | 1120 | ||
1115 | if (atkbd->softrepeat) | 1121 | if (atkbd->softrepeat) |
1116 | atkbd->softraw = 1; | 1122 | atkbd->softraw = true; |
1117 | 1123 | ||
1118 | serio_set_drvdata(serio, atkbd); | 1124 | serio_set_drvdata(serio, atkbd); |
1119 | 1125 | ||
@@ -1172,7 +1178,8 @@ static int atkbd_reconnect(struct serio *serio) | |||
1172 | int retval = -1; | 1178 | int retval = -1; |
1173 | 1179 | ||
1174 | if (!atkbd || !drv) { | 1180 | if (!atkbd || !drv) { |
1175 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); | 1181 | dev_dbg(&serio->dev, |
1182 | "reconnect request, but serio is disconnected, ignoring...\n"); | ||
1176 | return -1; | 1183 | return -1; |
1177 | } | 1184 | } |
1178 | 1185 | ||
@@ -1286,7 +1293,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
1286 | struct input_dev *old_dev, *new_dev; | 1293 | struct input_dev *old_dev, *new_dev; |
1287 | unsigned long value; | 1294 | unsigned long value; |
1288 | int err; | 1295 | int err; |
1289 | unsigned char old_extra, old_set; | 1296 | bool old_extra; |
1297 | unsigned char old_set; | ||
1290 | 1298 | ||
1291 | if (!atkbd->write) | 1299 | if (!atkbd->write) |
1292 | return -EIO; | 1300 | return -EIO; |
@@ -1369,7 +1377,7 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou | |||
1369 | struct input_dev *old_dev, *new_dev; | 1377 | struct input_dev *old_dev, *new_dev; |
1370 | unsigned long value; | 1378 | unsigned long value; |
1371 | int err; | 1379 | int err; |
1372 | unsigned char old_scroll; | 1380 | bool old_scroll; |
1373 | 1381 | ||
1374 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1382 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1375 | return -EINVAL; | 1383 | return -EINVAL; |
@@ -1413,7 +1421,8 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
1413 | struct input_dev *old_dev, *new_dev; | 1421 | struct input_dev *old_dev, *new_dev; |
1414 | unsigned long value; | 1422 | unsigned long value; |
1415 | int err; | 1423 | int err; |
1416 | unsigned char old_set, old_extra; | 1424 | unsigned char old_set; |
1425 | bool old_extra; | ||
1417 | 1426 | ||
1418 | if (!atkbd->write) | 1427 | if (!atkbd->write) |
1419 | return -EIO; | 1428 | return -EIO; |
@@ -1463,7 +1472,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1463 | struct input_dev *old_dev, *new_dev; | 1472 | struct input_dev *old_dev, *new_dev; |
1464 | unsigned long value; | 1473 | unsigned long value; |
1465 | int err; | 1474 | int err; |
1466 | unsigned char old_softrepeat, old_softraw; | 1475 | bool old_softrepeat, old_softraw; |
1467 | 1476 | ||
1468 | if (!atkbd->write) | 1477 | if (!atkbd->write) |
1469 | return -EIO; | 1478 | return -EIO; |
@@ -1483,7 +1492,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1483 | atkbd->dev = new_dev; | 1492 | atkbd->dev = new_dev; |
1484 | atkbd->softrepeat = value; | 1493 | atkbd->softrepeat = value; |
1485 | if (atkbd->softrepeat) | 1494 | if (atkbd->softrepeat) |
1486 | atkbd->softraw = 1; | 1495 | atkbd->softraw = true; |
1487 | atkbd_set_device_attrs(atkbd); | 1496 | atkbd_set_device_attrs(atkbd); |
1488 | 1497 | ||
1489 | err = input_register_device(atkbd->dev); | 1498 | err = input_register_device(atkbd->dev); |
@@ -1513,7 +1522,7 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co | |||
1513 | struct input_dev *old_dev, *new_dev; | 1522 | struct input_dev *old_dev, *new_dev; |
1514 | unsigned long value; | 1523 | unsigned long value; |
1515 | int err; | 1524 | int err; |
1516 | unsigned char old_softraw; | 1525 | bool old_softraw; |
1517 | 1526 | ||
1518 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1527 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1519 | return -EINVAL; | 1528 | return -EINVAL; |
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index e45740429f7e..bd25a3af1664 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c | |||
@@ -69,7 +69,7 @@ struct ep93xx_keypad { | |||
69 | 69 | ||
70 | void __iomem *mmio_base; | 70 | void __iomem *mmio_base; |
71 | 71 | ||
72 | unsigned int matrix_keycodes[EP93XX_MATRIX_SIZE]; | 72 | unsigned short keycodes[EP93XX_MATRIX_SIZE]; |
73 | 73 | ||
74 | int key1; | 74 | int key1; |
75 | int key2; | 75 | int key2; |
@@ -79,24 +79,6 @@ struct ep93xx_keypad { | |||
79 | bool enabled; | 79 | bool enabled; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static void ep93xx_keypad_build_keycode(struct ep93xx_keypad *keypad) | ||
83 | { | ||
84 | struct ep93xx_keypad_platform_data *pdata = keypad->pdata; | ||
85 | struct input_dev *input_dev = keypad->input_dev; | ||
86 | unsigned int *key; | ||
87 | int i; | ||
88 | |||
89 | key = &pdata->matrix_key_map[0]; | ||
90 | for (i = 0; i < pdata->matrix_key_map_size; i++, key++) { | ||
91 | int row = KEY_ROW(*key); | ||
92 | int col = KEY_COL(*key); | ||
93 | int code = KEY_VAL(*key); | ||
94 | |||
95 | keypad->matrix_keycodes[(row << 3) + col] = code; | ||
96 | __set_bit(code, input_dev->keybit); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) | 82 | static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) |
101 | { | 83 | { |
102 | struct ep93xx_keypad *keypad = dev_id; | 84 | struct ep93xx_keypad *keypad = dev_id; |
@@ -107,10 +89,10 @@ static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) | |||
107 | status = __raw_readl(keypad->mmio_base + KEY_REG); | 89 | status = __raw_readl(keypad->mmio_base + KEY_REG); |
108 | 90 | ||
109 | keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT; | 91 | keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT; |
110 | key1 = keypad->matrix_keycodes[keycode]; | 92 | key1 = keypad->keycodes[keycode]; |
111 | 93 | ||
112 | keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT; | 94 | keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT; |
113 | key2 = keypad->matrix_keycodes[keycode]; | 95 | key2 = keypad->keycodes[keycode]; |
114 | 96 | ||
115 | if (status & KEY_REG_2KEYS) { | 97 | if (status & KEY_REG_2KEYS) { |
116 | if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1) | 98 | if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1) |
@@ -256,6 +238,7 @@ static int ep93xx_keypad_resume(struct platform_device *pdev) | |||
256 | static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | 238 | static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) |
257 | { | 239 | { |
258 | struct ep93xx_keypad *keypad; | 240 | struct ep93xx_keypad *keypad; |
241 | const struct matrix_keymap_data *keymap_data; | ||
259 | struct input_dev *input_dev; | 242 | struct input_dev *input_dev; |
260 | struct resource *res; | 243 | struct resource *res; |
261 | int err; | 244 | int err; |
@@ -270,6 +253,12 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
270 | goto failed_free; | 253 | goto failed_free; |
271 | } | 254 | } |
272 | 255 | ||
256 | keymap_data = keypad->pdata->keymap_data; | ||
257 | if (!keymap_data) { | ||
258 | err = -EINVAL; | ||
259 | goto failed_free; | ||
260 | } | ||
261 | |||
273 | keypad->irq = platform_get_irq(pdev, 0); | 262 | keypad->irq = platform_get_irq(pdev, 0); |
274 | if (!keypad->irq) { | 263 | if (!keypad->irq) { |
275 | err = -ENXIO; | 264 | err = -ENXIO; |
@@ -317,9 +306,9 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
317 | input_dev->open = ep93xx_keypad_open; | 306 | input_dev->open = ep93xx_keypad_open; |
318 | input_dev->close = ep93xx_keypad_close; | 307 | input_dev->close = ep93xx_keypad_close; |
319 | input_dev->dev.parent = &pdev->dev; | 308 | input_dev->dev.parent = &pdev->dev; |
320 | input_dev->keycode = keypad->matrix_keycodes; | 309 | input_dev->keycode = keypad->keycodes; |
321 | input_dev->keycodesize = sizeof(keypad->matrix_keycodes[0]); | 310 | input_dev->keycodesize = sizeof(keypad->keycodes[0]); |
322 | input_dev->keycodemax = ARRAY_SIZE(keypad->matrix_keycodes); | 311 | input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); |
323 | 312 | ||
324 | input_set_drvdata(input_dev, keypad); | 313 | input_set_drvdata(input_dev, keypad); |
325 | 314 | ||
@@ -327,7 +316,8 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
327 | if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT) | 316 | if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT) |
328 | input_dev->evbit[0] |= BIT_MASK(EV_REP); | 317 | input_dev->evbit[0] |= BIT_MASK(EV_REP); |
329 | 318 | ||
330 | ep93xx_keypad_build_keycode(keypad); | 319 | matrix_keypad_build_keymap(keymap_data, 3, |
320 | input_dev->keycode, input_dev->keybit); | ||
331 | platform_set_drvdata(pdev, keypad); | 321 | platform_set_drvdata(pdev, keypad); |
332 | 322 | ||
333 | err = request_irq(keypad->irq, ep93xx_keypad_irq_handler, | 323 | err = request_irq(keypad->irq, ep93xx_keypad_irq_handler, |
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 191cc51d6cf8..31f30087b591 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c | |||
@@ -362,7 +362,7 @@ static int __devexit qt2160_remove(struct i2c_client *client) | |||
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |
364 | 364 | ||
365 | static struct i2c_device_id qt2160_idtable[] = { | 365 | static const struct i2c_device_id qt2160_idtable[] = { |
366 | { "qt2160", 0, }, | 366 | { "qt2160", 0, }, |
367 | { } | 367 | { } |
368 | }; | 368 | }; |
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 8e9380bfed40..efcc3a3b9b53 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -36,6 +36,8 @@ static const struct { | |||
36 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, | 36 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, |
37 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, | 37 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, |
38 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, | 38 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, |
39 | [SH_KEYSC_MODE_4] = { 3, 6, 6 }, | ||
40 | [SH_KEYSC_MODE_5] = { 4, 6, 7 }, | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | struct sh_keysc_priv { | 43 | struct sh_keysc_priv { |
@@ -122,8 +124,6 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id) | |||
122 | return IRQ_HANDLED; | 124 | return IRQ_HANDLED; |
123 | } | 125 | } |
124 | 126 | ||
125 | #define res_size(res) ((res)->end - (res)->start + 1) | ||
126 | |||
127 | static int __devinit sh_keysc_probe(struct platform_device *pdev) | 127 | static int __devinit sh_keysc_probe(struct platform_device *pdev) |
128 | { | 128 | { |
129 | struct sh_keysc_priv *priv; | 129 | struct sh_keysc_priv *priv; |
@@ -164,7 +164,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
164 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); | 164 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); |
165 | pdata = &priv->pdata; | 165 | pdata = &priv->pdata; |
166 | 166 | ||
167 | priv->iomem_base = ioremap_nocache(res->start, res_size(res)); | 167 | priv->iomem_base = ioremap_nocache(res->start, resource_size(res)); |
168 | if (priv->iomem_base == NULL) { | 168 | if (priv->iomem_base == NULL) { |
169 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | 169 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); |
170 | error = -ENXIO; | 170 | error = -ENXIO; |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 71b82434264d..a8d2b8db4e35 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -149,7 +149,7 @@ static void apanel_shutdown(struct i2c_client *client) | |||
149 | apanel_remove(client); | 149 | apanel_remove(client); |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct i2c_device_id apanel_id[] = { | 152 | static const struct i2c_device_id apanel_id[] = { |
153 | { "fujitsu_apanel", 0 }, | 153 | { "fujitsu_apanel", 0 }, |
154 | { } | 154 | { } |
155 | }; | 155 | }; |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 90be30e93556..9169d1591c1f 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -68,10 +68,6 @@ module_param(post_interrupt_delay, int, 0644); | |||
68 | MODULE_PARM_DESC(post_interrupt_delay, | 68 | MODULE_PARM_DESC(post_interrupt_delay, |
69 | "delay (ms) before recal after recal interrupt detected"); | 69 | "delay (ms) before recal after recal interrupt detected"); |
70 | 70 | ||
71 | static int autorecal = 1; | ||
72 | module_param(autorecal, int, 0644); | ||
73 | MODULE_PARM_DESC(autorecal, "enable recalibration in the driver"); | ||
74 | |||
75 | /* | 71 | /* |
76 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" | 72 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" |
77 | * above the pad and still have it send packets. This causes a jump cursor | 73 | * above the pad and still have it send packets. This causes a jump cursor |
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c index 1dacbe0d9348..797314be7af2 100644 --- a/drivers/input/serio/pcips2.c +++ b/drivers/input/serio/pcips2.c | |||
@@ -186,7 +186,7 @@ static void __devexit pcips2_remove(struct pci_dev *dev) | |||
186 | pci_disable_device(dev); | 186 | pci_disable_device(dev); |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct pci_device_id pcips2_ids[] = { | 189 | static const struct pci_device_id pcips2_ids[] = { |
190 | { | 190 | { |
191 | .vendor = 0x14f2, /* MOBILITY */ | 191 | .vendor = 0x14f2, /* MOBILITY */ |
192 | .device = 0x0123, /* Keyboard */ | 192 | .device = 0x0123, /* Keyboard */ |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index e0f30186d513..c3b626e9eae7 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | 26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/stddef.h> | 31 | #include <linux/stddef.h> |
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/serio.h> | 33 | #include <linux/serio.h> |
@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) | |||
119 | 121 | ||
120 | error = device_bind_driver(&serio->dev); | 122 | error = device_bind_driver(&serio->dev); |
121 | if (error) { | 123 | if (error) { |
122 | printk(KERN_WARNING | 124 | dev_warn(&serio->dev, |
123 | "serio: device_bind_driver() failed " | 125 | "device_bind_driver() failed for %s (%s) and %s, error: %d\n", |
124 | "for %s (%s) and %s, error: %d\n", | 126 | serio->phys, serio->name, |
125 | serio->phys, serio->name, | 127 | drv->description, error); |
126 | drv->description, error); | ||
127 | serio_disconnect_driver(serio); | 128 | serio_disconnect_driver(serio); |
128 | serio->dev.driver = NULL; | 129 | serio->dev.driver = NULL; |
129 | return error; | 130 | return error; |
@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio) | |||
138 | 139 | ||
139 | error = device_attach(&serio->dev); | 140 | error = device_attach(&serio->dev); |
140 | if (error < 0) | 141 | if (error < 0) |
141 | printk(KERN_WARNING | 142 | dev_warn(&serio->dev, |
142 | "serio: device_attach() failed for %s (%s), error: %d\n", | 143 | "device_attach() failed for %s (%s), error: %d\n", |
143 | serio->phys, serio->name, error); | 144 | serio->phys, serio->name, error); |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner, | |||
194 | 195 | ||
195 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); | 196 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); |
196 | if (!event) { | 197 | if (!event) { |
197 | printk(KERN_ERR | 198 | pr_err("Not enough memory to queue event %d\n", event_type); |
198 | "serio: Not enough memory to queue event %d\n", | ||
199 | event_type); | ||
200 | retval = -ENOMEM; | 199 | retval = -ENOMEM; |
201 | goto out; | 200 | goto out; |
202 | } | 201 | } |
203 | 202 | ||
204 | if (!try_module_get(owner)) { | 203 | if (!try_module_get(owner)) { |
205 | printk(KERN_WARNING | 204 | pr_warning("Can't get module reference, dropping event %d\n", |
206 | "serio: Can't get module reference, dropping event %d\n", | 205 | event_type); |
207 | event_type); | ||
208 | kfree(event); | 206 | kfree(event); |
209 | retval = -EINVAL; | 207 | retval = -EINVAL; |
210 | goto out; | 208 | goto out; |
@@ -230,14 +228,12 @@ static void serio_free_event(struct serio_event *event) | |||
230 | 228 | ||
231 | static void serio_remove_duplicate_events(struct serio_event *event) | 229 | static void serio_remove_duplicate_events(struct serio_event *event) |
232 | { | 230 | { |
233 | struct list_head *node, *next; | 231 | struct serio_event *e, *next; |
234 | struct serio_event *e; | ||
235 | unsigned long flags; | 232 | unsigned long flags; |
236 | 233 | ||
237 | spin_lock_irqsave(&serio_event_lock, flags); | 234 | spin_lock_irqsave(&serio_event_lock, flags); |
238 | 235 | ||
239 | list_for_each_safe(node, next, &serio_event_list) { | 236 | list_for_each_entry_safe(e, next, &serio_event_list, node) { |
240 | e = list_entry(node, struct serio_event, node); | ||
241 | if (event->object == e->object) { | 237 | if (event->object == e->object) { |
242 | /* | 238 | /* |
243 | * If this event is of different type we should not | 239 | * If this event is of different type we should not |
@@ -247,7 +243,7 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
247 | if (event->type != e->type) | 243 | if (event->type != e->type) |
248 | break; | 244 | break; |
249 | 245 | ||
250 | list_del_init(node); | 246 | list_del_init(&e->node); |
251 | serio_free_event(e); | 247 | serio_free_event(e); |
252 | } | 248 | } |
253 | } | 249 | } |
@@ -258,23 +254,18 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
258 | 254 | ||
259 | static struct serio_event *serio_get_event(void) | 255 | static struct serio_event *serio_get_event(void) |
260 | { | 256 | { |
261 | struct serio_event *event; | 257 | struct serio_event *event = NULL; |
262 | struct list_head *node; | ||
263 | unsigned long flags; | 258 | unsigned long flags; |
264 | 259 | ||
265 | spin_lock_irqsave(&serio_event_lock, flags); | 260 | spin_lock_irqsave(&serio_event_lock, flags); |
266 | 261 | ||
267 | if (list_empty(&serio_event_list)) { | 262 | if (!list_empty(&serio_event_list)) { |
268 | spin_unlock_irqrestore(&serio_event_lock, flags); | 263 | event = list_first_entry(&serio_event_list, |
269 | return NULL; | 264 | struct serio_event, node); |
265 | list_del_init(&event->node); | ||
270 | } | 266 | } |
271 | 267 | ||
272 | node = serio_event_list.next; | ||
273 | event = list_entry(node, struct serio_event, node); | ||
274 | list_del_init(node); | ||
275 | |||
276 | spin_unlock_irqrestore(&serio_event_lock, flags); | 268 | spin_unlock_irqrestore(&serio_event_lock, flags); |
277 | |||
278 | return event; | 269 | return event; |
279 | } | 270 | } |
280 | 271 | ||
@@ -287,29 +278,27 @@ static void serio_handle_event(void) | |||
287 | while ((event = serio_get_event())) { | 278 | while ((event = serio_get_event())) { |
288 | 279 | ||
289 | switch (event->type) { | 280 | switch (event->type) { |
290 | case SERIO_REGISTER_PORT: | ||
291 | serio_add_port(event->object); | ||
292 | break; | ||
293 | 281 | ||
294 | case SERIO_RECONNECT_PORT: | 282 | case SERIO_REGISTER_PORT: |
295 | serio_reconnect_port(event->object); | 283 | serio_add_port(event->object); |
296 | break; | 284 | break; |
297 | 285 | ||
298 | case SERIO_RESCAN_PORT: | 286 | case SERIO_RECONNECT_PORT: |
299 | serio_disconnect_port(event->object); | 287 | serio_reconnect_port(event->object); |
300 | serio_find_driver(event->object); | 288 | break; |
301 | break; | ||
302 | 289 | ||
303 | case SERIO_RECONNECT_CHAIN: | 290 | case SERIO_RESCAN_PORT: |
304 | serio_reconnect_chain(event->object); | 291 | serio_disconnect_port(event->object); |
305 | break; | 292 | serio_find_driver(event->object); |
293 | break; | ||
306 | 294 | ||
307 | case SERIO_ATTACH_DRIVER: | 295 | case SERIO_RECONNECT_CHAIN: |
308 | serio_attach_driver(event->object); | 296 | serio_reconnect_chain(event->object); |
309 | break; | 297 | break; |
310 | 298 | ||
311 | default: | 299 | case SERIO_ATTACH_DRIVER: |
312 | break; | 300 | serio_attach_driver(event->object); |
301 | break; | ||
313 | } | 302 | } |
314 | 303 | ||
315 | serio_remove_duplicate_events(event); | 304 | serio_remove_duplicate_events(event); |
@@ -325,16 +314,14 @@ static void serio_handle_event(void) | |||
325 | */ | 314 | */ |
326 | static void serio_remove_pending_events(void *object) | 315 | static void serio_remove_pending_events(void *object) |
327 | { | 316 | { |
328 | struct list_head *node, *next; | 317 | struct serio_event *event, *next; |
329 | struct serio_event *event; | ||
330 | unsigned long flags; | 318 | unsigned long flags; |
331 | 319 | ||
332 | spin_lock_irqsave(&serio_event_lock, flags); | 320 | spin_lock_irqsave(&serio_event_lock, flags); |
333 | 321 | ||
334 | list_for_each_safe(node, next, &serio_event_list) { | 322 | list_for_each_entry_safe(event, next, &serio_event_list, node) { |
335 | event = list_entry(node, struct serio_event, node); | ||
336 | if (event->object == object) { | 323 | if (event->object == object) { |
337 | list_del_init(node); | 324 | list_del_init(&event->node); |
338 | serio_free_event(event); | 325 | serio_free_event(event); |
339 | } | 326 | } |
340 | } | 327 | } |
@@ -380,7 +367,6 @@ static int serio_thread(void *nothing) | |||
380 | kthread_should_stop() || !list_empty(&serio_event_list)); | 367 | kthread_should_stop() || !list_empty(&serio_event_list)); |
381 | } while (!kthread_should_stop()); | 368 | } while (!kthread_should_stop()); |
382 | 369 | ||
383 | printk(KERN_DEBUG "serio: kseriod exiting\n"); | ||
384 | return 0; | 370 | return 0; |
385 | } | 371 | } |
386 | 372 | ||
@@ -445,6 +431,11 @@ static struct attribute_group serio_id_attr_group = { | |||
445 | .attrs = serio_device_id_attrs, | 431 | .attrs = serio_device_id_attrs, |
446 | }; | 432 | }; |
447 | 433 | ||
434 | static const struct attribute_group *serio_device_attr_groups[] = { | ||
435 | &serio_id_attr_group, | ||
436 | NULL | ||
437 | }; | ||
438 | |||
448 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 439 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
449 | { | 440 | { |
450 | struct serio *serio = to_serio_port(dev); | 441 | struct serio *serio = to_serio_port(dev); |
@@ -532,6 +523,7 @@ static void serio_init_port(struct serio *serio) | |||
532 | (long)atomic_inc_return(&serio_no) - 1); | 523 | (long)atomic_inc_return(&serio_no) - 1); |
533 | serio->dev.bus = &serio_bus; | 524 | serio->dev.bus = &serio_bus; |
534 | serio->dev.release = serio_release_port; | 525 | serio->dev.release = serio_release_port; |
526 | serio->dev.groups = serio_device_attr_groups; | ||
535 | if (serio->parent) { | 527 | if (serio->parent) { |
536 | serio->dev.parent = &serio->parent->dev; | 528 | serio->dev.parent = &serio->parent->dev; |
537 | serio->depth = serio->parent->depth + 1; | 529 | serio->depth = serio->parent->depth + 1; |
@@ -555,21 +547,15 @@ static void serio_add_port(struct serio *serio) | |||
555 | } | 547 | } |
556 | 548 | ||
557 | list_add_tail(&serio->node, &serio_list); | 549 | list_add_tail(&serio->node, &serio_list); |
550 | |||
558 | if (serio->start) | 551 | if (serio->start) |
559 | serio->start(serio); | 552 | serio->start(serio); |
553 | |||
560 | error = device_add(&serio->dev); | 554 | error = device_add(&serio->dev); |
561 | if (error) | 555 | if (error) |
562 | printk(KERN_ERR | 556 | dev_err(&serio->dev, |
563 | "serio: device_add() failed for %s (%s), error: %d\n", | 557 | "device_add() failed for %s (%s), error: %d\n", |
564 | serio->phys, serio->name, error); | 558 | serio->phys, serio->name, error); |
565 | else { | ||
566 | serio->registered = true; | ||
567 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | ||
568 | if (error) | ||
569 | printk(KERN_ERR | ||
570 | "serio: sysfs_create_group() failed for %s (%s), error: %d\n", | ||
571 | serio->phys, serio->name, error); | ||
572 | } | ||
573 | } | 559 | } |
574 | 560 | ||
575 | /* | 561 | /* |
@@ -596,11 +582,8 @@ static void serio_destroy_port(struct serio *serio) | |||
596 | serio->parent = NULL; | 582 | serio->parent = NULL; |
597 | } | 583 | } |
598 | 584 | ||
599 | if (serio->registered) { | 585 | if (device_is_registered(&serio->dev)) |
600 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | ||
601 | device_del(&serio->dev); | 586 | device_del(&serio->dev); |
602 | serio->registered = false; | ||
603 | } | ||
604 | 587 | ||
605 | list_del_init(&serio->node); | 588 | list_del_init(&serio->node); |
606 | serio_remove_pending_events(serio); | 589 | serio_remove_pending_events(serio); |
@@ -798,9 +781,8 @@ static void serio_attach_driver(struct serio_driver *drv) | |||
798 | 781 | ||
799 | error = driver_attach(&drv->driver); | 782 | error = driver_attach(&drv->driver); |
800 | if (error) | 783 | if (error) |
801 | printk(KERN_WARNING | 784 | pr_warning("driver_attach() failed for %s with error %d\n", |
802 | "serio: driver_attach() failed for %s with error %d\n", | 785 | drv->driver.name, error); |
803 | drv->driver.name, error); | ||
804 | } | 786 | } |
805 | 787 | ||
806 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) | 788 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) |
@@ -820,8 +802,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons | |||
820 | 802 | ||
821 | error = driver_register(&drv->driver); | 803 | error = driver_register(&drv->driver); |
822 | if (error) { | 804 | if (error) { |
823 | printk(KERN_ERR | 805 | pr_err("driver_register() failed for %s, error: %d\n", |
824 | "serio: driver_register() failed for %s, error: %d\n", | ||
825 | drv->driver.name, error); | 806 | drv->driver.name, error); |
826 | return error; | 807 | return error; |
827 | } | 808 | } |
@@ -987,7 +968,7 @@ irqreturn_t serio_interrupt(struct serio *serio, | |||
987 | 968 | ||
988 | if (likely(serio->drv)) { | 969 | if (likely(serio->drv)) { |
989 | ret = serio->drv->interrupt(serio, data, dfl); | 970 | ret = serio->drv->interrupt(serio, data, dfl); |
990 | } else if (!dfl && serio->registered) { | 971 | } else if (!dfl && device_is_registered(&serio->dev)) { |
991 | serio_rescan(serio); | 972 | serio_rescan(serio); |
992 | ret = IRQ_HANDLED; | 973 | ret = IRQ_HANDLED; |
993 | } | 974 | } |
@@ -1018,7 +999,7 @@ static int __init serio_init(void) | |||
1018 | 999 | ||
1019 | error = bus_register(&serio_bus); | 1000 | error = bus_register(&serio_bus); |
1020 | if (error) { | 1001 | if (error) { |
1021 | printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); | 1002 | pr_err("Failed to register serio bus, error: %d\n", error); |
1022 | return error; | 1003 | return error; |
1023 | } | 1004 | } |
1024 | 1005 | ||
@@ -1026,7 +1007,7 @@ static int __init serio_init(void) | |||
1026 | if (IS_ERR(serio_task)) { | 1007 | if (IS_ERR(serio_task)) { |
1027 | bus_unregister(&serio_bus); | 1008 | bus_unregister(&serio_bus); |
1028 | error = PTR_ERR(serio_task); | 1009 | error = PTR_ERR(serio_task); |
1029 | printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); | 1010 | pr_err("Failed to start kseriod, error: %d\n", error); |
1030 | return error; | 1011 | return error; |
1031 | } | 1012 | } |
1032 | 1013 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index ebb22f88c842..78c64fb8a4b0 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
@@ -354,7 +354,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev) | |||
354 | } | 354 | } |
355 | 355 | ||
356 | /* Match table for of_platform binding */ | 356 | /* Match table for of_platform binding */ |
357 | static struct of_device_id xps2_of_match[] __devinitdata = { | 357 | static const struct of_device_id xps2_of_match[] __devinitconst = { |
358 | { .compatible = "xlnx,xps-ps2-1.00.a", }, | 358 | { .compatible = "xlnx,xps-ps2-1.00.a", }, |
359 | { /* end of list */ }, | 359 | { /* end of list */ }, |
360 | }; | 360 | }; |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 3d32d3f4e486..866a9ee1af1a 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -92,7 +92,7 @@ Scott Hill shill@gtcocalcomp.com | |||
92 | /* DATA STRUCTURES */ | 92 | /* DATA STRUCTURES */ |
93 | 93 | ||
94 | /* Device table */ | 94 | /* Device table */ |
95 | static struct usb_device_id gtco_usbid_table [] = { | 95 | static const struct usb_device_id gtco_usbid_table[] = { |
96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, | 96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, |
97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, | 97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, |
98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, | 98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, |
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c index 8f38c5e55ce6..486d31ba9c09 100644 --- a/drivers/input/touchscreen/elo.c +++ b/drivers/input/touchscreen/elo.c | |||
@@ -72,45 +72,49 @@ static void elo_process_data_10(struct elo *elo, unsigned char data) | |||
72 | struct input_dev *dev = elo->dev; | 72 | struct input_dev *dev = elo->dev; |
73 | 73 | ||
74 | elo->data[elo->idx] = data; | 74 | elo->data[elo->idx] = data; |
75 | switch (elo->idx++) { | ||
76 | case 0: | ||
77 | elo->csum = 0xaa; | ||
78 | if (data != ELO10_LEAD_BYTE) { | ||
79 | pr_debug("elo: unsynchronized data: 0x%02x\n", data); | ||
80 | elo->idx = 0; | ||
81 | } | ||
82 | break; | ||
83 | 75 | ||
84 | case 9: | 76 | switch (elo->idx++) { |
77 | case 0: | ||
78 | elo->csum = 0xaa; | ||
79 | if (data != ELO10_LEAD_BYTE) { | ||
80 | dev_dbg(&elo->serio->dev, | ||
81 | "unsynchronized data: 0x%02x\n", data); | ||
85 | elo->idx = 0; | 82 | elo->idx = 0; |
86 | if (data != elo->csum) { | 83 | } |
87 | pr_debug("elo: bad checksum: 0x%02x, expected 0x%02x\n", | 84 | break; |
88 | data, elo->csum); | 85 | |
89 | break; | 86 | case 9: |
90 | } | 87 | elo->idx = 0; |
91 | if (elo->data[1] != elo->expected_packet) { | 88 | if (data != elo->csum) { |
92 | if (elo->data[1] != ELO10_TOUCH_PACKET) | 89 | dev_dbg(&elo->serio->dev, |
93 | pr_debug("elo: unexpected packet: 0x%02x\n", | 90 | "bad checksum: 0x%02x, expected 0x%02x\n", |
94 | elo->data[1]); | 91 | data, elo->csum); |
95 | break; | 92 | break; |
96 | } | 93 | } |
97 | if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { | 94 | if (elo->data[1] != elo->expected_packet) { |
98 | input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); | 95 | if (elo->data[1] != ELO10_TOUCH_PACKET) |
99 | input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); | 96 | dev_dbg(&elo->serio->dev, |
100 | if (elo->data[2] & ELO10_PRESSURE) | 97 | "unexpected packet: 0x%02x\n", |
101 | input_report_abs(dev, ABS_PRESSURE, | 98 | elo->data[1]); |
102 | (elo->data[8] << 8) | elo->data[7]); | ||
103 | input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH); | ||
104 | input_sync(dev); | ||
105 | } else if (elo->data[1] == ELO10_ACK_PACKET) { | ||
106 | if (elo->data[2] == '0') | ||
107 | elo->expected_packet = ELO10_TOUCH_PACKET; | ||
108 | complete(&elo->cmd_done); | ||
109 | } else { | ||
110 | memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN); | ||
111 | elo->expected_packet = ELO10_ACK_PACKET; | ||
112 | } | ||
113 | break; | 99 | break; |
100 | } | ||
101 | if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { | ||
102 | input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); | ||
103 | input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); | ||
104 | if (elo->data[2] & ELO10_PRESSURE) | ||
105 | input_report_abs(dev, ABS_PRESSURE, | ||
106 | (elo->data[8] << 8) | elo->data[7]); | ||
107 | input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH); | ||
108 | input_sync(dev); | ||
109 | } else if (elo->data[1] == ELO10_ACK_PACKET) { | ||
110 | if (elo->data[2] == '0') | ||
111 | elo->expected_packet = ELO10_TOUCH_PACKET; | ||
112 | complete(&elo->cmd_done); | ||
113 | } else { | ||
114 | memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN); | ||
115 | elo->expected_packet = ELO10_ACK_PACKET; | ||
116 | } | ||
117 | break; | ||
114 | } | 118 | } |
115 | elo->csum += data; | 119 | elo->csum += data; |
116 | } | 120 | } |
@@ -123,42 +127,53 @@ static void elo_process_data_6(struct elo *elo, unsigned char data) | |||
123 | 127 | ||
124 | switch (elo->idx++) { | 128 | switch (elo->idx++) { |
125 | 129 | ||
126 | case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break; | 130 | case 0: |
127 | case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break; | 131 | if ((data & 0xc0) != 0xc0) |
128 | case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break; | 132 | elo->idx = 0; |
129 | 133 | break; | |
130 | case 3: | ||
131 | if (data & 0xc0) { | ||
132 | elo->idx = 0; | ||
133 | break; | ||
134 | } | ||
135 | 134 | ||
136 | input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); | 135 | case 1: |
137 | input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); | 136 | if ((data & 0xc0) != 0x80) |
137 | elo->idx = 0; | ||
138 | break; | ||
138 | 139 | ||
139 | if (elo->id == 2) { | 140 | case 2: |
140 | input_report_key(dev, BTN_TOUCH, 1); | 141 | if ((data & 0xc0) != 0x40) |
141 | input_sync(dev); | 142 | elo->idx = 0; |
142 | elo->idx = 0; | 143 | break; |
143 | } | ||
144 | 144 | ||
145 | case 3: | ||
146 | if (data & 0xc0) { | ||
147 | elo->idx = 0; | ||
145 | break; | 148 | break; |
149 | } | ||
146 | 150 | ||
147 | case 4: | 151 | input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); |
148 | if (data) { | 152 | input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); |
149 | input_sync(dev); | ||
150 | elo->idx = 0; | ||
151 | } | ||
152 | break; | ||
153 | 153 | ||
154 | case 5: | 154 | if (elo->id == 2) { |
155 | if ((data & 0xf0) == 0) { | 155 | input_report_key(dev, BTN_TOUCH, 1); |
156 | input_report_abs(dev, ABS_PRESSURE, elo->data[5]); | ||
157 | input_report_key(dev, BTN_TOUCH, !!elo->data[5]); | ||
158 | } | ||
159 | input_sync(dev); | 156 | input_sync(dev); |
160 | elo->idx = 0; | 157 | elo->idx = 0; |
161 | break; | 158 | } |
159 | |||
160 | break; | ||
161 | |||
162 | case 4: | ||
163 | if (data) { | ||
164 | input_sync(dev); | ||
165 | elo->idx = 0; | ||
166 | } | ||
167 | break; | ||
168 | |||
169 | case 5: | ||
170 | if ((data & 0xf0) == 0) { | ||
171 | input_report_abs(dev, ABS_PRESSURE, elo->data[5]); | ||
172 | input_report_key(dev, BTN_TOUCH, !!elo->data[5]); | ||
173 | } | ||
174 | input_sync(dev); | ||
175 | elo->idx = 0; | ||
176 | break; | ||
162 | } | 177 | } |
163 | } | 178 | } |
164 | 179 | ||
@@ -170,17 +185,17 @@ static void elo_process_data_3(struct elo *elo, unsigned char data) | |||
170 | 185 | ||
171 | switch (elo->idx++) { | 186 | switch (elo->idx++) { |
172 | 187 | ||
173 | case 0: | 188 | case 0: |
174 | if ((data & 0x7f) != 0x01) | 189 | if ((data & 0x7f) != 0x01) |
175 | elo->idx = 0; | ||
176 | break; | ||
177 | case 2: | ||
178 | input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80)); | ||
179 | input_report_abs(dev, ABS_X, elo->data[1]); | ||
180 | input_report_abs(dev, ABS_Y, elo->data[2]); | ||
181 | input_sync(dev); | ||
182 | elo->idx = 0; | 190 | elo->idx = 0; |
183 | break; | 191 | break; |
192 | case 2: | ||
193 | input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80)); | ||
194 | input_report_abs(dev, ABS_X, elo->data[1]); | ||
195 | input_report_abs(dev, ABS_Y, elo->data[2]); | ||
196 | input_sync(dev); | ||
197 | elo->idx = 0; | ||
198 | break; | ||
184 | } | 199 | } |
185 | } | 200 | } |
186 | 201 | ||
@@ -189,19 +204,19 @@ static irqreturn_t elo_interrupt(struct serio *serio, | |||
189 | { | 204 | { |
190 | struct elo *elo = serio_get_drvdata(serio); | 205 | struct elo *elo = serio_get_drvdata(serio); |
191 | 206 | ||
192 | switch(elo->id) { | 207 | switch (elo->id) { |
193 | case 0: | 208 | case 0: |
194 | elo_process_data_10(elo, data); | 209 | elo_process_data_10(elo, data); |
195 | break; | 210 | break; |
196 | 211 | ||
197 | case 1: | 212 | case 1: |
198 | case 2: | 213 | case 2: |
199 | elo_process_data_6(elo, data); | 214 | elo_process_data_6(elo, data); |
200 | break; | 215 | break; |
201 | 216 | ||
202 | case 3: | 217 | case 3: |
203 | elo_process_data_3(elo, data); | 218 | elo_process_data_3(elo, data); |
204 | break; | 219 | break; |
205 | } | 220 | } |
206 | 221 | ||
207 | return IRQ_HANDLED; | 222 | return IRQ_HANDLED; |
@@ -261,10 +276,10 @@ static int elo_setup_10(struct elo *elo) | |||
261 | if (packet[3] & ELO10_PRESSURE) | 276 | if (packet[3] & ELO10_PRESSURE) |
262 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); | 277 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
263 | 278 | ||
264 | printk(KERN_INFO "elo: %sTouch touchscreen, fw: %02x.%02x, " | 279 | dev_info(&elo->serio->dev, |
265 | "features: 0x%02x, controller: 0x%02x\n", | 280 | "%sTouch touchscreen, fw: %02x.%02x, features: 0x%02x, controller: 0x%02x\n", |
266 | elo_types[(packet[1] -'0') & 0x03], | 281 | elo_types[(packet[1] -'0') & 0x03], |
267 | packet[5], packet[4], packet[3], packet[7]); | 282 | packet[5], packet[4], packet[3], packet[7]); |
268 | 283 | ||
269 | return 0; | 284 | return 0; |
270 | } | 285 | } |
@@ -330,24 +345,24 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv) | |||
330 | 345 | ||
331 | switch (elo->id) { | 346 | switch (elo->id) { |
332 | 347 | ||
333 | case 0: /* 10-byte protocol */ | 348 | case 0: /* 10-byte protocol */ |
334 | if (elo_setup_10(elo)) | 349 | if (elo_setup_10(elo)) |
335 | goto fail3; | 350 | goto fail3; |
336 | 351 | ||
337 | break; | 352 | break; |
338 | 353 | ||
339 | case 1: /* 6-byte protocol */ | 354 | case 1: /* 6-byte protocol */ |
340 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); | 355 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); |
341 | 356 | ||
342 | case 2: /* 4-byte protocol */ | 357 | case 2: /* 4-byte protocol */ |
343 | input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); | 358 | input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); |
344 | input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); | 359 | input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); |
345 | break; | 360 | break; |
346 | 361 | ||
347 | case 3: /* 3-byte protocol */ | 362 | case 3: /* 3-byte protocol */ |
348 | input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); | 363 | input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); |
349 | input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); | 364 | input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); |
350 | break; | 365 | break; |
351 | } | 366 | } |
352 | 367 | ||
353 | err = input_register_device(elo->dev); | 368 | err = input_register_device(elo->dev); |
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 7ef0d1420d3c..be23780e8a3e 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -358,7 +358,7 @@ static int __devexit tsc2007_remove(struct i2c_client *client) | |||
358 | return 0; | 358 | return 0; |
359 | } | 359 | } |
360 | 360 | ||
361 | static struct i2c_device_id tsc2007_idtable[] = { | 361 | static const struct i2c_device_id tsc2007_idtable[] = { |
362 | { "tsc2007", 0 }, | 362 | { "tsc2007", 0 }, |
363 | { } | 363 | { } |
364 | }; | 364 | }; |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 09a5e7341bd5..b1b99e931f80 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -144,7 +144,7 @@ enum { | |||
144 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ | 144 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ |
145 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE | 145 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE |
146 | 146 | ||
147 | static struct usb_device_id usbtouch_devices[] = { | 147 | static const struct usb_device_id usbtouch_devices[] = { |
148 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | 148 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
149 | /* ignore the HID capable devices, handled by usbhid */ | 149 | /* ignore the HID capable devices, handled by usbhid */ |
150 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, | 150 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, |
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c index c721c0a23eb8..d30436fee476 100644 --- a/drivers/input/xen-kbdfront.c +++ b/drivers/input/xen-kbdfront.c | |||
@@ -321,7 +321,7 @@ InitWait: | |||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | static struct xenbus_device_id xenkbd_ids[] = { | 324 | static const struct xenbus_device_id xenkbd_ids[] = { |
325 | { "vkbd" }, | 325 | { "vkbd" }, |
326 | { "" } | 326 | { "" } |
327 | }; | 327 | }; |
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index 1bc08541c2b9..48e68da097f6 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
@@ -46,7 +46,6 @@ struct gameport { | |||
46 | struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ | 46 | struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ |
47 | 47 | ||
48 | struct device dev; | 48 | struct device dev; |
49 | unsigned int registered; /* port has been fully registered with driver core */ | ||
50 | 49 | ||
51 | struct list_head node; | 50 | struct list_head node; |
52 | }; | 51 | }; |
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h index c211b5cf08e6..2aff38bcf2ba 100644 --- a/include/linux/input/sh_keysc.h +++ b/include/linux/input/sh_keysc.h | |||
@@ -1,10 +1,11 @@ | |||
1 | #ifndef __SH_KEYSC_H__ | 1 | #ifndef __SH_KEYSC_H__ |
2 | #define __SH_KEYSC_H__ | 2 | #define __SH_KEYSC_H__ |
3 | 3 | ||
4 | #define SH_KEYSC_MAXKEYS 30 | 4 | #define SH_KEYSC_MAXKEYS 42 |
5 | 5 | ||
6 | struct sh_keysc_info { | 6 | struct sh_keysc_info { |
7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode; | 7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3, |
8 | SH_KEYSC_MODE_4, SH_KEYSC_MODE_5 } mode; | ||
8 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ | 9 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ |
9 | int delay; | 10 | int delay; |
10 | int kycr2_delay; | 11 | int kycr2_delay; |
diff --git a/include/linux/serio.h b/include/linux/serio.h index 813d26c247ec..64b473066b9a 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
@@ -30,7 +30,6 @@ struct serio { | |||
30 | char phys[32]; | 30 | char phys[32]; |
31 | 31 | ||
32 | bool manual_bind; | 32 | bool manual_bind; |
33 | bool registered; /* port has been fully registered with driver core */ | ||
34 | 33 | ||
35 | struct serio_device_id id; | 34 | struct serio_device_id id; |
36 | 35 | ||