Commit 1acd2de5facd7fbea499aea64a3a3d0ec7bb9b51
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull more input updates from Dmitry Torokhov: "The second round of updates for the input subsystem. Updates to ALPS an bfin_roraty drivers and a couple oother fixups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: psmouse - use IS_ENABLED instead of homegrown code Input: bfin_rotary - introduce open and close methods Input: bfin_rotary - convert to use managed resources Input: bfin_rotary - use generic IO functions Input: bfin_rotary - move pin lists into into platform data Input: bfin_rotary - move platform header to linux/platform_data Input: bfin_rotary - mark suspend and resume code as __maybe_unused Input: bfin_rotary - fix potential oops in interrupt handler Input: ALPS - move v7 packet info to Documentation and v6 packet info Input: ALPS - fix confusing comment in protocol data Input: ALPS - do not mix trackstick and external PS/2 mouse data Input: ALPS - fix trackstick detection on some Dell Latitudes Input: ALPS - consolidate setting protocol parameters Input: ALPS - split protocol data from model info Input: ALPS - make Rushmore a separate protocol Input: ALPS - renumber protocol numbers Input: adi - remove an unnecessary check Input: pxa27x_keypad - remove an unneeded NULL check Input: soc_button_array - use "Windows" key for "Home"
Showing 20 changed files Side-by-side Diff
- Documentation/input/alps.txt
- arch/blackfin/include/asm/bfin_rotary.h
- arch/blackfin/mach-bf527/boards/ad7160eval.c
- arch/blackfin/mach-bf527/boards/ezkit.c
- arch/blackfin/mach-bf548/boards/ezkit.c
- arch/blackfin/mach-bf609/boards/ezkit.c
- drivers/input/joystick/adi.c
- drivers/input/keyboard/pxa27x_keypad.c
- drivers/input/misc/bfin_rotary.c
- drivers/input/misc/soc_button_array.c
- drivers/input/mouse/alps.c
- drivers/input/mouse/alps.h
- drivers/input/mouse/cypress_ps2.c
- drivers/input/mouse/cypress_ps2.h
- drivers/input/mouse/focaltech.c
- drivers/input/mouse/focaltech.h
- drivers/input/mouse/psmouse-base.c
- drivers/input/mouse/synaptics.c
- drivers/input/mouse/synaptics.h
- include/linux/platform_data/bfin_rotary.h
Documentation/input/alps.txt
... | ... | @@ -3,8 +3,8 @@ |
3 | 3 | |
4 | 4 | Introduction |
5 | 5 | ------------ |
6 | -Currently the ALPS touchpad driver supports five protocol versions in use by | |
7 | -ALPS touchpads, called versions 1, 2, 3, 4 and 5. | |
6 | +Currently the ALPS touchpad driver supports seven protocol versions in use by | |
7 | +ALPS touchpads, called versions 1, 2, 3, 4, 5, 6 and 7. | |
8 | 8 | |
9 | 9 | Since roughly mid-2010 several new ALPS touchpads have been released and |
10 | 10 | integrated into a variety of laptops and netbooks. These new touchpads |
... | ... | @@ -240,4 +240,68 @@ |
240 | 240 | byte 3: 0 x23 x22 x21 x20 x19 x18 x17 |
241 | 241 | byte 4: 0 x9 x8 x7 x6 x5 x4 x3 |
242 | 242 | byte 5: 0 x16 x15 x14 x13 x12 x11 x10 |
243 | + | |
244 | +ALPS Absolute Mode - Protocol Version 6 | |
245 | +--------------------------------------- | |
246 | + | |
247 | +For trackstick packet, the format is: | |
248 | + | |
249 | + byte 0: 1 1 1 1 1 1 1 1 | |
250 | + byte 1: 0 X6 X5 X4 X3 X2 X1 X0 | |
251 | + byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | |
252 | + byte 3: ? Y7 X7 ? ? M R L | |
253 | + byte 4: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0 | |
254 | + byte 5: 0 1 1 1 1 1 1 1 | |
255 | + | |
256 | +For touchpad packet, the format is: | |
257 | + | |
258 | + byte 0: 1 1 1 1 1 1 1 1 | |
259 | + byte 1: 0 0 0 0 x3 x2 x1 x0 | |
260 | + byte 2: 0 0 0 0 y3 y2 y1 y0 | |
261 | + byte 3: ? x7 x6 x5 x4 ? r l | |
262 | + byte 4: ? y7 y6 y5 y4 ? ? ? | |
263 | + byte 5: z7 z6 z5 z4 z3 z2 z1 z0 | |
264 | + | |
265 | +(v6 touchpad does not have middle button) | |
266 | + | |
267 | +ALPS Absolute Mode - Protocol Version 7 | |
268 | +--------------------------------------- | |
269 | + | |
270 | +For trackstick packet, the format is: | |
271 | + | |
272 | + byte 0: 0 1 0 0 1 0 0 0 | |
273 | + byte 1: 1 1 * * 1 M R L | |
274 | + byte 2: X7 1 X5 X4 X3 X2 X1 X0 | |
275 | + byte 3: Z6 1 Y6 X6 1 Y2 Y1 Y0 | |
276 | + byte 4: Y7 0 Y5 Y4 Y3 1 1 0 | |
277 | + byte 5: T&P 0 Z5 Z4 Z3 Z2 Z1 Z0 | |
278 | + | |
279 | +For touchpad packet, the format is: | |
280 | + | |
281 | + packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 | |
282 | + byte 0: TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 | |
283 | + byte 0: NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 | |
284 | + byte 1: Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 | |
285 | + byte 2: X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 | |
286 | + byte 3: X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 | |
287 | + byte 4: TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 | |
288 | + byte 4: MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 | |
289 | + byte 4: NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 | |
290 | + byte 5: TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 | |
291 | + byte 5: MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 | |
292 | + | |
293 | + L: Left button | |
294 | + R / M: Non-clickpads: Right / Middle button | |
295 | + Clickpads: When > 2 fingers are down, and some fingers | |
296 | + are in the button area, then the 2 coordinates reported | |
297 | + are for fingers outside the button area and these report | |
298 | + extra fingers being present in the right / left button | |
299 | + area. Note these fingers are not added to the F field! | |
300 | + so if a TWO packet is received and R = 1 then there are | |
301 | + 3 fingers down, etc. | |
302 | + TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt | |
303 | + 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt | |
304 | + otherwise byte 0 bit 4 must be set and byte 0/4/5 are | |
305 | + in NEW fmt | |
306 | + F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... |
arch/blackfin/include/asm/bfin_rotary.h
1 | -/* | |
2 | - * board initialization should put one of these structures into platform_data | |
3 | - * and place the bfin-rotary onto platform_bus named "bfin-rotary". | |
4 | - * | |
5 | - * Copyright 2008-2010 Analog Devices Inc. | |
6 | - * | |
7 | - * Licensed under the GPL-2 or later. | |
8 | - */ | |
9 | - | |
10 | -#ifndef _BFIN_ROTARY_H | |
11 | -#define _BFIN_ROTARY_H | |
12 | - | |
13 | -/* mode bitmasks */ | |
14 | -#define ROT_QUAD_ENC CNTMODE_QUADENC /* quadrature/grey code encoder mode */ | |
15 | -#define ROT_BIN_ENC CNTMODE_BINENC /* binary encoder mode */ | |
16 | -#define ROT_UD_CNT CNTMODE_UDCNT /* rotary counter mode */ | |
17 | -#define ROT_DIR_CNT CNTMODE_DIRCNT /* direction counter mode */ | |
18 | - | |
19 | -#define ROT_DEBE DEBE /* Debounce Enable */ | |
20 | - | |
21 | -#define ROT_CDGINV CDGINV /* CDG Pin Polarity Invert */ | |
22 | -#define ROT_CUDINV CUDINV /* CUD Pin Polarity Invert */ | |
23 | -#define ROT_CZMINV CZMINV /* CZM Pin Polarity Invert */ | |
24 | - | |
25 | -struct bfin_rotary_platform_data { | |
26 | - /* set rotary UP KEY_### or BTN_### in case you prefer | |
27 | - * bfin-rotary to send EV_KEY otherwise set 0 | |
28 | - */ | |
29 | - unsigned int rotary_up_key; | |
30 | - /* set rotary DOWN KEY_### or BTN_### in case you prefer | |
31 | - * bfin-rotary to send EV_KEY otherwise set 0 | |
32 | - */ | |
33 | - unsigned int rotary_down_key; | |
34 | - /* set rotary BUTTON KEY_### or BTN_### */ | |
35 | - unsigned int rotary_button_key; | |
36 | - /* set rotary Relative Axis REL_### in case you prefer | |
37 | - * bfin-rotary to send EV_REL otherwise set 0 | |
38 | - */ | |
39 | - unsigned int rotary_rel_code; | |
40 | - unsigned short debounce; /* 0..17 */ | |
41 | - unsigned short mode; | |
42 | - unsigned short pm_wakeup; | |
43 | -}; | |
44 | - | |
45 | -/* CNT_CONFIG bitmasks */ | |
46 | -#define CNTE (1 << 0) /* Counter Enable */ | |
47 | -#define DEBE (1 << 1) /* Debounce Enable */ | |
48 | -#define CDGINV (1 << 4) /* CDG Pin Polarity Invert */ | |
49 | -#define CUDINV (1 << 5) /* CUD Pin Polarity Invert */ | |
50 | -#define CZMINV (1 << 6) /* CZM Pin Polarity Invert */ | |
51 | -#define CNTMODE_SHIFT 8 | |
52 | -#define CNTMODE (0x7 << CNTMODE_SHIFT) /* Counter Operating Mode */ | |
53 | -#define ZMZC (1 << 1) /* CZM Zeroes Counter Enable */ | |
54 | -#define BNDMODE_SHIFT 12 | |
55 | -#define BNDMODE (0x3 << BNDMODE_SHIFT) /* Boundary register Mode */ | |
56 | -#define INPDIS (1 << 15) /* CUG and CDG Input Disable */ | |
57 | - | |
58 | -#define CNTMODE_QUADENC (0 << CNTMODE_SHIFT) /* quadrature encoder mode */ | |
59 | -#define CNTMODE_BINENC (1 << CNTMODE_SHIFT) /* binary encoder mode */ | |
60 | -#define CNTMODE_UDCNT (2 << CNTMODE_SHIFT) /* up/down counter mode */ | |
61 | -#define CNTMODE_DIRCNT (4 << CNTMODE_SHIFT) /* direction counter mode */ | |
62 | -#define CNTMODE_DIRTMR (5 << CNTMODE_SHIFT) /* direction timer mode */ | |
63 | - | |
64 | -#define BNDMODE_COMP (0 << BNDMODE_SHIFT) /* boundary compare mode */ | |
65 | -#define BNDMODE_ZERO (1 << BNDMODE_SHIFT) /* boundary compare and zero mode */ | |
66 | -#define BNDMODE_CAPT (2 << BNDMODE_SHIFT) /* boundary capture mode */ | |
67 | -#define BNDMODE_AEXT (3 << BNDMODE_SHIFT) /* boundary auto-extend mode */ | |
68 | - | |
69 | -/* CNT_IMASK bitmasks */ | |
70 | -#define ICIE (1 << 0) /* Illegal Gray/Binary Code Interrupt Enable */ | |
71 | -#define UCIE (1 << 1) /* Up count Interrupt Enable */ | |
72 | -#define DCIE (1 << 2) /* Down count Interrupt Enable */ | |
73 | -#define MINCIE (1 << 3) /* Min Count Interrupt Enable */ | |
74 | -#define MAXCIE (1 << 4) /* Max Count Interrupt Enable */ | |
75 | -#define COV31IE (1 << 5) /* Bit 31 Overflow Interrupt Enable */ | |
76 | -#define COV15IE (1 << 6) /* Bit 15 Overflow Interrupt Enable */ | |
77 | -#define CZEROIE (1 << 7) /* Count to Zero Interrupt Enable */ | |
78 | -#define CZMIE (1 << 8) /* CZM Pin Interrupt Enable */ | |
79 | -#define CZMEIE (1 << 9) /* CZM Error Interrupt Enable */ | |
80 | -#define CZMZIE (1 << 10) /* CZM Zeroes Counter Interrupt Enable */ | |
81 | - | |
82 | -/* CNT_STATUS bitmasks */ | |
83 | -#define ICII (1 << 0) /* Illegal Gray/Binary Code Interrupt Identifier */ | |
84 | -#define UCII (1 << 1) /* Up count Interrupt Identifier */ | |
85 | -#define DCII (1 << 2) /* Down count Interrupt Identifier */ | |
86 | -#define MINCII (1 << 3) /* Min Count Interrupt Identifier */ | |
87 | -#define MAXCII (1 << 4) /* Max Count Interrupt Identifier */ | |
88 | -#define COV31II (1 << 5) /* Bit 31 Overflow Interrupt Identifier */ | |
89 | -#define COV15II (1 << 6) /* Bit 15 Overflow Interrupt Identifier */ | |
90 | -#define CZEROII (1 << 7) /* Count to Zero Interrupt Identifier */ | |
91 | -#define CZMII (1 << 8) /* CZM Pin Interrupt Identifier */ | |
92 | -#define CZMEII (1 << 9) /* CZM Error Interrupt Identifier */ | |
93 | -#define CZMZII (1 << 10) /* CZM Zeroes Counter Interrupt Identifier */ | |
94 | - | |
95 | -/* CNT_COMMAND bitmasks */ | |
96 | -#define W1LCNT 0xf /* Load Counter Register */ | |
97 | -#define W1LMIN 0xf0 /* Load Min Register */ | |
98 | -#define W1LMAX 0xf00 /* Load Max Register */ | |
99 | -#define W1ZMONCE (1 << 12) /* Enable CZM Clear Counter Once */ | |
100 | - | |
101 | -#define W1LCNT_ZERO (1 << 0) /* write 1 to load CNT_COUNTER with zero */ | |
102 | -#define W1LCNT_MIN (1 << 2) /* write 1 to load CNT_COUNTER from CNT_MIN */ | |
103 | -#define W1LCNT_MAX (1 << 3) /* write 1 to load CNT_COUNTER from CNT_MAX */ | |
104 | - | |
105 | -#define W1LMIN_ZERO (1 << 4) /* write 1 to load CNT_MIN with zero */ | |
106 | -#define W1LMIN_CNT (1 << 5) /* write 1 to load CNT_MIN from CNT_COUNTER */ | |
107 | -#define W1LMIN_MAX (1 << 7) /* write 1 to load CNT_MIN from CNT_MAX */ | |
108 | - | |
109 | -#define W1LMAX_ZERO (1 << 8) /* write 1 to load CNT_MAX with zero */ | |
110 | -#define W1LMAX_CNT (1 << 9) /* write 1 to load CNT_MAX from CNT_COUNTER */ | |
111 | -#define W1LMAX_MIN (1 << 10) /* write 1 to load CNT_MAX from CNT_MIN */ | |
112 | - | |
113 | -/* CNT_DEBOUNCE bitmasks */ | |
114 | -#define DPRESCALE 0xf /* Load Counter Register */ | |
115 | - | |
116 | -#endif |
arch/blackfin/mach-bf527/boards/ad7160eval.c
... | ... | @@ -666,8 +666,15 @@ |
666 | 666 | #endif |
667 | 667 | |
668 | 668 | #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) |
669 | -#include <asm/bfin_rotary.h> | |
669 | +#include <linux/platform_data/bfin_rotary.h> | |
670 | 670 | |
671 | +static const u16 per_cnt[] = { | |
672 | + P_CNT_CUD, | |
673 | + P_CNT_CDG, | |
674 | + P_CNT_CZM, | |
675 | + 0 | |
676 | +}; | |
677 | + | |
671 | 678 | static struct bfin_rotary_platform_data bfin_rotary_data = { |
672 | 679 | /*.rotary_up_key = KEY_UP,*/ |
673 | 680 | /*.rotary_down_key = KEY_DOWN,*/ |
674 | 681 | |
... | ... | @@ -676,9 +683,15 @@ |
676 | 683 | .debounce = 10, /* 0..17 */ |
677 | 684 | .mode = ROT_QUAD_ENC | ROT_DEBE, |
678 | 685 | .pm_wakeup = 1, |
686 | + .pin_list = per_cnt, | |
679 | 687 | }; |
680 | 688 | |
681 | 689 | static struct resource bfin_rotary_resources[] = { |
690 | + { | |
691 | + .start = CNT_CONFIG, | |
692 | + .end = CNT_CONFIG + 0xff, | |
693 | + .flags = IORESOURCE_MEM, | |
694 | + }, | |
682 | 695 | { |
683 | 696 | .start = IRQ_CNT, |
684 | 697 | .end = IRQ_CNT, |
arch/blackfin/mach-bf527/boards/ezkit.c
... | ... | @@ -1092,8 +1092,15 @@ |
1092 | 1092 | #endif |
1093 | 1093 | |
1094 | 1094 | #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) |
1095 | -#include <asm/bfin_rotary.h> | |
1095 | +#include <linux/platform_data/bfin_rotary.h> | |
1096 | 1096 | |
1097 | +static const u16 per_cnt[] = { | |
1098 | + P_CNT_CUD, | |
1099 | + P_CNT_CDG, | |
1100 | + P_CNT_CZM, | |
1101 | + 0 | |
1102 | +}; | |
1103 | + | |
1097 | 1104 | static struct bfin_rotary_platform_data bfin_rotary_data = { |
1098 | 1105 | /*.rotary_up_key = KEY_UP,*/ |
1099 | 1106 | /*.rotary_down_key = KEY_DOWN,*/ |
1100 | 1107 | |
... | ... | @@ -1102,9 +1109,15 @@ |
1102 | 1109 | .debounce = 10, /* 0..17 */ |
1103 | 1110 | .mode = ROT_QUAD_ENC | ROT_DEBE, |
1104 | 1111 | .pm_wakeup = 1, |
1112 | + .pin_list = per_cnt, | |
1105 | 1113 | }; |
1106 | 1114 | |
1107 | 1115 | static struct resource bfin_rotary_resources[] = { |
1116 | + { | |
1117 | + .start = CNT_CONFIG, | |
1118 | + .end = CNT_CONFIG + 0xff, | |
1119 | + .flags = IORESOURCE_MEM, | |
1120 | + }, | |
1108 | 1121 | { |
1109 | 1122 | .start = IRQ_CNT, |
1110 | 1123 | .end = IRQ_CNT, |
arch/blackfin/mach-bf548/boards/ezkit.c
... | ... | @@ -159,7 +159,7 @@ |
159 | 159 | #endif |
160 | 160 | |
161 | 161 | #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) |
162 | -#include <asm/bfin_rotary.h> | |
162 | +#include <linux/platform_data/bfin_rotary.h> | |
163 | 163 | |
164 | 164 | static struct bfin_rotary_platform_data bfin_rotary_data = { |
165 | 165 | /*.rotary_up_key = KEY_UP,*/ |
... | ... | @@ -172,6 +172,11 @@ |
172 | 172 | }; |
173 | 173 | |
174 | 174 | static struct resource bfin_rotary_resources[] = { |
175 | + { | |
176 | + .start = CNT_CONFIG, | |
177 | + .end = CNT_CONFIG + 0xff, | |
178 | + .flags = IORESOURCE_MEM, | |
179 | + }, | |
175 | 180 | { |
176 | 181 | .start = IRQ_CNT, |
177 | 182 | .end = IRQ_CNT, |
arch/blackfin/mach-bf609/boards/ezkit.c
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | #endif |
76 | 76 | |
77 | 77 | #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) |
78 | -#include <asm/bfin_rotary.h> | |
78 | +#include <linux/platform_data/bfin_rotary.h> | |
79 | 79 | |
80 | 80 | static struct bfin_rotary_platform_data bfin_rotary_data = { |
81 | 81 | /*.rotary_up_key = KEY_UP,*/ |
... | ... | @@ -87,6 +87,11 @@ |
87 | 87 | }; |
88 | 88 | |
89 | 89 | static struct resource bfin_rotary_resources[] = { |
90 | + { | |
91 | + .start = CNT_CONFIG, | |
92 | + .end = CNT_CONFIG + 0xff, | |
93 | + .flags = IORESOURCE_MEM, | |
94 | + }, | |
90 | 95 | { |
91 | 96 | .start = IRQ_CNT, |
92 | 97 | .end = IRQ_CNT, |
drivers/input/joystick/adi.c
... | ... | @@ -535,8 +535,7 @@ |
535 | 535 | } |
536 | 536 | } |
537 | 537 | fail2: for (i = 0; i < 2; i++) |
538 | - if (port->adi[i].dev) | |
539 | - input_free_device(port->adi[i].dev); | |
538 | + input_free_device(port->adi[i].dev); | |
540 | 539 | gameport_close(gameport); |
541 | 540 | fail1: gameport_set_drvdata(gameport, NULL); |
542 | 541 | kfree(port); |
drivers/input/keyboard/pxa27x_keypad.c
... | ... | @@ -345,13 +345,11 @@ |
345 | 345 | { |
346 | 346 | const struct pxa27x_keypad_platform_data *pdata = keypad->pdata; |
347 | 347 | struct input_dev *input_dev = keypad->input_dev; |
348 | - const struct matrix_keymap_data *keymap_data = | |
349 | - pdata ? pdata->matrix_keymap_data : NULL; | |
350 | 348 | unsigned short keycode; |
351 | 349 | int i; |
352 | 350 | int error; |
353 | 351 | |
354 | - error = matrix_keypad_build_keymap(keymap_data, NULL, | |
352 | + error = matrix_keypad_build_keymap(pdata->matrix_keymap_data, NULL, | |
355 | 353 | pdata->matrix_key_rows, |
356 | 354 | pdata->matrix_key_cols, |
357 | 355 | keypad->keycodes, input_dev); |
drivers/input/misc/bfin_rotary.c
... | ... | @@ -7,29 +7,37 @@ |
7 | 7 | |
8 | 8 | #include <linux/module.h> |
9 | 9 | #include <linux/interrupt.h> |
10 | +#include <linux/io.h> | |
10 | 11 | #include <linux/irq.h> |
11 | 12 | #include <linux/pm.h> |
12 | 13 | #include <linux/platform_device.h> |
13 | 14 | #include <linux/input.h> |
14 | 15 | #include <linux/slab.h> |
16 | +#include <linux/platform_data/bfin_rotary.h> | |
15 | 17 | |
16 | 18 | #include <asm/portmux.h> |
17 | -#include <asm/bfin_rotary.h> | |
18 | 19 | |
19 | -static const u16 per_cnt[] = { | |
20 | - P_CNT_CUD, | |
21 | - P_CNT_CDG, | |
22 | - P_CNT_CZM, | |
23 | - 0 | |
24 | -}; | |
20 | +#define CNT_CONFIG_OFF 0 /* CNT Config Offset */ | |
21 | +#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ | |
22 | +#define CNT_STATUS_OFF 8 /* CNT Status Offset */ | |
23 | +#define CNT_COMMAND_OFF 12 /* CNT Command Offset */ | |
24 | +#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ | |
25 | +#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ | |
26 | +#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ | |
27 | +#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ | |
25 | 28 | |
26 | 29 | struct bfin_rot { |
27 | 30 | struct input_dev *input; |
31 | + void __iomem *base; | |
28 | 32 | int irq; |
29 | 33 | unsigned int up_key; |
30 | 34 | unsigned int down_key; |
31 | 35 | unsigned int button_key; |
32 | 36 | unsigned int rel_code; |
37 | + | |
38 | + unsigned short mode; | |
39 | + unsigned short debounce; | |
40 | + | |
33 | 41 | unsigned short cnt_config; |
34 | 42 | unsigned short cnt_imask; |
35 | 43 | unsigned short cnt_debounce; |
36 | 44 | |
37 | 45 | |
... | ... | @@ -59,18 +67,17 @@ |
59 | 67 | |
60 | 68 | static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) |
61 | 69 | { |
62 | - struct platform_device *pdev = dev_id; | |
63 | - struct bfin_rot *rotary = platform_get_drvdata(pdev); | |
70 | + struct bfin_rot *rotary = dev_id; | |
64 | 71 | int delta; |
65 | 72 | |
66 | - switch (bfin_read_CNT_STATUS()) { | |
73 | + switch (readw(rotary->base + CNT_STATUS_OFF)) { | |
67 | 74 | |
68 | 75 | case ICII: |
69 | 76 | break; |
70 | 77 | |
71 | 78 | case UCII: |
72 | 79 | case DCII: |
73 | - delta = bfin_read_CNT_COUNTER(); | |
80 | + delta = readl(rotary->base + CNT_COUNTER_OFF); | |
74 | 81 | if (delta) |
75 | 82 | report_rotary_event(rotary, delta); |
76 | 83 | break; |
77 | 84 | |
78 | 85 | |
79 | 86 | |
... | ... | @@ -83,16 +90,52 @@ |
83 | 90 | break; |
84 | 91 | } |
85 | 92 | |
86 | - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ | |
87 | - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ | |
93 | + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ | |
94 | + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ | |
88 | 95 | |
89 | 96 | return IRQ_HANDLED; |
90 | 97 | } |
91 | 98 | |
99 | +static int bfin_rotary_open(struct input_dev *input) | |
100 | +{ | |
101 | + struct bfin_rot *rotary = input_get_drvdata(input); | |
102 | + unsigned short val; | |
103 | + | |
104 | + if (rotary->mode & ROT_DEBE) | |
105 | + writew(rotary->debounce & DPRESCALE, | |
106 | + rotary->base + CNT_DEBOUNCE_OFF); | |
107 | + | |
108 | + writew(rotary->mode & ~CNTE, rotary->base + CNT_CONFIG_OFF); | |
109 | + | |
110 | + val = UCIE | DCIE; | |
111 | + if (rotary->button_key) | |
112 | + val |= CZMIE; | |
113 | + writew(val, rotary->base + CNT_IMASK_OFF); | |
114 | + | |
115 | + writew(rotary->mode | CNTE, rotary->base + CNT_CONFIG_OFF); | |
116 | + | |
117 | + return 0; | |
118 | +} | |
119 | + | |
120 | +static void bfin_rotary_close(struct input_dev *input) | |
121 | +{ | |
122 | + struct bfin_rot *rotary = input_get_drvdata(input); | |
123 | + | |
124 | + writew(0, rotary->base + CNT_CONFIG_OFF); | |
125 | + writew(0, rotary->base + CNT_IMASK_OFF); | |
126 | +} | |
127 | + | |
128 | +static void bfin_rotary_free_action(void *data) | |
129 | +{ | |
130 | + peripheral_free_list(data); | |
131 | +} | |
132 | + | |
92 | 133 | static int bfin_rotary_probe(struct platform_device *pdev) |
93 | 134 | { |
94 | - struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
135 | + struct device *dev = &pdev->dev; | |
136 | + const struct bfin_rotary_platform_data *pdata = dev_get_platdata(dev); | |
95 | 137 | struct bfin_rot *rotary; |
138 | + struct resource *res; | |
96 | 139 | struct input_dev *input; |
97 | 140 | int error; |
98 | 141 | |
99 | 142 | |
100 | 143 | |
... | ... | @@ -102,19 +145,38 @@ |
102 | 145 | return -EINVAL; |
103 | 146 | } |
104 | 147 | |
105 | - error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); | |
106 | - if (error) { | |
107 | - dev_err(&pdev->dev, "requesting peripherals failed\n"); | |
108 | - return error; | |
109 | - } | |
148 | + if (pdata->pin_list) { | |
149 | + error = peripheral_request_list(pdata->pin_list, | |
150 | + dev_name(&pdev->dev)); | |
151 | + if (error) { | |
152 | + dev_err(dev, "requesting peripherals failed: %d\n", | |
153 | + error); | |
154 | + return error; | |
155 | + } | |
110 | 156 | |
111 | - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); | |
112 | - input = input_allocate_device(); | |
113 | - if (!rotary || !input) { | |
114 | - error = -ENOMEM; | |
115 | - goto out1; | |
157 | + error = devm_add_action(dev, bfin_rotary_free_action, | |
158 | + pdata->pin_list); | |
159 | + if (error) { | |
160 | + dev_err(dev, "setting cleanup action failed: %d\n", | |
161 | + error); | |
162 | + peripheral_free_list(pdata->pin_list); | |
163 | + return error; | |
164 | + } | |
116 | 165 | } |
117 | 166 | |
167 | + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); | |
168 | + if (!rotary) | |
169 | + return -ENOMEM; | |
170 | + | |
171 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
172 | + rotary->base = devm_ioremap_resource(dev, res); | |
173 | + if (IS_ERR(rotary->base)) | |
174 | + return PTR_ERR(rotary->base); | |
175 | + | |
176 | + input = devm_input_allocate_device(dev); | |
177 | + if (!input) | |
178 | + return -ENOMEM; | |
179 | + | |
118 | 180 | rotary->input = input; |
119 | 181 | |
120 | 182 | rotary->up_key = pdata->rotary_up_key; |
... | ... | @@ -122,9 +184,8 @@ |
122 | 184 | rotary->button_key = pdata->rotary_button_key; |
123 | 185 | rotary->rel_code = pdata->rotary_rel_code; |
124 | 186 | |
125 | - error = rotary->irq = platform_get_irq(pdev, 0); | |
126 | - if (error < 0) | |
127 | - goto out1; | |
187 | + rotary->mode = pdata->mode; | |
188 | + rotary->debounce = pdata->debounce; | |
128 | 189 | |
129 | 190 | input->name = pdev->name; |
130 | 191 | input->phys = "bfin-rotary/input0"; |
... | ... | @@ -137,6 +198,9 @@ |
137 | 198 | input->id.product = 0x0001; |
138 | 199 | input->id.version = 0x0100; |
139 | 200 | |
201 | + input->open = bfin_rotary_open; | |
202 | + input->close = bfin_rotary_close; | |
203 | + | |
140 | 204 | if (rotary->up_key) { |
141 | 205 | __set_bit(EV_KEY, input->evbit); |
142 | 206 | __set_bit(rotary->up_key, input->keybit); |
143 | 207 | |
144 | 208 | |
145 | 209 | |
146 | 210 | |
147 | 211 | |
148 | 212 | |
149 | 213 | |
150 | 214 | |
... | ... | @@ -151,75 +215,43 @@ |
151 | 215 | __set_bit(rotary->button_key, input->keybit); |
152 | 216 | } |
153 | 217 | |
154 | - error = request_irq(rotary->irq, bfin_rotary_isr, | |
155 | - 0, dev_name(&pdev->dev), pdev); | |
218 | + /* Quiesce the device before requesting irq */ | |
219 | + bfin_rotary_close(input); | |
220 | + | |
221 | + rotary->irq = platform_get_irq(pdev, 0); | |
222 | + if (rotary->irq < 0) { | |
223 | + dev_err(dev, "No rotary IRQ specified\n"); | |
224 | + return -ENOENT; | |
225 | + } | |
226 | + | |
227 | + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, | |
228 | + 0, dev_name(dev), rotary); | |
156 | 229 | if (error) { |
157 | - dev_err(&pdev->dev, | |
158 | - "unable to claim irq %d; error %d\n", | |
230 | + dev_err(dev, "unable to claim irq %d; error %d\n", | |
159 | 231 | rotary->irq, error); |
160 | - goto out1; | |
232 | + return error; | |
161 | 233 | } |
162 | 234 | |
163 | 235 | error = input_register_device(input); |
164 | 236 | if (error) { |
165 | - dev_err(&pdev->dev, | |
166 | - "unable to register input device (%d)\n", error); | |
167 | - goto out2; | |
237 | + dev_err(dev, "unable to register input device (%d)\n", error); | |
238 | + return error; | |
168 | 239 | } |
169 | 240 | |
170 | - if (pdata->rotary_button_key) | |
171 | - bfin_write_CNT_IMASK(CZMIE); | |
172 | - | |
173 | - if (pdata->mode & ROT_DEBE) | |
174 | - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); | |
175 | - | |
176 | - if (pdata->mode) | |
177 | - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | | |
178 | - (pdata->mode & ~CNTE)); | |
179 | - | |
180 | - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); | |
181 | - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); | |
182 | - | |
183 | 241 | platform_set_drvdata(pdev, rotary); |
184 | 242 | device_init_wakeup(&pdev->dev, 1); |
185 | 243 | |
186 | 244 | return 0; |
187 | - | |
188 | -out2: | |
189 | - free_irq(rotary->irq, pdev); | |
190 | -out1: | |
191 | - input_free_device(input); | |
192 | - kfree(rotary); | |
193 | - peripheral_free_list(per_cnt); | |
194 | - | |
195 | - return error; | |
196 | 245 | } |
197 | 246 | |
198 | -static int bfin_rotary_remove(struct platform_device *pdev) | |
247 | +static int __maybe_unused bfin_rotary_suspend(struct device *dev) | |
199 | 248 | { |
200 | - struct bfin_rot *rotary = platform_get_drvdata(pdev); | |
201 | - | |
202 | - bfin_write_CNT_CONFIG(0); | |
203 | - bfin_write_CNT_IMASK(0); | |
204 | - | |
205 | - free_irq(rotary->irq, pdev); | |
206 | - input_unregister_device(rotary->input); | |
207 | - peripheral_free_list(per_cnt); | |
208 | - | |
209 | - kfree(rotary); | |
210 | - | |
211 | - return 0; | |
212 | -} | |
213 | - | |
214 | -#ifdef CONFIG_PM | |
215 | -static int bfin_rotary_suspend(struct device *dev) | |
216 | -{ | |
217 | 249 | struct platform_device *pdev = to_platform_device(dev); |
218 | 250 | struct bfin_rot *rotary = platform_get_drvdata(pdev); |
219 | 251 | |
220 | - rotary->cnt_config = bfin_read_CNT_CONFIG(); | |
221 | - rotary->cnt_imask = bfin_read_CNT_IMASK(); | |
222 | - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); | |
252 | + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); | |
253 | + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); | |
254 | + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); | |
223 | 255 | |
224 | 256 | if (device_may_wakeup(&pdev->dev)) |
225 | 257 | enable_irq_wake(rotary->irq); |
226 | 258 | |
227 | 259 | |
228 | 260 | |
229 | 261 | |
230 | 262 | |
231 | 263 | |
... | ... | @@ -227,38 +259,32 @@ |
227 | 259 | return 0; |
228 | 260 | } |
229 | 261 | |
230 | -static int bfin_rotary_resume(struct device *dev) | |
262 | +static int __maybe_unused bfin_rotary_resume(struct device *dev) | |
231 | 263 | { |
232 | 264 | struct platform_device *pdev = to_platform_device(dev); |
233 | 265 | struct bfin_rot *rotary = platform_get_drvdata(pdev); |
234 | 266 | |
235 | - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); | |
236 | - bfin_write_CNT_IMASK(rotary->cnt_imask); | |
237 | - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); | |
267 | + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); | |
268 | + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); | |
269 | + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); | |
238 | 270 | |
239 | 271 | if (device_may_wakeup(&pdev->dev)) |
240 | 272 | disable_irq_wake(rotary->irq); |
241 | 273 | |
242 | 274 | if (rotary->cnt_config & CNTE) |
243 | - bfin_write_CNT_CONFIG(rotary->cnt_config); | |
275 | + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); | |
244 | 276 | |
245 | 277 | return 0; |
246 | 278 | } |
247 | 279 | |
248 | -static const struct dev_pm_ops bfin_rotary_pm_ops = { | |
249 | - .suspend = bfin_rotary_suspend, | |
250 | - .resume = bfin_rotary_resume, | |
251 | -}; | |
252 | -#endif | |
280 | +static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops, | |
281 | + bfin_rotary_suspend, bfin_rotary_resume); | |
253 | 282 | |
254 | 283 | static struct platform_driver bfin_rotary_device_driver = { |
255 | 284 | .probe = bfin_rotary_probe, |
256 | - .remove = bfin_rotary_remove, | |
257 | 285 | .driver = { |
258 | 286 | .name = "bfin-rotary", |
259 | -#ifdef CONFIG_PM | |
260 | 287 | .pm = &bfin_rotary_pm_ops, |
261 | -#endif | |
262 | 288 | }, |
263 | 289 | }; |
264 | 290 | module_platform_driver(bfin_rotary_device_driver); |
drivers/input/misc/soc_button_array.c
... | ... | @@ -195,7 +195,7 @@ |
195 | 195 | |
196 | 196 | static struct soc_button_info soc_button_PNP0C40[] = { |
197 | 197 | { "power", 0, EV_KEY, KEY_POWER, false, true }, |
198 | - { "home", 1, EV_KEY, KEY_HOME, false, true }, | |
198 | + { "home", 1, EV_KEY, KEY_LEFTMETA, false, true }, | |
199 | 199 | { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false }, |
200 | 200 | { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false }, |
201 | 201 | { "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false }, |
drivers/input/mouse/alps.c
... | ... | @@ -99,49 +99,65 @@ |
99 | 99 | #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ |
100 | 100 | #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with |
101 | 101 | 6-byte ALPS packet */ |
102 | -#define ALPS_IS_RUSHMORE 0x100 /* device is a rushmore */ | |
103 | 102 | #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */ |
104 | 103 | |
105 | 104 | static const struct alps_model_info alps_model_data[] = { |
106 | - { { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ | |
107 | - { { 0x33, 0x02, 0x0a }, 0x00, ALPS_PROTO_V1, 0x88, 0xf8, 0 }, /* UMAX-530T */ | |
108 | - { { 0x53, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
109 | - { { 0x53, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
110 | - { { 0x60, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, /* HP ze1115 */ | |
111 | - { { 0x63, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
112 | - { { 0x63, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
113 | - { { 0x63, 0x02, 0x28 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */ | |
114 | - { { 0x63, 0x02, 0x3c }, 0x00, ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ | |
115 | - { { 0x63, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ | |
116 | - { { 0x63, 0x02, 0x64 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
117 | - { { 0x63, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D800 */ | |
118 | - { { 0x73, 0x00, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT }, /* ThinkPad R61 8918-5QG */ | |
119 | - { { 0x73, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, | |
120 | - { { 0x73, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Ahtec Laptop */ | |
121 | - { { 0x20, 0x02, 0x0e }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ | |
122 | - { { 0x22, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, | |
123 | - { { 0x22, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ | |
105 | + { { 0x32, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Toshiba Salellite Pro M10 */ | |
106 | + { { 0x33, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V1, 0x88, 0xf8, 0 } }, /* UMAX-530T */ | |
107 | + { { 0x53, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
108 | + { { 0x53, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
109 | + { { 0x60, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, /* HP ze1115 */ | |
110 | + { { 0x63, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
111 | + { { 0x63, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
112 | + { { 0x63, 0x02, 0x28 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Fujitsu Siemens S6010 */ | |
113 | + { { 0x63, 0x02, 0x3c }, 0x00, { ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL } }, /* Toshiba Satellite S2400-103 */ | |
114 | + { { 0x63, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 } }, /* NEC Versa L320 */ | |
115 | + { { 0x63, 0x02, 0x64 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
116 | + { { 0x63, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D800 */ | |
117 | + { { 0x73, 0x00, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT } }, /* ThinkPad R61 8918-5QG */ | |
118 | + { { 0x73, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, | |
119 | + { { 0x73, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Ahtec Laptop */ | |
120 | + | |
121 | + /* | |
122 | + * XXX This entry is suspicious. First byte has zero lower nibble, | |
123 | + * which is what a normal mouse would report. Also, the value 0x0e | |
124 | + * isn't valid per PS/2 spec. | |
125 | + */ | |
126 | + { { 0x20, 0x02, 0x0e }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, | |
127 | + | |
128 | + { { 0x22, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, | |
129 | + { { 0x22, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D600 */ | |
124 | 130 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
125 | - { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, | |
126 | - ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | |
127 | - { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT }, /* Dell XT2 */ | |
128 | - { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | |
129 | - { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, | |
130 | - ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | |
131 | - { { 0x73, 0x02, 0x64 }, 0x8a, ALPS_PROTO_V4, 0x8f, 0x8f, 0 }, | |
131 | + { { 0x62, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, | |
132 | + ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } }, | |
133 | + { { 0x73, 0x00, 0x14 }, 0x00, { ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT } }, /* Dell XT2 */ | |
134 | + { { 0x73, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } }, /* Dell Vostro 1400 */ | |
135 | + { { 0x52, 0x01, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, | |
136 | + ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } }, /* Toshiba Tecra A11-11L */ | |
137 | + { { 0x73, 0x02, 0x64 }, 0x8a, { ALPS_PROTO_V4, 0x8f, 0x8f, 0 } }, | |
132 | 138 | }; |
133 | 139 | |
140 | +static const struct alps_protocol_info alps_v3_protocol_data = { | |
141 | + ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT | |
142 | +}; | |
143 | + | |
144 | +static const struct alps_protocol_info alps_v3_rushmore_data = { | |
145 | + ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT | |
146 | +}; | |
147 | + | |
148 | +static const struct alps_protocol_info alps_v5_protocol_data = { | |
149 | + ALPS_PROTO_V5, 0xc8, 0xd8, 0 | |
150 | +}; | |
151 | + | |
152 | +static const struct alps_protocol_info alps_v7_protocol_data = { | |
153 | + ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT | |
154 | +}; | |
155 | + | |
134 | 156 | static void alps_set_abs_params_st(struct alps_data *priv, |
135 | 157 | struct input_dev *dev1); |
136 | 158 | static void alps_set_abs_params_mt(struct alps_data *priv, |
137 | 159 | struct input_dev *dev1); |
138 | 160 | |
139 | -/* | |
140 | - * XXX - this entry is suspicious. First byte has zero lower nibble, | |
141 | - * which is what a normal mouse would report. Also, the value 0x0e | |
142 | - * isn't valid per PS/2 spec. | |
143 | - */ | |
144 | - | |
145 | 161 | /* Packet formats are described in Documentation/input/alps.txt */ |
146 | 162 | |
147 | 163 | static bool alps_is_valid_first_byte(struct alps_data *priv, |
... | ... | @@ -150,8 +166,7 @@ |
150 | 166 | return (data & priv->mask0) == priv->byte0; |
151 | 167 | } |
152 | 168 | |
153 | -static void alps_report_buttons(struct psmouse *psmouse, | |
154 | - struct input_dev *dev1, struct input_dev *dev2, | |
169 | +static void alps_report_buttons(struct input_dev *dev1, struct input_dev *dev2, | |
155 | 170 | int left, int right, int middle) |
156 | 171 | { |
157 | 172 | struct input_dev *dev; |
158 | 173 | |
159 | 174 | |
160 | 175 | |
... | ... | @@ -161,20 +176,21 @@ |
161 | 176 | * other device (dev2) then this event should be also |
162 | 177 | * sent through that device. |
163 | 178 | */ |
164 | - dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1; | |
179 | + dev = (dev2 && test_bit(BTN_LEFT, dev2->key)) ? dev2 : dev1; | |
165 | 180 | input_report_key(dev, BTN_LEFT, left); |
166 | 181 | |
167 | - dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1; | |
182 | + dev = (dev2 && test_bit(BTN_RIGHT, dev2->key)) ? dev2 : dev1; | |
168 | 183 | input_report_key(dev, BTN_RIGHT, right); |
169 | 184 | |
170 | - dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1; | |
185 | + dev = (dev2 && test_bit(BTN_MIDDLE, dev2->key)) ? dev2 : dev1; | |
171 | 186 | input_report_key(dev, BTN_MIDDLE, middle); |
172 | 187 | |
173 | 188 | /* |
174 | 189 | * Sync the _other_ device now, we'll do the first |
175 | 190 | * device later once we report the rest of the events. |
176 | 191 | */ |
177 | - input_sync(dev2); | |
192 | + if (dev2) | |
193 | + input_sync(dev2); | |
178 | 194 | } |
179 | 195 | |
180 | 196 | static void alps_process_packet_v1_v2(struct psmouse *psmouse) |
181 | 197 | |
... | ... | @@ -221,13 +237,13 @@ |
221 | 237 | input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); |
222 | 238 | input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); |
223 | 239 | |
224 | - alps_report_buttons(psmouse, dev2, dev, left, right, middle); | |
240 | + alps_report_buttons(dev2, dev, left, right, middle); | |
225 | 241 | |
226 | 242 | input_sync(dev2); |
227 | 243 | return; |
228 | 244 | } |
229 | 245 | |
230 | - alps_report_buttons(psmouse, dev, dev2, left, right, middle); | |
246 | + alps_report_buttons(dev, dev2, left, right, middle); | |
231 | 247 | |
232 | 248 | /* Convert hardware tap to a reasonable Z value */ |
233 | 249 | if (ges && !fin) |
... | ... | @@ -412,7 +428,7 @@ |
412 | 428 | (2 * (priv->y_bits - 1)); |
413 | 429 | |
414 | 430 | /* y-bitmap order is reversed, except on rushmore */ |
415 | - if (!(priv->flags & ALPS_IS_RUSHMORE)) { | |
431 | + if (priv->proto_version != ALPS_PROTO_V3_RUSHMORE) { | |
416 | 432 | fields->mt[0].y = priv->y_max - fields->mt[0].y; |
417 | 433 | fields->mt[1].y = priv->y_max - fields->mt[1].y; |
418 | 434 | } |
... | ... | @@ -648,7 +664,8 @@ |
648 | 664 | */ |
649 | 665 | if (f->is_mp) { |
650 | 666 | fingers = f->fingers; |
651 | - if (priv->proto_version == ALPS_PROTO_V3) { | |
667 | + if (priv->proto_version == ALPS_PROTO_V3 || | |
668 | + priv->proto_version == ALPS_PROTO_V3_RUSHMORE) { | |
652 | 669 | if (alps_process_bitmap(priv, f) == 0) |
653 | 670 | fingers = 0; /* Use st data */ |
654 | 671 | |
... | ... | @@ -892,34 +909,6 @@ |
892 | 909 | unsigned char *pkt, |
893 | 910 | unsigned char pkt_id) |
894 | 911 | { |
895 | - /* | |
896 | - * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 | |
897 | - * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 | |
898 | - * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 | |
899 | - * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 | |
900 | - * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 | |
901 | - * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 | |
902 | - * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 | |
903 | - * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 | |
904 | - * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 | |
905 | - * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 | |
906 | - * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 | |
907 | - * L: Left button | |
908 | - * R / M: Non-clickpads: Right / Middle button | |
909 | - * Clickpads: When > 2 fingers are down, and some fingers | |
910 | - * are in the button area, then the 2 coordinates reported | |
911 | - * are for fingers outside the button area and these report | |
912 | - * extra fingers being present in the right / left button | |
913 | - * area. Note these fingers are not added to the F field! | |
914 | - * so if a TWO packet is received and R = 1 then there are | |
915 | - * 3 fingers down, etc. | |
916 | - * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt | |
917 | - * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt | |
918 | - * otherwise byte 0 bit 4 must be set and byte 0/4/5 are | |
919 | - * in NEW fmt | |
920 | - * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... | |
921 | - */ | |
922 | - | |
923 | 912 | mt[0].x = ((pkt[2] & 0x80) << 4); |
924 | 913 | mt[0].x |= ((pkt[2] & 0x3F) << 5); |
925 | 914 | mt[0].x |= ((pkt[3] & 0x30) >> 1); |
... | ... | @@ -1044,17 +1033,6 @@ |
1044 | 1033 | return; |
1045 | 1034 | } |
1046 | 1035 | |
1047 | - /* | |
1048 | - * b7 b6 b5 b4 b3 b2 b1 b0 | |
1049 | - * Byte0 0 1 0 0 1 0 0 0 | |
1050 | - * Byte1 1 1 * * 1 M R L | |
1051 | - * Byte2 X7 1 X5 X4 X3 X2 X1 X0 | |
1052 | - * Byte3 Z6 1 Y6 X6 1 Y2 Y1 Y0 | |
1053 | - * Byte4 Y7 0 Y5 Y4 Y3 1 1 0 | |
1054 | - * Byte5 T&P 0 Z5 Z4 Z3 Z2 Z1 Z0 | |
1055 | - * M / R / L: Middle / Right / Left button | |
1056 | - */ | |
1057 | - | |
1058 | 1036 | x = ((packet[2] & 0xbf)) | ((packet[3] & 0x10) << 2); |
1059 | 1037 | y = (packet[3] & 0x07) | (packet[4] & 0xb8) | |
1060 | 1038 | ((packet[3] & 0x20) << 1); |
1061 | 1039 | |
1062 | 1040 | |
1063 | 1041 | |
1064 | 1042 | |
1065 | 1043 | |
... | ... | @@ -1107,23 +1085,89 @@ |
1107 | 1085 | alps_process_touchpad_packet_v7(psmouse); |
1108 | 1086 | } |
1109 | 1087 | |
1110 | -static void alps_report_bare_ps2_packet(struct psmouse *psmouse, | |
1088 | +static DEFINE_MUTEX(alps_mutex); | |
1089 | + | |
1090 | +static void alps_register_bare_ps2_mouse(struct work_struct *work) | |
1091 | +{ | |
1092 | + struct alps_data *priv = | |
1093 | + container_of(work, struct alps_data, dev3_register_work.work); | |
1094 | + struct psmouse *psmouse = priv->psmouse; | |
1095 | + struct input_dev *dev3; | |
1096 | + int error = 0; | |
1097 | + | |
1098 | + mutex_lock(&alps_mutex); | |
1099 | + | |
1100 | + if (priv->dev3) | |
1101 | + goto out; | |
1102 | + | |
1103 | + dev3 = input_allocate_device(); | |
1104 | + if (!dev3) { | |
1105 | + psmouse_err(psmouse, "failed to allocate secondary device\n"); | |
1106 | + error = -ENOMEM; | |
1107 | + goto out; | |
1108 | + } | |
1109 | + | |
1110 | + snprintf(priv->phys3, sizeof(priv->phys3), "%s/%s", | |
1111 | + psmouse->ps2dev.serio->phys, | |
1112 | + (priv->dev2 ? "input2" : "input1")); | |
1113 | + dev3->phys = priv->phys3; | |
1114 | + | |
1115 | + /* | |
1116 | + * format of input device name is: "protocol vendor name" | |
1117 | + * see function psmouse_switch_protocol() in psmouse-base.c | |
1118 | + */ | |
1119 | + dev3->name = "PS/2 ALPS Mouse"; | |
1120 | + | |
1121 | + dev3->id.bustype = BUS_I8042; | |
1122 | + dev3->id.vendor = 0x0002; | |
1123 | + dev3->id.product = PSMOUSE_PS2; | |
1124 | + dev3->id.version = 0x0000; | |
1125 | + dev3->dev.parent = &psmouse->ps2dev.serio->dev; | |
1126 | + | |
1127 | + input_set_capability(dev3, EV_REL, REL_X); | |
1128 | + input_set_capability(dev3, EV_REL, REL_Y); | |
1129 | + input_set_capability(dev3, EV_KEY, BTN_LEFT); | |
1130 | + input_set_capability(dev3, EV_KEY, BTN_RIGHT); | |
1131 | + input_set_capability(dev3, EV_KEY, BTN_MIDDLE); | |
1132 | + | |
1133 | + __set_bit(INPUT_PROP_POINTER, dev3->propbit); | |
1134 | + | |
1135 | + error = input_register_device(dev3); | |
1136 | + if (error) { | |
1137 | + psmouse_err(psmouse, | |
1138 | + "failed to register secondary device: %d\n", | |
1139 | + error); | |
1140 | + input_free_device(dev3); | |
1141 | + goto out; | |
1142 | + } | |
1143 | + | |
1144 | + priv->dev3 = dev3; | |
1145 | + | |
1146 | +out: | |
1147 | + /* | |
1148 | + * Save the error code so that we can detect that we | |
1149 | + * already tried to create the device. | |
1150 | + */ | |
1151 | + if (error) | |
1152 | + priv->dev3 = ERR_PTR(error); | |
1153 | + | |
1154 | + mutex_unlock(&alps_mutex); | |
1155 | +} | |
1156 | + | |
1157 | +static void alps_report_bare_ps2_packet(struct input_dev *dev, | |
1111 | 1158 | unsigned char packet[], |
1112 | 1159 | bool report_buttons) |
1113 | 1160 | { |
1114 | - struct alps_data *priv = psmouse->private; | |
1115 | - struct input_dev *dev2 = priv->dev2; | |
1116 | - | |
1117 | 1161 | if (report_buttons) |
1118 | - alps_report_buttons(psmouse, dev2, psmouse->dev, | |
1162 | + alps_report_buttons(dev, NULL, | |
1119 | 1163 | packet[0] & 1, packet[0] & 2, packet[0] & 4); |
1120 | 1164 | |
1121 | - input_report_rel(dev2, REL_X, | |
1165 | + input_report_rel(dev, REL_X, | |
1122 | 1166 | packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0); |
1123 | - input_report_rel(dev2, REL_Y, | |
1167 | + input_report_rel(dev, REL_Y, | |
1124 | 1168 | packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0); |
1125 | 1169 | |
1126 | - input_sync(dev2); | |
1170 | + input_sync(dev); | |
1127 | 1171 | } |
1128 | 1172 | |
1129 | 1173 | static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) |
... | ... | @@ -1188,8 +1232,8 @@ |
1188 | 1232 | * de-synchronization. |
1189 | 1233 | */ |
1190 | 1234 | |
1191 | - alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3], | |
1192 | - false); | |
1235 | + alps_report_bare_ps2_packet(priv->dev2, | |
1236 | + &psmouse->packet[3], false); | |
1193 | 1237 | |
1194 | 1238 | /* |
1195 | 1239 | * Continue with the standard ALPS protocol handling, |
1196 | 1240 | |
... | ... | @@ -1245,9 +1289,18 @@ |
1245 | 1289 | * properly we only do this if the device is fully synchronized. |
1246 | 1290 | */ |
1247 | 1291 | if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { |
1292 | + | |
1293 | + /* Register dev3 mouse if we received PS/2 packet first time */ | |
1294 | + if (unlikely(!priv->dev3)) | |
1295 | + psmouse_queue_work(psmouse, | |
1296 | + &priv->dev3_register_work, 0); | |
1297 | + | |
1248 | 1298 | if (psmouse->pktcnt == 3) { |
1249 | - alps_report_bare_ps2_packet(psmouse, psmouse->packet, | |
1250 | - true); | |
1299 | + /* Once dev3 mouse device is registered report data */ | |
1300 | + if (likely(!IS_ERR_OR_NULL(priv->dev3))) | |
1301 | + alps_report_bare_ps2_packet(priv->dev3, | |
1302 | + psmouse->packet, | |
1303 | + true); | |
1251 | 1304 | return PSMOUSE_FULL_PACKET; |
1252 | 1305 | } |
1253 | 1306 | return PSMOUSE_GOOD_DATA; |
... | ... | @@ -1275,7 +1328,7 @@ |
1275 | 1328 | psmouse->pktcnt - 1, |
1276 | 1329 | psmouse->packet[psmouse->pktcnt - 1]); |
1277 | 1330 | |
1278 | - if (priv->proto_version == ALPS_PROTO_V3 && | |
1331 | + if (priv->proto_version == ALPS_PROTO_V3_RUSHMORE && | |
1279 | 1332 | psmouse->pktcnt == psmouse->pktsize) { |
1280 | 1333 | /* |
1281 | 1334 | * Some Dell boxes, such as Latitude E6440 or E7440 |
... | ... | @@ -1780,7 +1833,7 @@ |
1780 | 1833 | * all. |
1781 | 1834 | */ |
1782 | 1835 | if (alps_rpt_cmd(psmouse, 0, PSMOUSE_CMD_SETSCALE21, param)) { |
1783 | - psmouse_warn(psmouse, "trackstick E7 report failed\n"); | |
1836 | + psmouse_warn(psmouse, "Failed to initialize trackstick (E7 report failed)\n"); | |
1784 | 1837 | ret = -ENODEV; |
1785 | 1838 | } else { |
1786 | 1839 | psmouse_dbg(psmouse, "trackstick E7 report: %3ph\n", param); |
... | ... | @@ -1945,8 +1998,6 @@ |
1945 | 1998 | ALPS_REG_BASE_RUSHMORE); |
1946 | 1999 | if (reg_val == -EIO) |
1947 | 2000 | goto error; |
1948 | - if (reg_val == -ENODEV) | |
1949 | - priv->flags &= ~ALPS_DUALPOINT; | |
1950 | 2001 | } |
1951 | 2002 | |
1952 | 2003 | if (alps_enter_command_mode(psmouse) || |
1953 | 2004 | |
1954 | 2005 | |
... | ... | @@ -2162,12 +2213,19 @@ |
2162 | 2213 | return ret; |
2163 | 2214 | } |
2164 | 2215 | |
2165 | -static void alps_set_defaults(struct alps_data *priv) | |
2216 | +static int alps_set_protocol(struct psmouse *psmouse, | |
2217 | + struct alps_data *priv, | |
2218 | + const struct alps_protocol_info *protocol) | |
2166 | 2219 | { |
2167 | - priv->byte0 = 0x8f; | |
2168 | - priv->mask0 = 0x8f; | |
2169 | - priv->flags = ALPS_DUALPOINT; | |
2220 | + psmouse->private = priv; | |
2170 | 2221 | |
2222 | + setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse); | |
2223 | + | |
2224 | + priv->proto_version = protocol->version; | |
2225 | + priv->byte0 = protocol->byte0; | |
2226 | + priv->mask0 = protocol->mask0; | |
2227 | + priv->flags = protocol->flags; | |
2228 | + | |
2171 | 2229 | priv->x_max = 2000; |
2172 | 2230 | priv->y_max = 1400; |
2173 | 2231 | priv->x_bits = 15; |
... | ... | @@ -2182,6 +2240,7 @@ |
2182 | 2240 | priv->x_max = 1023; |
2183 | 2241 | priv->y_max = 767; |
2184 | 2242 | break; |
2243 | + | |
2185 | 2244 | case ALPS_PROTO_V3: |
2186 | 2245 | priv->hw_init = alps_hw_init_v3; |
2187 | 2246 | priv->process_packet = alps_process_packet_v3; |
... | ... | @@ -2190,6 +2249,23 @@ |
2190 | 2249 | priv->nibble_commands = alps_v3_nibble_commands; |
2191 | 2250 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; |
2192 | 2251 | break; |
2252 | + | |
2253 | + case ALPS_PROTO_V3_RUSHMORE: | |
2254 | + priv->hw_init = alps_hw_init_rushmore_v3; | |
2255 | + priv->process_packet = alps_process_packet_v3; | |
2256 | + priv->set_abs_params = alps_set_abs_params_mt; | |
2257 | + priv->decode_fields = alps_decode_rushmore; | |
2258 | + priv->nibble_commands = alps_v3_nibble_commands; | |
2259 | + priv->addr_command = PSMOUSE_CMD_RESET_WRAP; | |
2260 | + priv->x_bits = 16; | |
2261 | + priv->y_bits = 12; | |
2262 | + | |
2263 | + if (alps_probe_trackstick_v3(psmouse, | |
2264 | + ALPS_REG_BASE_RUSHMORE) < 0) | |
2265 | + priv->flags &= ~ALPS_DUALPOINT; | |
2266 | + | |
2267 | + break; | |
2268 | + | |
2193 | 2269 | case ALPS_PROTO_V4: |
2194 | 2270 | priv->hw_init = alps_hw_init_v4; |
2195 | 2271 | priv->process_packet = alps_process_packet_v4; |
... | ... | @@ -2197,6 +2273,7 @@ |
2197 | 2273 | priv->nibble_commands = alps_v4_nibble_commands; |
2198 | 2274 | priv->addr_command = PSMOUSE_CMD_DISABLE; |
2199 | 2275 | break; |
2276 | + | |
2200 | 2277 | case ALPS_PROTO_V5: |
2201 | 2278 | priv->hw_init = alps_hw_init_dolphin_v1; |
2202 | 2279 | priv->process_packet = alps_process_touchpad_packet_v3_v5; |
2203 | 2280 | |
... | ... | @@ -2204,14 +2281,12 @@ |
2204 | 2281 | priv->set_abs_params = alps_set_abs_params_mt; |
2205 | 2282 | priv->nibble_commands = alps_v3_nibble_commands; |
2206 | 2283 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; |
2207 | - priv->byte0 = 0xc8; | |
2208 | - priv->mask0 = 0xd8; | |
2209 | - priv->flags = 0; | |
2210 | 2284 | priv->x_max = 1360; |
2211 | 2285 | priv->y_max = 660; |
2212 | 2286 | priv->x_bits = 23; |
2213 | 2287 | priv->y_bits = 12; |
2214 | 2288 | break; |
2289 | + | |
2215 | 2290 | case ALPS_PROTO_V6: |
2216 | 2291 | priv->hw_init = alps_hw_init_v6; |
2217 | 2292 | priv->process_packet = alps_process_packet_v6; |
... | ... | @@ -2220,6 +2295,7 @@ |
2220 | 2295 | priv->x_max = 2047; |
2221 | 2296 | priv->y_max = 1535; |
2222 | 2297 | break; |
2298 | + | |
2223 | 2299 | case ALPS_PROTO_V7: |
2224 | 2300 | priv->hw_init = alps_hw_init_v7; |
2225 | 2301 | priv->process_packet = alps_process_packet_v7; |
2226 | 2302 | |
2227 | 2303 | |
2228 | 2304 | |
2229 | 2305 | |
... | ... | @@ -2227,19 +2303,21 @@ |
2227 | 2303 | priv->set_abs_params = alps_set_abs_params_mt; |
2228 | 2304 | priv->nibble_commands = alps_v3_nibble_commands; |
2229 | 2305 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; |
2230 | - priv->x_max = 0xfff; | |
2231 | - priv->y_max = 0x7ff; | |
2232 | - priv->byte0 = 0x48; | |
2233 | - priv->mask0 = 0x48; | |
2234 | 2306 | |
2307 | + if (alps_dolphin_get_device_area(psmouse, priv)) | |
2308 | + return -EIO; | |
2309 | + | |
2235 | 2310 | if (priv->fw_ver[1] != 0xba) |
2236 | 2311 | priv->flags |= ALPS_BUTTONPAD; |
2312 | + | |
2237 | 2313 | break; |
2238 | 2314 | } |
2315 | + | |
2316 | + return 0; | |
2239 | 2317 | } |
2240 | 2318 | |
2241 | -static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv, | |
2242 | - unsigned char *e7, unsigned char *ec) | |
2319 | +static const struct alps_protocol_info *alps_match_table(unsigned char *e7, | |
2320 | + unsigned char *ec) | |
2243 | 2321 | { |
2244 | 2322 | const struct alps_model_info *model; |
2245 | 2323 | int i; |
2246 | 2324 | |
2247 | 2325 | |
2248 | 2326 | |
... | ... | @@ -2251,23 +2329,18 @@ |
2251 | 2329 | (!model->command_mode_resp || |
2252 | 2330 | model->command_mode_resp == ec[2])) { |
2253 | 2331 | |
2254 | - priv->proto_version = model->proto_version; | |
2255 | - alps_set_defaults(priv); | |
2256 | - | |
2257 | - priv->flags = model->flags; | |
2258 | - priv->byte0 = model->byte0; | |
2259 | - priv->mask0 = model->mask0; | |
2260 | - | |
2261 | - return 0; | |
2332 | + return &model->protocol_info; | |
2262 | 2333 | } |
2263 | 2334 | } |
2264 | 2335 | |
2265 | - return -EINVAL; | |
2336 | + return NULL; | |
2266 | 2337 | } |
2267 | 2338 | |
2268 | 2339 | static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) |
2269 | 2340 | { |
2341 | + const struct alps_protocol_info *protocol; | |
2270 | 2342 | unsigned char e6[4], e7[4], ec[4]; |
2343 | + int error; | |
2271 | 2344 | |
2272 | 2345 | /* |
2273 | 2346 | * First try "E6 report". |
2274 | 2347 | |
2275 | 2348 | |
... | ... | @@ -2293,54 +2366,35 @@ |
2293 | 2366 | alps_exit_command_mode(psmouse)) |
2294 | 2367 | return -EIO; |
2295 | 2368 | |
2296 | - /* Save the Firmware version */ | |
2297 | - memcpy(priv->fw_ver, ec, 3); | |
2369 | + protocol = alps_match_table(e7, ec); | |
2370 | + if (!protocol) { | |
2371 | + if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && | |
2372 | + ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) { | |
2373 | + protocol = &alps_v5_protocol_data; | |
2374 | + } else if (ec[0] == 0x88 && | |
2375 | + ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) { | |
2376 | + protocol = &alps_v7_protocol_data; | |
2377 | + } else if (ec[0] == 0x88 && ec[1] == 0x08) { | |
2378 | + protocol = &alps_v3_rushmore_data; | |
2379 | + } else if (ec[0] == 0x88 && ec[1] == 0x07 && | |
2380 | + ec[2] >= 0x90 && ec[2] <= 0x9d) { | |
2381 | + protocol = &alps_v3_protocol_data; | |
2382 | + } else { | |
2383 | + psmouse_dbg(psmouse, | |
2384 | + "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | |
2385 | + return -EINVAL; | |
2386 | + } | |
2387 | + } | |
2298 | 2388 | |
2299 | - if (alps_match_table(psmouse, priv, e7, ec) == 0) { | |
2300 | - return 0; | |
2301 | - } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && | |
2302 | - ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) { | |
2303 | - priv->proto_version = ALPS_PROTO_V5; | |
2304 | - alps_set_defaults(priv); | |
2305 | - if (alps_dolphin_get_device_area(psmouse, priv)) | |
2306 | - return -EIO; | |
2307 | - else | |
2308 | - return 0; | |
2309 | - } else if (ec[0] == 0x88 && | |
2310 | - ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) { | |
2311 | - priv->proto_version = ALPS_PROTO_V7; | |
2312 | - alps_set_defaults(priv); | |
2313 | - | |
2314 | - return 0; | |
2315 | - } else if (ec[0] == 0x88 && ec[1] == 0x08) { | |
2316 | - priv->proto_version = ALPS_PROTO_V3; | |
2317 | - alps_set_defaults(priv); | |
2318 | - | |
2319 | - priv->hw_init = alps_hw_init_rushmore_v3; | |
2320 | - priv->decode_fields = alps_decode_rushmore; | |
2321 | - priv->x_bits = 16; | |
2322 | - priv->y_bits = 12; | |
2323 | - priv->flags |= ALPS_IS_RUSHMORE; | |
2324 | - | |
2325 | - /* hack to make addr_command, nibble_command available */ | |
2326 | - psmouse->private = priv; | |
2327 | - | |
2328 | - if (alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE)) | |
2329 | - priv->flags &= ~ALPS_DUALPOINT; | |
2330 | - | |
2331 | - return 0; | |
2332 | - } else if (ec[0] == 0x88 && ec[1] == 0x07 && | |
2333 | - ec[2] >= 0x90 && ec[2] <= 0x9d) { | |
2334 | - priv->proto_version = ALPS_PROTO_V3; | |
2335 | - alps_set_defaults(priv); | |
2336 | - | |
2337 | - return 0; | |
2389 | + if (priv) { | |
2390 | + /* Save the Firmware version */ | |
2391 | + memcpy(priv->fw_ver, ec, 3); | |
2392 | + error = alps_set_protocol(psmouse, priv, protocol); | |
2393 | + if (error) | |
2394 | + return error; | |
2338 | 2395 | } |
2339 | 2396 | |
2340 | - psmouse_dbg(psmouse, | |
2341 | - "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | |
2342 | - | |
2343 | - return -EINVAL; | |
2397 | + return 0; | |
2344 | 2398 | } |
2345 | 2399 | |
2346 | 2400 | static int alps_reconnect(struct psmouse *psmouse) |
... | ... | @@ -2361,7 +2415,10 @@ |
2361 | 2415 | |
2362 | 2416 | psmouse_reset(psmouse); |
2363 | 2417 | del_timer_sync(&priv->timer); |
2364 | - input_unregister_device(priv->dev2); | |
2418 | + if (priv->dev2) | |
2419 | + input_unregister_device(priv->dev2); | |
2420 | + if (!IS_ERR_OR_NULL(priv->dev3)) | |
2421 | + input_unregister_device(priv->dev3); | |
2365 | 2422 | kfree(priv); |
2366 | 2423 | } |
2367 | 2424 | |
2368 | 2425 | |
2369 | 2426 | |
... | ... | @@ -2394,27 +2451,14 @@ |
2394 | 2451 | |
2395 | 2452 | int alps_init(struct psmouse *psmouse) |
2396 | 2453 | { |
2397 | - struct alps_data *priv; | |
2398 | - struct input_dev *dev1 = psmouse->dev, *dev2; | |
2454 | + struct alps_data *priv = psmouse->private; | |
2455 | + struct input_dev *dev1 = psmouse->dev; | |
2456 | + int error; | |
2399 | 2457 | |
2400 | - priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); | |
2401 | - dev2 = input_allocate_device(); | |
2402 | - if (!priv || !dev2) | |
2458 | + error = priv->hw_init(psmouse); | |
2459 | + if (error) | |
2403 | 2460 | goto init_fail; |
2404 | 2461 | |
2405 | - priv->dev2 = dev2; | |
2406 | - setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse); | |
2407 | - | |
2408 | - psmouse->private = priv; | |
2409 | - | |
2410 | - psmouse_reset(psmouse); | |
2411 | - | |
2412 | - if (alps_identify(psmouse, priv) < 0) | |
2413 | - goto init_fail; | |
2414 | - | |
2415 | - if (priv->hw_init(psmouse)) | |
2416 | - goto init_fail; | |
2417 | - | |
2418 | 2462 | /* |
2419 | 2463 | * Undo part of setup done for us by psmouse core since touchpad |
2420 | 2464 | * is not a relative device. |
2421 | 2465 | |
2422 | 2466 | |
2423 | 2467 | |
2424 | 2468 | |
2425 | 2469 | |
2426 | 2470 | |
... | ... | @@ -2462,37 +2506,58 @@ |
2462 | 2506 | } |
2463 | 2507 | |
2464 | 2508 | if (priv->flags & ALPS_DUALPOINT) { |
2509 | + struct input_dev *dev2; | |
2510 | + | |
2511 | + dev2 = input_allocate_device(); | |
2512 | + if (!dev2) { | |
2513 | + psmouse_err(psmouse, | |
2514 | + "failed to allocate trackstick device\n"); | |
2515 | + error = -ENOMEM; | |
2516 | + goto init_fail; | |
2517 | + } | |
2518 | + | |
2519 | + snprintf(priv->phys2, sizeof(priv->phys2), "%s/input1", | |
2520 | + psmouse->ps2dev.serio->phys); | |
2521 | + dev2->phys = priv->phys2; | |
2522 | + | |
2465 | 2523 | /* |
2466 | 2524 | * format of input device name is: "protocol vendor name" |
2467 | 2525 | * see function psmouse_switch_protocol() in psmouse-base.c |
2468 | 2526 | */ |
2469 | 2527 | dev2->name = "AlpsPS/2 ALPS DualPoint Stick"; |
2528 | + | |
2529 | + dev2->id.bustype = BUS_I8042; | |
2530 | + dev2->id.vendor = 0x0002; | |
2470 | 2531 | dev2->id.product = PSMOUSE_ALPS; |
2471 | 2532 | dev2->id.version = priv->proto_version; |
2472 | - } else { | |
2473 | - dev2->name = "PS/2 ALPS Mouse"; | |
2474 | - dev2->id.product = PSMOUSE_PS2; | |
2475 | - dev2->id.version = 0x0000; | |
2476 | - } | |
2533 | + dev2->dev.parent = &psmouse->ps2dev.serio->dev; | |
2477 | 2534 | |
2478 | - snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); | |
2479 | - dev2->phys = priv->phys; | |
2480 | - dev2->id.bustype = BUS_I8042; | |
2481 | - dev2->id.vendor = 0x0002; | |
2482 | - dev2->dev.parent = &psmouse->ps2dev.serio->dev; | |
2535 | + input_set_capability(dev2, EV_REL, REL_X); | |
2536 | + input_set_capability(dev2, EV_REL, REL_Y); | |
2537 | + input_set_capability(dev2, EV_KEY, BTN_LEFT); | |
2538 | + input_set_capability(dev2, EV_KEY, BTN_RIGHT); | |
2539 | + input_set_capability(dev2, EV_KEY, BTN_MIDDLE); | |
2483 | 2540 | |
2484 | - dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | |
2485 | - dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | |
2486 | - dev2->keybit[BIT_WORD(BTN_LEFT)] = | |
2487 | - BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | |
2488 | - | |
2489 | - __set_bit(INPUT_PROP_POINTER, dev2->propbit); | |
2490 | - if (priv->flags & ALPS_DUALPOINT) | |
2541 | + __set_bit(INPUT_PROP_POINTER, dev2->propbit); | |
2491 | 2542 | __set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit); |
2492 | 2543 | |
2493 | - if (input_register_device(priv->dev2)) | |
2494 | - goto init_fail; | |
2544 | + error = input_register_device(dev2); | |
2545 | + if (error) { | |
2546 | + psmouse_err(psmouse, | |
2547 | + "failed to register trackstick device: %d\n", | |
2548 | + error); | |
2549 | + input_free_device(dev2); | |
2550 | + goto init_fail; | |
2551 | + } | |
2495 | 2552 | |
2553 | + priv->dev2 = dev2; | |
2554 | + } | |
2555 | + | |
2556 | + priv->psmouse = psmouse; | |
2557 | + | |
2558 | + INIT_DELAYED_WORK(&priv->dev3_register_work, | |
2559 | + alps_register_bare_ps2_mouse); | |
2560 | + | |
2496 | 2561 | psmouse->protocol_handler = alps_process_byte; |
2497 | 2562 | psmouse->poll = alps_poll; |
2498 | 2563 | psmouse->disconnect = alps_disconnect; |
2499 | 2564 | |
2500 | 2565 | |
2501 | 2566 | |
2502 | 2567 | |
2503 | 2568 | |
2504 | 2569 | |
2505 | 2570 | |
... | ... | @@ -2509,25 +2574,56 @@ |
2509 | 2574 | |
2510 | 2575 | init_fail: |
2511 | 2576 | psmouse_reset(psmouse); |
2512 | - input_free_device(dev2); | |
2513 | - kfree(priv); | |
2577 | + /* | |
2578 | + * Even though we did not allocate psmouse->private we do free | |
2579 | + * it here. | |
2580 | + */ | |
2581 | + kfree(psmouse->private); | |
2514 | 2582 | psmouse->private = NULL; |
2515 | - return -1; | |
2583 | + return error; | |
2516 | 2584 | } |
2517 | 2585 | |
2518 | 2586 | int alps_detect(struct psmouse *psmouse, bool set_properties) |
2519 | 2587 | { |
2520 | - struct alps_data dummy; | |
2588 | + struct alps_data *priv; | |
2589 | + int error; | |
2521 | 2590 | |
2522 | - if (alps_identify(psmouse, &dummy) < 0) | |
2523 | - return -1; | |
2591 | + error = alps_identify(psmouse, NULL); | |
2592 | + if (error) | |
2593 | + return error; | |
2524 | 2594 | |
2595 | + /* | |
2596 | + * Reset the device to make sure it is fully operational: | |
2597 | + * on some laptops, like certain Dell Latitudes, we may | |
2598 | + * fail to properly detect presence of trackstick if device | |
2599 | + * has not been reset. | |
2600 | + */ | |
2601 | + psmouse_reset(psmouse); | |
2602 | + | |
2603 | + priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); | |
2604 | + if (!priv) | |
2605 | + return -ENOMEM; | |
2606 | + | |
2607 | + error = alps_identify(psmouse, priv); | |
2608 | + if (error) | |
2609 | + return error; | |
2610 | + | |
2525 | 2611 | if (set_properties) { |
2526 | 2612 | psmouse->vendor = "ALPS"; |
2527 | - psmouse->name = dummy.flags & ALPS_DUALPOINT ? | |
2613 | + psmouse->name = priv->flags & ALPS_DUALPOINT ? | |
2528 | 2614 | "DualPoint TouchPad" : "GlidePoint"; |
2529 | - psmouse->model = dummy.proto_version << 8; | |
2615 | + psmouse->model = priv->proto_version; | |
2616 | + } else { | |
2617 | + /* | |
2618 | + * Destroy alps_data structure we allocated earlier since | |
2619 | + * this was just a "trial run". Otherwise we'll keep it | |
2620 | + * to be used by alps_init() which has to be called if | |
2621 | + * we succeed and set_properties is true. | |
2622 | + */ | |
2623 | + kfree(priv); | |
2624 | + psmouse->private = NULL; | |
2530 | 2625 | } |
2626 | + | |
2531 | 2627 | return 0; |
2532 | 2628 | } |
drivers/input/mouse/alps.h
... | ... | @@ -14,13 +14,14 @@ |
14 | 14 | |
15 | 15 | #include <linux/input/mt.h> |
16 | 16 | |
17 | -#define ALPS_PROTO_V1 1 | |
18 | -#define ALPS_PROTO_V2 2 | |
19 | -#define ALPS_PROTO_V3 3 | |
20 | -#define ALPS_PROTO_V4 4 | |
21 | -#define ALPS_PROTO_V5 5 | |
22 | -#define ALPS_PROTO_V6 6 | |
23 | -#define ALPS_PROTO_V7 7 /* t3btl t4s */ | |
17 | +#define ALPS_PROTO_V1 0x100 | |
18 | +#define ALPS_PROTO_V2 0x200 | |
19 | +#define ALPS_PROTO_V3 0x300 | |
20 | +#define ALPS_PROTO_V3_RUSHMORE 0x310 | |
21 | +#define ALPS_PROTO_V4 0x400 | |
22 | +#define ALPS_PROTO_V5 0x500 | |
23 | +#define ALPS_PROTO_V6 0x600 | |
24 | +#define ALPS_PROTO_V7 0x700 /* t3btl t4s */ | |
24 | 25 | |
25 | 26 | #define MAX_TOUCHES 2 |
26 | 27 | |
27 | 28 | |
28 | 29 | |
... | ... | @@ -46,29 +47,37 @@ |
46 | 47 | }; |
47 | 48 | |
48 | 49 | /** |
50 | + * struct alps_protocol_info - information about protocol used by a device | |
51 | + * @version: Indicates V1/V2/V3/... | |
52 | + * @byte0: Helps figure out whether a position report packet matches the | |
53 | + * known format for this model. The first byte of the report, ANDed with | |
54 | + * mask0, should match byte0. | |
55 | + * @mask0: The mask used to check the first byte of the report. | |
56 | + * @flags: Additional device capabilities (passthrough port, trackstick, etc.). | |
57 | + */ | |
58 | +struct alps_protocol_info { | |
59 | + u16 version; | |
60 | + u8 byte0, mask0; | |
61 | + unsigned int flags; | |
62 | +}; | |
63 | + | |
64 | +/** | |
49 | 65 | * struct alps_model_info - touchpad ID table |
50 | 66 | * @signature: E7 response string to match. |
51 | 67 | * @command_mode_resp: For V3/V4 touchpads, the final byte of the EC response |
52 | 68 | * (aka command mode response) identifies the firmware minor version. This |
53 | 69 | * can be used to distinguish different hardware models which are not |
54 | 70 | * uniquely identifiable through their E7 responses. |
55 | - * @proto_version: Indicates V1/V2/V3/... | |
56 | - * @byte0: Helps figure out whether a position report packet matches the | |
57 | - * known format for this model. The first byte of the report, ANDed with | |
58 | - * mask0, should match byte0. | |
59 | - * @mask0: The mask used to check the first byte of the report. | |
60 | - * @flags: Additional device capabilities (passthrough port, trackstick, etc.). | |
71 | + * @protocol_info: information about protcol used by the device. | |
61 | 72 | * |
62 | 73 | * Many (but not all) ALPS touchpads can be identified by looking at the |
63 | 74 | * values returned in the "E7 report" and/or the "EC report." This table |
64 | 75 | * lists a number of such touchpads. |
65 | 76 | */ |
66 | 77 | struct alps_model_info { |
67 | - unsigned char signature[3]; | |
68 | - unsigned char command_mode_resp; | |
69 | - unsigned char proto_version; | |
70 | - unsigned char byte0, mask0; | |
71 | - int flags; | |
78 | + u8 signature[3]; | |
79 | + u8 command_mode_resp; | |
80 | + struct alps_protocol_info protocol_info; | |
72 | 81 | }; |
73 | 82 | |
74 | 83 | /** |
... | ... | @@ -132,8 +141,12 @@ |
132 | 141 | |
133 | 142 | /** |
134 | 143 | * struct alps_data - private data structure for the ALPS driver |
135 | - * @dev2: "Relative" device used to report trackstick or mouse activity. | |
136 | - * @phys: Physical path for the relative device. | |
144 | + * @psmouse: Pointer to parent psmouse device | |
145 | + * @dev2: Trackstick device (can be NULL). | |
146 | + * @dev3: Generic PS/2 mouse (can be NULL, delayed registering). | |
147 | + * @phys2: Physical path for the trackstick device. | |
148 | + * @phys3: Physical path for the generic PS/2 mouse. | |
149 | + * @dev3_register_work: Delayed work for registering PS/2 mouse. | |
137 | 150 | * @nibble_commands: Command mapping used for touchpad register accesses. |
138 | 151 | * @addr_command: Command used to tell the touchpad that a register address |
139 | 152 | * follows. |
140 | 153 | |
141 | 154 | |
... | ... | @@ -160,15 +173,19 @@ |
160 | 173 | * @timer: Timer for flushing out the final report packet in the stream. |
161 | 174 | */ |
162 | 175 | struct alps_data { |
176 | + struct psmouse *psmouse; | |
163 | 177 | struct input_dev *dev2; |
164 | - char phys[32]; | |
178 | + struct input_dev *dev3; | |
179 | + char phys2[32]; | |
180 | + char phys3[32]; | |
181 | + struct delayed_work dev3_register_work; | |
165 | 182 | |
166 | 183 | /* these are autodetected when the device is identified */ |
167 | 184 | const struct alps_nibble_commands *nibble_commands; |
168 | 185 | int addr_command; |
169 | - unsigned char proto_version; | |
170 | - unsigned char byte0, mask0; | |
171 | - unsigned char fw_ver[3]; | |
186 | + u16 proto_version; | |
187 | + u8 byte0, mask0; | |
188 | + u8 fw_ver[3]; | |
172 | 189 | int flags; |
173 | 190 | int x_max; |
174 | 191 | int y_max; |
drivers/input/mouse/cypress_ps2.c
drivers/input/mouse/cypress_ps2.h
... | ... | @@ -172,7 +172,6 @@ |
172 | 172 | #ifdef CONFIG_MOUSE_PS2_CYPRESS |
173 | 173 | int cypress_detect(struct psmouse *psmouse, bool set_properties); |
174 | 174 | int cypress_init(struct psmouse *psmouse); |
175 | -bool cypress_supported(void); | |
176 | 175 | #else |
177 | 176 | inline int cypress_detect(struct psmouse *psmouse, bool set_properties) |
178 | 177 | { |
... | ... | @@ -181,10 +180,6 @@ |
181 | 180 | inline int cypress_init(struct psmouse *psmouse) |
182 | 181 | { |
183 | 182 | return -ENOSYS; |
184 | -} | |
185 | -inline bool cypress_supported(void) | |
186 | -{ | |
187 | - return 0; | |
188 | 183 | } |
189 | 184 | #endif /* CONFIG_MOUSE_PS2_CYPRESS */ |
190 | 185 |
drivers/input/mouse/focaltech.c
... | ... | @@ -424,11 +424,6 @@ |
424 | 424 | return error; |
425 | 425 | } |
426 | 426 | |
427 | -bool focaltech_supported(void) | |
428 | -{ | |
429 | - return true; | |
430 | -} | |
431 | - | |
432 | 427 | #else /* CONFIG_MOUSE_PS2_FOCALTECH */ |
433 | 428 | |
434 | 429 | int focaltech_init(struct psmouse *psmouse) |
... | ... | @@ -436,11 +431,6 @@ |
436 | 431 | focaltech_reset(psmouse); |
437 | 432 | |
438 | 433 | return 0; |
439 | -} | |
440 | - | |
441 | -bool focaltech_supported(void) | |
442 | -{ | |
443 | - return false; | |
444 | 434 | } |
445 | 435 | |
446 | 436 | #endif /* CONFIG_MOUSE_PS2_FOCALTECH */ |
drivers/input/mouse/focaltech.h
drivers/input/mouse/psmouse-base.c
... | ... | @@ -727,7 +727,7 @@ |
727 | 727 | if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) { |
728 | 728 | if (max_proto > PSMOUSE_IMEX) { |
729 | 729 | if (!set_properties || focaltech_init(psmouse) == 0) { |
730 | - if (focaltech_supported()) | |
730 | + if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH)) | |
731 | 731 | return PSMOUSE_FOCALTECH; |
732 | 732 | /* |
733 | 733 | * Note that we need to also restrict |
... | ... | @@ -776,7 +776,7 @@ |
776 | 776 | * Try activating protocol, but check if support is enabled first, since |
777 | 777 | * we try detecting Synaptics even when protocol is disabled. |
778 | 778 | */ |
779 | - if (synaptics_supported() && | |
779 | + if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) && | |
780 | 780 | (!set_properties || synaptics_init(psmouse) == 0)) { |
781 | 781 | return PSMOUSE_SYNAPTICS; |
782 | 782 | } |
... | ... | @@ -801,7 +801,7 @@ |
801 | 801 | */ |
802 | 802 | if (max_proto > PSMOUSE_IMEX && |
803 | 803 | cypress_detect(psmouse, set_properties) == 0) { |
804 | - if (cypress_supported()) { | |
804 | + if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) { | |
805 | 805 | if (cypress_init(psmouse) == 0) |
806 | 806 | return PSMOUSE_CYPRESS; |
807 | 807 |
drivers/input/mouse/synaptics.c
... | ... | @@ -1454,11 +1454,6 @@ |
1454 | 1454 | return __synaptics_init(psmouse, false); |
1455 | 1455 | } |
1456 | 1456 | |
1457 | -bool synaptics_supported(void) | |
1458 | -{ | |
1459 | - return true; | |
1460 | -} | |
1461 | - | |
1462 | 1457 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
1463 | 1458 | |
1464 | 1459 | void __init synaptics_module_init(void) |
... | ... | @@ -1468,11 +1463,6 @@ |
1468 | 1463 | int synaptics_init(struct psmouse *psmouse) |
1469 | 1464 | { |
1470 | 1465 | return -ENOSYS; |
1471 | -} | |
1472 | - | |
1473 | -bool synaptics_supported(void) | |
1474 | -{ | |
1475 | - return false; | |
1476 | 1466 | } |
1477 | 1467 | |
1478 | 1468 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
drivers/input/mouse/synaptics.h
include/linux/platform_data/bfin_rotary.h
1 | +/* | |
2 | + * board initialization should put one of these structures into platform_data | |
3 | + * and place the bfin-rotary onto platform_bus named "bfin-rotary". | |
4 | + * | |
5 | + * Copyright 2008-2010 Analog Devices Inc. | |
6 | + * | |
7 | + * Licensed under the GPL-2 or later. | |
8 | + */ | |
9 | + | |
10 | +#ifndef _BFIN_ROTARY_H | |
11 | +#define _BFIN_ROTARY_H | |
12 | + | |
13 | +/* mode bitmasks */ | |
14 | +#define ROT_QUAD_ENC CNTMODE_QUADENC /* quadrature/grey code encoder mode */ | |
15 | +#define ROT_BIN_ENC CNTMODE_BINENC /* binary encoder mode */ | |
16 | +#define ROT_UD_CNT CNTMODE_UDCNT /* rotary counter mode */ | |
17 | +#define ROT_DIR_CNT CNTMODE_DIRCNT /* direction counter mode */ | |
18 | + | |
19 | +#define ROT_DEBE DEBE /* Debounce Enable */ | |
20 | + | |
21 | +#define ROT_CDGINV CDGINV /* CDG Pin Polarity Invert */ | |
22 | +#define ROT_CUDINV CUDINV /* CUD Pin Polarity Invert */ | |
23 | +#define ROT_CZMINV CZMINV /* CZM Pin Polarity Invert */ | |
24 | + | |
25 | +struct bfin_rotary_platform_data { | |
26 | + /* set rotary UP KEY_### or BTN_### in case you prefer | |
27 | + * bfin-rotary to send EV_KEY otherwise set 0 | |
28 | + */ | |
29 | + unsigned int rotary_up_key; | |
30 | + /* set rotary DOWN KEY_### or BTN_### in case you prefer | |
31 | + * bfin-rotary to send EV_KEY otherwise set 0 | |
32 | + */ | |
33 | + unsigned int rotary_down_key; | |
34 | + /* set rotary BUTTON KEY_### or BTN_### */ | |
35 | + unsigned int rotary_button_key; | |
36 | + /* set rotary Relative Axis REL_### in case you prefer | |
37 | + * bfin-rotary to send EV_REL otherwise set 0 | |
38 | + */ | |
39 | + unsigned int rotary_rel_code; | |
40 | + unsigned short debounce; /* 0..17 */ | |
41 | + unsigned short mode; | |
42 | + unsigned short pm_wakeup; | |
43 | + unsigned short *pin_list; | |
44 | +}; | |
45 | + | |
46 | +/* CNT_CONFIG bitmasks */ | |
47 | +#define CNTE (1 << 0) /* Counter Enable */ | |
48 | +#define DEBE (1 << 1) /* Debounce Enable */ | |
49 | +#define CDGINV (1 << 4) /* CDG Pin Polarity Invert */ | |
50 | +#define CUDINV (1 << 5) /* CUD Pin Polarity Invert */ | |
51 | +#define CZMINV (1 << 6) /* CZM Pin Polarity Invert */ | |
52 | +#define CNTMODE_SHIFT 8 | |
53 | +#define CNTMODE (0x7 << CNTMODE_SHIFT) /* Counter Operating Mode */ | |
54 | +#define ZMZC (1 << 1) /* CZM Zeroes Counter Enable */ | |
55 | +#define BNDMODE_SHIFT 12 | |
56 | +#define BNDMODE (0x3 << BNDMODE_SHIFT) /* Boundary register Mode */ | |
57 | +#define INPDIS (1 << 15) /* CUG and CDG Input Disable */ | |
58 | + | |
59 | +#define CNTMODE_QUADENC (0 << CNTMODE_SHIFT) /* quadrature encoder mode */ | |
60 | +#define CNTMODE_BINENC (1 << CNTMODE_SHIFT) /* binary encoder mode */ | |
61 | +#define CNTMODE_UDCNT (2 << CNTMODE_SHIFT) /* up/down counter mode */ | |
62 | +#define CNTMODE_DIRCNT (4 << CNTMODE_SHIFT) /* direction counter mode */ | |
63 | +#define CNTMODE_DIRTMR (5 << CNTMODE_SHIFT) /* direction timer mode */ | |
64 | + | |
65 | +#define BNDMODE_COMP (0 << BNDMODE_SHIFT) /* boundary compare mode */ | |
66 | +#define BNDMODE_ZERO (1 << BNDMODE_SHIFT) /* boundary compare and zero mode */ | |
67 | +#define BNDMODE_CAPT (2 << BNDMODE_SHIFT) /* boundary capture mode */ | |
68 | +#define BNDMODE_AEXT (3 << BNDMODE_SHIFT) /* boundary auto-extend mode */ | |
69 | + | |
70 | +/* CNT_IMASK bitmasks */ | |
71 | +#define ICIE (1 << 0) /* Illegal Gray/Binary Code Interrupt Enable */ | |
72 | +#define UCIE (1 << 1) /* Up count Interrupt Enable */ | |
73 | +#define DCIE (1 << 2) /* Down count Interrupt Enable */ | |
74 | +#define MINCIE (1 << 3) /* Min Count Interrupt Enable */ | |
75 | +#define MAXCIE (1 << 4) /* Max Count Interrupt Enable */ | |
76 | +#define COV31IE (1 << 5) /* Bit 31 Overflow Interrupt Enable */ | |
77 | +#define COV15IE (1 << 6) /* Bit 15 Overflow Interrupt Enable */ | |
78 | +#define CZEROIE (1 << 7) /* Count to Zero Interrupt Enable */ | |
79 | +#define CZMIE (1 << 8) /* CZM Pin Interrupt Enable */ | |
80 | +#define CZMEIE (1 << 9) /* CZM Error Interrupt Enable */ | |
81 | +#define CZMZIE (1 << 10) /* CZM Zeroes Counter Interrupt Enable */ | |
82 | + | |
83 | +/* CNT_STATUS bitmasks */ | |
84 | +#define ICII (1 << 0) /* Illegal Gray/Binary Code Interrupt Identifier */ | |
85 | +#define UCII (1 << 1) /* Up count Interrupt Identifier */ | |
86 | +#define DCII (1 << 2) /* Down count Interrupt Identifier */ | |
87 | +#define MINCII (1 << 3) /* Min Count Interrupt Identifier */ | |
88 | +#define MAXCII (1 << 4) /* Max Count Interrupt Identifier */ | |
89 | +#define COV31II (1 << 5) /* Bit 31 Overflow Interrupt Identifier */ | |
90 | +#define COV15II (1 << 6) /* Bit 15 Overflow Interrupt Identifier */ | |
91 | +#define CZEROII (1 << 7) /* Count to Zero Interrupt Identifier */ | |
92 | +#define CZMII (1 << 8) /* CZM Pin Interrupt Identifier */ | |
93 | +#define CZMEII (1 << 9) /* CZM Error Interrupt Identifier */ | |
94 | +#define CZMZII (1 << 10) /* CZM Zeroes Counter Interrupt Identifier */ | |
95 | + | |
96 | +/* CNT_COMMAND bitmasks */ | |
97 | +#define W1LCNT 0xf /* Load Counter Register */ | |
98 | +#define W1LMIN 0xf0 /* Load Min Register */ | |
99 | +#define W1LMAX 0xf00 /* Load Max Register */ | |
100 | +#define W1ZMONCE (1 << 12) /* Enable CZM Clear Counter Once */ | |
101 | + | |
102 | +#define W1LCNT_ZERO (1 << 0) /* write 1 to load CNT_COUNTER with zero */ | |
103 | +#define W1LCNT_MIN (1 << 2) /* write 1 to load CNT_COUNTER from CNT_MIN */ | |
104 | +#define W1LCNT_MAX (1 << 3) /* write 1 to load CNT_COUNTER from CNT_MAX */ | |
105 | + | |
106 | +#define W1LMIN_ZERO (1 << 4) /* write 1 to load CNT_MIN with zero */ | |
107 | +#define W1LMIN_CNT (1 << 5) /* write 1 to load CNT_MIN from CNT_COUNTER */ | |
108 | +#define W1LMIN_MAX (1 << 7) /* write 1 to load CNT_MIN from CNT_MAX */ | |
109 | + | |
110 | +#define W1LMAX_ZERO (1 << 8) /* write 1 to load CNT_MAX with zero */ | |
111 | +#define W1LMAX_CNT (1 << 9) /* write 1 to load CNT_MAX from CNT_COUNTER */ | |
112 | +#define W1LMAX_MIN (1 << 10) /* write 1 to load CNT_MAX from CNT_MIN */ | |
113 | + | |
114 | +/* CNT_DEBOUNCE bitmasks */ | |
115 | +#define DPRESCALE 0xf /* Load Counter Register */ | |
116 | + | |
117 | +#endif |