diff options
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/Kconfig | 2 | ||||
-rw-r--r-- | drivers/input/mouse/alps.c | 351 | ||||
-rw-r--r-- | drivers/input/mouse/alps.h | 1 | ||||
-rw-r--r-- | drivers/input/mouse/appletouch.c | 6 | ||||
-rw-r--r-- | drivers/input/mouse/bcm5974.c | 45 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.c | 106 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.h | 5 | ||||
-rw-r--r-- | drivers/input/mouse/hgpk.c | 19 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 60 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.h | 4 | ||||
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 154 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse.h | 1 | ||||
-rw-r--r-- | drivers/input/mouse/pxa930_trkball.c | 1 | ||||
-rw-r--r-- | drivers/input/mouse/sentelic.c | 8 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 77 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.h | 6 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics_i2c.c | 7 | ||||
-rw-r--r-- | drivers/input/mouse/touchkit_ps2.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 14 | ||||
-rw-r--r-- | drivers/input/mouse/vsxxxaa.c | 374 |
21 files changed, 809 insertions, 440 deletions
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 3feeb3af8abd..c714ca2407f8 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS | |||
70 | config MOUSE_PS2_LIFEBOOK | 70 | config MOUSE_PS2_LIFEBOOK |
71 | bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED | 71 | bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED |
72 | default y | 72 | default y |
73 | depends on MOUSE_PS2 && X86 | 73 | depends on MOUSE_PS2 && X86 && DMI |
74 | help | 74 | help |
75 | Say Y here if you have a Fujitsu B-series Lifebook PS/2 | 75 | Say Y here if you have a Fujitsu B-series Lifebook PS/2 |
76 | TouchScreen connected to your system. | 76 | TouchScreen connected to your system. |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index f36110689aae..99d58764ef03 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com> | 5 | * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com> |
6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> | 6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> |
7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> |
8 | * Copyright (c) 2009 Sebastian Kapfer <sebastian_kapfer@gmx.net> | ||
8 | * | 9 | * |
9 | * ALPS detection, tap switching and status querying info is taken from | 10 | * ALPS detection, tap switching and status querying info is taken from |
10 | * tpconfig utility (by C. Scott Ananian and Bruce Kall). | 11 | * tpconfig utility (by C. Scott Ananian and Bruce Kall). |
@@ -14,6 +15,7 @@ | |||
14 | * the Free Software Foundation. | 15 | * the Free Software Foundation. |
15 | */ | 16 | */ |
16 | 17 | ||
18 | #include <linux/slab.h> | ||
17 | #include <linux/input.h> | 19 | #include <linux/input.h> |
18 | #include <linux/serio.h> | 20 | #include <linux/serio.h> |
19 | #include <linux/libps2.h> | 21 | #include <linux/libps2.h> |
@@ -28,13 +30,16 @@ | |||
28 | #define dbg(format, arg...) do {} while (0) | 30 | #define dbg(format, arg...) do {} while (0) |
29 | #endif | 31 | #endif |
30 | 32 | ||
31 | #define ALPS_DUALPOINT 0x01 | 33 | #define ALPS_OLDPROTO 0x01 /* old style input */ |
32 | #define ALPS_WHEEL 0x02 | 34 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ |
33 | #define ALPS_FW_BK_1 0x04 | 35 | #define ALPS_PASS 0x04 /* device has a pass-through port */ |
34 | #define ALPS_4BTN 0x08 | 36 | |
35 | #define ALPS_OLDPROTO 0x10 | 37 | #define ALPS_WHEEL 0x08 /* hardware wheel present */ |
36 | #define ALPS_PASS 0x20 | 38 | #define ALPS_FW_BK_1 0x10 /* front & back buttons present */ |
37 | #define ALPS_FW_BK_2 0x40 | 39 | #define ALPS_FW_BK_2 0x20 /* front & back buttons present */ |
40 | #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ | ||
41 | #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with | ||
42 | 6-byte ALPS packet */ | ||
38 | 43 | ||
39 | static const struct alps_model_info alps_model_data[] = { | 44 | static const struct alps_model_info alps_model_data[] = { |
40 | { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ | 45 | { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ |
@@ -55,8 +60,12 @@ static const struct alps_model_info alps_model_data[] = { | |||
55 | { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ | 60 | { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ |
56 | { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, | 61 | { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, |
57 | { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ | 62 | { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ |
58 | { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */ | 63 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
59 | { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 }, /* Dell Vostro 1400 */ | 64 | { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, |
65 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | ||
66 | { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | ||
67 | { { 0x52, 0x01, 0x14 }, 0xff, 0xff, | ||
68 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | ||
60 | }; | 69 | }; |
61 | 70 | ||
62 | /* | 71 | /* |
@@ -66,42 +75,86 @@ static const struct alps_model_info alps_model_data[] = { | |||
66 | */ | 75 | */ |
67 | 76 | ||
68 | /* | 77 | /* |
69 | * ALPS abolute Mode - new format | 78 | * PS/2 packet format |
79 | * | ||
80 | * byte 0: 0 0 YSGN XSGN 1 M R L | ||
81 | * byte 1: X7 X6 X5 X4 X3 X2 X1 X0 | ||
82 | * byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
83 | * | ||
84 | * Note that the device never signals overflow condition. | ||
85 | * | ||
86 | * ALPS absolute Mode - new format | ||
70 | * | 87 | * |
71 | * byte 0: 1 ? ? ? 1 ? ? ? | 88 | * byte 0: 1 ? ? ? 1 ? ? ? |
72 | * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | 89 | * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 |
73 | * byte 2: 0 x10 x9 x8 x7 ? fin ges | 90 | * byte 2: 0 x10 x9 x8 x7 ? fin ges |
74 | * byte 3: 0 y9 y8 y7 1 M R L | 91 | * byte 3: 0 y9 y8 y7 1 M R L |
75 | * byte 4: 0 y6 y5 y4 y3 y2 y1 y0 | 92 | * byte 4: 0 y6 y5 y4 y3 y2 y1 y0 |
76 | * byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | 93 | * byte 5: 0 z6 z5 z4 z3 z2 z1 z0 |
77 | * | 94 | * |
95 | * Dualpoint device -- interleaved packet format | ||
96 | * | ||
97 | * byte 0: 1 1 0 0 1 1 1 1 | ||
98 | * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
99 | * byte 2: 0 x10 x9 x8 x7 0 fin ges | ||
100 | * byte 3: 0 0 YSGN XSGN 1 1 1 1 | ||
101 | * byte 4: X7 X6 X5 X4 X3 X2 X1 X0 | ||
102 | * byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
103 | * byte 6: 0 y9 y8 y7 1 m r l | ||
104 | * byte 7: 0 y6 y5 y4 y3 y2 y1 y0 | ||
105 | * byte 8: 0 z6 z5 z4 z3 z2 z1 z0 | ||
106 | * | ||
107 | * CAPITALS = stick, miniscules = touchpad | ||
108 | * | ||
78 | * ?'s can have different meanings on different models, | 109 | * ?'s can have different meanings on different models, |
79 | * such as wheel rotation, extra buttons, stick buttons | 110 | * such as wheel rotation, extra buttons, stick buttons |
80 | * on a dualpoint, etc. | 111 | * on a dualpoint, etc. |
81 | */ | 112 | */ |
82 | 113 | ||
114 | static bool alps_is_valid_first_byte(const struct alps_model_info *model, | ||
115 | unsigned char data) | ||
116 | { | ||
117 | return (data & model->mask0) == model->byte0; | ||
118 | } | ||
119 | |||
120 | static void alps_report_buttons(struct psmouse *psmouse, | ||
121 | struct input_dev *dev1, struct input_dev *dev2, | ||
122 | int left, int right, int middle) | ||
123 | { | ||
124 | struct input_dev *dev; | ||
125 | |||
126 | /* | ||
127 | * If shared button has already been reported on the | ||
128 | * other device (dev2) then this event should be also | ||
129 | * sent through that device. | ||
130 | */ | ||
131 | dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1; | ||
132 | input_report_key(dev, BTN_LEFT, left); | ||
133 | |||
134 | dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1; | ||
135 | input_report_key(dev, BTN_RIGHT, right); | ||
136 | |||
137 | dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1; | ||
138 | input_report_key(dev, BTN_MIDDLE, middle); | ||
139 | |||
140 | /* | ||
141 | * Sync the _other_ device now, we'll do the first | ||
142 | * device later once we report the rest of the events. | ||
143 | */ | ||
144 | input_sync(dev2); | ||
145 | } | ||
146 | |||
83 | static void alps_process_packet(struct psmouse *psmouse) | 147 | static void alps_process_packet(struct psmouse *psmouse) |
84 | { | 148 | { |
85 | struct alps_data *priv = psmouse->private; | 149 | struct alps_data *priv = psmouse->private; |
150 | const struct alps_model_info *model = priv->i; | ||
86 | unsigned char *packet = psmouse->packet; | 151 | unsigned char *packet = psmouse->packet; |
87 | struct input_dev *dev = psmouse->dev; | 152 | struct input_dev *dev = psmouse->dev; |
88 | struct input_dev *dev2 = priv->dev2; | 153 | struct input_dev *dev2 = priv->dev2; |
89 | int x, y, z, ges, fin, left, right, middle; | 154 | int x, y, z, ges, fin, left, right, middle; |
90 | int back = 0, forward = 0; | 155 | int back = 0, forward = 0; |
91 | 156 | ||
92 | if ((packet[0] & 0xc8) == 0x08) { /* 3-byte PS/2 packet */ | 157 | if (model->flags & ALPS_OLDPROTO) { |
93 | input_report_key(dev2, BTN_LEFT, packet[0] & 1); | ||
94 | input_report_key(dev2, BTN_RIGHT, packet[0] & 2); | ||
95 | input_report_key(dev2, BTN_MIDDLE, packet[0] & 4); | ||
96 | input_report_rel(dev2, REL_X, | ||
97 | packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0); | ||
98 | input_report_rel(dev2, REL_Y, | ||
99 | packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0); | ||
100 | input_sync(dev2); | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | if (priv->i->flags & ALPS_OLDPROTO) { | ||
105 | left = packet[2] & 0x10; | 158 | left = packet[2] & 0x10; |
106 | right = packet[2] & 0x08; | 159 | right = packet[2] & 0x08; |
107 | middle = 0; | 160 | middle = 0; |
@@ -117,12 +170,12 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
117 | z = packet[5]; | 170 | z = packet[5]; |
118 | } | 171 | } |
119 | 172 | ||
120 | if (priv->i->flags & ALPS_FW_BK_1) { | 173 | if (model->flags & ALPS_FW_BK_1) { |
121 | back = packet[0] & 0x10; | 174 | back = packet[0] & 0x10; |
122 | forward = packet[2] & 4; | 175 | forward = packet[2] & 4; |
123 | } | 176 | } |
124 | 177 | ||
125 | if (priv->i->flags & ALPS_FW_BK_2) { | 178 | if (model->flags & ALPS_FW_BK_2) { |
126 | back = packet[3] & 4; | 179 | back = packet[3] & 4; |
127 | forward = packet[2] & 4; | 180 | forward = packet[2] & 4; |
128 | if ((middle = forward && back)) | 181 | if ((middle = forward && back)) |
@@ -132,25 +185,21 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
132 | ges = packet[2] & 1; | 185 | ges = packet[2] & 1; |
133 | fin = packet[2] & 2; | 186 | fin = packet[2] & 2; |
134 | 187 | ||
135 | if ((priv->i->flags & ALPS_DUALPOINT) && z == 127) { | 188 | if ((model->flags & ALPS_DUALPOINT) && z == 127) { |
136 | input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); | 189 | input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); |
137 | input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); | 190 | input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); |
138 | 191 | ||
139 | input_report_key(dev2, BTN_LEFT, left); | 192 | alps_report_buttons(psmouse, dev2, dev, left, right, middle); |
140 | input_report_key(dev2, BTN_RIGHT, right); | ||
141 | input_report_key(dev2, BTN_MIDDLE, middle); | ||
142 | 193 | ||
143 | input_sync(dev); | ||
144 | input_sync(dev2); | 194 | input_sync(dev2); |
145 | return; | 195 | return; |
146 | } | 196 | } |
147 | 197 | ||
148 | input_report_key(dev, BTN_LEFT, left); | 198 | alps_report_buttons(psmouse, dev, dev2, left, right, middle); |
149 | input_report_key(dev, BTN_RIGHT, right); | ||
150 | input_report_key(dev, BTN_MIDDLE, middle); | ||
151 | 199 | ||
152 | /* Convert hardware tap to a reasonable Z value */ | 200 | /* Convert hardware tap to a reasonable Z value */ |
153 | if (ges && !fin) z = 40; | 201 | if (ges && !fin) |
202 | z = 40; | ||
154 | 203 | ||
155 | /* | 204 | /* |
156 | * A "tap and drag" operation is reported by the hardware as a transition | 205 | * A "tap and drag" operation is reported by the hardware as a transition |
@@ -166,8 +215,10 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
166 | } | 215 | } |
167 | priv->prev_fin = fin; | 216 | priv->prev_fin = fin; |
168 | 217 | ||
169 | if (z > 30) input_report_key(dev, BTN_TOUCH, 1); | 218 | if (z > 30) |
170 | if (z < 25) input_report_key(dev, BTN_TOUCH, 0); | 219 | input_report_key(dev, BTN_TOUCH, 1); |
220 | if (z < 25) | ||
221 | input_report_key(dev, BTN_TOUCH, 0); | ||
171 | 222 | ||
172 | if (z > 0) { | 223 | if (z > 0) { |
173 | input_report_abs(dev, ABS_X, x); | 224 | input_report_abs(dev, ABS_X, x); |
@@ -177,36 +228,186 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
177 | input_report_abs(dev, ABS_PRESSURE, z); | 228 | input_report_abs(dev, ABS_PRESSURE, z); |
178 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); | 229 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); |
179 | 230 | ||
180 | if (priv->i->flags & ALPS_WHEEL) | 231 | if (model->flags & ALPS_WHEEL) |
181 | input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); | 232 | input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); |
182 | 233 | ||
183 | if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { | 234 | if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { |
184 | input_report_key(dev, BTN_FORWARD, forward); | 235 | input_report_key(dev, BTN_FORWARD, forward); |
185 | input_report_key(dev, BTN_BACK, back); | 236 | input_report_key(dev, BTN_BACK, back); |
186 | } | 237 | } |
187 | 238 | ||
239 | if (model->flags & ALPS_FOUR_BUTTONS) { | ||
240 | input_report_key(dev, BTN_0, packet[2] & 4); | ||
241 | input_report_key(dev, BTN_1, packet[0] & 0x10); | ||
242 | input_report_key(dev, BTN_2, packet[3] & 4); | ||
243 | input_report_key(dev, BTN_3, packet[0] & 0x20); | ||
244 | } | ||
245 | |||
188 | input_sync(dev); | 246 | input_sync(dev); |
189 | } | 247 | } |
190 | 248 | ||
249 | static void alps_report_bare_ps2_packet(struct psmouse *psmouse, | ||
250 | unsigned char packet[], | ||
251 | bool report_buttons) | ||
252 | { | ||
253 | struct alps_data *priv = psmouse->private; | ||
254 | struct input_dev *dev2 = priv->dev2; | ||
255 | |||
256 | if (report_buttons) | ||
257 | alps_report_buttons(psmouse, dev2, psmouse->dev, | ||
258 | packet[0] & 1, packet[0] & 2, packet[0] & 4); | ||
259 | |||
260 | input_report_rel(dev2, REL_X, | ||
261 | packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0); | ||
262 | input_report_rel(dev2, REL_Y, | ||
263 | packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0); | ||
264 | |||
265 | input_sync(dev2); | ||
266 | } | ||
267 | |||
268 | static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) | ||
269 | { | ||
270 | struct alps_data *priv = psmouse->private; | ||
271 | |||
272 | if (psmouse->pktcnt < 6) | ||
273 | return PSMOUSE_GOOD_DATA; | ||
274 | |||
275 | if (psmouse->pktcnt == 6) { | ||
276 | /* | ||
277 | * Start a timer to flush the packet if it ends up last | ||
278 | * 6-byte packet in the stream. Timer needs to fire | ||
279 | * psmouse core times out itself. 20 ms should be enough | ||
280 | * to decide if we are getting more data or not. | ||
281 | */ | ||
282 | mod_timer(&priv->timer, jiffies + msecs_to_jiffies(20)); | ||
283 | return PSMOUSE_GOOD_DATA; | ||
284 | } | ||
285 | |||
286 | del_timer(&priv->timer); | ||
287 | |||
288 | if (psmouse->packet[6] & 0x80) { | ||
289 | |||
290 | /* | ||
291 | * Highest bit is set - that means we either had | ||
292 | * complete ALPS packet and this is start of the | ||
293 | * next packet or we got garbage. | ||
294 | */ | ||
295 | |||
296 | if (((psmouse->packet[3] | | ||
297 | psmouse->packet[4] | | ||
298 | psmouse->packet[5]) & 0x80) || | ||
299 | (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { | ||
300 | dbg("refusing packet %x %x %x %x " | ||
301 | "(suspected interleaved ps/2)\n", | ||
302 | psmouse->packet[3], psmouse->packet[4], | ||
303 | psmouse->packet[5], psmouse->packet[6]); | ||
304 | return PSMOUSE_BAD_DATA; | ||
305 | } | ||
306 | |||
307 | alps_process_packet(psmouse); | ||
308 | |||
309 | /* Continue with the next packet */ | ||
310 | psmouse->packet[0] = psmouse->packet[6]; | ||
311 | psmouse->pktcnt = 1; | ||
312 | |||
313 | } else { | ||
314 | |||
315 | /* | ||
316 | * High bit is 0 - that means that we indeed got a PS/2 | ||
317 | * packet in the middle of ALPS packet. | ||
318 | * | ||
319 | * There is also possibility that we got 6-byte ALPS | ||
320 | * packet followed by 3-byte packet from trackpoint. We | ||
321 | * can not distinguish between these 2 scenarios but | ||
322 | * becase the latter is unlikely to happen in course of | ||
323 | * normal operation (user would need to press all | ||
324 | * buttons on the pad and start moving trackpoint | ||
325 | * without touching the pad surface) we assume former. | ||
326 | * Even if we are wrong the wost thing that would happen | ||
327 | * the cursor would jump but we should not get protocol | ||
328 | * desynchronization. | ||
329 | */ | ||
330 | |||
331 | alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3], | ||
332 | false); | ||
333 | |||
334 | /* | ||
335 | * Continue with the standard ALPS protocol handling, | ||
336 | * but make sure we won't process it as an interleaved | ||
337 | * packet again, which may happen if all buttons are | ||
338 | * pressed. To avoid this let's reset the 4th bit which | ||
339 | * is normally 1. | ||
340 | */ | ||
341 | psmouse->packet[3] = psmouse->packet[6] & 0xf7; | ||
342 | psmouse->pktcnt = 4; | ||
343 | } | ||
344 | |||
345 | return PSMOUSE_GOOD_DATA; | ||
346 | } | ||
347 | |||
348 | static void alps_flush_packet(unsigned long data) | ||
349 | { | ||
350 | struct psmouse *psmouse = (struct psmouse *)data; | ||
351 | |||
352 | serio_pause_rx(psmouse->ps2dev.serio); | ||
353 | |||
354 | if (psmouse->pktcnt == 6) { | ||
355 | |||
356 | /* | ||
357 | * We did not any more data in reasonable amount of time. | ||
358 | * Validate the last 3 bytes and process as a standard | ||
359 | * ALPS packet. | ||
360 | */ | ||
361 | if ((psmouse->packet[3] | | ||
362 | psmouse->packet[4] | | ||
363 | psmouse->packet[5]) & 0x80) { | ||
364 | dbg("refusing packet %x %x %x " | ||
365 | "(suspected interleaved ps/2)\n", | ||
366 | psmouse->packet[3], psmouse->packet[4], | ||
367 | psmouse->packet[5]); | ||
368 | } else { | ||
369 | alps_process_packet(psmouse); | ||
370 | } | ||
371 | psmouse->pktcnt = 0; | ||
372 | } | ||
373 | |||
374 | serio_continue_rx(psmouse->ps2dev.serio); | ||
375 | } | ||
376 | |||
191 | static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | 377 | static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) |
192 | { | 378 | { |
193 | struct alps_data *priv = psmouse->private; | 379 | struct alps_data *priv = psmouse->private; |
380 | const struct alps_model_info *model = priv->i; | ||
194 | 381 | ||
195 | if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ | 382 | if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ |
196 | if (psmouse->pktcnt == 3) { | 383 | if (psmouse->pktcnt == 3) { |
197 | alps_process_packet(psmouse); | 384 | alps_report_bare_ps2_packet(psmouse, psmouse->packet, |
385 | true); | ||
198 | return PSMOUSE_FULL_PACKET; | 386 | return PSMOUSE_FULL_PACKET; |
199 | } | 387 | } |
200 | return PSMOUSE_GOOD_DATA; | 388 | return PSMOUSE_GOOD_DATA; |
201 | } | 389 | } |
202 | 390 | ||
203 | if ((psmouse->packet[0] & priv->i->mask0) != priv->i->byte0) | 391 | /* Check for PS/2 packet stuffed in the middle of ALPS packet. */ |
392 | |||
393 | if ((model->flags & ALPS_PS2_INTERLEAVED) && | ||
394 | psmouse->pktcnt >= 4 && (psmouse->packet[3] & 0x0f) == 0x0f) { | ||
395 | return alps_handle_interleaved_ps2(psmouse); | ||
396 | } | ||
397 | |||
398 | if (!alps_is_valid_first_byte(model, psmouse->packet[0])) { | ||
399 | dbg("refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n", | ||
400 | psmouse->packet[0], model->mask0, model->byte0); | ||
204 | return PSMOUSE_BAD_DATA; | 401 | return PSMOUSE_BAD_DATA; |
402 | } | ||
205 | 403 | ||
206 | /* Bytes 2 - 6 should have 0 in the highest bit */ | 404 | /* Bytes 2 - 6 should have 0 in the highest bit */ |
207 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 && | 405 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 && |
208 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) | 406 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
407 | dbg("refusing packet[%i] = %x\n", | ||
408 | psmouse->pktcnt - 1, psmouse->packet[psmouse->pktcnt - 1]); | ||
209 | return PSMOUSE_BAD_DATA; | 409 | return PSMOUSE_BAD_DATA; |
410 | } | ||
210 | 411 | ||
211 | if (psmouse->pktcnt == 6) { | 412 | if (psmouse->pktcnt == 6) { |
212 | alps_process_packet(psmouse); | 413 | alps_process_packet(psmouse); |
@@ -393,15 +594,12 @@ static int alps_poll(struct psmouse *psmouse) | |||
393 | return 0; | 594 | return 0; |
394 | } | 595 | } |
395 | 596 | ||
396 | static int alps_hw_init(struct psmouse *psmouse, int *version) | 597 | static int alps_hw_init(struct psmouse *psmouse) |
397 | { | 598 | { |
398 | struct alps_data *priv = psmouse->private; | 599 | struct alps_data *priv = psmouse->private; |
600 | const struct alps_model_info *model = priv->i; | ||
399 | 601 | ||
400 | priv->i = alps_get_model(psmouse, version); | 602 | if ((model->flags & ALPS_PASS) && |
401 | if (!priv->i) | ||
402 | return -1; | ||
403 | |||
404 | if ((priv->i->flags & ALPS_PASS) && | ||
405 | alps_passthrough_mode(psmouse, true)) { | 603 | alps_passthrough_mode(psmouse, true)) { |
406 | return -1; | 604 | return -1; |
407 | } | 605 | } |
@@ -416,7 +614,7 @@ static int alps_hw_init(struct psmouse *psmouse, int *version) | |||
416 | return -1; | 614 | return -1; |
417 | } | 615 | } |
418 | 616 | ||
419 | if ((priv->i->flags & ALPS_PASS) && | 617 | if ((model->flags & ALPS_PASS) && |
420 | alps_passthrough_mode(psmouse, false)) { | 618 | alps_passthrough_mode(psmouse, false)) { |
421 | return -1; | 619 | return -1; |
422 | } | 620 | } |
@@ -432,12 +630,15 @@ static int alps_hw_init(struct psmouse *psmouse, int *version) | |||
432 | 630 | ||
433 | static int alps_reconnect(struct psmouse *psmouse) | 631 | static int alps_reconnect(struct psmouse *psmouse) |
434 | { | 632 | { |
633 | const struct alps_model_info *model; | ||
634 | |||
435 | psmouse_reset(psmouse); | 635 | psmouse_reset(psmouse); |
436 | 636 | ||
437 | if (alps_hw_init(psmouse, NULL)) | 637 | model = alps_get_model(psmouse, NULL); |
638 | if (!model) | ||
438 | return -1; | 639 | return -1; |
439 | 640 | ||
440 | return 0; | 641 | return alps_hw_init(psmouse); |
441 | } | 642 | } |
442 | 643 | ||
443 | static void alps_disconnect(struct psmouse *psmouse) | 644 | static void alps_disconnect(struct psmouse *psmouse) |
@@ -445,6 +646,7 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
445 | struct alps_data *priv = psmouse->private; | 646 | struct alps_data *priv = psmouse->private; |
446 | 647 | ||
447 | psmouse_reset(psmouse); | 648 | psmouse_reset(psmouse); |
649 | del_timer_sync(&priv->timer); | ||
448 | input_unregister_device(priv->dev2); | 650 | input_unregister_device(priv->dev2); |
449 | kfree(priv); | 651 | kfree(priv); |
450 | } | 652 | } |
@@ -452,6 +654,7 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
452 | int alps_init(struct psmouse *psmouse) | 654 | int alps_init(struct psmouse *psmouse) |
453 | { | 655 | { |
454 | struct alps_data *priv; | 656 | struct alps_data *priv; |
657 | const struct alps_model_info *model; | ||
455 | struct input_dev *dev1 = psmouse->dev, *dev2; | 658 | struct input_dev *dev1 = psmouse->dev, *dev2; |
456 | int version; | 659 | int version; |
457 | 660 | ||
@@ -461,35 +664,63 @@ int alps_init(struct psmouse *psmouse) | |||
461 | goto init_fail; | 664 | goto init_fail; |
462 | 665 | ||
463 | priv->dev2 = dev2; | 666 | priv->dev2 = dev2; |
667 | setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse); | ||
668 | |||
464 | psmouse->private = priv; | 669 | psmouse->private = priv; |
465 | 670 | ||
466 | if (alps_hw_init(psmouse, &version)) | 671 | model = alps_get_model(psmouse, &version); |
672 | if (!model) | ||
673 | goto init_fail; | ||
674 | |||
675 | priv->i = model; | ||
676 | |||
677 | if (alps_hw_init(psmouse)) | ||
467 | goto init_fail; | 678 | goto init_fail; |
468 | 679 | ||
680 | /* | ||
681 | * Undo part of setup done for us by psmouse core since touchpad | ||
682 | * is not a relative device. | ||
683 | */ | ||
684 | __clear_bit(EV_REL, dev1->evbit); | ||
685 | __clear_bit(REL_X, dev1->relbit); | ||
686 | __clear_bit(REL_Y, dev1->relbit); | ||
687 | |||
688 | /* | ||
689 | * Now set up our capabilities. | ||
690 | */ | ||
469 | dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); | 691 | dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); |
470 | dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); | 692 | dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); |
471 | dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); | 693 | dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); |
472 | dev1->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 694 | dev1->keybit[BIT_WORD(BTN_LEFT)] |= |
473 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 695 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
474 | 696 | ||
475 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); | 697 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); |
476 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); | 698 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); |
477 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | 699 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); |
478 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); | 700 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); |
479 | 701 | ||
480 | if (priv->i->flags & ALPS_WHEEL) { | 702 | if (model->flags & ALPS_WHEEL) { |
481 | dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); | 703 | dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); |
482 | dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL); | 704 | dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL); |
483 | } | 705 | } |
484 | 706 | ||
485 | if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { | 707 | if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { |
486 | dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); | 708 | dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); |
487 | dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); | 709 | dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); |
488 | } | 710 | } |
489 | 711 | ||
712 | if (model->flags & ALPS_FOUR_BUTTONS) { | ||
713 | dev1->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_0); | ||
714 | dev1->keybit[BIT_WORD(BTN_1)] |= BIT_MASK(BTN_1); | ||
715 | dev1->keybit[BIT_WORD(BTN_2)] |= BIT_MASK(BTN_2); | ||
716 | dev1->keybit[BIT_WORD(BTN_3)] |= BIT_MASK(BTN_3); | ||
717 | } else { | ||
718 | dev1->keybit[BIT_WORD(BTN_MIDDLE)] |= BIT_MASK(BTN_MIDDLE); | ||
719 | } | ||
720 | |||
490 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); | 721 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); |
491 | dev2->phys = priv->phys; | 722 | dev2->phys = priv->phys; |
492 | dev2->name = (priv->i->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; | 723 | dev2->name = (model->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; |
493 | dev2->id.bustype = BUS_I8042; | 724 | dev2->id.bustype = BUS_I8042; |
494 | dev2->id.vendor = 0x0002; | 725 | dev2->id.vendor = 0x0002; |
495 | dev2->id.product = PSMOUSE_ALPS; | 726 | dev2->id.product = PSMOUSE_ALPS; |
@@ -497,9 +728,9 @@ int alps_init(struct psmouse *psmouse) | |||
497 | dev2->dev.parent = &psmouse->ps2dev.serio->dev; | 728 | dev2->dev.parent = &psmouse->ps2dev.serio->dev; |
498 | 729 | ||
499 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 730 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
500 | dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 731 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
501 | dev2->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 732 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
502 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 733 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
503 | 734 | ||
504 | if (input_register_device(priv->dev2)) | 735 | if (input_register_device(priv->dev2)) |
505 | goto init_fail; | 736 | goto init_fail; |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index bc87936fee1a..904ed8b3c8be 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -23,6 +23,7 @@ struct alps_data { | |||
23 | char phys[32]; /* Phys */ | 23 | char phys[32]; /* Phys */ |
24 | const struct alps_model_info *i;/* Info */ | 24 | const struct alps_model_info *i;/* Info */ |
25 | int prev_fin; /* Finger bit from previous packet */ | 25 | int prev_fin; /* Finger bit from previous packet */ |
26 | struct timer_list timer; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | #ifdef CONFIG_MOUSE_PS2_ALPS | 29 | #ifdef CONFIG_MOUSE_PS2_ALPS |
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 908b5b44052f..53ec7ddd1826 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -205,8 +205,8 @@ struct atp { | |||
205 | bool overflow_warned; | 205 | bool overflow_warned; |
206 | int x_old; /* last reported x/y, */ | 206 | int x_old; /* last reported x/y, */ |
207 | int y_old; /* used for smoothing */ | 207 | int y_old; /* used for smoothing */ |
208 | signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; | 208 | u8 xy_cur[ATP_XSENSORS + ATP_YSENSORS]; |
209 | signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; | 209 | u8 xy_old[ATP_XSENSORS + ATP_YSENSORS]; |
210 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; | 210 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; |
211 | int idlecount; /* number of empty packets */ | 211 | int idlecount; /* number of empty packets */ |
212 | struct work_struct work; | 212 | struct work_struct work; |
@@ -531,7 +531,7 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
531 | 531 | ||
532 | for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { | 532 | for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { |
533 | /* accumulate the change */ | 533 | /* accumulate the change */ |
534 | signed char change = dev->xy_old[i] - dev->xy_cur[i]; | 534 | int change = dev->xy_old[i] - dev->xy_cur[i]; |
535 | dev->xy_acc[i] -= change; | 535 | dev->xy_acc[i] -= change; |
536 | 536 | ||
537 | /* prevent down drifting */ | 537 | /* prevent down drifting */ |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 0d1d33468b43..b89879bd860f 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -139,6 +139,7 @@ struct tp_finger { | |||
139 | /* trackpad finger data size, empirically at least ten fingers */ | 139 | /* trackpad finger data size, empirically at least ten fingers */ |
140 | #define SIZEOF_FINGER sizeof(struct tp_finger) | 140 | #define SIZEOF_FINGER sizeof(struct tp_finger) |
141 | #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) | 141 | #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) |
142 | #define MAX_FINGER_ORIENTATION 16384 | ||
142 | 143 | ||
143 | /* device-specific parameters */ | 144 | /* device-specific parameters */ |
144 | struct bcm5974_param { | 145 | struct bcm5974_param { |
@@ -284,6 +285,26 @@ static void setup_events_to_report(struct input_dev *input_dev, | |||
284 | input_set_abs_params(input_dev, ABS_Y, | 285 | input_set_abs_params(input_dev, ABS_Y, |
285 | 0, cfg->y.dim, cfg->y.fuzz, 0); | 286 | 0, cfg->y.dim, cfg->y.fuzz, 0); |
286 | 287 | ||
288 | /* finger touch area */ | ||
289 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | ||
290 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
291 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, | ||
292 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
293 | /* finger approach area */ | ||
294 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, | ||
295 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
296 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, | ||
297 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
298 | /* finger orientation */ | ||
299 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, | ||
300 | -MAX_FINGER_ORIENTATION, | ||
301 | MAX_FINGER_ORIENTATION, 0, 0); | ||
302 | /* finger position */ | ||
303 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | ||
304 | cfg->x.devmin, cfg->x.devmax, 0, 0); | ||
305 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | ||
306 | cfg->y.devmin, cfg->y.devmax, 0, 0); | ||
307 | |||
287 | __set_bit(EV_KEY, input_dev->evbit); | 308 | __set_bit(EV_KEY, input_dev->evbit); |
288 | __set_bit(BTN_TOUCH, input_dev->keybit); | 309 | __set_bit(BTN_TOUCH, input_dev->keybit); |
289 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | 310 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); |
@@ -310,13 +331,29 @@ static int report_bt_state(struct bcm5974 *dev, int size) | |||
310 | return 0; | 331 | return 0; |
311 | } | 332 | } |
312 | 333 | ||
334 | static void report_finger_data(struct input_dev *input, | ||
335 | const struct bcm5974_config *cfg, | ||
336 | const struct tp_finger *f) | ||
337 | { | ||
338 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major)); | ||
339 | input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor)); | ||
340 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major)); | ||
341 | input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor)); | ||
342 | input_report_abs(input, ABS_MT_ORIENTATION, | ||
343 | MAX_FINGER_ORIENTATION - raw2int(f->orientation)); | ||
344 | input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x)); | ||
345 | input_report_abs(input, ABS_MT_POSITION_Y, | ||
346 | cfg->y.devmin + cfg->y.devmax - raw2int(f->abs_y)); | ||
347 | input_mt_sync(input); | ||
348 | } | ||
349 | |||
313 | /* report trackpad data as logical trackpad state */ | 350 | /* report trackpad data as logical trackpad state */ |
314 | static int report_tp_state(struct bcm5974 *dev, int size) | 351 | static int report_tp_state(struct bcm5974 *dev, int size) |
315 | { | 352 | { |
316 | const struct bcm5974_config *c = &dev->cfg; | 353 | const struct bcm5974_config *c = &dev->cfg; |
317 | const struct tp_finger *f; | 354 | const struct tp_finger *f; |
318 | struct input_dev *input = dev->input; | 355 | struct input_dev *input = dev->input; |
319 | int raw_p, raw_w, raw_x, raw_y, raw_n; | 356 | int raw_p, raw_w, raw_x, raw_y, raw_n, i; |
320 | int ptest, origin, ibt = 0, nmin = 0, nmax = 0; | 357 | int ptest, origin, ibt = 0, nmin = 0, nmax = 0; |
321 | int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; | 358 | int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; |
322 | 359 | ||
@@ -329,6 +366,11 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
329 | 366 | ||
330 | /* always track the first finger; when detached, start over */ | 367 | /* always track the first finger; when detached, start over */ |
331 | if (raw_n) { | 368 | if (raw_n) { |
369 | |||
370 | /* report raw trackpad data */ | ||
371 | for (i = 0; i < raw_n; i++) | ||
372 | report_finger_data(input, c, &f[i]); | ||
373 | |||
332 | raw_p = raw2int(f->force_major); | 374 | raw_p = raw2int(f->force_major); |
333 | raw_w = raw2int(f->size_major); | 375 | raw_w = raw2int(f->size_major); |
334 | raw_x = raw2int(f->abs_x); | 376 | raw_x = raw2int(f->abs_x); |
@@ -761,7 +803,6 @@ static struct usb_driver bcm5974_driver = { | |||
761 | .disconnect = bcm5974_disconnect, | 803 | .disconnect = bcm5974_disconnect, |
762 | .suspend = bcm5974_suspend, | 804 | .suspend = bcm5974_suspend, |
763 | .resume = bcm5974_resume, | 805 | .resume = bcm5974_resume, |
764 | .reset_resume = bcm5974_resume, | ||
765 | .id_table = bcm5974_table, | 806 | .id_table = bcm5974_table, |
766 | .supports_autosuspend = 1, | 807 | .supports_autosuspend = 1, |
767 | }; | 808 | }; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index fda35e615abf..112b4ee52ff2 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/input.h> | 16 | #include <linux/input.h> |
16 | #include <linux/serio.h> | 17 | #include <linux/serio.h> |
@@ -24,6 +25,10 @@ | |||
24 | printk(KERN_DEBUG format, ##arg); \ | 25 | printk(KERN_DEBUG format, ##arg); \ |
25 | } while (0) | 26 | } while (0) |
26 | 27 | ||
28 | static bool force_elantech; | ||
29 | module_param_named(force_elantech, force_elantech, bool, 0644); | ||
30 | MODULE_PARM_DESC(force_elantech, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default)."); | ||
31 | |||
27 | /* | 32 | /* |
28 | * Send a Synaptics style sliced query command | 33 | * Send a Synaptics style sliced query command |
29 | */ | 34 | */ |
@@ -180,14 +185,18 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
180 | int fingers; | 185 | int fingers; |
181 | static int old_fingers; | 186 | static int old_fingers; |
182 | 187 | ||
183 | if (etd->fw_version_maj == 0x01) { | 188 | if (etd->fw_version < 0x020000) { |
184 | /* byte 0: D U p1 p2 1 p3 R L | 189 | /* |
185 | byte 1: f 0 th tw x9 x8 y9 y8 */ | 190 | * byte 0: D U p1 p2 1 p3 R L |
191 | * byte 1: f 0 th tw x9 x8 y9 y8 | ||
192 | */ | ||
186 | fingers = ((packet[1] & 0x80) >> 7) + | 193 | fingers = ((packet[1] & 0x80) >> 7) + |
187 | ((packet[1] & 0x30) >> 4); | 194 | ((packet[1] & 0x30) >> 4); |
188 | } else { | 195 | } else { |
189 | /* byte 0: n1 n0 p2 p1 1 p3 R L | 196 | /* |
190 | byte 1: 0 0 0 0 x9 x8 y9 y8 */ | 197 | * byte 0: n1 n0 p2 p1 1 p3 R L |
198 | * byte 1: 0 0 0 0 x9 x8 y9 y8 | ||
199 | */ | ||
191 | fingers = (packet[0] & 0xc0) >> 6; | 200 | fingers = (packet[0] & 0xc0) >> 6; |
192 | } | 201 | } |
193 | 202 | ||
@@ -201,13 +210,15 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
201 | 210 | ||
202 | input_report_key(dev, BTN_TOUCH, fingers != 0); | 211 | input_report_key(dev, BTN_TOUCH, fingers != 0); |
203 | 212 | ||
204 | /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 | 213 | /* |
205 | byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */ | 214 | * byte 2: x7 x6 x5 x4 x3 x2 x1 x0 |
215 | * byte 3: y7 y6 y5 y4 y3 y2 y1 y0 | ||
216 | */ | ||
206 | if (fingers) { | 217 | if (fingers) { |
207 | input_report_abs(dev, ABS_X, | 218 | input_report_abs(dev, ABS_X, |
208 | ((packet[1] & 0x0c) << 6) | packet[2]); | 219 | ((packet[1] & 0x0c) << 6) | packet[2]); |
209 | input_report_abs(dev, ABS_Y, ETP_YMAX_V1 - | 220 | input_report_abs(dev, ABS_Y, |
210 | (((packet[1] & 0x03) << 8) | packet[3])); | 221 | ETP_YMAX_V1 - (((packet[1] & 0x03) << 8) | packet[3])); |
211 | } | 222 | } |
212 | 223 | ||
213 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | 224 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); |
@@ -216,7 +227,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
216 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 227 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
217 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | 228 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); |
218 | 229 | ||
219 | if ((etd->fw_version_maj == 0x01) && | 230 | if (etd->fw_version < 0x020000 && |
220 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { | 231 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { |
221 | /* rocker up */ | 232 | /* rocker up */ |
222 | input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); | 233 | input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); |
@@ -246,34 +257,47 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
246 | 257 | ||
247 | switch (fingers) { | 258 | switch (fingers) { |
248 | case 1: | 259 | case 1: |
249 | /* byte 1: x15 x14 x13 x12 x11 x10 x9 x8 | 260 | /* |
250 | byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */ | 261 | * byte 1: . . . . . x10 x9 x8 |
251 | input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]); | 262 | * byte 2: x7 x6 x5 x4 x4 x2 x1 x0 |
252 | /* byte 4: y15 y14 y13 y12 y11 y10 y8 y8 | 263 | */ |
253 | byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */ | 264 | input_report_abs(dev, ABS_X, |
254 | input_report_abs(dev, ABS_Y, ETP_YMAX_V2 - | 265 | ((packet[1] & 0x07) << 8) | packet[2]); |
255 | ((packet[4] << 8) | packet[5])); | 266 | /* |
267 | * byte 4: . . . . . . y9 y8 | ||
268 | * byte 5: y7 y6 y5 y4 y3 y2 y1 y0 | ||
269 | */ | ||
270 | input_report_abs(dev, ABS_Y, | ||
271 | ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5])); | ||
256 | break; | 272 | break; |
257 | 273 | ||
258 | case 2: | 274 | case 2: |
259 | /* The coordinate of each finger is reported separately with | 275 | /* |
260 | a lower resolution for two finger touches */ | 276 | * The coordinate of each finger is reported separately |
261 | /* byte 0: . . ay8 ax8 . . . . | 277 | * with a lower resolution for two finger touches: |
262 | byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */ | 278 | * byte 0: . . ay8 ax8 . . . . |
279 | * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 | ||
280 | */ | ||
263 | x1 = ((packet[0] & 0x10) << 4) | packet[1]; | 281 | x1 = ((packet[0] & 0x10) << 4) | packet[1]; |
264 | /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ | 282 | /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ |
265 | y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); | 283 | y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); |
266 | /* byte 3: . . by8 bx8 . . . . | 284 | /* |
267 | byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */ | 285 | * byte 3: . . by8 bx8 . . . . |
286 | * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 | ||
287 | */ | ||
268 | x2 = ((packet[3] & 0x10) << 4) | packet[4]; | 288 | x2 = ((packet[3] & 0x10) << 4) | packet[4]; |
269 | /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ | 289 | /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ |
270 | y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); | 290 | y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); |
271 | /* For compatibility with the X Synaptics driver scale up one | 291 | /* |
272 | coordinate and report as ordinary mouse movent */ | 292 | * For compatibility with the X Synaptics driver scale up |
293 | * one coordinate and report as ordinary mouse movent | ||
294 | */ | ||
273 | input_report_abs(dev, ABS_X, x1 << 2); | 295 | input_report_abs(dev, ABS_X, x1 << 2); |
274 | input_report_abs(dev, ABS_Y, y1 << 2); | 296 | input_report_abs(dev, ABS_Y, y1 << 2); |
275 | /* For compatibility with the proprietary X Elantech driver | 297 | /* |
276 | report both coordinates as hat coordinates */ | 298 | * For compatibility with the proprietary X Elantech driver |
299 | * report both coordinates as hat coordinates | ||
300 | */ | ||
277 | input_report_abs(dev, ABS_HAT0X, x1); | 301 | input_report_abs(dev, ABS_HAT0X, x1); |
278 | input_report_abs(dev, ABS_HAT0Y, y1); | 302 | input_report_abs(dev, ABS_HAT0Y, y1); |
279 | input_report_abs(dev, ABS_HAT1X, x2); | 303 | input_report_abs(dev, ABS_HAT1X, x2); |
@@ -297,7 +321,7 @@ static int elantech_check_parity_v1(struct psmouse *psmouse) | |||
297 | unsigned char p1, p2, p3; | 321 | unsigned char p1, p2, p3; |
298 | 322 | ||
299 | /* Parity bits are placed differently */ | 323 | /* Parity bits are placed differently */ |
300 | if (etd->fw_version_maj == 0x01) { | 324 | if (etd->fw_version < 0x020000) { |
301 | /* byte 0: D U p1 p2 1 p3 R L */ | 325 | /* byte 0: D U p1 p2 1 p3 R L */ |
302 | p1 = (packet[0] & 0x20) >> 5; | 326 | p1 = (packet[0] & 0x20) >> 5; |
303 | p2 = (packet[0] & 0x10) >> 4; | 327 | p2 = (packet[0] & 0x10) >> 4; |
@@ -420,6 +444,7 @@ static void elantech_set_input_params(struct psmouse *psmouse) | |||
420 | 444 | ||
421 | __set_bit(EV_KEY, dev->evbit); | 445 | __set_bit(EV_KEY, dev->evbit); |
422 | __set_bit(EV_ABS, dev->evbit); | 446 | __set_bit(EV_ABS, dev->evbit); |
447 | __clear_bit(EV_REL, dev->evbit); | ||
423 | 448 | ||
424 | __set_bit(BTN_LEFT, dev->keybit); | 449 | __set_bit(BTN_LEFT, dev->keybit); |
425 | __set_bit(BTN_RIGHT, dev->keybit); | 450 | __set_bit(BTN_RIGHT, dev->keybit); |
@@ -432,7 +457,7 @@ static void elantech_set_input_params(struct psmouse *psmouse) | |||
432 | switch (etd->hw_version) { | 457 | switch (etd->hw_version) { |
433 | case 1: | 458 | case 1: |
434 | /* Rocker button */ | 459 | /* Rocker button */ |
435 | if ((etd->fw_version_maj == 0x01) && | 460 | if (etd->fw_version < 0x020000 && |
436 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { | 461 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { |
437 | __set_bit(BTN_FORWARD, dev->keybit); | 462 | __set_bit(BTN_FORWARD, dev->keybit); |
438 | __set_bit(BTN_BACK, dev->keybit); | 463 | __set_bit(BTN_BACK, dev->keybit); |
@@ -594,8 +619,12 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties) | |||
594 | param[0], param[1], param[2]); | 619 | param[0], param[1], param[2]); |
595 | 620 | ||
596 | if (param[0] == 0 || param[1] != 0) { | 621 | if (param[0] == 0 || param[1] != 0) { |
597 | pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n"); | 622 | if (!force_elantech) { |
598 | return -1; | 623 | pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n"); |
624 | return -1; | ||
625 | } | ||
626 | |||
627 | pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n"); | ||
599 | } | 628 | } |
600 | 629 | ||
601 | if (set_properties) { | 630 | if (set_properties) { |
@@ -657,14 +686,14 @@ int elantech_init(struct psmouse *psmouse) | |||
657 | pr_err("elantech.c: failed to query firmware version.\n"); | 686 | pr_err("elantech.c: failed to query firmware version.\n"); |
658 | goto init_fail; | 687 | goto init_fail; |
659 | } | 688 | } |
660 | etd->fw_version_maj = param[0]; | 689 | |
661 | etd->fw_version_min = param[2]; | 690 | etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; |
662 | 691 | ||
663 | /* | 692 | /* |
664 | * Assume every version greater than this is new EeePC style | 693 | * Assume every version greater than this is new EeePC style |
665 | * hardware with 6 byte packets | 694 | * hardware with 6 byte packets |
666 | */ | 695 | */ |
667 | if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) { | 696 | if (etd->fw_version >= 0x020030) { |
668 | etd->hw_version = 2; | 697 | etd->hw_version = 2; |
669 | /* For now show extra debug information */ | 698 | /* For now show extra debug information */ |
670 | etd->debug = 1; | 699 | etd->debug = 1; |
@@ -674,8 +703,9 @@ int elantech_init(struct psmouse *psmouse) | |||
674 | etd->hw_version = 1; | 703 | etd->hw_version = 1; |
675 | etd->paritycheck = 1; | 704 | etd->paritycheck = 1; |
676 | } | 705 | } |
677 | pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n", | 706 | |
678 | etd->hw_version, etd->fw_version_maj, etd->fw_version_min); | 707 | pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n", |
708 | etd->hw_version, param[0], param[1], param[2]); | ||
679 | 709 | ||
680 | if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { | 710 | if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { |
681 | pr_err("elantech.c: failed to query capabilities.\n"); | 711 | pr_err("elantech.c: failed to query capabilities.\n"); |
@@ -690,8 +720,8 @@ int elantech_init(struct psmouse *psmouse) | |||
690 | * a touch action starts causing the mouse cursor or scrolled page | 720 | * a touch action starts causing the mouse cursor or scrolled page |
691 | * to jump. Enable a workaround. | 721 | * to jump. Enable a workaround. |
692 | */ | 722 | */ |
693 | if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) { | 723 | if (etd->fw_version == 0x020022) { |
694 | pr_info("elantech.c: firmware version 2.34 detected, " | 724 | pr_info("elantech.c: firmware version 2.0.34 detected, " |
695 | "enabling jumpy cursor workaround\n"); | 725 | "enabling jumpy cursor workaround\n"); |
696 | etd->jumpy_cursor = 1; | 726 | etd->jumpy_cursor = 1; |
697 | } | 727 | } |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index feac5f7af966..ac57bde1bb9f 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -100,11 +100,10 @@ struct elantech_data { | |||
100 | unsigned char reg_26; | 100 | unsigned char reg_26; |
101 | unsigned char debug; | 101 | unsigned char debug; |
102 | unsigned char capabilities; | 102 | unsigned char capabilities; |
103 | unsigned char fw_version_maj; | ||
104 | unsigned char fw_version_min; | ||
105 | unsigned char hw_version; | ||
106 | unsigned char paritycheck; | 103 | unsigned char paritycheck; |
107 | unsigned char jumpy_cursor; | 104 | unsigned char jumpy_cursor; |
105 | unsigned char hw_version; | ||
106 | unsigned int fw_version; | ||
108 | unsigned char parity[256]; | 107 | unsigned char parity[256]; |
109 | }; | 108 | }; |
110 | 109 | ||
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index de1e553028b7..08d66d820d2b 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -30,6 +30,7 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define DEBUG | 32 | #define DEBUG |
33 | #include <linux/slab.h> | ||
33 | #include <linux/input.h> | 34 | #include <linux/input.h> |
34 | #include <linux/serio.h> | 35 | #include <linux/serio.h> |
35 | #include <linux/libps2.h> | 36 | #include <linux/libps2.h> |
@@ -68,10 +69,6 @@ module_param(post_interrupt_delay, int, 0644); | |||
68 | MODULE_PARM_DESC(post_interrupt_delay, | 69 | MODULE_PARM_DESC(post_interrupt_delay, |
69 | "delay (ms) before recal after recal interrupt detected"); | 70 | "delay (ms) before recal after recal interrupt detected"); |
70 | 71 | ||
71 | static int autorecal = 1; | ||
72 | module_param(autorecal, int, 0644); | ||
73 | MODULE_PARM_DESC(autorecal, "enable recalibration in the driver"); | ||
74 | |||
75 | /* | 72 | /* |
76 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" | 73 | * 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 | 74 | * above the pad and still have it send packets. This causes a jump cursor |
@@ -427,22 +424,8 @@ static void hgpk_recalib_work(struct work_struct *work) | |||
427 | 424 | ||
428 | static int hgpk_register(struct psmouse *psmouse) | 425 | static int hgpk_register(struct psmouse *psmouse) |
429 | { | 426 | { |
430 | struct input_dev *dev = psmouse->dev; | ||
431 | int err; | 427 | int err; |
432 | 428 | ||
433 | /* unset the things that psmouse-base sets which we don't have */ | ||
434 | __clear_bit(BTN_MIDDLE, dev->keybit); | ||
435 | |||
436 | /* set the things we do have */ | ||
437 | __set_bit(EV_KEY, dev->evbit); | ||
438 | __set_bit(EV_REL, dev->evbit); | ||
439 | |||
440 | __set_bit(REL_X, dev->relbit); | ||
441 | __set_bit(REL_Y, dev->relbit); | ||
442 | |||
443 | __set_bit(BTN_LEFT, dev->keybit); | ||
444 | __set_bit(BTN_RIGHT, dev->keybit); | ||
445 | |||
446 | /* register handlers */ | 429 | /* register handlers */ |
447 | psmouse->protocol_handler = hgpk_process_byte; | 430 | psmouse->protocol_handler = hgpk_process_byte; |
448 | psmouse->poll = hgpk_poll; | 431 | psmouse->poll = hgpk_poll; |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 82811558ec33..c31ad11df6bb 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/serio.h> | 16 | #include <linux/serio.h> |
17 | #include <linux/libps2.h> | 17 | #include <linux/libps2.h> |
18 | #include <linux/dmi.h> | 18 | #include <linux/dmi.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #include "psmouse.h" | 21 | #include "psmouse.h" |
21 | #include "lifebook.h" | 22 | #include "lifebook.h" |
@@ -25,11 +26,13 @@ struct lifebook_data { | |||
25 | char phys[32]; | 26 | char phys[32]; |
26 | }; | 27 | }; |
27 | 28 | ||
29 | static bool lifebook_present; | ||
30 | |||
28 | static const char *desired_serio_phys; | 31 | static const char *desired_serio_phys; |
29 | 32 | ||
30 | static int lifebook_set_serio_phys(const struct dmi_system_id *d) | 33 | static int lifebook_limit_serio3(const struct dmi_system_id *d) |
31 | { | 34 | { |
32 | desired_serio_phys = d->driver_data; | 35 | desired_serio_phys = "isa0060/serio3"; |
33 | return 0; | 36 | return 0; |
34 | } | 37 | } |
35 | 38 | ||
@@ -41,53 +44,58 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) | |||
41 | return 0; | 44 | return 0; |
42 | } | 45 | } |
43 | 46 | ||
44 | static const struct dmi_system_id lifebook_dmi_table[] = { | 47 | static const struct dmi_system_id __initconst lifebook_dmi_table[] = { |
45 | { | 48 | { |
46 | .ident = "FLORA-ie 55mi", | 49 | /* FLORA-ie 55mi */ |
47 | .matches = { | 50 | .matches = { |
48 | DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), | 51 | DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), |
49 | }, | 52 | }, |
50 | }, | 53 | }, |
51 | { | 54 | { |
52 | .ident = "LifeBook B", | 55 | /* LifeBook B */ |
56 | .matches = { | ||
57 | DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B Series"), | ||
58 | }, | ||
59 | }, | ||
60 | { | ||
61 | /* LifeBook B */ | ||
53 | .matches = { | 62 | .matches = { |
54 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | 63 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), |
55 | }, | 64 | }, |
56 | }, | 65 | }, |
57 | { | 66 | { |
58 | .ident = "Lifebook B", | 67 | /* Lifebook B */ |
59 | .matches = { | 68 | .matches = { |
60 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), | 69 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), |
61 | }, | 70 | }, |
62 | }, | 71 | }, |
63 | { | 72 | { |
64 | .ident = "Lifebook B-2130", | 73 | /* Lifebook B-2130 */ |
65 | .matches = { | 74 | .matches = { |
66 | DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), | 75 | DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), |
67 | }, | 76 | }, |
68 | }, | 77 | }, |
69 | { | 78 | { |
70 | .ident = "Lifebook B213x/B2150", | 79 | /* Lifebook B213x/B2150 */ |
71 | .matches = { | 80 | .matches = { |
72 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), | 81 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), |
73 | }, | 82 | }, |
74 | }, | 83 | }, |
75 | { | 84 | { |
76 | .ident = "Zephyr", | 85 | /* Zephyr */ |
77 | .matches = { | 86 | .matches = { |
78 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), | 87 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), |
79 | }, | 88 | }, |
80 | }, | 89 | }, |
81 | { | 90 | { |
82 | .ident = "CF-18", | 91 | /* Panasonic CF-18 */ |
83 | .matches = { | 92 | .matches = { |
84 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | 93 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), |
85 | }, | 94 | }, |
86 | .callback = lifebook_set_serio_phys, | 95 | .callback = lifebook_limit_serio3, |
87 | .driver_data = "isa0060/serio3", | ||
88 | }, | 96 | }, |
89 | { | 97 | { |
90 | .ident = "Panasonic CF-28", | 98 | /* Panasonic CF-28 */ |
91 | .matches = { | 99 | .matches = { |
92 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | 100 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), |
93 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"), | 101 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"), |
@@ -95,7 +103,7 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
95 | .callback = lifebook_set_6byte_proto, | 103 | .callback = lifebook_set_6byte_proto, |
96 | }, | 104 | }, |
97 | { | 105 | { |
98 | .ident = "Panasonic CF-29", | 106 | /* Panasonic CF-29 */ |
99 | .matches = { | 107 | .matches = { |
100 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | 108 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), |
101 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), | 109 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), |
@@ -103,14 +111,14 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
103 | .callback = lifebook_set_6byte_proto, | 111 | .callback = lifebook_set_6byte_proto, |
104 | }, | 112 | }, |
105 | { | 113 | { |
106 | .ident = "CF-72", | 114 | /* Panasonic CF-72 */ |
107 | .matches = { | 115 | .matches = { |
108 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), | 116 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), |
109 | }, | 117 | }, |
110 | .callback = lifebook_set_6byte_proto, | 118 | .callback = lifebook_set_6byte_proto, |
111 | }, | 119 | }, |
112 | { | 120 | { |
113 | .ident = "Lifebook B142", | 121 | /* Lifebook B142 */ |
114 | .matches = { | 122 | .matches = { |
115 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | 123 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), |
116 | }, | 124 | }, |
@@ -118,6 +126,11 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
118 | { } | 126 | { } |
119 | }; | 127 | }; |
120 | 128 | ||
129 | void __init lifebook_module_init(void) | ||
130 | { | ||
131 | lifebook_present = dmi_check_system(lifebook_dmi_table); | ||
132 | } | ||
133 | |||
121 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) | 134 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) |
122 | { | 135 | { |
123 | struct lifebook_data *priv = psmouse->private; | 136 | struct lifebook_data *priv = psmouse->private; |
@@ -198,10 +211,10 @@ static int lifebook_absolute_mode(struct psmouse *psmouse) | |||
198 | return -1; | 211 | return -1; |
199 | 212 | ||
200 | /* | 213 | /* |
201 | Enable absolute output -- ps2_command fails always but if | 214 | * Enable absolute output -- ps2_command fails always but if |
202 | you leave this call out the touchsreen will never send | 215 | * you leave this call out the touchsreen will never send |
203 | absolute coordinates | 216 | * absolute coordinates |
204 | */ | 217 | */ |
205 | param = lifebook_use_6byte_proto ? 0x08 : 0x07; | 218 | param = lifebook_use_6byte_proto ? 0x08 : 0x07; |
206 | ps2_command(ps2dev, ¶m, PSMOUSE_CMD_SETRES); | 219 | ps2_command(ps2dev, ¶m, PSMOUSE_CMD_SETRES); |
207 | 220 | ||
@@ -243,7 +256,7 @@ static void lifebook_disconnect(struct psmouse *psmouse) | |||
243 | 256 | ||
244 | int lifebook_detect(struct psmouse *psmouse, bool set_properties) | 257 | int lifebook_detect(struct psmouse *psmouse, bool set_properties) |
245 | { | 258 | { |
246 | if (!dmi_check_system(lifebook_dmi_table)) | 259 | if (!lifebook_present) |
247 | return -1; | 260 | return -1; |
248 | 261 | ||
249 | if (desired_serio_phys && | 262 | if (desired_serio_phys && |
@@ -283,8 +296,8 @@ static int lifebook_create_relative_device(struct psmouse *psmouse) | |||
283 | 296 | ||
284 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 297 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
285 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 298 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
286 | dev2->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | | 299 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
287 | BIT_MASK(BTN_RIGHT); | 300 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
288 | 301 | ||
289 | error = input_register_device(priv->dev2); | 302 | error = input_register_device(priv->dev2); |
290 | if (error) | 303 | if (error) |
@@ -309,6 +322,7 @@ int lifebook_init(struct psmouse *psmouse) | |||
309 | 322 | ||
310 | dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); | 323 | dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); |
311 | dev1->relbit[0] = 0; | 324 | dev1->relbit[0] = 0; |
325 | dev1->keybit[BIT_WORD(BTN_MOUSE)] = 0; | ||
312 | dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 326 | dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
313 | input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); | 327 | input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); |
314 | input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0); | 328 | input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0); |
diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h index 407cb226bc0a..4c4326c6f504 100644 --- a/drivers/input/mouse/lifebook.h +++ b/drivers/input/mouse/lifebook.h | |||
@@ -12,9 +12,13 @@ | |||
12 | #define _LIFEBOOK_H | 12 | #define _LIFEBOOK_H |
13 | 13 | ||
14 | #ifdef CONFIG_MOUSE_PS2_LIFEBOOK | 14 | #ifdef CONFIG_MOUSE_PS2_LIFEBOOK |
15 | void lifebook_module_init(void); | ||
15 | int lifebook_detect(struct psmouse *psmouse, bool set_properties); | 16 | int lifebook_detect(struct psmouse *psmouse, bool set_properties); |
16 | int lifebook_init(struct psmouse *psmouse); | 17 | int lifebook_init(struct psmouse *psmouse); |
17 | #else | 18 | #else |
19 | inline void lifebook_module_init(void) | ||
20 | { | ||
21 | } | ||
18 | inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) | 22 | inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) |
19 | { | 23 | { |
20 | return -ENOSYS; | 24 | return -ENOSYS; |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index ab5dc5f5fd83..543c240a85f2 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -404,8 +404,8 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties) | |||
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | if (buttons < 3) | 407 | if (buttons >= 3) |
408 | __clear_bit(BTN_MIDDLE, psmouse->dev->keybit); | 408 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
409 | 409 | ||
410 | if (model_info) | 410 | if (model_info) |
411 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); | 411 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 07c53798301a..a3c97315a473 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -110,6 +110,7 @@ static struct workqueue_struct *kpsmoused_wq; | |||
110 | struct psmouse_protocol { | 110 | struct psmouse_protocol { |
111 | enum psmouse_type type; | 111 | enum psmouse_type type; |
112 | bool maxproto; | 112 | bool maxproto; |
113 | bool ignore_parity; /* Protocol should ignore parity errors from KBC */ | ||
113 | const char *name; | 114 | const char *name; |
114 | const char *alias; | 115 | const char *alias; |
115 | int (*detect)(struct psmouse *, bool); | 116 | int (*detect)(struct psmouse *, bool); |
@@ -288,7 +289,9 @@ static irqreturn_t psmouse_interrupt(struct serio *serio, | |||
288 | if (psmouse->state == PSMOUSE_IGNORE) | 289 | if (psmouse->state == PSMOUSE_IGNORE) |
289 | goto out; | 290 | goto out; |
290 | 291 | ||
291 | if (flags & (SERIO_PARITY|SERIO_TIMEOUT)) { | 292 | if (unlikely((flags & SERIO_TIMEOUT) || |
293 | ((flags & SERIO_PARITY) && !psmouse->ignore_parity))) { | ||
294 | |||
292 | if (psmouse->state == PSMOUSE_ACTIVATED) | 295 | if (psmouse->state == PSMOUSE_ACTIVATED) |
293 | printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", | 296 | printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", |
294 | flags & SERIO_TIMEOUT ? " timeout" : "", | 297 | flags & SERIO_TIMEOUT ? " timeout" : "", |
@@ -425,6 +428,7 @@ static int genius_detect(struct psmouse *psmouse, bool set_properties) | |||
425 | return -1; | 428 | return -1; |
426 | 429 | ||
427 | if (set_properties) { | 430 | if (set_properties) { |
431 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
428 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 432 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
429 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 433 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
430 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 434 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
@@ -460,8 +464,10 @@ static int intellimouse_detect(struct psmouse *psmouse, bool set_properties) | |||
460 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 464 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
461 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 465 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
462 | 466 | ||
463 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 467 | if (!psmouse->vendor) |
464 | if (!psmouse->name) psmouse->name = "Wheel Mouse"; | 468 | psmouse->vendor = "Generic"; |
469 | if (!psmouse->name) | ||
470 | psmouse->name = "Wheel Mouse"; | ||
465 | psmouse->pktsize = 4; | 471 | psmouse->pktsize = 4; |
466 | } | 472 | } |
467 | 473 | ||
@@ -504,8 +510,10 @@ static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) | |||
504 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 510 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
505 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 511 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
506 | 512 | ||
507 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 513 | if (!psmouse->vendor) |
508 | if (!psmouse->name) psmouse->name = "Explorer Mouse"; | 514 | psmouse->vendor = "Generic"; |
515 | if (!psmouse->name) | ||
516 | psmouse->name = "Explorer Mouse"; | ||
509 | psmouse->pktsize = 4; | 517 | psmouse->pktsize = 4; |
510 | } | 518 | } |
511 | 519 | ||
@@ -536,6 +544,7 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
536 | return -1; | 544 | return -1; |
537 | 545 | ||
538 | if (set_properties) { | 546 | if (set_properties) { |
547 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
539 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 548 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
540 | 549 | ||
541 | psmouse->vendor = "Kensington"; | 550 | psmouse->vendor = "Kensington"; |
@@ -551,8 +560,16 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
551 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) | 560 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) |
552 | { | 561 | { |
553 | if (set_properties) { | 562 | if (set_properties) { |
554 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 563 | if (!psmouse->vendor) |
555 | if (!psmouse->name) psmouse->name = "Mouse"; | 564 | psmouse->vendor = "Generic"; |
565 | if (!psmouse->name) | ||
566 | psmouse->name = "Mouse"; | ||
567 | |||
568 | /* | ||
569 | * We have no way of figuring true number of buttons so let's | ||
570 | * assume that the device has 3. | ||
571 | */ | ||
572 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
556 | } | 573 | } |
557 | 574 | ||
558 | return 0; | 575 | return 0; |
@@ -567,6 +584,8 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) | |||
567 | if (set_properties) { | 584 | if (set_properties) { |
568 | psmouse->vendor = "Cortron"; | 585 | psmouse->vendor = "Cortron"; |
569 | psmouse->name = "PS/2 Trackball"; | 586 | psmouse->name = "PS/2 Trackball"; |
587 | |||
588 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
570 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 589 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
571 | } | 590 | } |
572 | 591 | ||
@@ -611,8 +630,15 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
611 | synaptics_hardware = true; | 630 | synaptics_hardware = true; |
612 | 631 | ||
613 | if (max_proto > PSMOUSE_IMEX) { | 632 | if (max_proto > PSMOUSE_IMEX) { |
614 | if (!set_properties || synaptics_init(psmouse) == 0) | 633 | /* |
634 | * Try activating protocol, but check if support is enabled first, since | ||
635 | * we try detecting Synaptics even when protocol is disabled. | ||
636 | */ | ||
637 | if (synaptics_supported() && | ||
638 | (!set_properties || synaptics_init(psmouse) == 0)) { | ||
615 | return PSMOUSE_SYNAPTICS; | 639 | return PSMOUSE_SYNAPTICS; |
640 | } | ||
641 | |||
616 | /* | 642 | /* |
617 | * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). | 643 | * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). |
618 | * Unfortunately Logitech/Genius probes confuse some firmware versions so | 644 | * Unfortunately Logitech/Genius probes confuse some firmware versions so |
@@ -667,19 +693,6 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
667 | max_proto = PSMOUSE_IMEX; | 693 | max_proto = PSMOUSE_IMEX; |
668 | } | 694 | } |
669 | 695 | ||
670 | /* | ||
671 | * Try Finger Sensing Pad | ||
672 | */ | ||
673 | if (max_proto > PSMOUSE_IMEX) { | ||
674 | if (fsp_detect(psmouse, set_properties) == 0) { | ||
675 | if (!set_properties || fsp_init(psmouse) == 0) | ||
676 | return PSMOUSE_FSP; | ||
677 | /* | ||
678 | * Init failed, try basic relative protocols | ||
679 | */ | ||
680 | max_proto = PSMOUSE_IMEX; | ||
681 | } | ||
682 | } | ||
683 | 696 | ||
684 | if (max_proto > PSMOUSE_IMEX) { | 697 | if (max_proto > PSMOUSE_IMEX) { |
685 | if (genius_detect(psmouse, set_properties) == 0) | 698 | if (genius_detect(psmouse, set_properties) == 0) |
@@ -696,6 +709,21 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
696 | } | 709 | } |
697 | 710 | ||
698 | /* | 711 | /* |
712 | * Try Finger Sensing Pad. We do it here because its probe upsets | ||
713 | * Trackpoint devices (causing TP_READ_ID command to time out). | ||
714 | */ | ||
715 | if (max_proto > PSMOUSE_IMEX) { | ||
716 | if (fsp_detect(psmouse, set_properties) == 0) { | ||
717 | if (!set_properties || fsp_init(psmouse) == 0) | ||
718 | return PSMOUSE_FSP; | ||
719 | /* | ||
720 | * Init failed, try basic relative protocols | ||
721 | */ | ||
722 | max_proto = PSMOUSE_IMEX; | ||
723 | } | ||
724 | } | ||
725 | |||
726 | /* | ||
699 | * Reset to defaults in case the device got confused by extended | 727 | * Reset to defaults in case the device got confused by extended |
700 | * protocol probes. Note that we follow up with full reset because | 728 | * protocol probes. Note that we follow up with full reset because |
701 | * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS. | 729 | * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS. |
@@ -734,6 +762,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { | |||
734 | .name = "PS/2", | 762 | .name = "PS/2", |
735 | .alias = "bare", | 763 | .alias = "bare", |
736 | .maxproto = true, | 764 | .maxproto = true, |
765 | .ignore_parity = true, | ||
737 | .detect = ps2bare_detect, | 766 | .detect = ps2bare_detect, |
738 | }, | 767 | }, |
739 | #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP | 768 | #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP |
@@ -761,6 +790,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { | |||
761 | .name = "ImPS/2", | 790 | .name = "ImPS/2", |
762 | .alias = "imps", | 791 | .alias = "imps", |
763 | .maxproto = true, | 792 | .maxproto = true, |
793 | .ignore_parity = true, | ||
764 | .detect = intellimouse_detect, | 794 | .detect = intellimouse_detect, |
765 | }, | 795 | }, |
766 | { | 796 | { |
@@ -768,6 +798,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { | |||
768 | .name = "ImExPS/2", | 798 | .name = "ImExPS/2", |
769 | .alias = "exps", | 799 | .alias = "exps", |
770 | .maxproto = true, | 800 | .maxproto = true, |
801 | .ignore_parity = true, | ||
771 | .detect = im_explorer_detect, | 802 | .detect = im_explorer_detect, |
772 | }, | 803 | }, |
773 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS | 804 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS |
@@ -1116,12 +1147,22 @@ static void psmouse_cleanup(struct serio *serio) | |||
1116 | psmouse_deactivate(parent); | 1147 | psmouse_deactivate(parent); |
1117 | } | 1148 | } |
1118 | 1149 | ||
1119 | psmouse_deactivate(psmouse); | 1150 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); |
1151 | |||
1152 | /* | ||
1153 | * Disable stream mode so cleanup routine can proceed undisturbed. | ||
1154 | */ | ||
1155 | if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE)) | ||
1156 | printk(KERN_WARNING "psmouse.c: Failed to disable mouse on %s\n", | ||
1157 | psmouse->ps2dev.serio->phys); | ||
1120 | 1158 | ||
1121 | if (psmouse->cleanup) | 1159 | if (psmouse->cleanup) |
1122 | psmouse->cleanup(psmouse); | 1160 | psmouse->cleanup(psmouse); |
1123 | 1161 | ||
1124 | psmouse_reset(psmouse); | 1162 | /* |
1163 | * Reset the mouse to defaults (bare PS/2 protocol). | ||
1164 | */ | ||
1165 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); | ||
1125 | 1166 | ||
1126 | /* | 1167 | /* |
1127 | * Some boxes, such as HP nx7400, get terribly confused if mouse | 1168 | * Some boxes, such as HP nx7400, get terribly confused if mouse |
@@ -1184,15 +1225,17 @@ static void psmouse_disconnect(struct serio *serio) | |||
1184 | mutex_unlock(&psmouse_mutex); | 1225 | mutex_unlock(&psmouse_mutex); |
1185 | } | 1226 | } |
1186 | 1227 | ||
1187 | static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto) | 1228 | static int psmouse_switch_protocol(struct psmouse *psmouse, |
1229 | const struct psmouse_protocol *proto) | ||
1188 | { | 1230 | { |
1231 | const struct psmouse_protocol *selected_proto; | ||
1189 | struct input_dev *input_dev = psmouse->dev; | 1232 | struct input_dev *input_dev = psmouse->dev; |
1190 | 1233 | ||
1191 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; | 1234 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; |
1192 | 1235 | ||
1193 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 1236 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
1194 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | | 1237 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = |
1195 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 1238 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
1196 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 1239 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
1197 | 1240 | ||
1198 | psmouse->set_rate = psmouse_set_rate; | 1241 | psmouse->set_rate = psmouse_set_rate; |
@@ -1209,10 +1252,14 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse | |||
1209 | return -1; | 1252 | return -1; |
1210 | 1253 | ||
1211 | psmouse->type = proto->type; | 1254 | psmouse->type = proto->type; |
1212 | } | 1255 | selected_proto = proto; |
1213 | else | 1256 | } else { |
1214 | psmouse->type = psmouse_extensions(psmouse, | 1257 | psmouse->type = psmouse_extensions(psmouse, |
1215 | psmouse_max_proto, true); | 1258 | psmouse_max_proto, true); |
1259 | selected_proto = psmouse_protocol_by_type(psmouse->type); | ||
1260 | } | ||
1261 | |||
1262 | psmouse->ignore_parity = selected_proto->ignore_parity; | ||
1216 | 1263 | ||
1217 | /* | 1264 | /* |
1218 | * If mouse's packet size is 3 there is no point in polling the | 1265 | * If mouse's packet size is 3 there is no point in polling the |
@@ -1232,7 +1279,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse | |||
1232 | psmouse->resync_time = 0; | 1279 | psmouse->resync_time = 0; |
1233 | 1280 | ||
1234 | snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", | 1281 | snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", |
1235 | psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name); | 1282 | selected_proto->name, psmouse->vendor, psmouse->name); |
1236 | 1283 | ||
1237 | input_dev->name = psmouse->devname; | 1284 | input_dev->name = psmouse->devname; |
1238 | input_dev->phys = psmouse->phys; | 1285 | input_dev->phys = psmouse->phys; |
@@ -1347,6 +1394,7 @@ static int psmouse_reconnect(struct serio *serio) | |||
1347 | struct psmouse *psmouse = serio_get_drvdata(serio); | 1394 | struct psmouse *psmouse = serio_get_drvdata(serio); |
1348 | struct psmouse *parent = NULL; | 1395 | struct psmouse *parent = NULL; |
1349 | struct serio_driver *drv = serio->drv; | 1396 | struct serio_driver *drv = serio->drv; |
1397 | unsigned char type; | ||
1350 | int rc = -1; | 1398 | int rc = -1; |
1351 | 1399 | ||
1352 | if (!drv || !psmouse) { | 1400 | if (!drv || !psmouse) { |
@@ -1366,10 +1414,15 @@ static int psmouse_reconnect(struct serio *serio) | |||
1366 | if (psmouse->reconnect) { | 1414 | if (psmouse->reconnect) { |
1367 | if (psmouse->reconnect(psmouse)) | 1415 | if (psmouse->reconnect(psmouse)) |
1368 | goto out; | 1416 | goto out; |
1369 | } else if (psmouse_probe(psmouse) < 0 || | 1417 | } else { |
1370 | psmouse->type != psmouse_extensions(psmouse, | 1418 | psmouse_reset(psmouse); |
1371 | psmouse_max_proto, false)) { | 1419 | |
1372 | goto out; | 1420 | if (psmouse_probe(psmouse) < 0) |
1421 | goto out; | ||
1422 | |||
1423 | type = psmouse_extensions(psmouse, psmouse_max_proto, false); | ||
1424 | if (psmouse->type != type) | ||
1425 | goto out; | ||
1373 | } | 1426 | } |
1374 | 1427 | ||
1375 | /* ok, the device type (and capabilities) match the old one, | 1428 | /* ok, the device type (and capabilities) match the old one, |
@@ -1431,24 +1484,10 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *de | |||
1431 | struct serio *serio = to_serio_port(dev); | 1484 | struct serio *serio = to_serio_port(dev); |
1432 | struct psmouse_attribute *attr = to_psmouse_attr(devattr); | 1485 | struct psmouse_attribute *attr = to_psmouse_attr(devattr); |
1433 | struct psmouse *psmouse; | 1486 | struct psmouse *psmouse; |
1434 | int retval; | ||
1435 | |||
1436 | retval = serio_pin_driver(serio); | ||
1437 | if (retval) | ||
1438 | return retval; | ||
1439 | |||
1440 | if (serio->drv != &psmouse_drv) { | ||
1441 | retval = -ENODEV; | ||
1442 | goto out; | ||
1443 | } | ||
1444 | 1487 | ||
1445 | psmouse = serio_get_drvdata(serio); | 1488 | psmouse = serio_get_drvdata(serio); |
1446 | 1489 | ||
1447 | retval = attr->show(psmouse, attr->data, buf); | 1490 | return attr->show(psmouse, attr->data, buf); |
1448 | |||
1449 | out: | ||
1450 | serio_unpin_driver(serio); | ||
1451 | return retval; | ||
1452 | } | 1491 | } |
1453 | 1492 | ||
1454 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, | 1493 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, |
@@ -1459,18 +1498,9 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1459 | struct psmouse *psmouse, *parent = NULL; | 1498 | struct psmouse *psmouse, *parent = NULL; |
1460 | int retval; | 1499 | int retval; |
1461 | 1500 | ||
1462 | retval = serio_pin_driver(serio); | ||
1463 | if (retval) | ||
1464 | return retval; | ||
1465 | |||
1466 | if (serio->drv != &psmouse_drv) { | ||
1467 | retval = -ENODEV; | ||
1468 | goto out_unpin; | ||
1469 | } | ||
1470 | |||
1471 | retval = mutex_lock_interruptible(&psmouse_mutex); | 1501 | retval = mutex_lock_interruptible(&psmouse_mutex); |
1472 | if (retval) | 1502 | if (retval) |
1473 | goto out_unpin; | 1503 | goto out; |
1474 | 1504 | ||
1475 | psmouse = serio_get_drvdata(serio); | 1505 | psmouse = serio_get_drvdata(serio); |
1476 | 1506 | ||
@@ -1500,8 +1530,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1500 | 1530 | ||
1501 | out_unlock: | 1531 | out_unlock: |
1502 | mutex_unlock(&psmouse_mutex); | 1532 | mutex_unlock(&psmouse_mutex); |
1503 | out_unpin: | 1533 | out: |
1504 | serio_unpin_driver(serio); | ||
1505 | return retval; | 1534 | return retval; |
1506 | } | 1535 | } |
1507 | 1536 | ||
@@ -1563,9 +1592,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1563 | } | 1592 | } |
1564 | 1593 | ||
1565 | mutex_unlock(&psmouse_mutex); | 1594 | mutex_unlock(&psmouse_mutex); |
1566 | serio_unpin_driver(serio); | ||
1567 | serio_unregister_child_port(serio); | 1595 | serio_unregister_child_port(serio); |
1568 | serio_pin_driver_uninterruptible(serio); | ||
1569 | mutex_lock(&psmouse_mutex); | 1596 | mutex_lock(&psmouse_mutex); |
1570 | 1597 | ||
1571 | if (serio->drv != &psmouse_drv) { | 1598 | if (serio->drv != &psmouse_drv) { |
@@ -1680,6 +1707,9 @@ static int __init psmouse_init(void) | |||
1680 | { | 1707 | { |
1681 | int err; | 1708 | int err; |
1682 | 1709 | ||
1710 | lifebook_module_init(); | ||
1711 | synaptics_module_init(); | ||
1712 | |||
1683 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); | 1713 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); |
1684 | if (!kpsmoused_wq) { | 1714 | if (!kpsmoused_wq) { |
1685 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); | 1715 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); |
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index e053bdd137ff..593e910bfc7a 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -47,6 +47,7 @@ struct psmouse { | |||
47 | unsigned char pktcnt; | 47 | unsigned char pktcnt; |
48 | unsigned char pktsize; | 48 | unsigned char pktsize; |
49 | unsigned char type; | 49 | unsigned char type; |
50 | bool ignore_parity; | ||
50 | bool acks_disable_command; | 51 | bool acks_disable_command; |
51 | unsigned int model; | 52 | unsigned int model; |
52 | unsigned long last; | 53 | unsigned long last; |
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c index 1e827ad0afbe..943cfec15665 100644 --- a/drivers/input/mouse/pxa930_trkball.c +++ b/drivers/input/mouse/pxa930_trkball.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
23 | #include <mach/pxa930_trkball.h> | 24 | #include <mach/pxa930_trkball.h> |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index f84cbd97c884..1242775fee19 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Finger Sensing Pad PS/2 mouse driver. | 2 | * Finger Sensing Pad PS/2 mouse driver. |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. | 4 | * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. |
5 | * Copyright (C) 2005-2009 Tai-hwa Liang, Sentelic Corporation. | 5 | * Copyright (C) 2005-2010 Tai-hwa Liang, Sentelic Corporation. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/libps2.h> | 26 | #include <linux/libps2.h> |
27 | #include <linux/serio.h> | 27 | #include <linux/serio.h> |
28 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
29 | #include <linux/slab.h> | ||
29 | 30 | ||
30 | #include "psmouse.h" | 31 | #include "psmouse.h" |
31 | #include "sentelic.h" | 32 | #include "sentelic.h" |
@@ -658,9 +659,9 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
658 | if (packet[3] & BIT(1)) | 659 | if (packet[3] & BIT(1)) |
659 | button_status |= 0x0f; /* wheel up */ | 660 | button_status |= 0x0f; /* wheel up */ |
660 | if (packet[3] & BIT(2)) | 661 | if (packet[3] & BIT(2)) |
661 | button_status |= BIT(5);/* horizontal left */ | 662 | button_status |= BIT(4);/* horizontal left */ |
662 | if (packet[3] & BIT(3)) | 663 | if (packet[3] & BIT(3)) |
663 | button_status |= BIT(4);/* horizontal right */ | 664 | button_status |= BIT(5);/* horizontal right */ |
664 | /* push back to packet queue */ | 665 | /* push back to packet queue */ |
665 | if (button_status != 0) | 666 | if (button_status != 0) |
666 | packet[3] = button_status; | 667 | packet[3] = button_status; |
@@ -836,6 +837,7 @@ int fsp_init(struct psmouse *psmouse) | |||
836 | priv->flags |= FSPDRV_FLAG_EN_OPC; | 837 | priv->flags |= FSPDRV_FLAG_EN_OPC; |
837 | 838 | ||
838 | /* Set up various supported input event bits */ | 839 | /* Set up various supported input event bits */ |
840 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
839 | __set_bit(BTN_BACK, psmouse->dev->keybit); | 841 | __set_bit(BTN_BACK, psmouse->dev->keybit); |
840 | __set_bit(BTN_FORWARD, psmouse->dev->keybit); | 842 | __set_bit(BTN_FORWARD, psmouse->dev->keybit); |
841 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 843 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index f4a61252bcc9..ebd7a99efeae 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -24,9 +24,11 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/dmi.h> | ||
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
28 | #include <linux/serio.h> | 29 | #include <linux/serio.h> |
29 | #include <linux/libps2.h> | 30 | #include <linux/libps2.h> |
31 | #include <linux/slab.h> | ||
30 | #include "psmouse.h" | 32 | #include "psmouse.h" |
31 | #include "synaptics.h" | 33 | #include "synaptics.h" |
32 | 34 | ||
@@ -135,7 +137,8 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
135 | if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) | 137 | if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) |
136 | return -1; | 138 | return -1; |
137 | priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | 139 | priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; |
138 | priv->ext_cap = 0; | 140 | priv->ext_cap = priv->ext_cap_0c = 0; |
141 | |||
139 | if (!SYN_CAP_VALID(priv->capabilities)) | 142 | if (!SYN_CAP_VALID(priv->capabilities)) |
140 | return -1; | 143 | return -1; |
141 | 144 | ||
@@ -148,7 +151,7 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
148 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { | 151 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { |
149 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { | 152 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { |
150 | printk(KERN_ERR "Synaptics claims to have extended capabilities," | 153 | printk(KERN_ERR "Synaptics claims to have extended capabilities," |
151 | " but I'm not able to read them."); | 154 | " but I'm not able to read them.\n"); |
152 | } else { | 155 | } else { |
153 | priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | 156 | priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; |
154 | 157 | ||
@@ -160,6 +163,16 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
160 | priv->ext_cap &= 0xff0fff; | 163 | priv->ext_cap &= 0xff0fff; |
161 | } | 164 | } |
162 | } | 165 | } |
166 | |||
167 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) { | ||
168 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) { | ||
169 | printk(KERN_ERR "Synaptics claims to have extended capability 0x0c," | ||
170 | " but I'm not able to read it.\n"); | ||
171 | } else { | ||
172 | priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | ||
173 | } | ||
174 | } | ||
175 | |||
163 | return 0; | 176 | return 0; |
164 | } | 177 | } |
165 | 178 | ||
@@ -346,7 +359,15 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data | |||
346 | hw->left = (buf[0] & 0x01) ? 1 : 0; | 359 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
347 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 360 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
348 | 361 | ||
349 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { | 362 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
363 | /* | ||
364 | * Clickpad's button is transmitted as middle button, | ||
365 | * however, since it is primary button, we will report | ||
366 | * it as BTN_LEFT. | ||
367 | */ | ||
368 | hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; | ||
369 | |||
370 | } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { | ||
350 | hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; | 371 | hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; |
351 | if (hw->w == 2) | 372 | if (hw->w == 2) |
352 | hw->scroll = (signed char)(buf[1]); | 373 | hw->scroll = (signed char)(buf[1]); |
@@ -591,6 +612,12 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
591 | 612 | ||
592 | dev->absres[ABS_X] = priv->x_res; | 613 | dev->absres[ABS_X] = priv->x_res; |
593 | dev->absres[ABS_Y] = priv->y_res; | 614 | dev->absres[ABS_Y] = priv->y_res; |
615 | |||
616 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | ||
617 | /* Clickpads report only left button */ | ||
618 | __clear_bit(BTN_RIGHT, dev->keybit); | ||
619 | __clear_bit(BTN_MIDDLE, dev->keybit); | ||
620 | } | ||
594 | } | 621 | } |
595 | 622 | ||
596 | static void synaptics_disconnect(struct psmouse *psmouse) | 623 | static void synaptics_disconnect(struct psmouse *psmouse) |
@@ -629,25 +656,26 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
629 | return 0; | 656 | return 0; |
630 | } | 657 | } |
631 | 658 | ||
632 | #if defined(__i386__) | 659 | static bool impaired_toshiba_kbc; |
633 | #include <linux/dmi.h> | 660 | |
634 | static const struct dmi_system_id toshiba_dmi_table[] = { | 661 | static const struct dmi_system_id __initconst toshiba_dmi_table[] = { |
662 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
635 | { | 663 | { |
636 | .ident = "Toshiba Satellite", | 664 | /* Toshiba Satellite */ |
637 | .matches = { | 665 | .matches = { |
638 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 666 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
639 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), | 667 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), |
640 | }, | 668 | }, |
641 | }, | 669 | }, |
642 | { | 670 | { |
643 | .ident = "Toshiba Dynabook", | 671 | /* Toshiba Dynabook */ |
644 | .matches = { | 672 | .matches = { |
645 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 673 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
646 | DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), | 674 | DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), |
647 | }, | 675 | }, |
648 | }, | 676 | }, |
649 | { | 677 | { |
650 | .ident = "Toshiba Portege M300", | 678 | /* Toshiba Portege M300 */ |
651 | .matches = { | 679 | .matches = { |
652 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 680 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
653 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), | 681 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), |
@@ -655,7 +683,7 @@ static const struct dmi_system_id toshiba_dmi_table[] = { | |||
655 | 683 | ||
656 | }, | 684 | }, |
657 | { | 685 | { |
658 | .ident = "Toshiba Portege M300", | 686 | /* Toshiba Portege M300 */ |
659 | .matches = { | 687 | .matches = { |
660 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 688 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
661 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), | 689 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), |
@@ -664,8 +692,13 @@ static const struct dmi_system_id toshiba_dmi_table[] = { | |||
664 | 692 | ||
665 | }, | 693 | }, |
666 | { } | 694 | { } |
667 | }; | ||
668 | #endif | 695 | #endif |
696 | }; | ||
697 | |||
698 | void __init synaptics_module_init(void) | ||
699 | { | ||
700 | impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); | ||
701 | } | ||
669 | 702 | ||
670 | int synaptics_init(struct psmouse *psmouse) | 703 | int synaptics_init(struct psmouse *psmouse) |
671 | { | 704 | { |
@@ -689,10 +722,10 @@ int synaptics_init(struct psmouse *psmouse) | |||
689 | 722 | ||
690 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; | 723 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; |
691 | 724 | ||
692 | printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n", | 725 | printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", |
693 | SYN_ID_MODEL(priv->identity), | 726 | SYN_ID_MODEL(priv->identity), |
694 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), | 727 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), |
695 | priv->model_id, priv->capabilities, priv->ext_cap); | 728 | priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c); |
696 | 729 | ||
697 | set_input_params(psmouse->dev, priv); | 730 | set_input_params(psmouse->dev, priv); |
698 | 731 | ||
@@ -718,18 +751,16 @@ int synaptics_init(struct psmouse *psmouse) | |||
718 | if (SYN_CAP_PASS_THROUGH(priv->capabilities)) | 751 | if (SYN_CAP_PASS_THROUGH(priv->capabilities)) |
719 | synaptics_pt_create(psmouse); | 752 | synaptics_pt_create(psmouse); |
720 | 753 | ||
721 | #if defined(__i386__) | ||
722 | /* | 754 | /* |
723 | * Toshiba's KBC seems to have trouble handling data from | 755 | * Toshiba's KBC seems to have trouble handling data from |
724 | * Synaptics as full rate, switch to lower rate which is roughly | 756 | * Synaptics as full rate, switch to lower rate which is roughly |
725 | * thye same as rate of standard PS/2 mouse. | 757 | * thye same as rate of standard PS/2 mouse. |
726 | */ | 758 | */ |
727 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { | 759 | if (psmouse->rate >= 80 && impaired_toshiba_kbc) { |
728 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", | 760 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", |
729 | dmi_get_system_info(DMI_PRODUCT_NAME)); | 761 | dmi_get_system_info(DMI_PRODUCT_NAME)); |
730 | psmouse->rate = 40; | 762 | psmouse->rate = 40; |
731 | } | 763 | } |
732 | #endif | ||
733 | 764 | ||
734 | return 0; | 765 | return 0; |
735 | 766 | ||
@@ -738,12 +769,26 @@ int synaptics_init(struct psmouse *psmouse) | |||
738 | return -1; | 769 | return -1; |
739 | } | 770 | } |
740 | 771 | ||
772 | bool synaptics_supported(void) | ||
773 | { | ||
774 | return true; | ||
775 | } | ||
776 | |||
741 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ | 777 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
742 | 778 | ||
779 | void __init synaptics_module_init(void) | ||
780 | { | ||
781 | } | ||
782 | |||
743 | int synaptics_init(struct psmouse *psmouse) | 783 | int synaptics_init(struct psmouse *psmouse) |
744 | { | 784 | { |
745 | return -ENOSYS; | 785 | return -ENOSYS; |
746 | } | 786 | } |
747 | 787 | ||
788 | bool synaptics_supported(void) | ||
789 | { | ||
790 | return false; | ||
791 | } | ||
792 | |||
748 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ | 793 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
749 | 794 | ||
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 871f6fe377f9..ae37c5d162a4 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 | 18 | #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 |
19 | #define SYN_QUE_RESOLUTION 0x08 | 19 | #define SYN_QUE_RESOLUTION 0x08 |
20 | #define SYN_QUE_EXT_CAPAB 0x09 | 20 | #define SYN_QUE_EXT_CAPAB 0x09 |
21 | #define SYN_QUE_EXT_CAPAB_0C 0x0c | ||
21 | 22 | ||
22 | /* synatics modes */ | 23 | /* synatics modes */ |
23 | #define SYN_BIT_ABSOLUTE_MODE (1 << 7) | 24 | #define SYN_BIT_ABSOLUTE_MODE (1 << 7) |
@@ -48,6 +49,8 @@ | |||
48 | #define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) | 49 | #define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) |
49 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 50 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
50 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 51 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
52 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | ||
53 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) | ||
51 | 54 | ||
52 | /* synaptics modes query bits */ | 55 | /* synaptics modes query bits */ |
53 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) | 56 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
@@ -96,6 +99,7 @@ struct synaptics_data { | |||
96 | unsigned long int model_id; /* Model-ID */ | 99 | unsigned long int model_id; /* Model-ID */ |
97 | unsigned long int capabilities; /* Capabilities */ | 100 | unsigned long int capabilities; /* Capabilities */ |
98 | unsigned long int ext_cap; /* Extended Capabilities */ | 101 | unsigned long int ext_cap; /* Extended Capabilities */ |
102 | unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ | ||
99 | unsigned long int identity; /* Identification */ | 103 | unsigned long int identity; /* Identification */ |
100 | int x_res; /* X resolution in units/mm */ | 104 | int x_res; /* X resolution in units/mm */ |
101 | int y_res; /* Y resolution in units/mm */ | 105 | int y_res; /* Y resolution in units/mm */ |
@@ -105,8 +109,10 @@ struct synaptics_data { | |||
105 | int scroll; | 109 | int scroll; |
106 | }; | 110 | }; |
107 | 111 | ||
112 | void synaptics_module_init(void); | ||
108 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); | 113 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); |
109 | int synaptics_init(struct psmouse *psmouse); | 114 | int synaptics_init(struct psmouse *psmouse); |
110 | void synaptics_reset(struct psmouse *psmouse); | 115 | void synaptics_reset(struct psmouse *psmouse); |
116 | bool synaptics_supported(void); | ||
111 | 117 | ||
112 | #endif /* _SYNAPTICS_H */ | 118 | #endif /* _SYNAPTICS_H */ |
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 7283c78044af..8291e7399ffa 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/input.h> | 17 | #include <linux/input.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #define DRIVER_NAME "synaptics_i2c" | 22 | #define DRIVER_NAME "synaptics_i2c" |
22 | /* maximum product id is 15 characters */ | 23 | /* maximum product id is 15 characters */ |
@@ -420,8 +421,8 @@ static void synaptics_i2c_check_params(struct synaptics_i2c *touch) | |||
420 | } | 421 | } |
421 | 422 | ||
422 | /* Control the Device polling rate / Work Handler sleep time */ | 423 | /* Control the Device polling rate / Work Handler sleep time */ |
423 | unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, | 424 | static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, |
424 | bool have_data) | 425 | bool have_data) |
425 | { | 426 | { |
426 | unsigned long delay, nodata_count_thres; | 427 | unsigned long delay, nodata_count_thres; |
427 | 428 | ||
@@ -520,7 +521,7 @@ static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch) | |||
520 | __set_bit(BTN_LEFT, input->keybit); | 521 | __set_bit(BTN_LEFT, input->keybit); |
521 | } | 522 | } |
522 | 523 | ||
523 | struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) | 524 | static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) |
524 | { | 525 | { |
525 | struct synaptics_i2c *touch; | 526 | struct synaptics_i2c *touch; |
526 | 527 | ||
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c index 0308a0faa94d..88121c59c3cc 100644 --- a/drivers/input/mouse/touchkit_ps2.c +++ b/drivers/input/mouse/touchkit_ps2.c | |||
@@ -26,7 +26,6 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/slab.h> | ||
30 | 29 | ||
31 | #include <linux/input.h> | 30 | #include <linux/input.h> |
32 | #include <linux/serio.h> | 31 | #include <linux/serio.h> |
@@ -86,7 +85,8 @@ int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties) | |||
86 | 85 | ||
87 | if (set_properties) { | 86 | if (set_properties) { |
88 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 87 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
89 | __set_bit(BTN_TOUCH, dev->keybit); | 88 | dev->keybit[BIT_WORD(BTN_MOUSE)] = 0; |
89 | dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
90 | input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); | 90 | input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); |
91 | input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); | 91 | input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); |
92 | 92 | ||
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index e354362f2971..0643e49ca603 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * Trademarks are the property of their respective owners. | 8 | * Trademarks are the property of their respective owners. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/slab.h> | ||
11 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
12 | #include <linux/serio.h> | 13 | #include <linux/serio.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -284,7 +285,6 @@ static int trackpoint_reconnect(struct psmouse *psmouse) | |||
284 | 285 | ||
285 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | 286 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) |
286 | { | 287 | { |
287 | struct trackpoint_data *priv; | ||
288 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 288 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
289 | unsigned char firmware_id; | 289 | unsigned char firmware_id; |
290 | unsigned char button_info; | 290 | unsigned char button_info; |
@@ -301,8 +301,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
301 | button_info = 0; | 301 | button_info = 0; |
302 | } | 302 | } |
303 | 303 | ||
304 | psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); | 304 | psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); |
305 | if (!priv) | 305 | if (!psmouse->private) |
306 | return -1; | 306 | return -1; |
307 | 307 | ||
308 | psmouse->vendor = "IBM"; | 308 | psmouse->vendor = "IBM"; |
@@ -311,7 +311,10 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
311 | psmouse->reconnect = trackpoint_reconnect; | 311 | psmouse->reconnect = trackpoint_reconnect; |
312 | psmouse->disconnect = trackpoint_disconnect; | 312 | psmouse->disconnect = trackpoint_disconnect; |
313 | 313 | ||
314 | trackpoint_defaults(priv); | 314 | if ((button_info & 0x0f) >= 3) |
315 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
316 | |||
317 | trackpoint_defaults(psmouse->private); | ||
315 | trackpoint_sync(psmouse); | 318 | trackpoint_sync(psmouse); |
316 | 319 | ||
317 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 320 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
@@ -319,7 +322,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
319 | printk(KERN_ERR | 322 | printk(KERN_ERR |
320 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 323 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", |
321 | error); | 324 | error); |
322 | kfree(priv); | 325 | kfree(psmouse->private); |
326 | psmouse->private = NULL; | ||
323 | return -1; | 327 | return -1; |
324 | } | 328 | } |
325 | 329 | ||
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index 70111443678e..bf2c0c80d6cc 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c | |||
@@ -86,27 +86,28 @@ | |||
86 | 86 | ||
87 | #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" | 87 | #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" |
88 | 88 | ||
89 | MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); | 89 | MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); |
90 | MODULE_DESCRIPTION (DRIVER_DESC); | 90 | MODULE_DESCRIPTION(DRIVER_DESC); |
91 | MODULE_LICENSE ("GPL"); | 91 | MODULE_LICENSE("GPL"); |
92 | 92 | ||
93 | #undef VSXXXAA_DEBUG | 93 | #undef VSXXXAA_DEBUG |
94 | #ifdef VSXXXAA_DEBUG | 94 | #ifdef VSXXXAA_DEBUG |
95 | #define DBG(x...) printk (x) | 95 | #define DBG(x...) printk(x) |
96 | #else | 96 | #else |
97 | #define DBG(x...) do {} while (0) | 97 | #define DBG(x...) do {} while (0) |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #define VSXXXAA_INTRO_MASK 0x80 | 100 | #define VSXXXAA_INTRO_MASK 0x80 |
101 | #define VSXXXAA_INTRO_HEAD 0x80 | 101 | #define VSXXXAA_INTRO_HEAD 0x80 |
102 | #define IS_HDR_BYTE(x) (((x) & VSXXXAA_INTRO_MASK) \ | 102 | #define IS_HDR_BYTE(x) \ |
103 | == VSXXXAA_INTRO_HEAD) | 103 | (((x) & VSXXXAA_INTRO_MASK) == VSXXXAA_INTRO_HEAD) |
104 | 104 | ||
105 | #define VSXXXAA_PACKET_MASK 0xe0 | 105 | #define VSXXXAA_PACKET_MASK 0xe0 |
106 | #define VSXXXAA_PACKET_REL 0x80 | 106 | #define VSXXXAA_PACKET_REL 0x80 |
107 | #define VSXXXAA_PACKET_ABS 0xc0 | 107 | #define VSXXXAA_PACKET_ABS 0xc0 |
108 | #define VSXXXAA_PACKET_POR 0xa0 | 108 | #define VSXXXAA_PACKET_POR 0xa0 |
109 | #define MATCH_PACKET_TYPE(data, type) (((data) & VSXXXAA_PACKET_MASK) == (type)) | 109 | #define MATCH_PACKET_TYPE(data, type) \ |
110 | (((data) & VSXXXAA_PACKET_MASK) == (type)) | ||
110 | 111 | ||
111 | 112 | ||
112 | 113 | ||
@@ -123,52 +124,50 @@ struct vsxxxaa { | |||
123 | char phys[32]; | 124 | char phys[32]; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | static void | 127 | static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num) |
127 | vsxxxaa_drop_bytes (struct vsxxxaa *mouse, int num) | ||
128 | { | 128 | { |
129 | if (num >= mouse->count) | 129 | if (num >= mouse->count) { |
130 | mouse->count = 0; | 130 | mouse->count = 0; |
131 | else { | 131 | } else { |
132 | memmove (mouse->buf, mouse->buf + num - 1, BUFLEN - num); | 132 | memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num); |
133 | mouse->count -= num; | 133 | mouse->count -= num; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | static void | 137 | static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte) |
138 | vsxxxaa_queue_byte (struct vsxxxaa *mouse, unsigned char byte) | ||
139 | { | 138 | { |
140 | if (mouse->count == BUFLEN) { | 139 | if (mouse->count == BUFLEN) { |
141 | printk (KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", | 140 | printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", |
142 | mouse->name, mouse->phys); | 141 | mouse->name, mouse->phys); |
143 | vsxxxaa_drop_bytes (mouse, 1); | 142 | vsxxxaa_drop_bytes(mouse, 1); |
144 | } | 143 | } |
145 | DBG (KERN_INFO "Queueing byte 0x%02x\n", byte); | 144 | |
145 | DBG(KERN_INFO "Queueing byte 0x%02x\n", byte); | ||
146 | 146 | ||
147 | mouse->buf[mouse->count++] = byte; | 147 | mouse->buf[mouse->count++] = byte; |
148 | } | 148 | } |
149 | 149 | ||
150 | static void | 150 | static void vsxxxaa_detection_done(struct vsxxxaa *mouse) |
151 | vsxxxaa_detection_done (struct vsxxxaa *mouse) | ||
152 | { | 151 | { |
153 | switch (mouse->type) { | 152 | switch (mouse->type) { |
154 | case 0x02: | 153 | case 0x02: |
155 | strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse", | 154 | strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse", |
156 | sizeof (mouse->name)); | 155 | sizeof(mouse->name)); |
157 | break; | 156 | break; |
158 | 157 | ||
159 | case 0x04: | 158 | case 0x04: |
160 | strlcpy (mouse->name, "DEC VSXXX-AB digitizer", | 159 | strlcpy(mouse->name, "DEC VSXXX-AB digitizer", |
161 | sizeof (mouse->name)); | 160 | sizeof(mouse->name)); |
162 | break; | 161 | break; |
163 | 162 | ||
164 | default: | 163 | default: |
165 | snprintf (mouse->name, sizeof (mouse->name), | 164 | snprintf(mouse->name, sizeof(mouse->name), |
166 | "unknown DEC pointer device (type = 0x%02x)", | 165 | "unknown DEC pointer device (type = 0x%02x)", |
167 | mouse->type); | 166 | mouse->type); |
168 | break; | 167 | break; |
169 | } | 168 | } |
170 | 169 | ||
171 | printk (KERN_INFO | 170 | printk(KERN_INFO |
172 | "Found %s version 0x%02x from country 0x%02x on port %s\n", | 171 | "Found %s version 0x%02x from country 0x%02x on port %s\n", |
173 | mouse->name, mouse->version, mouse->country, mouse->phys); | 172 | mouse->name, mouse->version, mouse->country, mouse->phys); |
174 | } | 173 | } |
@@ -176,42 +175,38 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse) | |||
176 | /* | 175 | /* |
177 | * Returns number of bytes to be dropped, 0 if packet is okay. | 176 | * Returns number of bytes to be dropped, 0 if packet is okay. |
178 | */ | 177 | */ |
179 | static int | 178 | static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len) |
180 | vsxxxaa_check_packet (struct vsxxxaa *mouse, int packet_len) | ||
181 | { | 179 | { |
182 | int i; | 180 | int i; |
183 | 181 | ||
184 | /* First byte must be a header byte */ | 182 | /* First byte must be a header byte */ |
185 | if (!IS_HDR_BYTE (mouse->buf[0])) { | 183 | if (!IS_HDR_BYTE(mouse->buf[0])) { |
186 | DBG ("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); | 184 | DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); |
187 | return 1; | 185 | return 1; |
188 | } | 186 | } |
189 | 187 | ||
190 | /* Check all following bytes */ | 188 | /* Check all following bytes */ |
191 | if (packet_len > 1) { | 189 | for (i = 1; i < packet_len; i++) { |
192 | for (i = 1; i < packet_len; i++) { | 190 | if (IS_HDR_BYTE(mouse->buf[i])) { |
193 | if (IS_HDR_BYTE (mouse->buf[i])) { | 191 | printk(KERN_ERR |
194 | printk (KERN_ERR "Need to drop %d bytes " | 192 | "Need to drop %d bytes of a broken packet.\n", |
195 | "of a broken packet.\n", | 193 | i - 1); |
196 | i - 1); | 194 | DBG(KERN_INFO "check: len=%d, b[%d]=0x%02x\n", |
197 | DBG (KERN_INFO "check: len=%d, b[%d]=0x%02x\n", | 195 | packet_len, i, mouse->buf[i]); |
198 | packet_len, i, mouse->buf[i]); | 196 | return i - 1; |
199 | return i - 1; | ||
200 | } | ||
201 | } | 197 | } |
202 | } | 198 | } |
203 | 199 | ||
204 | return 0; | 200 | return 0; |
205 | } | 201 | } |
206 | 202 | ||
207 | static __inline__ int | 203 | static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse, |
208 | vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t len) | 204 | unsigned char type, size_t len) |
209 | { | 205 | { |
210 | return (mouse->count >= len) && MATCH_PACKET_TYPE (mouse->buf[0], type); | 206 | return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type); |
211 | } | 207 | } |
212 | 208 | ||
213 | static void | 209 | static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse) |
214 | vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse) | ||
215 | { | 210 | { |
216 | struct input_dev *dev = mouse->dev; | 211 | struct input_dev *dev = mouse->dev; |
217 | unsigned char *buf = mouse->buf; | 212 | unsigned char *buf = mouse->buf; |
@@ -232,43 +227,42 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse) | |||
232 | * 0, bit 4 of byte 0 is direction. | 227 | * 0, bit 4 of byte 0 is direction. |
233 | */ | 228 | */ |
234 | dx = buf[1] & 0x7f; | 229 | dx = buf[1] & 0x7f; |
235 | dx *= ((buf[0] >> 4) & 0x01)? 1: -1; | 230 | dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1; |
236 | 231 | ||
237 | /* | 232 | /* |
238 | * Low 7 bit of byte 2 are abs(dy), bit 7 is | 233 | * Low 7 bit of byte 2 are abs(dy), bit 7 is |
239 | * 0, bit 3 of byte 0 is direction. | 234 | * 0, bit 3 of byte 0 is direction. |
240 | */ | 235 | */ |
241 | dy = buf[2] & 0x7f; | 236 | dy = buf[2] & 0x7f; |
242 | dy *= ((buf[0] >> 3) & 0x01)? -1: 1; | 237 | dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1; |
243 | 238 | ||
244 | /* | 239 | /* |
245 | * Get button state. It's the low three bits | 240 | * Get button state. It's the low three bits |
246 | * (for three buttons) of byte 0. | 241 | * (for three buttons) of byte 0. |
247 | */ | 242 | */ |
248 | left = (buf[0] & 0x04)? 1: 0; | 243 | left = buf[0] & 0x04; |
249 | middle = (buf[0] & 0x02)? 1: 0; | 244 | middle = buf[0] & 0x02; |
250 | right = (buf[0] & 0x01)? 1: 0; | 245 | right = buf[0] & 0x01; |
251 | 246 | ||
252 | vsxxxaa_drop_bytes (mouse, 3); | 247 | vsxxxaa_drop_bytes(mouse, 3); |
253 | 248 | ||
254 | DBG (KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", | 249 | DBG(KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", |
255 | mouse->name, mouse->phys, dx, dy, | 250 | mouse->name, mouse->phys, dx, dy, |
256 | left? "L": "l", middle? "M": "m", right? "R": "r"); | 251 | left ? "L" : "l", middle ? "M" : "m", right ? "R" : "r"); |
257 | 252 | ||
258 | /* | 253 | /* |
259 | * Report what we've found so far... | 254 | * Report what we've found so far... |
260 | */ | 255 | */ |
261 | input_report_key (dev, BTN_LEFT, left); | 256 | input_report_key(dev, BTN_LEFT, left); |
262 | input_report_key (dev, BTN_MIDDLE, middle); | 257 | input_report_key(dev, BTN_MIDDLE, middle); |
263 | input_report_key (dev, BTN_RIGHT, right); | 258 | input_report_key(dev, BTN_RIGHT, right); |
264 | input_report_key (dev, BTN_TOUCH, 0); | 259 | input_report_key(dev, BTN_TOUCH, 0); |
265 | input_report_rel (dev, REL_X, dx); | 260 | input_report_rel(dev, REL_X, dx); |
266 | input_report_rel (dev, REL_Y, dy); | 261 | input_report_rel(dev, REL_Y, dy); |
267 | input_sync (dev); | 262 | input_sync(dev); |
268 | } | 263 | } |
269 | 264 | ||
270 | static void | 265 | static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse) |
271 | vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse) | ||
272 | { | 266 | { |
273 | struct input_dev *dev = mouse->dev; | 267 | struct input_dev *dev = mouse->dev; |
274 | unsigned char *buf = mouse->buf; | 268 | unsigned char *buf = mouse->buf; |
@@ -296,32 +290,31 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse) | |||
296 | /* | 290 | /* |
297 | * Get button state. It's bits <4..1> of byte 0. | 291 | * Get button state. It's bits <4..1> of byte 0. |
298 | */ | 292 | */ |
299 | left = (buf[0] & 0x02)? 1: 0; | 293 | left = buf[0] & 0x02; |
300 | middle = (buf[0] & 0x04)? 1: 0; | 294 | middle = buf[0] & 0x04; |
301 | right = (buf[0] & 0x08)? 1: 0; | 295 | right = buf[0] & 0x08; |
302 | touch = (buf[0] & 0x10)? 1: 0; | 296 | touch = buf[0] & 0x10; |
303 | 297 | ||
304 | vsxxxaa_drop_bytes (mouse, 5); | 298 | vsxxxaa_drop_bytes(mouse, 5); |
305 | 299 | ||
306 | DBG (KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", | 300 | DBG(KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", |
307 | mouse->name, mouse->phys, x, y, | 301 | mouse->name, mouse->phys, x, y, |
308 | left? "L": "l", middle? "M": "m", | 302 | left ? "L" : "l", middle ? "M" : "m", |
309 | right? "R": "r", touch? "T": "t"); | 303 | right ? "R" : "r", touch ? "T" : "t"); |
310 | 304 | ||
311 | /* | 305 | /* |
312 | * Report what we've found so far... | 306 | * Report what we've found so far... |
313 | */ | 307 | */ |
314 | input_report_key (dev, BTN_LEFT, left); | 308 | input_report_key(dev, BTN_LEFT, left); |
315 | input_report_key (dev, BTN_MIDDLE, middle); | 309 | input_report_key(dev, BTN_MIDDLE, middle); |
316 | input_report_key (dev, BTN_RIGHT, right); | 310 | input_report_key(dev, BTN_RIGHT, right); |
317 | input_report_key (dev, BTN_TOUCH, touch); | 311 | input_report_key(dev, BTN_TOUCH, touch); |
318 | input_report_abs (dev, ABS_X, x); | 312 | input_report_abs(dev, ABS_X, x); |
319 | input_report_abs (dev, ABS_Y, y); | 313 | input_report_abs(dev, ABS_Y, y); |
320 | input_sync (dev); | 314 | input_sync(dev); |
321 | } | 315 | } |
322 | 316 | ||
323 | static void | 317 | static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse) |
324 | vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | ||
325 | { | 318 | { |
326 | struct input_dev *dev = mouse->dev; | 319 | struct input_dev *dev = mouse->dev; |
327 | unsigned char *buf = mouse->buf; | 320 | unsigned char *buf = mouse->buf; |
@@ -356,24 +349,24 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | |||
356 | * (for three buttons) of byte 0. Maybe even the bit <3> | 349 | * (for three buttons) of byte 0. Maybe even the bit <3> |
357 | * has some meaning if a tablet is attached. | 350 | * has some meaning if a tablet is attached. |
358 | */ | 351 | */ |
359 | left = (buf[0] & 0x04)? 1: 0; | 352 | left = buf[0] & 0x04; |
360 | middle = (buf[0] & 0x02)? 1: 0; | 353 | middle = buf[0] & 0x02; |
361 | right = (buf[0] & 0x01)? 1: 0; | 354 | right = buf[0] & 0x01; |
362 | 355 | ||
363 | vsxxxaa_drop_bytes (mouse, 4); | 356 | vsxxxaa_drop_bytes(mouse, 4); |
364 | vsxxxaa_detection_done (mouse); | 357 | vsxxxaa_detection_done(mouse); |
365 | 358 | ||
366 | if (error <= 0x1f) { | 359 | if (error <= 0x1f) { |
367 | /* No (serious) error. Report buttons */ | 360 | /* No (serious) error. Report buttons */ |
368 | input_report_key (dev, BTN_LEFT, left); | 361 | input_report_key(dev, BTN_LEFT, left); |
369 | input_report_key (dev, BTN_MIDDLE, middle); | 362 | input_report_key(dev, BTN_MIDDLE, middle); |
370 | input_report_key (dev, BTN_RIGHT, right); | 363 | input_report_key(dev, BTN_RIGHT, right); |
371 | input_report_key (dev, BTN_TOUCH, 0); | 364 | input_report_key(dev, BTN_TOUCH, 0); |
372 | input_sync (dev); | 365 | input_sync(dev); |
373 | 366 | ||
374 | if (error != 0) | 367 | if (error != 0) |
375 | printk (KERN_INFO "Your %s on %s reports error=0x%02x\n", | 368 | printk(KERN_INFO "Your %s on %s reports error=0x%02x\n", |
376 | mouse->name, mouse->phys, error); | 369 | mouse->name, mouse->phys, error); |
377 | 370 | ||
378 | } | 371 | } |
379 | 372 | ||
@@ -381,18 +374,18 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | |||
381 | * If the mouse was hot-plugged, we need to force differential mode | 374 | * If the mouse was hot-plugged, we need to force differential mode |
382 | * now... However, give it a second to recover from it's reset. | 375 | * now... However, give it a second to recover from it's reset. |
383 | */ | 376 | */ |
384 | printk (KERN_NOTICE "%s on %s: Forceing standard packet format, " | 377 | printk(KERN_NOTICE |
385 | "incremental streaming mode and 72 samples/sec\n", | 378 | "%s on %s: Forcing standard packet format, " |
386 | mouse->name, mouse->phys); | 379 | "incremental streaming mode and 72 samples/sec\n", |
387 | serio_write (mouse->serio, 'S'); /* Standard format */ | 380 | mouse->name, mouse->phys); |
388 | mdelay (50); | 381 | serio_write(mouse->serio, 'S'); /* Standard format */ |
389 | serio_write (mouse->serio, 'R'); /* Incremental */ | 382 | mdelay(50); |
390 | mdelay (50); | 383 | serio_write(mouse->serio, 'R'); /* Incremental */ |
391 | serio_write (mouse->serio, 'L'); /* 72 samples/sec */ | 384 | mdelay(50); |
385 | serio_write(mouse->serio, 'L'); /* 72 samples/sec */ | ||
392 | } | 386 | } |
393 | 387 | ||
394 | static void | 388 | static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse) |
395 | vsxxxaa_parse_buffer (struct vsxxxaa *mouse) | ||
396 | { | 389 | { |
397 | unsigned char *buf = mouse->buf; | 390 | unsigned char *buf = mouse->buf; |
398 | int stray_bytes; | 391 | int stray_bytes; |
@@ -409,122 +402,107 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse) | |||
409 | * activity on the mouse. | 402 | * activity on the mouse. |
410 | */ | 403 | */ |
411 | while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { | 404 | while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { |
412 | printk (KERN_ERR "%s on %s: Dropping a byte to regain " | 405 | printk(KERN_ERR "%s on %s: Dropping a byte to regain " |
413 | "sync with mouse data stream...\n", | 406 | "sync with mouse data stream...\n", |
414 | mouse->name, mouse->phys); | 407 | mouse->name, mouse->phys); |
415 | vsxxxaa_drop_bytes (mouse, 1); | 408 | vsxxxaa_drop_bytes(mouse, 1); |
416 | } | 409 | } |
417 | 410 | ||
418 | /* | 411 | /* |
419 | * Check for packets we know about. | 412 | * Check for packets we know about. |
420 | */ | 413 | */ |
421 | 414 | ||
422 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_REL, 3)) { | 415 | if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) { |
423 | /* Check for broken packet */ | 416 | /* Check for broken packet */ |
424 | stray_bytes = vsxxxaa_check_packet (mouse, 3); | 417 | stray_bytes = vsxxxaa_check_packet(mouse, 3); |
425 | if (stray_bytes > 0) { | 418 | if (!stray_bytes) |
426 | printk (KERN_ERR "Dropping %d bytes now...\n", | 419 | vsxxxaa_handle_REL_packet(mouse); |
427 | stray_bytes); | ||
428 | vsxxxaa_drop_bytes (mouse, stray_bytes); | ||
429 | continue; | ||
430 | } | ||
431 | |||
432 | vsxxxaa_handle_REL_packet (mouse); | ||
433 | continue; /* More to parse? */ | ||
434 | } | ||
435 | 420 | ||
436 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_ABS, 5)) { | 421 | } else if (vsxxxaa_smells_like_packet(mouse, |
422 | VSXXXAA_PACKET_ABS, 5)) { | ||
437 | /* Check for broken packet */ | 423 | /* Check for broken packet */ |
438 | stray_bytes = vsxxxaa_check_packet (mouse, 5); | 424 | stray_bytes = vsxxxaa_check_packet(mouse, 5); |
439 | if (stray_bytes > 0) { | 425 | if (!stray_bytes) |
440 | printk (KERN_ERR "Dropping %d bytes now...\n", | 426 | vsxxxaa_handle_ABS_packet(mouse); |
441 | stray_bytes); | ||
442 | vsxxxaa_drop_bytes (mouse, stray_bytes); | ||
443 | continue; | ||
444 | } | ||
445 | |||
446 | vsxxxaa_handle_ABS_packet (mouse); | ||
447 | continue; /* More to parse? */ | ||
448 | } | ||
449 | 427 | ||
450 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_POR, 4)) { | 428 | } else if (vsxxxaa_smells_like_packet(mouse, |
429 | VSXXXAA_PACKET_POR, 4)) { | ||
451 | /* Check for broken packet */ | 430 | /* Check for broken packet */ |
452 | stray_bytes = vsxxxaa_check_packet (mouse, 4); | 431 | stray_bytes = vsxxxaa_check_packet(mouse, 4); |
453 | if (stray_bytes > 0) { | 432 | if (!stray_bytes) |
454 | printk (KERN_ERR "Dropping %d bytes now...\n", | 433 | vsxxxaa_handle_POR_packet(mouse); |
455 | stray_bytes); | 434 | |
456 | vsxxxaa_drop_bytes (mouse, stray_bytes); | 435 | } else { |
457 | continue; | 436 | break; /* No REL, ABS or POR packet found */ |
458 | } | 437 | } |
459 | 438 | ||
460 | vsxxxaa_handle_POR_packet (mouse); | 439 | if (stray_bytes > 0) { |
461 | continue; /* More to parse? */ | 440 | printk(KERN_ERR "Dropping %d bytes now...\n", |
441 | stray_bytes); | ||
442 | vsxxxaa_drop_bytes(mouse, stray_bytes); | ||
462 | } | 443 | } |
463 | 444 | ||
464 | break; /* No REL, ABS or POR packet found */ | ||
465 | } while (1); | 445 | } while (1); |
466 | } | 446 | } |
467 | 447 | ||
468 | static irqreturn_t | 448 | static irqreturn_t vsxxxaa_interrupt(struct serio *serio, |
469 | vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags) | 449 | unsigned char data, unsigned int flags) |
470 | { | 450 | { |
471 | struct vsxxxaa *mouse = serio_get_drvdata (serio); | 451 | struct vsxxxaa *mouse = serio_get_drvdata(serio); |
472 | 452 | ||
473 | vsxxxaa_queue_byte (mouse, data); | 453 | vsxxxaa_queue_byte(mouse, data); |
474 | vsxxxaa_parse_buffer (mouse); | 454 | vsxxxaa_parse_buffer(mouse); |
475 | 455 | ||
476 | return IRQ_HANDLED; | 456 | return IRQ_HANDLED; |
477 | } | 457 | } |
478 | 458 | ||
479 | static void | 459 | static void vsxxxaa_disconnect(struct serio *serio) |
480 | vsxxxaa_disconnect (struct serio *serio) | ||
481 | { | 460 | { |
482 | struct vsxxxaa *mouse = serio_get_drvdata (serio); | 461 | struct vsxxxaa *mouse = serio_get_drvdata(serio); |
483 | 462 | ||
484 | serio_close (serio); | 463 | serio_close(serio); |
485 | serio_set_drvdata (serio, NULL); | 464 | serio_set_drvdata(serio, NULL); |
486 | input_unregister_device (mouse->dev); | 465 | input_unregister_device(mouse->dev); |
487 | kfree (mouse); | 466 | kfree(mouse); |
488 | } | 467 | } |
489 | 468 | ||
490 | static int | 469 | static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv) |
491 | vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | ||
492 | { | 470 | { |
493 | struct vsxxxaa *mouse; | 471 | struct vsxxxaa *mouse; |
494 | struct input_dev *input_dev; | 472 | struct input_dev *input_dev; |
495 | int err = -ENOMEM; | 473 | int err = -ENOMEM; |
496 | 474 | ||
497 | mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); | 475 | mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL); |
498 | input_dev = input_allocate_device (); | 476 | input_dev = input_allocate_device(); |
499 | if (!mouse || !input_dev) | 477 | if (!mouse || !input_dev) |
500 | goto fail1; | 478 | goto fail1; |
501 | 479 | ||
502 | mouse->dev = input_dev; | 480 | mouse->dev = input_dev; |
503 | mouse->serio = serio; | 481 | mouse->serio = serio; |
504 | strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", | 482 | strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", |
505 | sizeof (mouse->name)); | 483 | sizeof(mouse->name)); |
506 | snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys); | 484 | snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys); |
507 | 485 | ||
508 | input_dev->name = mouse->name; | 486 | input_dev->name = mouse->name; |
509 | input_dev->phys = mouse->phys; | 487 | input_dev->phys = mouse->phys; |
510 | input_dev->id.bustype = BUS_RS232; | 488 | input_dev->id.bustype = BUS_RS232; |
511 | input_dev->dev.parent = &serio->dev; | 489 | input_dev->dev.parent = &serio->dev; |
512 | 490 | ||
513 | set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ | 491 | __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */ |
514 | set_bit (EV_REL, input_dev->evbit); | 492 | __set_bit(EV_REL, input_dev->evbit); |
515 | set_bit (EV_ABS, input_dev->evbit); | 493 | __set_bit(EV_ABS, input_dev->evbit); |
516 | set_bit (BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ | 494 | __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ |
517 | set_bit (BTN_MIDDLE, input_dev->keybit); | 495 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
518 | set_bit (BTN_RIGHT, input_dev->keybit); | 496 | __set_bit(BTN_RIGHT, input_dev->keybit); |
519 | set_bit (BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ | 497 | __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ |
520 | set_bit (REL_X, input_dev->relbit); | 498 | __set_bit(REL_X, input_dev->relbit); |
521 | set_bit (REL_Y, input_dev->relbit); | 499 | __set_bit(REL_Y, input_dev->relbit); |
522 | input_set_abs_params (input_dev, ABS_X, 0, 1023, 0, 0); | 500 | input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0); |
523 | input_set_abs_params (input_dev, ABS_Y, 0, 1023, 0, 0); | 501 | input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0); |
524 | 502 | ||
525 | serio_set_drvdata (serio, mouse); | 503 | serio_set_drvdata(serio, mouse); |
526 | 504 | ||
527 | err = serio_open (serio, drv); | 505 | err = serio_open(serio, drv); |
528 | if (err) | 506 | if (err) |
529 | goto fail2; | 507 | goto fail2; |
530 | 508 | ||
@@ -532,18 +510,18 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | |||
532 | * Request selftest. Standard packet format and differential | 510 | * Request selftest. Standard packet format and differential |
533 | * mode will be requested after the device ID'ed successfully. | 511 | * mode will be requested after the device ID'ed successfully. |
534 | */ | 512 | */ |
535 | serio_write (serio, 'T'); /* Test */ | 513 | serio_write(serio, 'T'); /* Test */ |
536 | 514 | ||
537 | err = input_register_device (input_dev); | 515 | err = input_register_device(input_dev); |
538 | if (err) | 516 | if (err) |
539 | goto fail3; | 517 | goto fail3; |
540 | 518 | ||
541 | return 0; | 519 | return 0; |
542 | 520 | ||
543 | fail3: serio_close (serio); | 521 | fail3: serio_close(serio); |
544 | fail2: serio_set_drvdata (serio, NULL); | 522 | fail2: serio_set_drvdata(serio, NULL); |
545 | fail1: input_free_device (input_dev); | 523 | fail1: input_free_device(input_dev); |
546 | kfree (mouse); | 524 | kfree(mouse); |
547 | return err; | 525 | return err; |
548 | } | 526 | } |
549 | 527 | ||
@@ -570,18 +548,16 @@ static struct serio_driver vsxxxaa_drv = { | |||
570 | .disconnect = vsxxxaa_disconnect, | 548 | .disconnect = vsxxxaa_disconnect, |
571 | }; | 549 | }; |
572 | 550 | ||
573 | static int __init | 551 | static int __init vsxxxaa_init(void) |
574 | vsxxxaa_init (void) | ||
575 | { | 552 | { |
576 | return serio_register_driver(&vsxxxaa_drv); | 553 | return serio_register_driver(&vsxxxaa_drv); |
577 | } | 554 | } |
578 | 555 | ||
579 | static void __exit | 556 | static void __exit vsxxxaa_exit(void) |
580 | vsxxxaa_exit (void) | ||
581 | { | 557 | { |
582 | serio_unregister_driver(&vsxxxaa_drv); | 558 | serio_unregister_driver(&vsxxxaa_drv); |
583 | } | 559 | } |
584 | 560 | ||
585 | module_init (vsxxxaa_init); | 561 | module_init(vsxxxaa_init); |
586 | module_exit (vsxxxaa_exit); | 562 | module_exit(vsxxxaa_exit); |
587 | 563 | ||