Commit d5806926 authored by John Horan's avatar John Horan Committed by Dmitry Torokhov

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: default avatarJohn Horan <knasher@gmail.com>
Tested-by: default avatarJochen Radmacher <jradmacher@gmx.de>
Tested-by: default avatarYang Hongyang <burnef@gmail.com>
Tested-by: default avatarYen-Chin, Lee <coldnew.tw@gmail.com>
Tested-by: default avatarGeorge Hilios <ghilios@gmail.com>
Tested-by: default avatarJanez Urevc <janez@janezurevc.name>
Signed-off-by: default avatarHenrik Rydberg <rydberg@bitmath.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a4a2c545
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver
* *
* Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) * Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se)
* Copyright (C) 2015 John Horan (knasher@gmail.com)
* *
* The USB initialization and package decoding was made by * The USB initialization and package decoding was made by
* Scott Shawcroft as part of the touchd user-space driver project: * Scott Shawcroft as part of the touchd user-space driver project:
...@@ -91,6 +92,10 @@ ...@@ -91,6 +92,10 @@
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292
/* MacbookPro12,1 (2015) */
#define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272
#define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273
#define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274
#define BCM5974_DEVICE(prod) { \ #define BCM5974_DEVICE(prod) { \
.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
...@@ -152,6 +157,10 @@ static const struct usb_device_id bcm5974_table[] = { ...@@ -152,6 +157,10 @@ static const struct usb_device_id bcm5974_table[] = {
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
/* MacbookPro12,1 */
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ISO),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_JIS),
/* Terminating entry */ /* Terminating entry */
{} {}
}; };
...@@ -180,18 +189,21 @@ struct bt_data { ...@@ -180,18 +189,21 @@ struct bt_data {
enum tp_type { enum tp_type {
TYPE1, /* plain trackpad */ TYPE1, /* plain trackpad */
TYPE2, /* button integrated in trackpad */ TYPE2, /* button integrated in trackpad */
TYPE3 /* additional header fields since June 2013 */ TYPE3, /* additional header fields since June 2013 */
TYPE4 /* additional header field for pressure data */
}; };
/* trackpad finger data offsets, le16-aligned */ /* trackpad finger data offsets, le16-aligned */
#define HEADER_TYPE1 (13 * sizeof(__le16)) #define HEADER_TYPE1 (13 * sizeof(__le16))
#define HEADER_TYPE2 (15 * sizeof(__le16)) #define HEADER_TYPE2 (15 * sizeof(__le16))
#define HEADER_TYPE3 (19 * sizeof(__le16)) #define HEADER_TYPE3 (19 * sizeof(__le16))
#define HEADER_TYPE4 (23 * sizeof(__le16))
/* trackpad button data offsets */ /* trackpad button data offsets */
#define BUTTON_TYPE1 0 #define BUTTON_TYPE1 0
#define BUTTON_TYPE2 15 #define BUTTON_TYPE2 15
#define BUTTON_TYPE3 23 #define BUTTON_TYPE3 23
#define BUTTON_TYPE4 31
/* list of device capability bits */ /* list of device capability bits */
#define HAS_INTEGRATED_BUTTON 1 #define HAS_INTEGRATED_BUTTON 1
...@@ -200,16 +212,19 @@ enum tp_type { ...@@ -200,16 +212,19 @@ enum tp_type {
#define FSIZE_TYPE1 (14 * sizeof(__le16)) #define FSIZE_TYPE1 (14 * sizeof(__le16))
#define FSIZE_TYPE2 (14 * sizeof(__le16)) #define FSIZE_TYPE2 (14 * sizeof(__le16))
#define FSIZE_TYPE3 (14 * sizeof(__le16)) #define FSIZE_TYPE3 (14 * sizeof(__le16))
#define FSIZE_TYPE4 (15 * sizeof(__le16))
/* offset from header to finger struct */ /* offset from header to finger struct */
#define DELTA_TYPE1 (0 * sizeof(__le16)) #define DELTA_TYPE1 (0 * sizeof(__le16))
#define DELTA_TYPE2 (0 * sizeof(__le16)) #define DELTA_TYPE2 (0 * sizeof(__le16))
#define DELTA_TYPE3 (0 * sizeof(__le16)) #define DELTA_TYPE3 (0 * sizeof(__le16))
#define DELTA_TYPE4 (1 * sizeof(__le16))
/* usb control message mode switch data */ /* usb control message mode switch data */
#define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8 #define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8
#define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8 #define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8
#define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8 #define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8
#define USBMSG_TYPE4 2, 0x302, 2, 1, 0x1, 0x0
/* Wellspring initialization constants */ /* Wellspring initialization constants */
#define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1
...@@ -227,7 +242,8 @@ struct tp_finger { ...@@ -227,7 +242,8 @@ struct tp_finger {
__le16 orientation; /* 16384 when point, else 15 bit angle */ __le16 orientation; /* 16384 when point, else 15 bit angle */
__le16 touch_major; /* touch area, major axis */ __le16 touch_major; /* touch area, major axis */
__le16 touch_minor; /* touch area, minor axis */ __le16 touch_minor; /* touch area, minor axis */
__le16 unused[3]; /* zeros */ __le16 unused[2]; /* zeros */
__le16 pressure; /* pressure on forcetouch touchpad */
__le16 multi; /* one finger: varies, more fingers: constant */ __le16 multi; /* one finger: varies, more fingers: constant */
} __attribute__((packed,aligned(2))); } __attribute__((packed,aligned(2)));
...@@ -468,6 +484,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { ...@@ -468,6 +484,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
{ SN_COORD, -150, 6600 }, { SN_COORD, -150, 6600 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
}, },
{
USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI,
USB_DEVICE_ID_APPLE_WELLSPRING9_ISO,
USB_DEVICE_ID_APPLE_WELLSPRING9_JIS,
HAS_INTEGRATED_BUTTON,
0, sizeof(struct bt_data),
0x83, DATAFORMAT(TYPE4),
{ SN_PRESSURE, 0, 300 },
{ SN_WIDTH, 0, 2048 },
{ SN_COORD, -4828, 5345 },
{ SN_COORD, -203, 6803 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
},
{} {}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment