Skip to content

Commit d580692

Browse files
johnhorandtor
authored andcommitted
Input: bcm5974 - add support for the 2015 Macbook Pro
Add support for the MacBookPro12,1 model. This patch needs to be applied together with the accompanied HID patch, as usual. Tested-by: John Horan <knasher@gmail.com> Tested-by: Jochen Radmacher <jradmacher@gmx.de> Tested-by: Yang Hongyang <burnef@gmail.com> Tested-by: Yen-Chin, Lee <coldnew.tw@gmail.com> Tested-by: George Hilios <ghilios@gmail.com> Tested-by: Janez Urevc <janez@janezurevc.name> Signed-off-by: Henrik Rydberg <rydberg@bitmath.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent a4a2c54 commit d580692

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

drivers/input/mouse/bcm5974.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver
33
*
44
* Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se)
5+
* Copyright (C) 2015 John Horan (knasher@gmail.com)
56
*
67
* The USB initialization and package decoding was made by
78
* Scott Shawcroft as part of the touchd user-space driver project:
@@ -91,6 +92,10 @@
9192
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
9293
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
9394
#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
9499

95100
#define BCM5974_DEVICE(prod) { \
96101
.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -152,6 +157,10 @@ static const struct usb_device_id bcm5974_table[] = {
152157
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
153158
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
154159
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),
155164
/* Terminating entry */
156165
{}
157166
};
@@ -180,18 +189,21 @@ struct bt_data {
180189
enum tp_type {
181190
TYPE1, /* plain trackpad */
182191
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 */
184194
};
185195

186196
/* trackpad finger data offsets, le16-aligned */
187197
#define HEADER_TYPE1 (13 * sizeof(__le16))
188198
#define HEADER_TYPE2 (15 * sizeof(__le16))
189199
#define HEADER_TYPE3 (19 * sizeof(__le16))
200+
#define HEADER_TYPE4 (23 * sizeof(__le16))
190201

191202
/* trackpad button data offsets */
192203
#define BUTTON_TYPE1 0
193204
#define BUTTON_TYPE2 15
194205
#define BUTTON_TYPE3 23
206+
#define BUTTON_TYPE4 31
195207

196208
/* list of device capability bits */
197209
#define HAS_INTEGRATED_BUTTON 1
@@ -200,16 +212,19 @@ enum tp_type {
200212
#define FSIZE_TYPE1 (14 * sizeof(__le16))
201213
#define FSIZE_TYPE2 (14 * sizeof(__le16))
202214
#define FSIZE_TYPE3 (14 * sizeof(__le16))
215+
#define FSIZE_TYPE4 (15 * sizeof(__le16))
203216

204217
/* offset from header to finger struct */
205218
#define DELTA_TYPE1 (0 * sizeof(__le16))
206219
#define DELTA_TYPE2 (0 * sizeof(__le16))
207220
#define DELTA_TYPE3 (0 * sizeof(__le16))
221+
#define DELTA_TYPE4 (1 * sizeof(__le16))
208222

209223
/* usb control message mode switch data */
210224
#define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8
211225
#define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8
212226
#define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8
227+
#define USBMSG_TYPE4 2, 0x302, 2, 1, 0x1, 0x0
213228

214229
/* Wellspring initialization constants */
215230
#define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1
@@ -227,7 +242,8 @@ struct tp_finger {
227242
__le16 orientation; /* 16384 when point, else 15 bit angle */
228243
__le16 touch_major; /* touch area, major axis */
229244
__le16 touch_minor; /* touch area, minor axis */
230-
__le16 unused[3]; /* zeros */
245+
__le16 unused[2]; /* zeros */
246+
__le16 pressure; /* pressure on forcetouch touchpad */
231247
__le16 multi; /* one finger: varies, more fingers: constant */
232248
} __attribute__((packed,aligned(2)));
233249

@@ -468,6 +484,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
468484
{ SN_COORD, -150, 6600 },
469485
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
470486
},
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+
},
471500
{}
472501
};
473502

0 commit comments

Comments
 (0)