diff options
-rw-r--r-- | drivers/hid/hid-apple.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 3 | ||||
-rw-r--r-- | drivers/input/mouse/bcm5974.c | 165 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/zforce_ts.c | 2 |
6 files changed, 130 insertions, 56 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index f822fd2a1ada..884d82f9190e 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -546,6 +546,12 @@ static const struct hid_device_id apple_devices[] = { | |||
546 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 546 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
547 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), | 547 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), |
548 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 548 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
549 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), | ||
550 | .driver_data = APPLE_HAS_FN }, | ||
551 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), | ||
552 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
553 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), | ||
554 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
549 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 555 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
550 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 556 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
551 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 557 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 157c62775053..e6fce23b121a 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1782,6 +1782,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1782 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, | 1782 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, |
1783 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, | 1783 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, |
1784 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, | 1784 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, |
1785 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, | ||
1786 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, | ||
1787 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, | ||
1785 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1788 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1786 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1789 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1787 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1790 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
@@ -2463,6 +2466,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2463 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, | 2466 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, |
2464 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, | 2467 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, |
2465 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, | 2468 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, |
2469 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, | ||
2470 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, | ||
2471 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, | ||
2466 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2472 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2467 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2473 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2468 | { } | 2474 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b04b0820d816..b3b225b75d0a 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -142,6 +142,9 @@ | |||
142 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 | 142 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 |
143 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 | 143 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 |
144 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 | 144 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 |
145 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272 | ||
146 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273 | ||
147 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274 | ||
145 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | 148 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a |
146 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | 149 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b |
147 | #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 | 150 | #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index b10709f04615..30e3442518f8 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver | 2 | * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver |
3 | * | 3 | * |
4 | * Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) | 4 | * Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) |
5 | * Copyright (C) 2015 John Horan (knasher@gmail.com) | ||
5 | * | 6 | * |
6 | * The USB initialization and package decoding was made by | 7 | * The USB initialization and package decoding was made by |
7 | * Scott Shawcroft as part of the touchd user-space driver project: | 8 | * Scott Shawcroft as part of the touchd user-space driver project: |
@@ -91,6 +92,10 @@ | |||
91 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 | 92 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 |
92 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 | 93 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 |
93 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 | 94 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 |
95 | /* MacbookPro12,1 (2015) */ | ||
96 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272 | ||
97 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273 | ||
98 | #define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274 | ||
94 | 99 | ||
95 | #define BCM5974_DEVICE(prod) { \ | 100 | #define BCM5974_DEVICE(prod) { \ |
96 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 101 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -152,6 +157,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
152 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), | 157 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), |
153 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), | 158 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), |
154 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), | 159 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), |
160 | /* MacbookPro12,1 */ | ||
161 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), | ||
162 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), | ||
163 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), | ||
155 | /* Terminating entry */ | 164 | /* Terminating entry */ |
156 | {} | 165 | {} |
157 | }; | 166 | }; |
@@ -180,21 +189,47 @@ struct bt_data { | |||
180 | enum tp_type { | 189 | enum tp_type { |
181 | TYPE1, /* plain trackpad */ | 190 | TYPE1, /* plain trackpad */ |
182 | TYPE2, /* button integrated in trackpad */ | 191 | TYPE2, /* button integrated in trackpad */ |
183 | TYPE3 /* additional header fields since June 2013 */ | 192 | TYPE3, /* additional header fields since June 2013 */ |
193 | TYPE4 /* additional header field for pressure data */ | ||
184 | }; | 194 | }; |
185 | 195 | ||
186 | /* trackpad finger data offsets, le16-aligned */ | 196 | /* trackpad finger data offsets, le16-aligned */ |
187 | #define FINGER_TYPE1 (13 * sizeof(__le16)) | 197 | #define HEADER_TYPE1 (13 * sizeof(__le16)) |
188 | #define FINGER_TYPE2 (15 * sizeof(__le16)) | 198 | #define HEADER_TYPE2 (15 * sizeof(__le16)) |
189 | #define FINGER_TYPE3 (19 * sizeof(__le16)) | 199 | #define HEADER_TYPE3 (19 * sizeof(__le16)) |
200 | #define HEADER_TYPE4 (23 * sizeof(__le16)) | ||
190 | 201 | ||
191 | /* trackpad button data offsets */ | 202 | /* trackpad button data offsets */ |
203 | #define BUTTON_TYPE1 0 | ||
192 | #define BUTTON_TYPE2 15 | 204 | #define BUTTON_TYPE2 15 |
193 | #define BUTTON_TYPE3 23 | 205 | #define BUTTON_TYPE3 23 |
206 | #define BUTTON_TYPE4 31 | ||
194 | 207 | ||
195 | /* list of device capability bits */ | 208 | /* list of device capability bits */ |
196 | #define HAS_INTEGRATED_BUTTON 1 | 209 | #define HAS_INTEGRATED_BUTTON 1 |
197 | 210 | ||
211 | /* trackpad finger data block size */ | ||
212 | #define FSIZE_TYPE1 (14 * sizeof(__le16)) | ||
213 | #define FSIZE_TYPE2 (14 * sizeof(__le16)) | ||
214 | #define FSIZE_TYPE3 (14 * sizeof(__le16)) | ||
215 | #define FSIZE_TYPE4 (15 * sizeof(__le16)) | ||
216 | |||
217 | /* offset from header to finger struct */ | ||
218 | #define DELTA_TYPE1 (0 * sizeof(__le16)) | ||
219 | #define DELTA_TYPE2 (0 * sizeof(__le16)) | ||
220 | #define DELTA_TYPE3 (0 * sizeof(__le16)) | ||
221 | #define DELTA_TYPE4 (1 * sizeof(__le16)) | ||
222 | |||
223 | /* usb control message mode switch data */ | ||
224 | #define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8 | ||
225 | #define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8 | ||
226 | #define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8 | ||
227 | #define USBMSG_TYPE4 2, 0x302, 2, 1, 0x1, 0x0 | ||
228 | |||
229 | /* Wellspring initialization constants */ | ||
230 | #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 | ||
231 | #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID 9 | ||
232 | |||
198 | /* trackpad finger structure, le16-aligned */ | 233 | /* trackpad finger structure, le16-aligned */ |
199 | struct tp_finger { | 234 | struct tp_finger { |
200 | __le16 origin; /* zero when switching track finger */ | 235 | __le16 origin; /* zero when switching track finger */ |
@@ -207,14 +242,13 @@ struct tp_finger { | |||
207 | __le16 orientation; /* 16384 when point, else 15 bit angle */ | 242 | __le16 orientation; /* 16384 when point, else 15 bit angle */ |
208 | __le16 touch_major; /* touch area, major axis */ | 243 | __le16 touch_major; /* touch area, major axis */ |
209 | __le16 touch_minor; /* touch area, minor axis */ | 244 | __le16 touch_minor; /* touch area, minor axis */ |
210 | __le16 unused[3]; /* zeros */ | 245 | __le16 unused[2]; /* zeros */ |
246 | __le16 pressure; /* pressure on forcetouch touchpad */ | ||
211 | __le16 multi; /* one finger: varies, more fingers: constant */ | 247 | __le16 multi; /* one finger: varies, more fingers: constant */ |
212 | } __attribute__((packed,aligned(2))); | 248 | } __attribute__((packed,aligned(2))); |
213 | 249 | ||
214 | /* trackpad finger data size, empirically at least ten fingers */ | 250 | /* trackpad finger data size, empirically at least ten fingers */ |
215 | #define MAX_FINGERS 16 | 251 | #define MAX_FINGERS 16 |
216 | #define SIZEOF_FINGER sizeof(struct tp_finger) | ||
217 | #define SIZEOF_ALL_FINGERS (MAX_FINGERS * SIZEOF_FINGER) | ||
218 | #define MAX_FINGER_ORIENTATION 16384 | 252 | #define MAX_FINGER_ORIENTATION 16384 |
219 | 253 | ||
220 | /* device-specific parameters */ | 254 | /* device-specific parameters */ |
@@ -232,8 +266,17 @@ struct bcm5974_config { | |||
232 | int bt_datalen; /* data length of the button interface */ | 266 | int bt_datalen; /* data length of the button interface */ |
233 | int tp_ep; /* the endpoint of the trackpad interface */ | 267 | int tp_ep; /* the endpoint of the trackpad interface */ |
234 | enum tp_type tp_type; /* type of trackpad interface */ | 268 | enum tp_type tp_type; /* type of trackpad interface */ |
235 | int tp_offset; /* offset to trackpad finger data */ | 269 | int tp_header; /* bytes in header block */ |
236 | int tp_datalen; /* data length of the trackpad interface */ | 270 | int tp_datalen; /* data length of the trackpad interface */ |
271 | int tp_button; /* offset to button data */ | ||
272 | int tp_fsize; /* bytes in single finger block */ | ||
273 | int tp_delta; /* offset from header to finger struct */ | ||
274 | int um_size; /* usb control message length */ | ||
275 | int um_req_val; /* usb control message value */ | ||
276 | int um_req_idx; /* usb control message index */ | ||
277 | int um_switch_idx; /* usb control message mode switch index */ | ||
278 | int um_switch_on; /* usb control message mode switch on */ | ||
279 | int um_switch_off; /* usb control message mode switch off */ | ||
237 | struct bcm5974_param p; /* finger pressure limits */ | 280 | struct bcm5974_param p; /* finger pressure limits */ |
238 | struct bcm5974_param w; /* finger width limits */ | 281 | struct bcm5974_param w; /* finger width limits */ |
239 | struct bcm5974_param x; /* horizontal limits */ | 282 | struct bcm5974_param x; /* horizontal limits */ |
@@ -259,6 +302,24 @@ struct bcm5974 { | |||
259 | int slots[MAX_FINGERS]; /* slot assignments */ | 302 | int slots[MAX_FINGERS]; /* slot assignments */ |
260 | }; | 303 | }; |
261 | 304 | ||
305 | /* trackpad finger block data, le16-aligned */ | ||
306 | static const struct tp_finger *get_tp_finger(const struct bcm5974 *dev, int i) | ||
307 | { | ||
308 | const struct bcm5974_config *c = &dev->cfg; | ||
309 | u8 *f_base = dev->tp_data + c->tp_header + c->tp_delta; | ||
310 | |||
311 | return (const struct tp_finger *)(f_base + i * c->tp_fsize); | ||
312 | } | ||
313 | |||
314 | #define DATAFORMAT(type) \ | ||
315 | type, \ | ||
316 | HEADER_##type, \ | ||
317 | HEADER_##type + (MAX_FINGERS) * (FSIZE_##type), \ | ||
318 | BUTTON_##type, \ | ||
319 | FSIZE_##type, \ | ||
320 | DELTA_##type, \ | ||
321 | USBMSG_##type | ||
322 | |||
262 | /* logical signal quality */ | 323 | /* logical signal quality */ |
263 | #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ | 324 | #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ |
264 | #define SN_WIDTH 25 /* width signal-to-noise ratio */ | 325 | #define SN_WIDTH 25 /* width signal-to-noise ratio */ |
@@ -273,7 +334,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
273 | USB_DEVICE_ID_APPLE_WELLSPRING_JIS, | 334 | USB_DEVICE_ID_APPLE_WELLSPRING_JIS, |
274 | 0, | 335 | 0, |
275 | 0x84, sizeof(struct bt_data), | 336 | 0x84, sizeof(struct bt_data), |
276 | 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, | 337 | 0x81, DATAFORMAT(TYPE1), |
277 | { SN_PRESSURE, 0, 256 }, | 338 | { SN_PRESSURE, 0, 256 }, |
278 | { SN_WIDTH, 0, 2048 }, | 339 | { SN_WIDTH, 0, 2048 }, |
279 | { SN_COORD, -4824, 5342 }, | 340 | { SN_COORD, -4824, 5342 }, |
@@ -286,7 +347,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
286 | USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, | 347 | USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, |
287 | 0, | 348 | 0, |
288 | 0x84, sizeof(struct bt_data), | 349 | 0x84, sizeof(struct bt_data), |
289 | 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, | 350 | 0x81, DATAFORMAT(TYPE1), |
290 | { SN_PRESSURE, 0, 256 }, | 351 | { SN_PRESSURE, 0, 256 }, |
291 | { SN_WIDTH, 0, 2048 }, | 352 | { SN_WIDTH, 0, 2048 }, |
292 | { SN_COORD, -4824, 4824 }, | 353 | { SN_COORD, -4824, 4824 }, |
@@ -299,7 +360,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
299 | USB_DEVICE_ID_APPLE_WELLSPRING3_JIS, | 360 | USB_DEVICE_ID_APPLE_WELLSPRING3_JIS, |
300 | HAS_INTEGRATED_BUTTON, | 361 | HAS_INTEGRATED_BUTTON, |
301 | 0x84, sizeof(struct bt_data), | 362 | 0x84, sizeof(struct bt_data), |
302 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 363 | 0x81, DATAFORMAT(TYPE2), |
303 | { SN_PRESSURE, 0, 300 }, | 364 | { SN_PRESSURE, 0, 300 }, |
304 | { SN_WIDTH, 0, 2048 }, | 365 | { SN_WIDTH, 0, 2048 }, |
305 | { SN_COORD, -4460, 5166 }, | 366 | { SN_COORD, -4460, 5166 }, |
@@ -312,7 +373,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
312 | USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, | 373 | USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, |
313 | HAS_INTEGRATED_BUTTON, | 374 | HAS_INTEGRATED_BUTTON, |
314 | 0x84, sizeof(struct bt_data), | 375 | 0x84, sizeof(struct bt_data), |
315 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 376 | 0x81, DATAFORMAT(TYPE2), |
316 | { SN_PRESSURE, 0, 300 }, | 377 | { SN_PRESSURE, 0, 300 }, |
317 | { SN_WIDTH, 0, 2048 }, | 378 | { SN_WIDTH, 0, 2048 }, |
318 | { SN_COORD, -4620, 5140 }, | 379 | { SN_COORD, -4620, 5140 }, |
@@ -325,7 +386,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
325 | USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, | 386 | USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, |
326 | HAS_INTEGRATED_BUTTON, | 387 | HAS_INTEGRATED_BUTTON, |
327 | 0x84, sizeof(struct bt_data), | 388 | 0x84, sizeof(struct bt_data), |
328 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 389 | 0x81, DATAFORMAT(TYPE2), |
329 | { SN_PRESSURE, 0, 300 }, | 390 | { SN_PRESSURE, 0, 300 }, |
330 | { SN_WIDTH, 0, 2048 }, | 391 | { SN_WIDTH, 0, 2048 }, |
331 | { SN_COORD, -4616, 5112 }, | 392 | { SN_COORD, -4616, 5112 }, |
@@ -338,7 +399,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
338 | USB_DEVICE_ID_APPLE_WELLSPRING5_JIS, | 399 | USB_DEVICE_ID_APPLE_WELLSPRING5_JIS, |
339 | HAS_INTEGRATED_BUTTON, | 400 | HAS_INTEGRATED_BUTTON, |
340 | 0x84, sizeof(struct bt_data), | 401 | 0x84, sizeof(struct bt_data), |
341 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 402 | 0x81, DATAFORMAT(TYPE2), |
342 | { SN_PRESSURE, 0, 300 }, | 403 | { SN_PRESSURE, 0, 300 }, |
343 | { SN_WIDTH, 0, 2048 }, | 404 | { SN_WIDTH, 0, 2048 }, |
344 | { SN_COORD, -4415, 5050 }, | 405 | { SN_COORD, -4415, 5050 }, |
@@ -351,7 +412,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
351 | USB_DEVICE_ID_APPLE_WELLSPRING6_JIS, | 412 | USB_DEVICE_ID_APPLE_WELLSPRING6_JIS, |
352 | HAS_INTEGRATED_BUTTON, | 413 | HAS_INTEGRATED_BUTTON, |
353 | 0x84, sizeof(struct bt_data), | 414 | 0x84, sizeof(struct bt_data), |
354 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 415 | 0x81, DATAFORMAT(TYPE2), |
355 | { SN_PRESSURE, 0, 300 }, | 416 | { SN_PRESSURE, 0, 300 }, |
356 | { SN_WIDTH, 0, 2048 }, | 417 | { SN_WIDTH, 0, 2048 }, |
357 | { SN_COORD, -4620, 5140 }, | 418 | { SN_COORD, -4620, 5140 }, |
@@ -364,7 +425,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
364 | USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS, | 425 | USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS, |
365 | HAS_INTEGRATED_BUTTON, | 426 | HAS_INTEGRATED_BUTTON, |
366 | 0x84, sizeof(struct bt_data), | 427 | 0x84, sizeof(struct bt_data), |
367 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 428 | 0x81, DATAFORMAT(TYPE2), |
368 | { SN_PRESSURE, 0, 300 }, | 429 | { SN_PRESSURE, 0, 300 }, |
369 | { SN_WIDTH, 0, 2048 }, | 430 | { SN_WIDTH, 0, 2048 }, |
370 | { SN_COORD, -4750, 5280 }, | 431 | { SN_COORD, -4750, 5280 }, |
@@ -377,7 +438,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
377 | USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS, | 438 | USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS, |
378 | HAS_INTEGRATED_BUTTON, | 439 | HAS_INTEGRATED_BUTTON, |
379 | 0x84, sizeof(struct bt_data), | 440 | 0x84, sizeof(struct bt_data), |
380 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 441 | 0x81, DATAFORMAT(TYPE2), |
381 | { SN_PRESSURE, 0, 300 }, | 442 | { SN_PRESSURE, 0, 300 }, |
382 | { SN_WIDTH, 0, 2048 }, | 443 | { SN_WIDTH, 0, 2048 }, |
383 | { SN_COORD, -4620, 5140 }, | 444 | { SN_COORD, -4620, 5140 }, |
@@ -390,7 +451,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
390 | USB_DEVICE_ID_APPLE_WELLSPRING7_JIS, | 451 | USB_DEVICE_ID_APPLE_WELLSPRING7_JIS, |
391 | HAS_INTEGRATED_BUTTON, | 452 | HAS_INTEGRATED_BUTTON, |
392 | 0x84, sizeof(struct bt_data), | 453 | 0x84, sizeof(struct bt_data), |
393 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 454 | 0x81, DATAFORMAT(TYPE2), |
394 | { SN_PRESSURE, 0, 300 }, | 455 | { SN_PRESSURE, 0, 300 }, |
395 | { SN_WIDTH, 0, 2048 }, | 456 | { SN_WIDTH, 0, 2048 }, |
396 | { SN_COORD, -4750, 5280 }, | 457 | { SN_COORD, -4750, 5280 }, |
@@ -403,7 +464,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
403 | USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, | 464 | USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, |
404 | HAS_INTEGRATED_BUTTON, | 465 | HAS_INTEGRATED_BUTTON, |
405 | 0x84, sizeof(struct bt_data), | 466 | 0x84, sizeof(struct bt_data), |
406 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | 467 | 0x81, DATAFORMAT(TYPE2), |
407 | { SN_PRESSURE, 0, 300 }, | 468 | { SN_PRESSURE, 0, 300 }, |
408 | { SN_WIDTH, 0, 2048 }, | 469 | { SN_WIDTH, 0, 2048 }, |
409 | { SN_COORD, -4750, 5280 }, | 470 | { SN_COORD, -4750, 5280 }, |
@@ -416,13 +477,26 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
416 | USB_DEVICE_ID_APPLE_WELLSPRING8_JIS, | 477 | USB_DEVICE_ID_APPLE_WELLSPRING8_JIS, |
417 | HAS_INTEGRATED_BUTTON, | 478 | HAS_INTEGRATED_BUTTON, |
418 | 0, sizeof(struct bt_data), | 479 | 0, sizeof(struct bt_data), |
419 | 0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS, | 480 | 0x83, DATAFORMAT(TYPE3), |
420 | { SN_PRESSURE, 0, 300 }, | 481 | { SN_PRESSURE, 0, 300 }, |
421 | { SN_WIDTH, 0, 2048 }, | 482 | { SN_WIDTH, 0, 2048 }, |
422 | { SN_COORD, -4620, 5140 }, | 483 | { SN_COORD, -4620, 5140 }, |
423 | { SN_COORD, -150, 6600 }, | 484 | { SN_COORD, -150, 6600 }, |
424 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | 485 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } |
425 | }, | 486 | }, |
487 | { | ||
488 | USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI, | ||
489 | USB_DEVICE_ID_APPLE_WELLSPRING9_ISO, | ||
490 | USB_DEVICE_ID_APPLE_WELLSPRING9_JIS, | ||
491 | HAS_INTEGRATED_BUTTON, | ||
492 | 0, sizeof(struct bt_data), | ||
493 | 0x83, DATAFORMAT(TYPE4), | ||
494 | { SN_PRESSURE, 0, 300 }, | ||
495 | { SN_WIDTH, 0, 2048 }, | ||
496 | { SN_COORD, -4828, 5345 }, | ||
497 | { SN_COORD, -203, 6803 }, | ||
498 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | ||
499 | }, | ||
426 | {} | 500 | {} |
427 | }; | 501 | }; |
428 | 502 | ||
@@ -549,19 +623,18 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
549 | struct input_dev *input = dev->input; | 623 | struct input_dev *input = dev->input; |
550 | int raw_n, i, n = 0; | 624 | int raw_n, i, n = 0; |
551 | 625 | ||
552 | if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0) | 626 | if (size < c->tp_header || (size - c->tp_header) % c->tp_fsize != 0) |
553 | return -EIO; | 627 | return -EIO; |
554 | 628 | ||
555 | /* finger data, le16-aligned */ | 629 | raw_n = (size - c->tp_header) / c->tp_fsize; |
556 | f = (const struct tp_finger *)(dev->tp_data + c->tp_offset); | ||
557 | raw_n = (size - c->tp_offset) / SIZEOF_FINGER; | ||
558 | 630 | ||
559 | for (i = 0; i < raw_n; i++) { | 631 | for (i = 0; i < raw_n; i++) { |
560 | if (raw2int(f[i].touch_major) == 0) | 632 | f = get_tp_finger(dev, i); |
633 | if (raw2int(f->touch_major) == 0) | ||
561 | continue; | 634 | continue; |
562 | dev->pos[n].x = raw2int(f[i].abs_x); | 635 | dev->pos[n].x = raw2int(f->abs_x); |
563 | dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y); | 636 | dev->pos[n].y = c->y.min + c->y.max - raw2int(f->abs_y); |
564 | dev->index[n++] = &f[i]; | 637 | dev->index[n++] = f; |
565 | } | 638 | } |
566 | 639 | ||
567 | input_mt_assign_slots(input, dev->slots, dev->pos, n, 0); | 640 | input_mt_assign_slots(input, dev->slots, dev->pos, n, 0); |
@@ -572,32 +645,22 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
572 | 645 | ||
573 | input_mt_sync_frame(input); | 646 | input_mt_sync_frame(input); |
574 | 647 | ||
575 | report_synaptics_data(input, c, f, raw_n); | 648 | report_synaptics_data(input, c, get_tp_finger(dev, 0), raw_n); |
576 | 649 | ||
577 | /* type 2 reports button events via ibt only */ | 650 | /* later types report button events via integrated button only */ |
578 | if (c->tp_type == TYPE2) { | 651 | if (c->caps & HAS_INTEGRATED_BUTTON) { |
579 | int ibt = raw2int(dev->tp_data[BUTTON_TYPE2]); | 652 | int ibt = raw2int(dev->tp_data[c->tp_button]); |
580 | input_report_key(input, BTN_LEFT, ibt); | 653 | input_report_key(input, BTN_LEFT, ibt); |
581 | } | 654 | } |
582 | 655 | ||
583 | if (c->tp_type == TYPE3) | ||
584 | input_report_key(input, BTN_LEFT, dev->tp_data[BUTTON_TYPE3]); | ||
585 | |||
586 | input_sync(input); | 656 | input_sync(input); |
587 | 657 | ||
588 | return 0; | 658 | return 0; |
589 | } | 659 | } |
590 | 660 | ||
591 | /* Wellspring initialization constants */ | ||
592 | #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 | ||
593 | #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID 9 | ||
594 | #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 | ||
595 | #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 | ||
596 | #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 | ||
597 | #define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08 | ||
598 | |||
599 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | 661 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) |
600 | { | 662 | { |
663 | const struct bcm5974_config *c = &dev->cfg; | ||
601 | int retval = 0, size; | 664 | int retval = 0, size; |
602 | char *data; | 665 | char *data; |
603 | 666 | ||
@@ -605,7 +668,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
605 | if (dev->cfg.tp_type == TYPE3) | 668 | if (dev->cfg.tp_type == TYPE3) |
606 | return 0; | 669 | return 0; |
607 | 670 | ||
608 | data = kmalloc(8, GFP_KERNEL); | 671 | data = kmalloc(c->um_size, GFP_KERNEL); |
609 | if (!data) { | 672 | if (!data) { |
610 | dev_err(&dev->intf->dev, "out of memory\n"); | 673 | dev_err(&dev->intf->dev, "out of memory\n"); |
611 | retval = -ENOMEM; | 674 | retval = -ENOMEM; |
@@ -616,28 +679,24 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
616 | size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), | 679 | size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), |
617 | BCM5974_WELLSPRING_MODE_READ_REQUEST_ID, | 680 | BCM5974_WELLSPRING_MODE_READ_REQUEST_ID, |
618 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 681 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
619 | BCM5974_WELLSPRING_MODE_REQUEST_VALUE, | 682 | c->um_req_val, c->um_req_idx, data, c->um_size, 5000); |
620 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | ||
621 | 683 | ||
622 | if (size != 8) { | 684 | if (size != c->um_size) { |
623 | dev_err(&dev->intf->dev, "could not read from device\n"); | 685 | dev_err(&dev->intf->dev, "could not read from device\n"); |
624 | retval = -EIO; | 686 | retval = -EIO; |
625 | goto out; | 687 | goto out; |
626 | } | 688 | } |
627 | 689 | ||
628 | /* apply the mode switch */ | 690 | /* apply the mode switch */ |
629 | data[0] = on ? | 691 | data[c->um_switch_idx] = on ? c->um_switch_on : c->um_switch_off; |
630 | BCM5974_WELLSPRING_MODE_VENDOR_VALUE : | ||
631 | BCM5974_WELLSPRING_MODE_NORMAL_VALUE; | ||
632 | 692 | ||
633 | /* write configuration */ | 693 | /* write configuration */ |
634 | size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | 694 | size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
635 | BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID, | 695 | BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID, |
636 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 696 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
637 | BCM5974_WELLSPRING_MODE_REQUEST_VALUE, | 697 | c->um_req_val, c->um_req_idx, data, c->um_size, 5000); |
638 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | ||
639 | 698 | ||
640 | if (size != 8) { | 699 | if (size != c->um_size) { |
641 | dev_err(&dev->intf->dev, "could not write to device\n"); | 700 | dev_err(&dev->intf->dev, "could not write to device\n"); |
642 | retval = -EIO; | 701 | retval = -EIO; |
643 | goto out; | 702 | goto out; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 3a32caf06bf1..6025eb430c0a 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -1484,12 +1484,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) | |||
1484 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; | 1484 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; |
1485 | 1485 | ||
1486 | psmouse_info(psmouse, | 1486 | psmouse_info(psmouse, |
1487 | "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", | 1487 | "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", |
1488 | SYN_ID_MODEL(priv->identity), | 1488 | SYN_ID_MODEL(priv->identity), |
1489 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), | 1489 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), |
1490 | priv->model_id, | 1490 | priv->model_id, |
1491 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c, | 1491 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c, |
1492 | priv->board_id, priv->firmware_id); | 1492 | priv->ext_cap_10, priv->board_id, priv->firmware_id); |
1493 | 1493 | ||
1494 | set_input_params(psmouse, priv); | 1494 | set_input_params(psmouse, priv); |
1495 | 1495 | ||
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 80285c71786e..f58a196521a9 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c | |||
@@ -429,7 +429,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf) | |||
429 | goto unlock; | 429 | goto unlock; |
430 | } | 430 | } |
431 | 431 | ||
432 | if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) { | 432 | if (buf[PAYLOAD_LENGTH] == 0) { |
433 | dev_err(&client->dev, "invalid payload length: %d\n", | 433 | dev_err(&client->dev, "invalid payload length: %d\n", |
434 | buf[PAYLOAD_LENGTH]); | 434 | buf[PAYLOAD_LENGTH]); |
435 | ret = -EIO; | 435 | ret = -EIO; |