2
2
* Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver
3
3
*
4
4
* Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se)
5
+ * Copyright (C) 2015 John Horan (knasher@gmail.com)
5
6
*
6
7
* The USB initialization and package decoding was made by
7
8
* Scott Shawcroft as part of the touchd user-space driver project:
91
92
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
92
93
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
93
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
100
#define BCM5974_DEVICE (prod ) { \
96
101
.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -152,6 +157,10 @@ static const struct usb_device_id bcm5974_table[] = {
152
157
BCM5974_DEVICE (USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI ),
153
158
BCM5974_DEVICE (USB_DEVICE_ID_APPLE_WELLSPRING8_ISO ),
154
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
164
/* Terminating entry */
156
165
{}
157
166
};
@@ -180,18 +189,21 @@ struct bt_data {
180
189
enum tp_type {
181
190
TYPE1 , /* plain trackpad */
182
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
196
/* trackpad finger data offsets, le16-aligned */
187
197
#define HEADER_TYPE1 (13 * sizeof(__le16))
188
198
#define HEADER_TYPE2 (15 * sizeof(__le16))
189
199
#define HEADER_TYPE3 (19 * sizeof(__le16))
200
+ #define HEADER_TYPE4 (23 * sizeof(__le16))
190
201
191
202
/* trackpad button data offsets */
192
203
#define BUTTON_TYPE1 0
193
204
#define BUTTON_TYPE2 15
194
205
#define BUTTON_TYPE3 23
206
+ #define BUTTON_TYPE4 31
195
207
196
208
/* list of device capability bits */
197
209
#define HAS_INTEGRATED_BUTTON 1
@@ -200,16 +212,19 @@ enum tp_type {
200
212
#define FSIZE_TYPE1 (14 * sizeof(__le16))
201
213
#define FSIZE_TYPE2 (14 * sizeof(__le16))
202
214
#define FSIZE_TYPE3 (14 * sizeof(__le16))
215
+ #define FSIZE_TYPE4 (15 * sizeof(__le16))
203
216
204
217
/* offset from header to finger struct */
205
218
#define DELTA_TYPE1 (0 * sizeof(__le16))
206
219
#define DELTA_TYPE2 (0 * sizeof(__le16))
207
220
#define DELTA_TYPE3 (0 * sizeof(__le16))
221
+ #define DELTA_TYPE4 (1 * sizeof(__le16))
208
222
209
223
/* usb control message mode switch data */
210
224
#define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8
211
225
#define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8
212
226
#define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8
227
+ #define USBMSG_TYPE4 2, 0x302, 2, 1, 0x1, 0x0
213
228
214
229
/* Wellspring initialization constants */
215
230
#define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1
@@ -227,7 +242,8 @@ struct tp_finger {
227
242
__le16 orientation ; /* 16384 when point, else 15 bit angle */
228
243
__le16 touch_major ; /* touch area, major axis */
229
244
__le16 touch_minor ; /* touch area, minor axis */
230
- __le16 unused [3 ]; /* zeros */
245
+ __le16 unused [2 ]; /* zeros */
246
+ __le16 pressure ; /* pressure on forcetouch touchpad */
231
247
__le16 multi ; /* one finger: varies, more fingers: constant */
232
248
} __attribute__((packed ,aligned (2 )));
233
249
@@ -468,6 +484,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
468
484
{ SN_COORD , -150 , 6600 },
469
485
{ SN_ORIENT , - MAX_FINGER_ORIENTATION , MAX_FINGER_ORIENTATION }
470
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
+ },
471
500
{}
472
501
};
473
502
0 commit comments