diff options
| author | Dmitry Torokhov <rydberg@euromail.se> | 2013-07-01 14:47:51 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-07-02 23:39:33 -0400 |
| commit | 148c1c8ad3c4170186ebe6ea5900adde27d2a0e7 (patch) | |
| tree | 1fbe302656f0a3029a73dfe7a957b7038caeb9d5 | |
| parent | 9d9a04ee758b4c1fcc7586d065cdde7a7607e156 (diff) | |
Input: bcm5974 - add support for the 2013 MacBook Air
The June 2013 Macbook Air (13'') has a new trackpad protocol; four new
values are inserted in the header, and the mode switch is no longer
needed. This patch adds support for the new devices.
Cc: stable@vger.kernel.org
Reported-and-tested-by: Brad Ford <plymouthffl@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| -rw-r--r-- | drivers/input/mouse/bcm5974.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 2baff1b79a55..4ef4d5e198ae 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
| @@ -88,6 +88,10 @@ | |||
| 88 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | 88 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 |
| 89 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | 89 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a |
| 90 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | 90 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b |
| 91 | /* MacbookAir6,2 (unibody, June 2013) */ | ||
| 92 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0291 | ||
| 93 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0292 | ||
| 94 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0293 | ||
| 91 | 95 | ||
| 92 | #define BCM5974_DEVICE(prod) { \ | 96 | #define BCM5974_DEVICE(prod) { \ |
| 93 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 97 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
| @@ -145,6 +149,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
| 145 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | 149 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), |
| 146 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | 150 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), |
| 147 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | 151 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), |
| 152 | /* MacbookAir6,2 */ | ||
| 153 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), | ||
| 154 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), | ||
| 155 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), | ||
| 148 | /* Terminating entry */ | 156 | /* Terminating entry */ |
| 149 | {} | 157 | {} |
| 150 | }; | 158 | }; |
| @@ -172,15 +180,18 @@ struct bt_data { | |||
| 172 | /* trackpad header types */ | 180 | /* trackpad header types */ |
| 173 | enum tp_type { | 181 | enum tp_type { |
| 174 | TYPE1, /* plain trackpad */ | 182 | TYPE1, /* plain trackpad */ |
| 175 | TYPE2 /* button integrated in trackpad */ | 183 | TYPE2, /* button integrated in trackpad */ |
| 184 | TYPE3 /* additional header fields since June 2013 */ | ||
| 176 | }; | 185 | }; |
| 177 | 186 | ||
| 178 | /* trackpad finger data offsets, le16-aligned */ | 187 | /* trackpad finger data offsets, le16-aligned */ |
| 179 | #define FINGER_TYPE1 (13 * sizeof(__le16)) | 188 | #define FINGER_TYPE1 (13 * sizeof(__le16)) |
| 180 | #define FINGER_TYPE2 (15 * sizeof(__le16)) | 189 | #define FINGER_TYPE2 (15 * sizeof(__le16)) |
| 190 | #define FINGER_TYPE3 (19 * sizeof(__le16)) | ||
| 181 | 191 | ||
| 182 | /* trackpad button data offsets */ | 192 | /* trackpad button data offsets */ |
| 183 | #define BUTTON_TYPE2 15 | 193 | #define BUTTON_TYPE2 15 |
| 194 | #define BUTTON_TYPE3 23 | ||
| 184 | 195 | ||
| 185 | /* list of device capability bits */ | 196 | /* list of device capability bits */ |
| 186 | #define HAS_INTEGRATED_BUTTON 1 | 197 | #define HAS_INTEGRATED_BUTTON 1 |
| @@ -400,6 +411,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
| 400 | { SN_COORD, -150, 6730 }, | 411 | { SN_COORD, -150, 6730 }, |
| 401 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | 412 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } |
| 402 | }, | 413 | }, |
| 414 | { | ||
| 415 | USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI, | ||
| 416 | USB_DEVICE_ID_APPLE_WELLSPRING8_ISO, | ||
| 417 | USB_DEVICE_ID_APPLE_WELLSPRING8_JIS, | ||
| 418 | HAS_INTEGRATED_BUTTON, | ||
| 419 | 0, sizeof(struct bt_data), | ||
| 420 | 0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS, | ||
| 421 | { SN_PRESSURE, 0, 300 }, | ||
| 422 | { SN_WIDTH, 0, 2048 }, | ||
| 423 | { SN_COORD, -4620, 5140 }, | ||
| 424 | { SN_COORD, -150, 6600 }, | ||
| 425 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | ||
| 426 | }, | ||
| 403 | {} | 427 | {} |
| 404 | }; | 428 | }; |
| 405 | 429 | ||
| @@ -557,6 +581,9 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
| 557 | input_report_key(input, BTN_LEFT, ibt); | 581 | input_report_key(input, BTN_LEFT, ibt); |
| 558 | } | 582 | } |
| 559 | 583 | ||
| 584 | if (c->tp_type == TYPE3) | ||
| 585 | input_report_key(input, BTN_LEFT, dev->tp_data[BUTTON_TYPE3]); | ||
| 586 | |||
| 560 | input_sync(input); | 587 | input_sync(input); |
| 561 | 588 | ||
| 562 | return 0; | 589 | return 0; |
| @@ -572,9 +599,14 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
| 572 | 599 | ||
| 573 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | 600 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) |
| 574 | { | 601 | { |
| 575 | char *data = kmalloc(8, GFP_KERNEL); | ||
| 576 | int retval = 0, size; | 602 | int retval = 0, size; |
| 603 | char *data; | ||
| 604 | |||
| 605 | /* Type 3 does not require a mode switch */ | ||
| 606 | if (dev->cfg.tp_type == TYPE3) | ||
| 607 | return 0; | ||
| 577 | 608 | ||
| 609 | data = kmalloc(8, GFP_KERNEL); | ||
| 578 | if (!data) { | 610 | if (!data) { |
| 579 | dev_err(&dev->intf->dev, "out of memory\n"); | 611 | dev_err(&dev->intf->dev, "out of memory\n"); |
| 580 | retval = -ENOMEM; | 612 | retval = -ENOMEM; |
