]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Synaptics TouchPad PS/2 mouse driver | |
3 | * | |
4 | * 2003 Dmitry Torokhov <dtor@mail.ru> | |
5 | * Added support for pass-through port. Special thanks to Peter Berg Larsen | |
6 | * for explaining various Synaptics quirks. | |
7 | * | |
8 | * 2003 Peter Osterlund <petero2@telia.com> | |
9 | * Ported to 2.5 input device infrastructure. | |
10 | * | |
11 | * Copyright (C) 2001 Stefan Gmeiner <riddlebox@freesurf.ch> | |
12 | * start merging tpconfig and gpm code to a xfree-input module | |
13 | * adding some changes and extensions (ex. 3rd and 4th button) | |
14 | * | |
15 | * Copyright (c) 1997 C. Scott Ananian <cananian@alumni.priceton.edu> | |
16 | * Copyright (c) 1998-2000 Bruce Kalk <kall@compass.com> | |
17 | * code for the special synaptics commands (from the tpconfig-source) | |
18 | * | |
19 | * This program is free software; you can redistribute it and/or modify it | |
20 | * under the terms of the GNU General Public License version 2 as published by | |
21 | * the Free Software Foundation. | |
22 | * | |
23 | * Trademarks are the property of their respective owners. | |
24 | */ | |
25 | ||
26 | #include <linux/module.h> | |
8521478f | 27 | #include <linux/delay.h> |
7705d548 | 28 | #include <linux/dmi.h> |
fec6e525 | 29 | #include <linux/input/mt.h> |
1da177e4 LT |
30 | #include <linux/serio.h> |
31 | #include <linux/libps2.h> | |
e839ffab BT |
32 | #include <linux/rmi.h> |
33 | #include <linux/i2c.h> | |
5a0e3ad6 | 34 | #include <linux/slab.h> |
1da177e4 LT |
35 | #include "psmouse.h" |
36 | #include "synaptics.h" | |
37 | ||
38 | /* | |
39 | * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, | |
40 | * section 2.3.2, which says that they should be valid regardless of the | |
41 | * actual size of the sensor. | |
83ba9ea8 DT |
42 | * Note that newer firmware allows querying device for maximum useable |
43 | * coordinates. | |
1da177e4 | 44 | */ |
c0394506 SF |
45 | #define XMIN 0 |
46 | #define XMAX 6143 | |
47 | #define YMIN 0 | |
48 | #define YMAX 6143 | |
1da177e4 LT |
49 | #define XMIN_NOMINAL 1472 |
50 | #define XMAX_NOMINAL 5472 | |
51 | #define YMIN_NOMINAL 1408 | |
52 | #define YMAX_NOMINAL 4448 | |
53 | ||
c0394506 SF |
54 | /* Size in bits of absolute position values reported by the hardware */ |
55 | #define ABS_POS_BITS 13 | |
56 | ||
57 | /* | |
824efd37 SF |
58 | * These values should represent the absolute maximum value that will |
59 | * be reported for a positive position value. Some Synaptics firmware | |
60 | * uses this value to indicate a finger near the edge of the touchpad | |
61 | * whose precise position cannot be determined. | |
62 | * | |
63 | * At least one touchpad is known to report positions in excess of this | |
64 | * value which are actually negative values truncated to the 13-bit | |
65 | * reporting range. These values have never been observed to be lower | |
66 | * than 8184 (i.e. -8), so we treat all values greater than 8176 as | |
67 | * negative and any other value as positive. | |
c0394506 | 68 | */ |
824efd37 SF |
69 | #define X_MAX_POSITIVE 8176 |
70 | #define Y_MAX_POSITIVE 8176 | |
55e3d922 | 71 | |
58fd9af6 BT |
72 | /* maximum ABS_MT_POSITION displacement (in mm) */ |
73 | #define DMAX 10 | |
74 | ||
1da177e4 | 75 | /***************************************************************************** |
55e3d922 | 76 | * Stuff we need even when we do not want native Synaptics support |
1da177e4 LT |
77 | ****************************************************************************/ |
78 | ||
79 | /* | |
55e3d922 | 80 | * Set the synaptics touchpad mode byte by special commands |
1da177e4 | 81 | */ |
f6c4442b | 82 | static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode) |
1da177e4 | 83 | { |
f6c4442b | 84 | u8 param[1]; |
212baf03 DT |
85 | int error; |
86 | ||
87 | error = psmouse_sliced_command(psmouse, mode); | |
88 | if (error) | |
89 | return error; | |
55e3d922 | 90 | |
55e3d922 | 91 | param[0] = SYN_PS_SET_MODE2; |
212baf03 DT |
92 | error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE); |
93 | if (error) | |
94 | return error; | |
95 | ||
1da177e4 LT |
96 | return 0; |
97 | } | |
98 | ||
b7802c5c | 99 | int synaptics_detect(struct psmouse *psmouse, bool set_properties) |
55e3d922 AS |
100 | { |
101 | struct ps2dev *ps2dev = &psmouse->ps2dev; | |
ab5b673c | 102 | u8 param[4] = { 0 }; |
55e3d922 AS |
103 | |
104 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | |
105 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | |
106 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | |
107 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | |
108 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); | |
109 | ||
110 | if (param[1] != 0x47) | |
111 | return -ENODEV; | |
112 | ||
113 | if (set_properties) { | |
114 | psmouse->vendor = "Synaptics"; | |
115 | psmouse->name = "TouchPad"; | |
116 | } | |
117 | ||
118 | return 0; | |
119 | } | |
120 | ||
121 | void synaptics_reset(struct psmouse *psmouse) | |
122 | { | |
123 | /* reset touchpad back to relative mode, gestures enabled */ | |
124 | synaptics_mode_cmd(psmouse, 0); | |
125 | } | |
126 | ||
e839ffab BT |
127 | #if defined(CONFIG_MOUSE_PS2_SYNAPTICS) || \ |
128 | defined(CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS) | |
0f68f39c | 129 | |
43e19888 HG |
130 | /* This list has been kindly provided by Synaptics. */ |
131 | static const char * const topbuttonpad_pnp_ids[] = { | |
132 | "LEN0017", | |
133 | "LEN0018", | |
134 | "LEN0019", | |
135 | "LEN0023", | |
136 | "LEN002A", | |
137 | "LEN002B", | |
138 | "LEN002C", | |
139 | "LEN002D", | |
140 | "LEN002E", | |
141 | "LEN0033", /* Helix */ | |
0f68f39c | 142 | "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */ |
43e19888 HG |
143 | "LEN0035", /* X240 */ |
144 | "LEN0036", /* T440 */ | |
8543cf1c | 145 | "LEN0037", /* X1 Carbon 2nd */ |
43e19888 | 146 | "LEN0038", |
e4742b1e | 147 | "LEN0039", /* T440s */ |
43e19888 HG |
148 | "LEN0041", |
149 | "LEN0042", /* Yoga */ | |
150 | "LEN0045", | |
43e19888 | 151 | "LEN0047", |
43e19888 | 152 | "LEN0049", |
7f2ca8b5 | 153 | "LEN2000", /* S540 */ |
0f68f39c | 154 | "LEN2001", /* Edge E431 */ |
e76aed9d | 155 | "LEN2002", /* Edge E531 */ |
43e19888 HG |
156 | "LEN2003", |
157 | "LEN2004", /* L440 */ | |
158 | "LEN2005", | |
98dc0703 | 159 | "LEN2006", /* Edge E440/E540 */ |
43e19888 HG |
160 | "LEN2007", |
161 | "LEN2008", | |
162 | "LEN2009", | |
163 | "LEN200A", | |
164 | "LEN200B", | |
165 | NULL | |
166 | }; | |
55e3d922 | 167 | |
e839ffab BT |
168 | static const char * const smbus_pnp_ids[] = { |
169 | /* all of the topbuttonpad_pnp_ids are valid, we just add some extras */ | |
e839ffab | 170 | "LEN0046", /* X250 */ |
adcc032c | 171 | "LEN0048", /* X1 Carbon 3 */ |
e839ffab | 172 | "LEN004a", /* W541 */ |
cdf163f7 | 173 | "LEN005b", /* P50 */ |
0f31ae53 | 174 | "LEN005e", /* T560 */ |
76ecb9f6 | 175 | "LEN006c", /* T470s */ |
f1bc1159 | 176 | "LEN0071", /* T480 */ |
065e81a0 | 177 | "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ |
81d407b4 | 178 | "LEN0073", /* X1 Carbon 5 */ |
a0e8a44d | 179 | "LEN0091", /* X1 Carbon 6 */ |
c6ca578d | 180 | "LEN0092", /* X1 Carbon 6 */ |
47b9f823 | 181 | "LEN0093", /* T480 */ |
c6ca578d | 182 | "LEN0096", /* X280 */ |
f1bc1159 | 183 | "LEN0097", /* X280 -> ALPS trackpoint */ |
28db1134 | 184 | "LEN009b", /* T580 */ |
adcc032c | 185 | "LEN200f", /* T450s */ |
df5330bc | 186 | "LEN2044", /* L470 */ |
c305beea AM |
187 | "LEN2054", /* E480 */ |
188 | "LEN2055", /* E580 */ | |
764b583d | 189 | "SYN3052", /* HP EliteBook 840 G4 */ |
adcc032c | 190 | "SYN3221", /* HP 15-ay000 */ |
5ab3c6ec | 191 | "SYN323d", /* HP Spectre X360 13-w013dx */ |
de4e374b DT |
192 | NULL |
193 | }; | |
194 | ||
f4101ff8 BT |
195 | static const char * const forcepad_pnp_ids[] = { |
196 | "SYN300D", | |
197 | "SYN3014", | |
198 | NULL | |
199 | }; | |
200 | ||
1a49a0a0 | 201 | /* |
e839ffab | 202 | * Send a command to the synpatics touchpad by special commands |
1a49a0a0 | 203 | */ |
f6c4442b | 204 | static int synaptics_send_cmd(struct psmouse *psmouse, u8 cmd, u8 *param) |
1a49a0a0 | 205 | { |
e839ffab BT |
206 | int error; |
207 | ||
f6c4442b | 208 | error = psmouse_sliced_command(psmouse, cmd); |
e839ffab BT |
209 | if (error) |
210 | return error; | |
211 | ||
212 | error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO); | |
213 | if (error) | |
214 | return error; | |
215 | ||
216 | return 0; | |
1a49a0a0 JD |
217 | } |
218 | ||
2c6ecbba DT |
219 | static int synaptics_query_int(struct psmouse *psmouse, u8 query_cmd, u32 *val) |
220 | { | |
221 | int error; | |
222 | union { | |
223 | __be32 be_val; | |
224 | char buf[4]; | |
225 | } resp = { 0 }; | |
226 | ||
227 | error = synaptics_send_cmd(psmouse, query_cmd, resp.buf + 1); | |
228 | if (error) | |
229 | return error; | |
230 | ||
231 | *val = be32_to_cpu(resp.be_val); | |
232 | return 0; | |
233 | } | |
234 | ||
1da177e4 | 235 | /* |
e839ffab BT |
236 | * Identify Touchpad |
237 | * See also the SYN_ID_* macros | |
1da177e4 | 238 | */ |
e839ffab BT |
239 | static int synaptics_identify(struct psmouse *psmouse, |
240 | struct synaptics_device_info *info) | |
1da177e4 | 241 | { |
e839ffab BT |
242 | int error; |
243 | ||
2c6ecbba | 244 | error = synaptics_query_int(psmouse, SYN_QUE_IDENTIFY, &info->identity); |
e839ffab BT |
245 | if (error) |
246 | return error; | |
247 | ||
e839ffab | 248 | return SYN_ID_IS_SYNAPTICS(info->identity) ? 0 : -ENXIO; |
1da177e4 LT |
249 | } |
250 | ||
251 | /* | |
252 | * Read the model-id bytes from the touchpad | |
253 | * see also SYN_MODEL_* macros | |
254 | */ | |
6c53694f DT |
255 | static int synaptics_model_id(struct psmouse *psmouse, |
256 | struct synaptics_device_info *info) | |
1da177e4 | 257 | { |
2c6ecbba | 258 | return synaptics_query_int(psmouse, SYN_QUE_MODEL, &info->model_id); |
1da177e4 LT |
259 | } |
260 | ||
e839ffab BT |
261 | /* |
262 | * Read the firmware id from the touchpad | |
263 | */ | |
264 | static int synaptics_firmware_id(struct psmouse *psmouse, | |
265 | struct synaptics_device_info *info) | |
266 | { | |
2c6ecbba DT |
267 | return synaptics_query_int(psmouse, SYN_QUE_FIRMWARE_ID, |
268 | &info->firmware_id); | |
06aa374b BT |
269 | } |
270 | ||
c6bd9d46 | 271 | /* |
06aa374b | 272 | * Read the board id and the "More Extended Queries" from the touchpad |
c6bd9d46 DK |
273 | * The board id is encoded in the "QUERY MODES" response |
274 | */ | |
6c53694f DT |
275 | static int synaptics_query_modes(struct psmouse *psmouse, |
276 | struct synaptics_device_info *info) | |
c6bd9d46 | 277 | { |
f6c4442b | 278 | u8 bid[3]; |
6c53694f | 279 | int error; |
c6bd9d46 | 280 | |
b57a7128 | 281 | /* firmwares prior 7.5 have no board_id encoded */ |
6c53694f | 282 | if (SYN_ID_FULL(info->identity) < 0x705) |
b57a7128 BT |
283 | return 0; |
284 | ||
6c53694f DT |
285 | error = synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid); |
286 | if (error) | |
287 | return error; | |
288 | ||
289 | info->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; | |
06aa374b BT |
290 | |
291 | if (SYN_MEXT_CAP_BIT(bid[0])) | |
2c6ecbba DT |
292 | return synaptics_query_int(psmouse, SYN_QUE_MEXT_CAPAB_10, |
293 | &info->ext_cap_10); | |
06aa374b | 294 | |
c6bd9d46 DK |
295 | return 0; |
296 | } | |
297 | ||
1da177e4 LT |
298 | /* |
299 | * Read the capability-bits from the touchpad | |
300 | * see also the SYN_CAP_* macros | |
301 | */ | |
6c53694f DT |
302 | static int synaptics_capability(struct psmouse *psmouse, |
303 | struct synaptics_device_info *info) | |
1da177e4 | 304 | { |
6c53694f | 305 | int error; |
1da177e4 | 306 | |
2c6ecbba DT |
307 | error = synaptics_query_int(psmouse, SYN_QUE_CAPABILITIES, |
308 | &info->capabilities); | |
6c53694f DT |
309 | if (error) |
310 | return error; | |
311 | ||
6c53694f | 312 | info->ext_cap = info->ext_cap_0c = 0; |
5f57d67d | 313 | |
3619b8fe DT |
314 | /* |
315 | * Older firmwares had submodel ID fixed to 0x47 | |
316 | */ | |
6c53694f DT |
317 | if (SYN_ID_FULL(info->identity) < 0x705 && |
318 | SYN_CAP_SUBMODEL_ID(info->capabilities) != 0x47) { | |
319 | return -ENXIO; | |
3619b8fe | 320 | } |
1da177e4 LT |
321 | |
322 | /* | |
323 | * Unless capExtended is set the rest of the flags should be ignored | |
324 | */ | |
6c53694f DT |
325 | if (!SYN_CAP_EXTENDED(info->capabilities)) |
326 | info->capabilities = 0; | |
1da177e4 | 327 | |
6c53694f | 328 | if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 1) { |
2c6ecbba DT |
329 | error = synaptics_query_int(psmouse, SYN_QUE_EXT_CAPAB, |
330 | &info->ext_cap); | |
331 | if (error) { | |
b5d21704 DT |
332 | psmouse_warn(psmouse, |
333 | "device claims to have extended capabilities, but I'm not able to read them.\n"); | |
1da177e4 | 334 | } else { |
1da177e4 LT |
335 | /* |
336 | * if nExtBtn is greater than 8 it should be considered | |
337 | * invalid and treated as 0 | |
338 | */ | |
6c53694f | 339 | if (SYN_CAP_MULTI_BUTTON_NO(info->ext_cap) > 8) |
2c6ecbba | 340 | info->ext_cap &= ~SYN_CAP_MB_MASK; |
1da177e4 LT |
341 | } |
342 | } | |
5f57d67d | 343 | |
6c53694f | 344 | if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 4) { |
2c6ecbba DT |
345 | error = synaptics_query_int(psmouse, SYN_QUE_EXT_CAPAB_0C, |
346 | &info->ext_cap_0c); | |
6c53694f | 347 | if (error) |
b5d21704 DT |
348 | psmouse_warn(psmouse, |
349 | "device claims to have extended capability 0x0c, but I'm not able to read it.\n"); | |
5f57d67d TI |
350 | } |
351 | ||
1da177e4 LT |
352 | return 0; |
353 | } | |
354 | ||
ec20a022 | 355 | /* |
83ba9ea8 | 356 | * Read touchpad resolution and maximum reported coordinates |
ec20a022 TS |
357 | * Resolution is left zero if touchpad does not support the query |
358 | */ | |
6c53694f DT |
359 | static int synaptics_resolution(struct psmouse *psmouse, |
360 | struct synaptics_device_info *info) | |
ec20a022 | 361 | { |
f6c4442b | 362 | u8 resp[3]; |
6c53694f | 363 | int error; |
ec20a022 | 364 | |
6c53694f | 365 | if (SYN_ID_MAJOR(info->identity) < 4) |
bbddd199 | 366 | return 0; |
ec20a022 | 367 | |
6c53694f DT |
368 | error = synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, resp); |
369 | if (!error) { | |
a66413fb | 370 | if (resp[0] != 0 && (resp[1] & 0x80) && resp[2] != 0) { |
6c53694f DT |
371 | info->x_res = resp[0]; /* x resolution in units/mm */ |
372 | info->y_res = resp[2]; /* y resolution in units/mm */ | |
83ba9ea8 DT |
373 | } |
374 | } | |
ec20a022 | 375 | |
6c53694f DT |
376 | if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 5 && |
377 | SYN_CAP_MAX_DIMENSIONS(info->ext_cap_0c)) { | |
378 | error = synaptics_send_cmd(psmouse, | |
379 | SYN_QUE_EXT_MAX_COORDS, resp); | |
380 | if (error) { | |
b5d21704 DT |
381 | psmouse_warn(psmouse, |
382 | "device claims to have max coordinates query, but I'm not able to read it.\n"); | |
a66413fb | 383 | } else { |
6c53694f DT |
384 | info->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); |
385 | info->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); | |
9aff6598 DM |
386 | psmouse_info(psmouse, |
387 | "queried max coordinates: x [..%d], y [..%d]\n", | |
6c53694f | 388 | info->x_max, info->y_max); |
a66413fb DT |
389 | } |
390 | } | |
391 | ||
6c53694f DT |
392 | if (SYN_CAP_MIN_DIMENSIONS(info->ext_cap_0c) && |
393 | (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 7 || | |
ac097930 DM |
394 | /* |
395 | * Firmware v8.1 does not report proper number of extended | |
396 | * capabilities, but has been proven to report correct min | |
397 | * coordinates. | |
398 | */ | |
6c53694f DT |
399 | SYN_ID_FULL(info->identity) == 0x801)) { |
400 | error = synaptics_send_cmd(psmouse, | |
401 | SYN_QUE_EXT_MIN_COORDS, resp); | |
402 | if (error) { | |
b5d21704 DT |
403 | psmouse_warn(psmouse, |
404 | "device claims to have min coordinates query, but I'm not able to read it.\n"); | |
83ba9ea8 | 405 | } else { |
6c53694f DT |
406 | info->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); |
407 | info->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); | |
9aff6598 DM |
408 | psmouse_info(psmouse, |
409 | "queried min coordinates: x [%d..], y [%d..]\n", | |
6c53694f | 410 | info->x_min, info->y_min); |
83ba9ea8 | 411 | } |
ec20a022 TS |
412 | } |
413 | ||
414 | return 0; | |
415 | } | |
416 | ||
e839ffab BT |
417 | static int synaptics_query_hardware(struct psmouse *psmouse, |
418 | struct synaptics_device_info *info) | |
419 | { | |
420 | int error; | |
421 | ||
27555511 EB |
422 | memset(info, 0, sizeof(*info)); |
423 | ||
e839ffab BT |
424 | error = synaptics_identify(psmouse, info); |
425 | if (error) | |
426 | return error; | |
427 | ||
428 | error = synaptics_model_id(psmouse, info); | |
429 | if (error) | |
430 | return error; | |
431 | ||
432 | error = synaptics_firmware_id(psmouse, info); | |
433 | if (error) | |
434 | return error; | |
435 | ||
436 | error = synaptics_query_modes(psmouse, info); | |
437 | if (error) | |
438 | return error; | |
439 | ||
440 | error = synaptics_capability(psmouse, info); | |
441 | if (error) | |
442 | return error; | |
443 | ||
444 | error = synaptics_resolution(psmouse, info); | |
445 | if (error) | |
446 | return error; | |
447 | ||
448 | return 0; | |
449 | } | |
450 | ||
451 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS || CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ | |
452 | ||
453 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS | |
454 | ||
455 | static bool cr48_profile_sensor; | |
456 | ||
457 | #define ANY_BOARD_ID 0 | |
458 | struct min_max_quirk { | |
459 | const char * const *pnp_ids; | |
460 | struct { | |
461 | u32 min, max; | |
462 | } board_id; | |
463 | u32 x_min, x_max, y_min, y_max; | |
464 | }; | |
465 | ||
466 | static const struct min_max_quirk min_max_pnpid_table[] = { | |
467 | { | |
468 | (const char * const []){"LEN0033", NULL}, | |
469 | {ANY_BOARD_ID, ANY_BOARD_ID}, | |
470 | 1024, 5052, 2258, 4832 | |
471 | }, | |
472 | { | |
473 | (const char * const []){"LEN0042", NULL}, | |
474 | {ANY_BOARD_ID, ANY_BOARD_ID}, | |
475 | 1232, 5710, 1156, 4696 | |
476 | }, | |
477 | { | |
478 | (const char * const []){"LEN0034", "LEN0036", "LEN0037", | |
479 | "LEN0039", "LEN2002", "LEN2004", | |
480 | NULL}, | |
481 | {ANY_BOARD_ID, 2961}, | |
482 | 1024, 5112, 2024, 4832 | |
483 | }, | |
484 | { | |
485 | (const char * const []){"LEN2000", NULL}, | |
486 | {ANY_BOARD_ID, ANY_BOARD_ID}, | |
487 | 1024, 5113, 2021, 4832 | |
488 | }, | |
489 | { | |
490 | (const char * const []){"LEN2001", NULL}, | |
491 | {ANY_BOARD_ID, ANY_BOARD_ID}, | |
492 | 1024, 5022, 2508, 4832 | |
493 | }, | |
494 | { | |
495 | (const char * const []){"LEN2006", NULL}, | |
496 | {2691, 2691}, | |
497 | 1024, 5045, 2457, 4832 | |
498 | }, | |
499 | { | |
500 | (const char * const []){"LEN2006", NULL}, | |
501 | {ANY_BOARD_ID, ANY_BOARD_ID}, | |
502 | 1264, 5675, 1171, 4688 | |
503 | }, | |
504 | { } | |
505 | }; | |
506 | ||
e839ffab BT |
507 | /***************************************************************************** |
508 | * Synaptics communications functions | |
509 | ****************************************************************************/ | |
510 | ||
511 | /* | |
512 | * Synaptics touchpads report the y coordinate from bottom to top, which is | |
513 | * opposite from what userspace expects. | |
514 | * This function is used to invert y before reporting. | |
515 | */ | |
516 | static int synaptics_invert_y(int y) | |
517 | { | |
518 | return YMAX_NOMINAL + YMIN_NOMINAL - y; | |
519 | } | |
520 | ||
8b04baba DM |
521 | /* |
522 | * Apply quirk(s) if the hardware matches | |
523 | */ | |
6c53694f DT |
524 | static void synaptics_apply_quirks(struct psmouse *psmouse, |
525 | struct synaptics_device_info *info) | |
8b04baba | 526 | { |
8b04baba DM |
527 | int i; |
528 | ||
529 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { | |
5b3089dd DM |
530 | if (!psmouse_matches_pnp_id(psmouse, |
531 | min_max_pnpid_table[i].pnp_ids)) | |
532 | continue; | |
533 | ||
534 | if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID && | |
6c53694f | 535 | info->board_id < min_max_pnpid_table[i].board_id.min) |
5b3089dd DM |
536 | continue; |
537 | ||
538 | if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID && | |
6c53694f | 539 | info->board_id > min_max_pnpid_table[i].board_id.max) |
5b3089dd DM |
540 | continue; |
541 | ||
6c53694f DT |
542 | info->x_min = min_max_pnpid_table[i].x_min; |
543 | info->x_max = min_max_pnpid_table[i].x_max; | |
544 | info->y_min = min_max_pnpid_table[i].y_min; | |
545 | info->y_max = min_max_pnpid_table[i].y_max; | |
5b3089dd DM |
546 | psmouse_info(psmouse, |
547 | "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n", | |
6c53694f DT |
548 | info->x_min, info->x_max, |
549 | info->y_min, info->y_max); | |
5b3089dd | 550 | break; |
8b04baba DM |
551 | } |
552 | } | |
553 | ||
3f9db52d AM |
554 | static bool synaptics_has_agm(struct synaptics_data *priv) |
555 | { | |
556 | return (SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) || | |
557 | SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)); | |
558 | } | |
559 | ||
7968a5dd DD |
560 | static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) |
561 | { | |
f6c4442b | 562 | static u8 param = 0xc8; |
212baf03 | 563 | int error; |
7968a5dd | 564 | |
212baf03 DT |
565 | error = psmouse_sliced_command(psmouse, SYN_QUE_MODEL); |
566 | if (error) | |
567 | return error; | |
7968a5dd | 568 | |
212baf03 DT |
569 | error = ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE); |
570 | if (error) | |
571 | return error; | |
7968a5dd | 572 | |
7968a5dd DD |
573 | return 0; |
574 | } | |
575 | ||
576 | static int synaptics_set_mode(struct psmouse *psmouse) | |
1da177e4 LT |
577 | { |
578 | struct synaptics_data *priv = psmouse->private; | |
212baf03 | 579 | int error; |
1da177e4 | 580 | |
7968a5dd | 581 | priv->mode = 0; |
62d78461 | 582 | if (priv->absolute_mode) |
7968a5dd | 583 | priv->mode |= SYN_BIT_ABSOLUTE_MODE; |
62d78461 | 584 | if (priv->disable_gesture) |
1da177e4 | 585 | priv->mode |= SYN_BIT_DISABLE_GESTURE; |
7968a5dd DD |
586 | if (psmouse->rate >= 80) |
587 | priv->mode |= SYN_BIT_HIGH_RATE; | |
6c53694f | 588 | if (SYN_CAP_EXTENDED(priv->info.capabilities)) |
62d78461 | 589 | priv->mode |= SYN_BIT_W_MODE; |
1da177e4 | 590 | |
212baf03 DT |
591 | error = synaptics_mode_cmd(psmouse, priv->mode); |
592 | if (error) | |
593 | return error; | |
1da177e4 | 594 | |
3f9db52d | 595 | if (priv->absolute_mode && synaptics_has_agm(priv)) { |
212baf03 DT |
596 | error = synaptics_set_advanced_gesture_mode(psmouse); |
597 | if (error) { | |
598 | psmouse_err(psmouse, | |
599 | "Advanced gesture mode init failed: %d\n", | |
600 | error); | |
601 | return error; | |
602 | } | |
7968a5dd DD |
603 | } |
604 | ||
1da177e4 LT |
605 | return 0; |
606 | } | |
607 | ||
608 | static void synaptics_set_rate(struct psmouse *psmouse, unsigned int rate) | |
609 | { | |
610 | struct synaptics_data *priv = psmouse->private; | |
611 | ||
612 | if (rate >= 80) { | |
613 | priv->mode |= SYN_BIT_HIGH_RATE; | |
614 | psmouse->rate = 80; | |
615 | } else { | |
616 | priv->mode &= ~SYN_BIT_HIGH_RATE; | |
617 | psmouse->rate = 40; | |
618 | } | |
619 | ||
620 | synaptics_mode_cmd(psmouse, priv->mode); | |
621 | } | |
622 | ||
623 | /***************************************************************************** | |
624 | * Synaptics pass-through PS/2 port support | |
625 | ****************************************************************************/ | |
f6c4442b | 626 | static int synaptics_pt_write(struct serio *serio, u8 c) |
1da177e4 LT |
627 | { |
628 | struct psmouse *parent = serio_get_drvdata(serio->parent); | |
212baf03 DT |
629 | u8 rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ |
630 | int error; | |
631 | ||
632 | error = psmouse_sliced_command(parent, c); | |
633 | if (error) | |
634 | return error; | |
635 | ||
636 | error = ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE); | |
637 | if (error) | |
638 | return error; | |
1da177e4 | 639 | |
1da177e4 LT |
640 | return 0; |
641 | } | |
642 | ||
a8b3c0f5 DT |
643 | static int synaptics_pt_start(struct serio *serio) |
644 | { | |
645 | struct psmouse *parent = serio_get_drvdata(serio->parent); | |
646 | struct synaptics_data *priv = parent->private; | |
647 | ||
648 | serio_pause_rx(parent->ps2dev.serio); | |
649 | priv->pt_port = serio; | |
650 | serio_continue_rx(parent->ps2dev.serio); | |
651 | ||
652 | return 0; | |
653 | } | |
654 | ||
655 | static void synaptics_pt_stop(struct serio *serio) | |
656 | { | |
657 | struct psmouse *parent = serio_get_drvdata(serio->parent); | |
658 | struct synaptics_data *priv = parent->private; | |
659 | ||
660 | serio_pause_rx(parent->ps2dev.serio); | |
661 | priv->pt_port = NULL; | |
662 | serio_continue_rx(parent->ps2dev.serio); | |
663 | } | |
664 | ||
f6c4442b | 665 | static int synaptics_is_pt_packet(u8 *buf) |
1da177e4 LT |
666 | { |
667 | return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; | |
668 | } | |
669 | ||
f6c4442b | 670 | static void synaptics_pass_pt_packet(struct serio *ptport, u8 *packet) |
1da177e4 LT |
671 | { |
672 | struct psmouse *child = serio_get_drvdata(ptport); | |
673 | ||
674 | if (child && child->state == PSMOUSE_ACTIVATED) { | |
bf23cfc3 | 675 | serio_interrupt(ptport, packet[1], 0); |
7d12e780 DH |
676 | serio_interrupt(ptport, packet[4], 0); |
677 | serio_interrupt(ptport, packet[5], 0); | |
33fdfa97 | 678 | if (child->pktsize == 4) |
7d12e780 | 679 | serio_interrupt(ptport, packet[2], 0); |
cdd9dc19 | 680 | } else { |
7d12e780 | 681 | serio_interrupt(ptport, packet[1], 0); |
cdd9dc19 | 682 | } |
1da177e4 LT |
683 | } |
684 | ||
685 | static void synaptics_pt_activate(struct psmouse *psmouse) | |
686 | { | |
1da177e4 | 687 | struct synaptics_data *priv = psmouse->private; |
a8b3c0f5 | 688 | struct psmouse *child = serio_get_drvdata(priv->pt_port); |
1da177e4 LT |
689 | |
690 | /* adjust the touchpad to child's choice of protocol */ | |
691 | if (child) { | |
33fdfa97 | 692 | if (child->pktsize == 4) |
1da177e4 LT |
693 | priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; |
694 | else | |
695 | priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; | |
696 | ||
697 | if (synaptics_mode_cmd(psmouse, priv->mode)) | |
b5d21704 DT |
698 | psmouse_warn(psmouse, |
699 | "failed to switch guest protocol\n"); | |
1da177e4 LT |
700 | } |
701 | } | |
702 | ||
703 | static void synaptics_pt_create(struct psmouse *psmouse) | |
704 | { | |
705 | struct serio *serio; | |
706 | ||
b39787a9 | 707 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
1da177e4 | 708 | if (!serio) { |
b5d21704 DT |
709 | psmouse_err(psmouse, |
710 | "not enough memory for pass-through port\n"); | |
1da177e4 LT |
711 | return; |
712 | } | |
713 | ||
1da177e4 LT |
714 | serio->id.type = SERIO_PS_PSTHRU; |
715 | strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); | |
716 | strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); | |
717 | serio->write = synaptics_pt_write; | |
a8b3c0f5 DT |
718 | serio->start = synaptics_pt_start; |
719 | serio->stop = synaptics_pt_stop; | |
1da177e4 LT |
720 | serio->parent = psmouse->ps2dev.serio; |
721 | ||
722 | psmouse->pt_activate = synaptics_pt_activate; | |
723 | ||
b5d21704 DT |
724 | psmouse_info(psmouse, "serio: %s port at %s\n", |
725 | serio->name, psmouse->phys); | |
1da177e4 LT |
726 | serio_register_port(serio); |
727 | } | |
728 | ||
729 | /***************************************************************************** | |
730 | * Functions to interpret the absolute mode packets | |
731 | ****************************************************************************/ | |
732 | ||
f6c4442b | 733 | static void synaptics_parse_agm(const u8 buf[], |
a6ca40c1 DK |
734 | struct synaptics_data *priv, |
735 | struct synaptics_hw_state *hw) | |
7afdb842 DK |
736 | { |
737 | struct synaptics_hw_state *agm = &priv->agm; | |
a6ca40c1 DK |
738 | int agm_packet_type; |
739 | ||
740 | agm_packet_type = (buf[5] & 0x30) >> 4; | |
741 | switch (agm_packet_type) { | |
742 | case 1: | |
743 | /* Gesture packet: (x, y, z) half resolution */ | |
744 | agm->w = hw->w; | |
745 | agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1; | |
746 | agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1; | |
747 | agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1; | |
748 | break; | |
749 | ||
750 | case 2: | |
e9e8520f BT |
751 | /* AGM-CONTACT packet: we are only interested in the count */ |
752 | priv->agm_count = buf[1]; | |
a6ca40c1 DK |
753 | break; |
754 | ||
755 | default: | |
756 | break; | |
757 | } | |
7afdb842 DK |
758 | } |
759 | ||
f6c4442b | 760 | static void synaptics_parse_ext_buttons(const u8 buf[], |
dc5465dc DT |
761 | struct synaptics_data *priv, |
762 | struct synaptics_hw_state *hw) | |
763 | { | |
764 | unsigned int ext_bits = | |
6c53694f | 765 | (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) + 1) >> 1; |
dc5465dc DT |
766 | unsigned int ext_mask = GENMASK(ext_bits - 1, 0); |
767 | ||
768 | hw->ext_buttons = buf[4] & ext_mask; | |
769 | hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits; | |
770 | } | |
771 | ||
f6c4442b | 772 | static int synaptics_parse_hw_state(const u8 buf[], |
fec6e525 HR |
773 | struct synaptics_data *priv, |
774 | struct synaptics_hw_state *hw) | |
1da177e4 LT |
775 | { |
776 | memset(hw, 0, sizeof(struct synaptics_hw_state)); | |
777 | ||
6c53694f | 778 | if (SYN_MODEL_NEWABS(priv->info.model_id)) { |
1da177e4 LT |
779 | hw->w = (((buf[0] & 0x30) >> 2) | |
780 | ((buf[0] & 0x04) >> 1) | | |
781 | ((buf[3] & 0x04) >> 2)); | |
782 | ||
3f9db52d | 783 | if (synaptics_has_agm(priv) && hw->w == 2) { |
5715fc76 DT |
784 | synaptics_parse_agm(buf, priv, hw); |
785 | return 1; | |
786 | } | |
787 | ||
788 | hw->x = (((buf[3] & 0x10) << 8) | | |
789 | ((buf[1] & 0x0f) << 8) | | |
790 | buf[4]); | |
791 | hw->y = (((buf[3] & 0x20) << 7) | | |
792 | ((buf[1] & 0xf0) << 4) | | |
793 | buf[5]); | |
794 | hw->z = buf[2]; | |
795 | ||
1da177e4 LT |
796 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
797 | hw->right = (buf[0] & 0x02) ? 1 : 0; | |
798 | ||
de4e374b | 799 | if (priv->is_forcepad) { |
5715fc76 DT |
800 | /* |
801 | * ForcePads, like Clickpads, use middle button | |
802 | * bits to report primary button clicks. | |
803 | * Unfortunately they report primary button not | |
804 | * only when user presses on the pad above certain | |
805 | * threshold, but also when there are more than one | |
806 | * finger on the touchpad, which interferes with | |
807 | * out multi-finger gestures. | |
808 | */ | |
809 | if (hw->z == 0) { | |
810 | /* No contacts */ | |
811 | priv->press = priv->report_press = false; | |
812 | } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { | |
813 | /* | |
814 | * Single-finger touch with pressure above | |
815 | * the threshold. If pressure stays long | |
816 | * enough, we'll start reporting primary | |
817 | * button. We rely on the device continuing | |
818 | * sending data even if finger does not | |
819 | * move. | |
820 | */ | |
821 | if (!priv->press) { | |
822 | priv->press_start = jiffies; | |
823 | priv->press = true; | |
824 | } else if (time_after(jiffies, | |
825 | priv->press_start + | |
826 | msecs_to_jiffies(50))) { | |
827 | priv->report_press = true; | |
828 | } | |
829 | } else { | |
830 | priv->press = false; | |
831 | } | |
832 | ||
833 | hw->left = priv->report_press; | |
834 | ||
6c53694f | 835 | } else if (SYN_CAP_CLICKPAD(priv->info.ext_cap_0c)) { |
5f57d67d TI |
836 | /* |
837 | * Clickpad's button is transmitted as middle button, | |
838 | * however, since it is primary button, we will report | |
839 | * it as BTN_LEFT. | |
840 | */ | |
841 | hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; | |
842 | ||
6c53694f | 843 | } else if (SYN_CAP_MIDDLE_BUTTON(priv->info.capabilities)) { |
1da177e4 LT |
844 | hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; |
845 | if (hw->w == 2) | |
f6c4442b | 846 | hw->scroll = (s8)buf[1]; |
1da177e4 LT |
847 | } |
848 | ||
6c53694f | 849 | if (SYN_CAP_FOUR_BUTTON(priv->info.capabilities)) { |
1da177e4 LT |
850 | hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; |
851 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; | |
852 | } | |
853 | ||
6c53694f | 854 | if (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) > 0 && |
1da177e4 | 855 | ((buf[0] ^ buf[3]) & 0x02)) { |
dc5465dc | 856 | synaptics_parse_ext_buttons(buf, priv, hw); |
1da177e4 LT |
857 | } |
858 | } else { | |
859 | hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); | |
860 | hw->y = (((buf[4] & 0x1f) << 8) | buf[5]); | |
861 | ||
862 | hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F)); | |
863 | hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1)); | |
864 | ||
865 | hw->left = (buf[0] & 0x01) ? 1 : 0; | |
866 | hw->right = (buf[0] & 0x02) ? 1 : 0; | |
867 | } | |
fec6e525 | 868 | |
824efd37 SF |
869 | /* |
870 | * Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE | |
871 | * is used by some firmware to indicate a finger at the edge of | |
872 | * the touchpad whose precise position cannot be determined, so | |
873 | * convert these values to the maximum axis value. | |
874 | */ | |
c0394506 SF |
875 | if (hw->x > X_MAX_POSITIVE) |
876 | hw->x -= 1 << ABS_POS_BITS; | |
824efd37 SF |
877 | else if (hw->x == X_MAX_POSITIVE) |
878 | hw->x = XMAX; | |
879 | ||
c0394506 SF |
880 | if (hw->y > Y_MAX_POSITIVE) |
881 | hw->y -= 1 << ABS_POS_BITS; | |
824efd37 SF |
882 | else if (hw->y == Y_MAX_POSITIVE) |
883 | hw->y = YMAX; | |
c0394506 | 884 | |
fec6e525 HR |
885 | return 0; |
886 | } | |
887 | ||
bea9f0ff DK |
888 | static void synaptics_report_semi_mt_slot(struct input_dev *dev, int slot, |
889 | bool active, int x, int y) | |
fec6e525 HR |
890 | { |
891 | input_mt_slot(dev, slot); | |
892 | input_mt_report_slot_state(dev, MT_TOOL_FINGER, active); | |
893 | if (active) { | |
894 | input_report_abs(dev, ABS_MT_POSITION_X, x); | |
6de58dd6 | 895 | input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(y)); |
fec6e525 HR |
896 | } |
897 | } | |
898 | ||
899 | static void synaptics_report_semi_mt_data(struct input_dev *dev, | |
900 | const struct synaptics_hw_state *a, | |
901 | const struct synaptics_hw_state *b, | |
902 | int num_fingers) | |
903 | { | |
904 | if (num_fingers >= 2) { | |
bea9f0ff DK |
905 | synaptics_report_semi_mt_slot(dev, 0, true, min(a->x, b->x), |
906 | min(a->y, b->y)); | |
907 | synaptics_report_semi_mt_slot(dev, 1, true, max(a->x, b->x), | |
908 | max(a->y, b->y)); | |
fec6e525 | 909 | } else if (num_fingers == 1) { |
bea9f0ff DK |
910 | synaptics_report_semi_mt_slot(dev, 0, true, a->x, a->y); |
911 | synaptics_report_semi_mt_slot(dev, 1, false, 0, 0); | |
fec6e525 | 912 | } else { |
bea9f0ff DK |
913 | synaptics_report_semi_mt_slot(dev, 0, false, 0, 0); |
914 | synaptics_report_semi_mt_slot(dev, 1, false, 0, 0); | |
fec6e525 | 915 | } |
1da177e4 LT |
916 | } |
917 | ||
ebc80840 BT |
918 | static void synaptics_report_ext_buttons(struct psmouse *psmouse, |
919 | const struct synaptics_hw_state *hw) | |
3cdfee9e DK |
920 | { |
921 | struct input_dev *dev = psmouse->dev; | |
922 | struct synaptics_data *priv = psmouse->private; | |
6c53694f | 923 | int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) + 1) >> 1; |
3cdfee9e DK |
924 | int i; |
925 | ||
6c53694f | 926 | if (!SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap)) |
ebc80840 BT |
927 | return; |
928 | ||
82be788c | 929 | /* Bug in FW 8.1 & 8.2, buttons are reported only when ExtBit is 1 */ |
6c53694f DT |
930 | if ((SYN_ID_FULL(priv->info.identity) == 0x801 || |
931 | SYN_ID_FULL(priv->info.identity) == 0x802) && | |
ebc80840 BT |
932 | !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02)) |
933 | return; | |
934 | ||
6c53694f | 935 | if (!SYN_CAP_EXT_BUTTONS_STICK(priv->info.ext_cap_10)) { |
cdd9dc19 BT |
936 | for (i = 0; i < ext_bits; i++) { |
937 | input_report_key(dev, BTN_0 + 2 * i, | |
991d29fe | 938 | hw->ext_buttons & BIT(i)); |
cdd9dc19 | 939 | input_report_key(dev, BTN_1 + 2 * i, |
991d29fe | 940 | hw->ext_buttons & BIT(i + ext_bits)); |
cdd9dc19 BT |
941 | } |
942 | return; | |
ebc80840 | 943 | } |
cdd9dc19 BT |
944 | |
945 | /* | |
946 | * This generation of touchpads has the trackstick buttons | |
947 | * physically wired to the touchpad. Re-route them through | |
948 | * the pass-through interface. | |
949 | */ | |
bf23cfc3 DT |
950 | if (priv->pt_port) { |
951 | u8 pt_buttons; | |
cdd9dc19 | 952 | |
bf23cfc3 | 953 | /* The trackstick expects at most 3 buttons */ |
996b9eed DT |
954 | pt_buttons = SYN_EXT_BUTTON_STICK_L(hw->ext_buttons) | |
955 | SYN_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | | |
956 | SYN_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; | |
cdd9dc19 | 957 | |
bf23cfc3 DT |
958 | serio_interrupt(priv->pt_port, |
959 | PSMOUSE_OOB_EXTRA_BTNS, SERIO_OOB_DATA); | |
960 | serio_interrupt(priv->pt_port, pt_buttons, SERIO_OOB_DATA); | |
961 | } | |
ebc80840 BT |
962 | } |
963 | ||
3cdfee9e DK |
964 | static void synaptics_report_buttons(struct psmouse *psmouse, |
965 | const struct synaptics_hw_state *hw) | |
966 | { | |
967 | struct input_dev *dev = psmouse->dev; | |
968 | struct synaptics_data *priv = psmouse->private; | |
3cdfee9e DK |
969 | |
970 | input_report_key(dev, BTN_LEFT, hw->left); | |
971 | input_report_key(dev, BTN_RIGHT, hw->right); | |
972 | ||
6c53694f | 973 | if (SYN_CAP_MIDDLE_BUTTON(priv->info.capabilities)) |
3cdfee9e DK |
974 | input_report_key(dev, BTN_MIDDLE, hw->middle); |
975 | ||
6c53694f | 976 | if (SYN_CAP_FOUR_BUTTON(priv->info.capabilities)) { |
3cdfee9e DK |
977 | input_report_key(dev, BTN_FORWARD, hw->up); |
978 | input_report_key(dev, BTN_BACK, hw->down); | |
979 | } | |
980 | ||
ebc80840 | 981 | synaptics_report_ext_buttons(psmouse, hw); |
3cdfee9e DK |
982 | } |
983 | ||
3cdfee9e | 984 | static void synaptics_report_mt_data(struct psmouse *psmouse, |
e9e8520f BT |
985 | const struct synaptics_hw_state *sgm, |
986 | int num_fingers) | |
3cdfee9e DK |
987 | { |
988 | struct input_dev *dev = psmouse->dev; | |
989 | struct synaptics_data *priv = psmouse->private; | |
e9e8520f BT |
990 | const struct synaptics_hw_state *hw[2] = { sgm, &priv->agm }; |
991 | struct input_mt_pos pos[2]; | |
992 | int slot[2], nsemi, i; | |
3cdfee9e | 993 | |
e9e8520f | 994 | nsemi = clamp_val(num_fingers, 0, 2); |
4dc772d2 | 995 | |
e9e8520f BT |
996 | for (i = 0; i < nsemi; i++) { |
997 | pos[i].x = hw[i]->x; | |
998 | pos[i].y = synaptics_invert_y(hw[i]->y); | |
3cdfee9e DK |
999 | } |
1000 | ||
6c53694f | 1001 | input_mt_assign_slots(dev, slot, pos, nsemi, DMAX * priv->info.x_res); |
e9e8520f BT |
1002 | |
1003 | for (i = 0; i < nsemi; i++) { | |
1004 | input_mt_slot(dev, slot[i]); | |
1005 | input_mt_report_slot_state(dev, MT_TOOL_FINGER, true); | |
1006 | input_report_abs(dev, ABS_MT_POSITION_X, pos[i].x); | |
1007 | input_report_abs(dev, ABS_MT_POSITION_Y, pos[i].y); | |
1008 | input_report_abs(dev, ABS_MT_PRESSURE, hw[i]->z); | |
1009 | } | |
1010 | ||
1011 | input_mt_drop_unused(dev); | |
1012 | ||
3cdfee9e DK |
1013 | /* Don't use active slot count to generate BTN_TOOL events. */ |
1014 | input_mt_report_pointer_emulation(dev, false); | |
1015 | ||
1016 | /* Send the number of fingers reported by touchpad itself. */ | |
e9e8520f | 1017 | input_mt_report_finger_count(dev, num_fingers); |
3cdfee9e DK |
1018 | |
1019 | synaptics_report_buttons(psmouse, sgm); | |
1020 | ||
1021 | input_sync(dev); | |
1022 | } | |
1023 | ||
1024 | static void synaptics_image_sensor_process(struct psmouse *psmouse, | |
1025 | struct synaptics_hw_state *sgm) | |
1026 | { | |
4dc772d2 | 1027 | struct synaptics_data *priv = psmouse->private; |
e9e8520f | 1028 | int num_fingers; |
4dc772d2 DK |
1029 | |
1030 | /* | |
1031 | * Update mt_state using the new finger count and current mt_state. | |
1032 | */ | |
3cdfee9e | 1033 | if (sgm->z == 0) |
e9e8520f | 1034 | num_fingers = 0; |
3cdfee9e | 1035 | else if (sgm->w >= 4) |
e9e8520f | 1036 | num_fingers = 1; |
3cdfee9e | 1037 | else if (sgm->w == 0) |
e9e8520f BT |
1038 | num_fingers = 2; |
1039 | else if (sgm->w == 1) | |
1040 | num_fingers = priv->agm_count ? priv->agm_count : 3; | |
6b4b49fe | 1041 | else |
e9e8520f | 1042 | num_fingers = 4; |
3cdfee9e DK |
1043 | |
1044 | /* Send resulting input events to user space */ | |
e9e8520f | 1045 | synaptics_report_mt_data(psmouse, sgm, num_fingers); |
3cdfee9e DK |
1046 | } |
1047 | ||
3f9db52d AM |
1048 | static bool synaptics_has_multifinger(struct synaptics_data *priv) |
1049 | { | |
1050 | if (SYN_CAP_MULTIFINGER(priv->info.capabilities)) | |
1051 | return true; | |
1052 | ||
1053 | /* Advanced gesture mode also sends multi finger data */ | |
1054 | return synaptics_has_agm(priv); | |
1055 | } | |
1056 | ||
1da177e4 LT |
1057 | /* |
1058 | * called for each full received packet from the touchpad | |
1059 | */ | |
1060 | static void synaptics_process_packet(struct psmouse *psmouse) | |
1061 | { | |
2e5b636b | 1062 | struct input_dev *dev = psmouse->dev; |
1da177e4 | 1063 | struct synaptics_data *priv = psmouse->private; |
6c53694f | 1064 | struct synaptics_device_info *info = &priv->info; |
1da177e4 LT |
1065 | struct synaptics_hw_state hw; |
1066 | int num_fingers; | |
1067 | int finger_width; | |
1da177e4 | 1068 | |
fec6e525 HR |
1069 | if (synaptics_parse_hw_state(psmouse->packet, priv, &hw)) |
1070 | return; | |
1da177e4 | 1071 | |
6c53694f | 1072 | if (SYN_CAP_IMAGE_SENSOR(info->ext_cap_0c)) { |
3cdfee9e DK |
1073 | synaptics_image_sensor_process(psmouse, &hw); |
1074 | return; | |
1075 | } | |
1076 | ||
1da177e4 LT |
1077 | if (hw.scroll) { |
1078 | priv->scroll += hw.scroll; | |
1079 | ||
1080 | while (priv->scroll >= 4) { | |
1081 | input_report_key(dev, BTN_BACK, !hw.down); | |
1082 | input_sync(dev); | |
1083 | input_report_key(dev, BTN_BACK, hw.down); | |
1084 | input_sync(dev); | |
1085 | priv->scroll -= 4; | |
1086 | } | |
1087 | while (priv->scroll <= -4) { | |
1088 | input_report_key(dev, BTN_FORWARD, !hw.up); | |
1089 | input_sync(dev); | |
1090 | input_report_key(dev, BTN_FORWARD, hw.up); | |
1091 | input_sync(dev); | |
1092 | priv->scroll += 4; | |
1093 | } | |
1094 | return; | |
1095 | } | |
1096 | ||
4f56ce92 | 1097 | if (hw.z > 0 && hw.x > 1) { |
1da177e4 LT |
1098 | num_fingers = 1; |
1099 | finger_width = 5; | |
6c53694f | 1100 | if (SYN_CAP_EXTENDED(info->capabilities)) { |
1da177e4 LT |
1101 | switch (hw.w) { |
1102 | case 0 ... 1: | |
3f9db52d | 1103 | if (synaptics_has_multifinger(priv)) |
1da177e4 LT |
1104 | num_fingers = hw.w + 2; |
1105 | break; | |
1106 | case 2: | |
6c53694f | 1107 | if (SYN_MODEL_PEN(info->model_id)) |
1da177e4 LT |
1108 | ; /* Nothing, treat a pen as a single finger */ |
1109 | break; | |
1110 | case 4 ... 15: | |
6c53694f | 1111 | if (SYN_CAP_PALMDETECT(info->capabilities)) |
1da177e4 LT |
1112 | finger_width = hw.w; |
1113 | break; | |
1114 | } | |
1115 | } | |
1116 | } else { | |
1117 | num_fingers = 0; | |
1118 | finger_width = 0; | |
1119 | } | |
1120 | ||
e08d9afa | 1121 | if (cr48_profile_sensor) { |
aa104b1a | 1122 | synaptics_report_mt_data(psmouse, &hw, num_fingers); |
e08d9afa HR |
1123 | return; |
1124 | } | |
1125 | ||
6c53694f | 1126 | if (SYN_CAP_ADV_GESTURE(info->ext_cap_0c)) |
7afdb842 DK |
1127 | synaptics_report_semi_mt_data(dev, &hw, &priv->agm, |
1128 | num_fingers); | |
fec6e525 | 1129 | |
1da177e4 LT |
1130 | /* Post events |
1131 | * BTN_TOUCH has to be first as mousedev relies on it when doing | |
1132 | * absolute -> relative conversion | |
1133 | */ | |
1134 | if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); | |
1135 | if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); | |
1136 | ||
4f56ce92 | 1137 | if (num_fingers > 0) { |
1da177e4 | 1138 | input_report_abs(dev, ABS_X, hw.x); |
6de58dd6 | 1139 | input_report_abs(dev, ABS_Y, synaptics_invert_y(hw.y)); |
1da177e4 LT |
1140 | } |
1141 | input_report_abs(dev, ABS_PRESSURE, hw.z); | |
1142 | ||
6c53694f | 1143 | if (SYN_CAP_PALMDETECT(info->capabilities)) |
2a8e7710 CB |
1144 | input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); |
1145 | ||
1da177e4 | 1146 | input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); |
3f9db52d | 1147 | if (synaptics_has_multifinger(priv)) { |
e42b6646 PH |
1148 | input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); |
1149 | input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); | |
1150 | } | |
1151 | ||
3cdfee9e | 1152 | synaptics_report_buttons(psmouse, &hw); |
1da177e4 LT |
1153 | |
1154 | input_sync(dev); | |
1155 | } | |
1156 | ||
f6c4442b DT |
1157 | static bool synaptics_validate_byte(struct psmouse *psmouse, |
1158 | int idx, enum synaptics_pkt_type pkt_type) | |
1da177e4 | 1159 | { |
f6c4442b DT |
1160 | static const u8 newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 }; |
1161 | static const u8 newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 }; | |
1162 | static const u8 newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 }; | |
1163 | static const u8 oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; | |
1164 | static const u8 oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; | |
1165 | const u8 *packet = psmouse->packet; | |
1da177e4 LT |
1166 | |
1167 | if (idx < 0 || idx > 4) | |
f6c4442b | 1168 | return false; |
1da177e4 LT |
1169 | |
1170 | switch (pkt_type) { | |
1da177e4 | 1171 | |
a62f0d27 DT |
1172 | case SYN_NEWABS: |
1173 | case SYN_NEWABS_RELAXED: | |
1174 | return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx]; | |
1da177e4 | 1175 | |
a62f0d27 DT |
1176 | case SYN_NEWABS_STRICT: |
1177 | return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx]; | |
1da177e4 | 1178 | |
a62f0d27 DT |
1179 | case SYN_OLDABS: |
1180 | return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; | |
1181 | ||
1182 | default: | |
b5d21704 | 1183 | psmouse_err(psmouse, "unknown packet type %d\n", pkt_type); |
f6c4442b | 1184 | return false; |
1da177e4 LT |
1185 | } |
1186 | } | |
1187 | ||
f6c4442b DT |
1188 | static enum synaptics_pkt_type |
1189 | synaptics_detect_pkt_type(struct psmouse *psmouse) | |
1da177e4 LT |
1190 | { |
1191 | int i; | |
1192 | ||
f6c4442b | 1193 | for (i = 0; i < 5; i++) { |
b5d21704 DT |
1194 | if (!synaptics_validate_byte(psmouse, i, SYN_NEWABS_STRICT)) { |
1195 | psmouse_info(psmouse, "using relaxed packet validation\n"); | |
1da177e4 LT |
1196 | return SYN_NEWABS_RELAXED; |
1197 | } | |
f6c4442b | 1198 | } |
1da177e4 LT |
1199 | |
1200 | return SYN_NEWABS_STRICT; | |
1201 | } | |
1202 | ||
7d12e780 | 1203 | static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse) |
1da177e4 | 1204 | { |
1da177e4 LT |
1205 | struct synaptics_data *priv = psmouse->private; |
1206 | ||
1da177e4 LT |
1207 | if (psmouse->pktcnt >= 6) { /* Full packet received */ |
1208 | if (unlikely(priv->pkt_type == SYN_NEWABS)) | |
1209 | priv->pkt_type = synaptics_detect_pkt_type(psmouse); | |
1210 | ||
6c53694f | 1211 | if (SYN_CAP_PASS_THROUGH(priv->info.capabilities) && |
a8b3c0f5 DT |
1212 | synaptics_is_pt_packet(psmouse->packet)) { |
1213 | if (priv->pt_port) | |
bf23cfc3 | 1214 | synaptics_pass_pt_packet(priv->pt_port, |
cdd9dc19 | 1215 | psmouse->packet); |
1da177e4 LT |
1216 | } else |
1217 | synaptics_process_packet(psmouse); | |
1218 | ||
1219 | return PSMOUSE_FULL_PACKET; | |
1220 | } | |
1221 | ||
b5d21704 | 1222 | return synaptics_validate_byte(psmouse, psmouse->pktcnt - 1, priv->pkt_type) ? |
1da177e4 LT |
1223 | PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA; |
1224 | } | |
1225 | ||
1226 | /***************************************************************************** | |
1227 | * Driver initialization/cleanup functions | |
1228 | ****************************************************************************/ | |
85615476 | 1229 | static void set_abs_position_params(struct input_dev *dev, |
6c53694f DT |
1230 | struct synaptics_device_info *info, |
1231 | int x_code, int y_code) | |
1da177e4 | 1232 | { |
6c53694f DT |
1233 | int x_min = info->x_min ?: XMIN_NOMINAL; |
1234 | int x_max = info->x_max ?: XMAX_NOMINAL; | |
1235 | int y_min = info->y_min ?: YMIN_NOMINAL; | |
1236 | int y_max = info->y_max ?: YMAX_NOMINAL; | |
1237 | int fuzz = SYN_CAP_REDUCED_FILTERING(info->ext_cap_0c) ? | |
a9f0b79e | 1238 | SYN_REDUCED_FILTER_FUZZ : 0; |
1da177e4 | 1239 | |
85615476 DK |
1240 | input_set_abs_params(dev, x_code, x_min, x_max, fuzz, 0); |
1241 | input_set_abs_params(dev, y_code, y_min, y_max, fuzz, 0); | |
6c53694f DT |
1242 | input_abs_set_res(dev, x_code, info->x_res); |
1243 | input_abs_set_res(dev, y_code, info->y_res); | |
85615476 DK |
1244 | } |
1245 | ||
43e19888 HG |
1246 | static void set_input_params(struct psmouse *psmouse, |
1247 | struct synaptics_data *priv) | |
85615476 | 1248 | { |
43e19888 | 1249 | struct input_dev *dev = psmouse->dev; |
6c53694f | 1250 | struct synaptics_device_info *info = &priv->info; |
85615476 DK |
1251 | int i; |
1252 | ||
7968a5dd | 1253 | /* Things that apply to both modes */ |
c14890a8 | 1254 | __set_bit(INPUT_PROP_POINTER, dev->propbit); |
7968a5dd DD |
1255 | __set_bit(EV_KEY, dev->evbit); |
1256 | __set_bit(BTN_LEFT, dev->keybit); | |
1257 | __set_bit(BTN_RIGHT, dev->keybit); | |
c14890a8 | 1258 | |
6c53694f | 1259 | if (SYN_CAP_MIDDLE_BUTTON(info->capabilities)) |
7968a5dd DD |
1260 | __set_bit(BTN_MIDDLE, dev->keybit); |
1261 | ||
1262 | if (!priv->absolute_mode) { | |
1263 | /* Relative mode */ | |
1264 | __set_bit(EV_REL, dev->evbit); | |
1265 | __set_bit(REL_X, dev->relbit); | |
1266 | __set_bit(REL_Y, dev->relbit); | |
1267 | return; | |
1268 | } | |
1269 | ||
1270 | /* Absolute mode */ | |
b7802c5c | 1271 | __set_bit(EV_ABS, dev->evbit); |
6c53694f | 1272 | set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y); |
1da177e4 | 1273 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
2a8e7710 | 1274 | |
e08d9afa HR |
1275 | if (cr48_profile_sensor) |
1276 | input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); | |
1277 | ||
6c53694f DT |
1278 | if (SYN_CAP_IMAGE_SENSOR(info->ext_cap_0c)) { |
1279 | set_abs_position_params(dev, info, | |
1280 | ABS_MT_POSITION_X, ABS_MT_POSITION_Y); | |
3cdfee9e DK |
1281 | /* Image sensors can report per-contact pressure */ |
1282 | input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); | |
dbf3c370 | 1283 | input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK); |
6b4b49fe DK |
1284 | |
1285 | /* Image sensors can signal 4 and 5 finger clicks */ | |
1286 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | |
1287 | __set_bit(BTN_TOOL_QUINTTAP, dev->keybit); | |
6c53694f DT |
1288 | } else if (SYN_CAP_ADV_GESTURE(info->ext_cap_0c)) { |
1289 | set_abs_position_params(dev, info, | |
1290 | ABS_MT_POSITION_X, ABS_MT_POSITION_Y); | |
e08d9afa HR |
1291 | /* |
1292 | * Profile sensor in CR-48 tracks contacts reasonably well, | |
1293 | * other non-image sensors with AGM use semi-mt. | |
1294 | */ | |
ae84197f | 1295 | input_mt_init_slots(dev, 2, |
e08d9afa HR |
1296 | INPUT_MT_POINTER | |
1297 | (cr48_profile_sensor ? | |
1298 | INPUT_MT_TRACK : INPUT_MT_SEMI_MT)); | |
e3f80b28 PH |
1299 | |
1300 | /* | |
1301 | * For semi-mt devices we send ABS_X/Y ourselves instead of | |
1302 | * input_mt_report_pointer_emulation. But | |
1303 | * input_mt_init_slots() resets the fuzz to 0, leading to a | |
1304 | * filtered ABS_MT_POSITION_X but an unfiltered ABS_X | |
1305 | * position. Let's re-initialize ABS_X/Y here. | |
1306 | */ | |
1307 | if (!cr48_profile_sensor) | |
1308 | set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y); | |
fec6e525 HR |
1309 | } |
1310 | ||
6c53694f | 1311 | if (SYN_CAP_PALMDETECT(info->capabilities)) |
58fb0218 | 1312 | input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); |
1da177e4 | 1313 | |
b7802c5c DT |
1314 | __set_bit(BTN_TOUCH, dev->keybit); |
1315 | __set_bit(BTN_TOOL_FINGER, dev->keybit); | |
1da177e4 | 1316 | |
3f9db52d | 1317 | if (synaptics_has_multifinger(priv)) { |
b7802c5c DT |
1318 | __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); |
1319 | __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); | |
e42b6646 PH |
1320 | } |
1321 | ||
6c53694f DT |
1322 | if (SYN_CAP_FOUR_BUTTON(info->capabilities) || |
1323 | SYN_CAP_MIDDLE_BUTTON(info->capabilities)) { | |
b7802c5c DT |
1324 | __set_bit(BTN_FORWARD, dev->keybit); |
1325 | __set_bit(BTN_BACK, dev->keybit); | |
1da177e4 LT |
1326 | } |
1327 | ||
6c53694f DT |
1328 | if (!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10)) |
1329 | for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(info->ext_cap); i++) | |
cdd9dc19 | 1330 | __set_bit(BTN_0 + i, dev->keybit); |
1da177e4 | 1331 | |
b7802c5c DT |
1332 | __clear_bit(EV_REL, dev->evbit); |
1333 | __clear_bit(REL_X, dev->relbit); | |
1334 | __clear_bit(REL_Y, dev->relbit); | |
ec20a022 | 1335 | |
6c53694f | 1336 | if (SYN_CAP_CLICKPAD(info->ext_cap_0c)) { |
c14890a8 | 1337 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
3adde1f5 | 1338 | if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) && |
6c53694f | 1339 | !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10)) |
e2f61102 | 1340 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); |
5f57d67d TI |
1341 | /* Clickpads report only left button */ |
1342 | __clear_bit(BTN_RIGHT, dev->keybit); | |
1343 | __clear_bit(BTN_MIDDLE, dev->keybit); | |
1344 | } | |
1da177e4 LT |
1345 | } |
1346 | ||
7968a5dd DD |
1347 | static ssize_t synaptics_show_disable_gesture(struct psmouse *psmouse, |
1348 | void *data, char *buf) | |
1349 | { | |
1350 | struct synaptics_data *priv = psmouse->private; | |
1351 | ||
1352 | return sprintf(buf, "%c\n", priv->disable_gesture ? '1' : '0'); | |
1353 | } | |
1354 | ||
1355 | static ssize_t synaptics_set_disable_gesture(struct psmouse *psmouse, | |
1356 | void *data, const char *buf, | |
1357 | size_t len) | |
1358 | { | |
1359 | struct synaptics_data *priv = psmouse->private; | |
1360 | unsigned int value; | |
1361 | int err; | |
1362 | ||
1363 | err = kstrtouint(buf, 10, &value); | |
1364 | if (err) | |
1365 | return err; | |
1366 | ||
1367 | if (value > 1) | |
1368 | return -EINVAL; | |
1369 | ||
1370 | if (value == priv->disable_gesture) | |
1371 | return len; | |
1372 | ||
1373 | priv->disable_gesture = value; | |
1374 | if (value) | |
1375 | priv->mode |= SYN_BIT_DISABLE_GESTURE; | |
1376 | else | |
1377 | priv->mode &= ~SYN_BIT_DISABLE_GESTURE; | |
1378 | ||
1379 | if (synaptics_mode_cmd(psmouse, priv->mode)) | |
1380 | return -EIO; | |
1381 | ||
1382 | return len; | |
1383 | } | |
1384 | ||
1385 | PSMOUSE_DEFINE_ATTR(disable_gesture, S_IWUSR | S_IRUGO, NULL, | |
1386 | synaptics_show_disable_gesture, | |
1387 | synaptics_set_disable_gesture); | |
1388 | ||
1da177e4 LT |
1389 | static void synaptics_disconnect(struct psmouse *psmouse) |
1390 | { | |
7968a5dd DD |
1391 | struct synaptics_data *priv = psmouse->private; |
1392 | ||
e839ffab BT |
1393 | /* |
1394 | * We might have left a breadcrumb when trying to | |
1395 | * set up SMbus companion. | |
1396 | */ | |
1397 | psmouse_smbus_cleanup(psmouse); | |
1398 | ||
6c53694f DT |
1399 | if (!priv->absolute_mode && |
1400 | SYN_ID_DISGEST_SUPPORTED(priv->info.identity)) | |
7968a5dd DD |
1401 | device_remove_file(&psmouse->ps2dev.serio->dev, |
1402 | &psmouse_attr_disable_gesture.dattr); | |
1403 | ||
1da177e4 | 1404 | synaptics_reset(psmouse); |
7968a5dd | 1405 | kfree(priv); |
1da177e4 LT |
1406 | psmouse->private = NULL; |
1407 | } | |
1408 | ||
1409 | static int synaptics_reconnect(struct psmouse *psmouse) | |
1410 | { | |
1411 | struct synaptics_data *priv = psmouse->private; | |
6c53694f | 1412 | struct synaptics_device_info info; |
f6c4442b | 1413 | u8 param[2]; |
c63fe0a4 APF |
1414 | int retry = 0; |
1415 | int error; | |
1da177e4 | 1416 | |
c63fe0a4 APF |
1417 | do { |
1418 | psmouse_reset(psmouse); | |
8521478f DT |
1419 | if (retry) { |
1420 | /* | |
1421 | * On some boxes, right after resuming, the touchpad | |
1422 | * needs some time to finish initializing (I assume | |
1423 | * it needs time to calibrate) and start responding | |
1424 | * to Synaptics-specific queries, so let's wait a | |
1425 | * bit. | |
1426 | */ | |
1427 | ssleep(1); | |
1428 | } | |
eeb06558 | 1429 | ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID); |
c63fe0a4 APF |
1430 | error = synaptics_detect(psmouse, 0); |
1431 | } while (error && ++retry < 3); | |
4d368456 | 1432 | |
c63fe0a4 | 1433 | if (error) |
212baf03 | 1434 | return error; |
1da177e4 | 1435 | |
c63fe0a4 | 1436 | if (retry > 1) |
b5d21704 | 1437 | psmouse_dbg(psmouse, "reconnected after %d tries\n", retry); |
c63fe0a4 | 1438 | |
212baf03 DT |
1439 | error = synaptics_query_hardware(psmouse, &info); |
1440 | if (error) { | |
b5d21704 | 1441 | psmouse_err(psmouse, "Unable to query device.\n"); |
212baf03 | 1442 | return error; |
1da177e4 LT |
1443 | } |
1444 | ||
212baf03 DT |
1445 | error = synaptics_set_mode(psmouse); |
1446 | if (error) { | |
b5d21704 | 1447 | psmouse_err(psmouse, "Unable to initialize device.\n"); |
212baf03 | 1448 | return error; |
1da177e4 LT |
1449 | } |
1450 | ||
6c53694f DT |
1451 | if (info.identity != priv->info.identity || |
1452 | info.model_id != priv->info.model_id || | |
1453 | info.capabilities != priv->info.capabilities || | |
1454 | info.ext_cap != priv->info.ext_cap) { | |
b5d21704 | 1455 | psmouse_err(psmouse, |
6c53694f DT |
1456 | "hardware appears to be different: id(%u-%u), model(%u-%u), caps(%x-%x), ext(%x-%x).\n", |
1457 | priv->info.identity, info.identity, | |
1458 | priv->info.model_id, info.model_id, | |
1459 | priv->info.capabilities, info.capabilities, | |
1460 | priv->info.ext_cap, info.ext_cap); | |
212baf03 | 1461 | return -ENXIO; |
baddf589 APF |
1462 | } |
1463 | ||
1da177e4 LT |
1464 | return 0; |
1465 | } | |
1466 | ||
7705d548 DT |
1467 | static bool impaired_toshiba_kbc; |
1468 | ||
c963156c | 1469 | static const struct dmi_system_id toshiba_dmi_table[] __initconst = { |
7705d548 | 1470 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) |
1da177e4 | 1471 | { |
9961e259 | 1472 | /* Toshiba Satellite */ |
1da177e4 LT |
1473 | .matches = { |
1474 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
53a2670c | 1475 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), |
1da177e4 LT |
1476 | }, |
1477 | }, | |
9ba5eaaf | 1478 | { |
9961e259 | 1479 | /* Toshiba Dynabook */ |
9ba5eaaf SH |
1480 | .matches = { |
1481 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
53a2670c RT |
1482 | DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), |
1483 | }, | |
1484 | }, | |
1485 | { | |
9961e259 | 1486 | /* Toshiba Portege M300 */ |
53a2670c RT |
1487 | .matches = { |
1488 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
1489 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), | |
9ba5eaaf | 1490 | }, |
5f5eeff4 DT |
1491 | |
1492 | }, | |
1493 | { | |
9961e259 | 1494 | /* Toshiba Portege M300 */ |
5f5eeff4 DT |
1495 | .matches = { |
1496 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
1497 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), | |
1498 | DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"), | |
1499 | }, | |
1500 | ||
9ba5eaaf | 1501 | }, |
1da177e4 | 1502 | #endif |
70874867 | 1503 | { } |
7705d548 DT |
1504 | }; |
1505 | ||
ef8313bb AS |
1506 | static bool broken_olpc_ec; |
1507 | ||
c963156c | 1508 | static const struct dmi_system_id olpc_dmi_table[] __initconst = { |
ef8313bb AS |
1509 | #if defined(CONFIG_DMI) && defined(CONFIG_OLPC) |
1510 | { | |
1511 | /* OLPC XO-1 or XO-1.5 */ | |
1512 | .matches = { | |
1513 | DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), | |
1514 | DMI_MATCH(DMI_PRODUCT_NAME, "XO"), | |
1515 | }, | |
1516 | }, | |
ef8313bb | 1517 | #endif |
70874867 | 1518 | { } |
ef8313bb AS |
1519 | }; |
1520 | ||
e08d9afa HR |
1521 | static const struct dmi_system_id __initconst cr48_dmi_table[] = { |
1522 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | |
1523 | { | |
1524 | /* Cr-48 Chromebook (Codename Mario) */ | |
1525 | .matches = { | |
1526 | DMI_MATCH(DMI_SYS_VENDOR, "IEC"), | |
1527 | DMI_MATCH(DMI_PRODUCT_NAME, "Mario"), | |
1528 | }, | |
1529 | }, | |
1530 | #endif | |
1531 | { } | |
1532 | }; | |
1533 | ||
7705d548 DT |
1534 | void __init synaptics_module_init(void) |
1535 | { | |
1536 | impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); | |
ef8313bb | 1537 | broken_olpc_ec = dmi_check_system(olpc_dmi_table); |
e08d9afa | 1538 | cr48_profile_sensor = dmi_check_system(cr48_dmi_table); |
7705d548 | 1539 | } |
1da177e4 | 1540 | |
e839ffab BT |
1541 | static int synaptics_init_ps2(struct psmouse *psmouse, |
1542 | struct synaptics_device_info *info, | |
1543 | bool absolute_mode) | |
1da177e4 LT |
1544 | { |
1545 | struct synaptics_data *priv; | |
e839ffab | 1546 | int err; |
1da177e4 | 1547 | |
e839ffab | 1548 | synaptics_apply_quirks(psmouse, info); |
ef8313bb | 1549 | |
b39787a9 | 1550 | psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL); |
1da177e4 | 1551 | if (!priv) |
6792cbbb | 1552 | return -ENOMEM; |
1da177e4 | 1553 | |
e839ffab | 1554 | priv->info = *info; |
7968a5dd | 1555 | priv->absolute_mode = absolute_mode; |
6c53694f | 1556 | if (SYN_ID_DISGEST_SUPPORTED(info->identity)) |
7968a5dd | 1557 | priv->disable_gesture = true; |
1da177e4 | 1558 | |
de4e374b DT |
1559 | /* |
1560 | * Unfortunately ForcePad capability is not exported over PS/2, | |
1561 | * so we have to resort to checking PNP IDs. | |
1562 | */ | |
1563 | priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids); | |
1564 | ||
e839ffab BT |
1565 | err = synaptics_set_mode(psmouse); |
1566 | if (err) { | |
7968a5dd | 1567 | psmouse_err(psmouse, "Unable to initialize device.\n"); |
fec6e525 HR |
1568 | goto init_fail; |
1569 | } | |
1570 | ||
6c53694f DT |
1571 | priv->pkt_type = SYN_MODEL_NEWABS(info->model_id) ? |
1572 | SYN_NEWABS : SYN_OLDABS; | |
1da177e4 | 1573 | |
b5d21704 | 1574 | psmouse_info(psmouse, |
991d29fe | 1575 | "Touchpad model: %lu, fw: %lu.%lu, id: %#x, caps: %#x/%#x/%#x/%#x, board id: %u, fw id: %u\n", |
6c53694f DT |
1576 | SYN_ID_MODEL(info->identity), |
1577 | SYN_ID_MAJOR(info->identity), SYN_ID_MINOR(info->identity), | |
1578 | info->model_id, | |
1579 | info->capabilities, info->ext_cap, info->ext_cap_0c, | |
1580 | info->ext_cap_10, info->board_id, info->firmware_id); | |
409b7506 | 1581 | |
43e19888 | 1582 | set_input_params(psmouse, priv); |
1da177e4 | 1583 | |
887cc127 DT |
1584 | /* |
1585 | * Encode touchpad model so that it can be used to set | |
1586 | * input device->id.version and be visible to userspace. | |
1587 | * Because version is __u16 we have to drop something. | |
1588 | * Hardware info bits seem to be good candidates as they | |
1589 | * are documented to be for Synaptics corp. internal use. | |
1590 | */ | |
6c53694f DT |
1591 | psmouse->model = ((info->model_id & 0x00ff0000) >> 8) | |
1592 | (info->model_id & 0x000000ff); | |
887cc127 | 1593 | |
7968a5dd DD |
1594 | if (absolute_mode) { |
1595 | psmouse->protocol_handler = synaptics_process_byte; | |
1596 | psmouse->pktsize = 6; | |
1597 | } else { | |
1598 | /* Relative mode follows standard PS/2 mouse protocol */ | |
1599 | psmouse->protocol_handler = psmouse_process_byte; | |
1600 | psmouse->pktsize = 3; | |
1601 | } | |
1602 | ||
1da177e4 LT |
1603 | psmouse->set_rate = synaptics_set_rate; |
1604 | psmouse->disconnect = synaptics_disconnect; | |
1605 | psmouse->reconnect = synaptics_reconnect; | |
a1cec061 | 1606 | psmouse->cleanup = synaptics_reset; |
f0d5c6f4 DT |
1607 | /* Synaptics can usually stay in sync without extra help */ |
1608 | psmouse->resync_time = 0; | |
1da177e4 | 1609 | |
6c53694f | 1610 | if (SYN_CAP_PASS_THROUGH(info->capabilities)) |
1da177e4 LT |
1611 | synaptics_pt_create(psmouse); |
1612 | ||
1da177e4 LT |
1613 | /* |
1614 | * Toshiba's KBC seems to have trouble handling data from | |
7ee99161 AS |
1615 | * Synaptics at full rate. Switch to a lower rate (roughly |
1616 | * the same rate as a standard PS/2 mouse). | |
1da177e4 | 1617 | */ |
7705d548 | 1618 | if (psmouse->rate >= 80 && impaired_toshiba_kbc) { |
b5d21704 DT |
1619 | psmouse_info(psmouse, |
1620 | "Toshiba %s detected, limiting rate to 40pps.\n", | |
1621 | dmi_get_system_info(DMI_PRODUCT_NAME)); | |
1da177e4 LT |
1622 | psmouse->rate = 40; |
1623 | } | |
1da177e4 | 1624 | |
6c53694f | 1625 | if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(info->identity)) { |
7968a5dd DD |
1626 | err = device_create_file(&psmouse->ps2dev.serio->dev, |
1627 | &psmouse_attr_disable_gesture.dattr); | |
1628 | if (err) { | |
1629 | psmouse_err(psmouse, | |
1630 | "Failed to create disable_gesture attribute (%d)", | |
1631 | err); | |
1632 | goto init_fail; | |
1633 | } | |
1634 | } | |
1635 | ||
1da177e4 LT |
1636 | return 0; |
1637 | ||
1638 | init_fail: | |
1639 | kfree(priv); | |
7968a5dd DD |
1640 | return err; |
1641 | } | |
1642 | ||
e839ffab BT |
1643 | static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) |
1644 | { | |
1645 | struct synaptics_device_info info; | |
1646 | int error; | |
1647 | ||
1648 | psmouse_reset(psmouse); | |
1649 | ||
1650 | error = synaptics_query_hardware(psmouse, &info); | |
1651 | if (error) { | |
1652 | psmouse_err(psmouse, "Unable to query device: %d\n", error); | |
1653 | return error; | |
1654 | } | |
1655 | ||
1656 | return synaptics_init_ps2(psmouse, &info, absolute_mode); | |
1657 | } | |
1658 | ||
1659 | int synaptics_init_absolute(struct psmouse *psmouse) | |
7968a5dd DD |
1660 | { |
1661 | return __synaptics_init(psmouse, true); | |
1662 | } | |
1663 | ||
1664 | int synaptics_init_relative(struct psmouse *psmouse) | |
1665 | { | |
1666 | return __synaptics_init(psmouse, false); | |
1da177e4 LT |
1667 | } |
1668 | ||
e839ffab BT |
1669 | static int synaptics_setup_ps2(struct psmouse *psmouse, |
1670 | struct synaptics_device_info *info) | |
1671 | { | |
1672 | bool absolute_mode = true; | |
1673 | int error; | |
1674 | ||
1675 | /* | |
1676 | * The OLPC XO has issues with Synaptics' absolute mode; the constant | |
1677 | * packet spew overloads the EC such that key presses on the keyboard | |
1678 | * are missed. Given that, don't even attempt to use Absolute mode. | |
1679 | * Relative mode seems to work just fine. | |
1680 | */ | |
1681 | if (broken_olpc_ec) { | |
1682 | psmouse_info(psmouse, | |
1683 | "OLPC XO detected, forcing relative protocol.\n"); | |
1684 | absolute_mode = false; | |
1685 | } | |
1686 | ||
1687 | error = synaptics_init_ps2(psmouse, info, absolute_mode); | |
1688 | if (error) | |
1689 | return error; | |
1690 | ||
1691 | return absolute_mode ? PSMOUSE_SYNAPTICS : PSMOUSE_SYNAPTICS_RELATIVE; | |
1692 | } | |
1693 | ||
55e3d922 AS |
1694 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
1695 | ||
7705d548 DT |
1696 | void __init synaptics_module_init(void) |
1697 | { | |
1698 | } | |
1699 | ||
e839ffab BT |
1700 | static int __maybe_unused |
1701 | synaptics_setup_ps2(struct psmouse *psmouse, | |
1702 | struct synaptics_device_info *info) | |
55e3d922 AS |
1703 | { |
1704 | return -ENOSYS; | |
1705 | } | |
1706 | ||
1707 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ | |
e839ffab BT |
1708 | |
1709 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS | |
1710 | ||
1711 | /* | |
1712 | * The newest Synaptics device can use a secondary bus (called InterTouch) which | |
1713 | * provides a better bandwidth and allow a better control of the touchpads. | |
1714 | * This is used to decide if we need to use this bus or not. | |
1715 | */ | |
1716 | enum { | |
1717 | SYNAPTICS_INTERTOUCH_NOT_SET = -1, | |
1718 | SYNAPTICS_INTERTOUCH_OFF, | |
1719 | SYNAPTICS_INTERTOUCH_ON, | |
1720 | }; | |
1721 | ||
f4947d79 BT |
1722 | static int synaptics_intertouch = IS_ENABLED(CONFIG_RMI4_SMB) ? |
1723 | SYNAPTICS_INTERTOUCH_NOT_SET : SYNAPTICS_INTERTOUCH_OFF; | |
e839ffab BT |
1724 | module_param_named(synaptics_intertouch, synaptics_intertouch, int, 0644); |
1725 | MODULE_PARM_DESC(synaptics_intertouch, "Use a secondary bus for the Synaptics device."); | |
1726 | ||
1727 | static int synaptics_create_intertouch(struct psmouse *psmouse, | |
1728 | struct synaptics_device_info *info, | |
1729 | bool leave_breadcrumbs) | |
1730 | { | |
1731 | bool topbuttonpad = | |
1732 | psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) && | |
1733 | !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10); | |
1734 | const struct rmi_device_platform_data pdata = { | |
1735 | .sensor_pdata = { | |
1736 | .sensor_type = rmi_sensor_touchpad, | |
1737 | .axis_align.flip_y = true, | |
2b30297d | 1738 | .kernel_tracking = false, |
e839ffab BT |
1739 | .topbuttonpad = topbuttonpad, |
1740 | }, | |
1741 | .f30_data = { | |
1742 | .buttonpad = SYN_CAP_CLICKPAD(info->ext_cap_0c), | |
1743 | .trackstick_buttons = | |
1744 | !!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10), | |
1745 | }, | |
1746 | }; | |
1747 | const struct i2c_board_info intertouch_board = { | |
1748 | I2C_BOARD_INFO("rmi4_smbus", 0x2c), | |
1749 | .flags = I2C_CLIENT_HOST_NOTIFY, | |
1750 | }; | |
1751 | ||
1752 | return psmouse_smbus_init(psmouse, &intertouch_board, | |
1753 | &pdata, sizeof(pdata), | |
1754 | leave_breadcrumbs); | |
1755 | } | |
1756 | ||
1757 | /** | |
1758 | * synaptics_setup_intertouch - called once the PS/2 devices are enumerated | |
1759 | * and decides to instantiate a SMBus InterTouch device. | |
1760 | */ | |
1761 | static int synaptics_setup_intertouch(struct psmouse *psmouse, | |
1762 | struct synaptics_device_info *info, | |
1763 | bool leave_breadcrumbs) | |
1764 | { | |
1765 | int error; | |
1766 | ||
1767 | if (synaptics_intertouch == SYNAPTICS_INTERTOUCH_OFF) | |
1768 | return -ENXIO; | |
1769 | ||
1770 | if (synaptics_intertouch == SYNAPTICS_INTERTOUCH_NOT_SET) { | |
1771 | if (!psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) && | |
2fef826e BT |
1772 | !psmouse_matches_pnp_id(psmouse, smbus_pnp_ids)) { |
1773 | ||
1774 | if (!psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids)) | |
1775 | psmouse_info(psmouse, | |
1776 | "Your touchpad (%s) says it can support a different bus. " | |
1777 | "If i2c-hid and hid-rmi are not used, you might want to try setting psmouse.synaptics_intertouch to 1 and report this to linux-input@vger.kernel.org.\n", | |
1778 | psmouse->ps2dev.serio->firmware_id); | |
1779 | ||
e839ffab | 1780 | return -ENXIO; |
2fef826e | 1781 | } |
e839ffab BT |
1782 | } |
1783 | ||
1784 | psmouse_info(psmouse, "Trying to set up SMBus access\n"); | |
1785 | ||
1786 | error = synaptics_create_intertouch(psmouse, info, leave_breadcrumbs); | |
1787 | if (error) { | |
1788 | if (error == -EAGAIN) | |
1789 | psmouse_info(psmouse, "SMbus companion is not ready yet\n"); | |
1790 | else | |
1791 | psmouse_err(psmouse, "unable to create intertouch device\n"); | |
1792 | ||
1793 | return error; | |
1794 | } | |
1795 | ||
1796 | return 0; | |
1797 | } | |
1798 | ||
1799 | int synaptics_init_smbus(struct psmouse *psmouse) | |
1800 | { | |
1801 | struct synaptics_device_info info; | |
1802 | int error; | |
1803 | ||
1804 | psmouse_reset(psmouse); | |
1805 | ||
1806 | error = synaptics_query_hardware(psmouse, &info); | |
1807 | if (error) { | |
1808 | psmouse_err(psmouse, "Unable to query device: %d\n", error); | |
1809 | return error; | |
1810 | } | |
1811 | ||
1812 | if (!SYN_CAP_INTERTOUCH(info.ext_cap_0c)) | |
1813 | return -ENXIO; | |
1814 | ||
1815 | return synaptics_create_intertouch(psmouse, &info, false); | |
1816 | } | |
1817 | ||
1818 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ | |
1819 | ||
1820 | static int __maybe_unused | |
1821 | synaptics_setup_intertouch(struct psmouse *psmouse, | |
1822 | struct synaptics_device_info *info, | |
1823 | bool leave_breadcrumbs) | |
1824 | { | |
1825 | return -ENOSYS; | |
1826 | } | |
1827 | ||
1828 | int synaptics_init_smbus(struct psmouse *psmouse) | |
1829 | { | |
1830 | return -ENOSYS; | |
1831 | } | |
1832 | ||
1833 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ | |
1834 | ||
1835 | #if defined(CONFIG_MOUSE_PS2_SYNAPTICS) || \ | |
1836 | defined(CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS) | |
1837 | ||
1838 | int synaptics_init(struct psmouse *psmouse) | |
1839 | { | |
1840 | struct synaptics_device_info info; | |
1841 | int error; | |
1842 | int retval; | |
1843 | ||
1844 | psmouse_reset(psmouse); | |
1845 | ||
1846 | error = synaptics_query_hardware(psmouse, &info); | |
1847 | if (error) { | |
1848 | psmouse_err(psmouse, "Unable to query device: %d\n", error); | |
1849 | return error; | |
1850 | } | |
1851 | ||
1852 | if (SYN_CAP_INTERTOUCH(info.ext_cap_0c)) { | |
f4101ff8 BT |
1853 | if ((!IS_ENABLED(CONFIG_RMI4_SMB) || |
1854 | !IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS)) && | |
1855 | /* Forcepads need F21, which is not ready */ | |
1856 | !psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids)) { | |
1857 | psmouse_warn(psmouse, | |
1858 | "The touchpad can support a better bus than the too old PS/2 protocol. " | |
1859 | "Make sure MOUSE_PS2_SYNAPTICS_SMBUS and RMI4_SMB are enabled to get a better touchpad experience.\n"); | |
1860 | } | |
1861 | ||
e839ffab BT |
1862 | error = synaptics_setup_intertouch(psmouse, &info, true); |
1863 | if (!error) | |
1864 | return PSMOUSE_SYNAPTICS_SMBUS; | |
1865 | } | |
1866 | ||
1867 | retval = synaptics_setup_ps2(psmouse, &info); | |
1868 | if (retval < 0) { | |
1869 | /* | |
1870 | * Not using any flavor of Synaptics support, so clean up | |
1871 | * SMbus breadcrumbs, if any. | |
1872 | */ | |
1873 | psmouse_smbus_cleanup(psmouse); | |
1874 | } | |
1875 | ||
1876 | return retval; | |
1877 | } | |
1878 | ||
1879 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS || CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ | |
1880 | ||
1881 | int synaptics_init(struct psmouse *psmouse) | |
1882 | { | |
1883 | return -ENOSYS; | |
1884 | } | |
1885 | ||
1886 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS || CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ |