aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
commit2c01e7bc46f10e9190818437e564f7e0db875ae9 (patch)
tree8b06c85d69754f7df27f7fb42520f6e2ceaea907 /drivers/input/tablet
parentab11ca34eea8fda7a1a9302d86f6ef6108ffd68f (diff)
parente644dae645e167d154c0526358940986682a72b0 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer updates from Dmitry Torokhov: - a bunch of new drivers (DA9052/53 touchscreenn controller, Synaptics Navpoint, LM8333 keypads, Wacom I2C touhscreen); - updates to existing touchpad drivers (ALPS, Sntelic); - Wacom driver now supports Intuos5; - device-tree bindings in numerous drivers; - other cleanups and fixes. Fix annoying conflict in drivers/input/tablet/wacom_wac.c that I think implies that the input layer device naming is broken, but let's see. I brough it up with Dmitry. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits) Input: matrix-keymap - fix building keymaps Input: spear-keyboard - document DT bindings Input: spear-keyboard - add device tree bindings Input: matrix-keymap - wire up device tree support Input: matrix-keymap - uninline and prepare for device tree support Input: adp5588 - add support for gpio names Input: omap-keypad - dynamically handle register offsets Input: synaptics - fix compile warning MAINTAINERS: adjust input-related patterns Input: ALPS - switch to using input_mt_report_finger_count Input: ALPS - add semi-MT support for v4 protocol Input: Add Synaptics NavPoint (PXA27x SSP/SPI) driver Input: atmel_mxt_ts - dump each message on just 1 line Input: atmel_mxt_ts - do not read extra (checksum) byte Input: atmel_mxt_ts - verify object size in mxt_write_object Input: atmel_mxt_ts - only allow root to update firmware Input: atmel_mxt_ts - use CONFIG_PM_SLEEP Input: sentelic - report device's production serial number Input: tl6040-vibra - Device Tree support Input: evdev - properly handle read/write with count 0 ...
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/aiptek.c2
-rw-r--r--drivers/input/tablet/wacom.h4
-rw-r--r--drivers/input/tablet/wacom_sys.c244
-rw-r--r--drivers/input/tablet/wacom_wac.c304
-rw-r--r--drivers/input/tablet/wacom_wac.h13
5 files changed, 457 insertions, 110 deletions
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 755a39e4c9e9..ee83c3904ee8 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1862,7 +1862,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1862 if (i == ARRAY_SIZE(speeds)) { 1862 if (i == ARRAY_SIZE(speeds)) {
1863 dev_info(&intf->dev, 1863 dev_info(&intf->dev,
1864 "Aiptek tried all speeds, no sane response\n"); 1864 "Aiptek tried all speeds, no sane response\n");
1865 goto fail2; 1865 goto fail3;
1866 } 1866 }
1867 1867
1868 /* Associate this driver's struct with the usb interface. 1868 /* Associate this driver's struct with the usb interface.
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index b4842d0e61dd..b79d45198d82 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -135,6 +135,6 @@ extern const struct usb_device_id wacom_ids[];
135 135
136void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); 136void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
137void wacom_setup_device_quirks(struct wacom_features *features); 137void wacom_setup_device_quirks(struct wacom_features *features);
138void wacom_setup_input_capabilities(struct input_dev *input_dev, 138int wacom_setup_input_capabilities(struct input_dev *input_dev,
139 struct wacom_wac *wacom_wac); 139 struct wacom_wac *wacom_wac);
140#endif 140#endif
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 79a0509882d4..cad5602d3ce4 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -28,6 +28,7 @@
28#define HID_USAGE_Y_TILT 0x3e 28#define HID_USAGE_Y_TILT 0x3e
29#define HID_USAGE_FINGER 0x22 29#define HID_USAGE_FINGER 0x22
30#define HID_USAGE_STYLUS 0x20 30#define HID_USAGE_STYLUS 0x20
31#define HID_USAGE_CONTACTMAX 0x55
31#define HID_COLLECTION 0xa1 32#define HID_COLLECTION 0xa1
32#define HID_COLLECTION_LOGICAL 0x02 33#define HID_COLLECTION_LOGICAL 0x02
33#define HID_COLLECTION_END 0xc0 34#define HID_COLLECTION_END 0xc0
@@ -204,6 +205,27 @@ static int wacom_parse_logical_collection(unsigned char *report,
204 return length; 205 return length;
205} 206}
206 207
208static void wacom_retrieve_report_data(struct usb_interface *intf,
209 struct wacom_features *features)
210{
211 int result = 0;
212 unsigned char *rep_data;
213
214 rep_data = kmalloc(2, GFP_KERNEL);
215 if (rep_data) {
216
217 rep_data[0] = 12;
218 result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
219 rep_data[0], &rep_data, 2,
220 WAC_MSG_RETRIES);
221
222 if (result >= 0 && rep_data[1] > 2)
223 features->touch_max = rep_data[1];
224
225 kfree(rep_data);
226 }
227}
228
207/* 229/*
208 * Interface Descriptor of wacom devices can be incomplete and 230 * Interface Descriptor of wacom devices can be incomplete and
209 * inconsistent so wacom_features table is used to store stylus 231 * inconsistent so wacom_features table is used to store stylus
@@ -236,6 +258,9 @@ static int wacom_parse_logical_collection(unsigned char *report,
236 * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical 258 * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical
237 * Collection. Instead they define a Logical Collection with a single 259 * Collection. Instead they define a Logical Collection with a single
238 * Logical Maximum for both X and Y. 260 * Logical Maximum for both X and Y.
261 *
262 * Intuos5 touch interface does not contain useful data. We deal with
263 * this after returning from this function.
239 */ 264 */
240static int wacom_parse_hid(struct usb_interface *intf, 265static int wacom_parse_hid(struct usb_interface *intf,
241 struct hid_descriptor *hid_desc, 266 struct hid_descriptor *hid_desc,
@@ -295,6 +320,10 @@ static int wacom_parse_hid(struct usb_interface *intf,
295 /* need to reset back */ 320 /* need to reset back */
296 features->pktlen = WACOM_PKGLEN_TPC2FG; 321 features->pktlen = WACOM_PKGLEN_TPC2FG;
297 } 322 }
323
324 if (features->type == MTSCREEN)
325 features->pktlen = WACOM_PKGLEN_MTOUCH;
326
298 if (features->type == BAMBOO_PT) { 327 if (features->type == BAMBOO_PT) {
299 /* need to reset back */ 328 /* need to reset back */
300 features->pktlen = WACOM_PKGLEN_BBTOUCH; 329 features->pktlen = WACOM_PKGLEN_BBTOUCH;
@@ -327,18 +356,15 @@ static int wacom_parse_hid(struct usb_interface *intf,
327 case HID_USAGE_Y: 356 case HID_USAGE_Y:
328 if (usage == WCM_DESKTOP) { 357 if (usage == WCM_DESKTOP) {
329 if (finger) { 358 if (finger) {
330 features->device_type = BTN_TOOL_FINGER; 359 int type = features->type;
331 if (features->type == TABLETPC2FG) { 360
332 /* need to reset back */ 361 if (type == TABLETPC2FG || type == MTSCREEN) {
333 features->pktlen = WACOM_PKGLEN_TPC2FG;
334 features->y_max = 362 features->y_max =
335 get_unaligned_le16(&report[i + 3]); 363 get_unaligned_le16(&report[i + 3]);
336 features->y_phy = 364 features->y_phy =
337 get_unaligned_le16(&report[i + 6]); 365 get_unaligned_le16(&report[i + 6]);
338 i += 7; 366 i += 7;
339 } else if (features->type == BAMBOO_PT) { 367 } else if (type == BAMBOO_PT) {
340 /* need to reset back */
341 features->pktlen = WACOM_PKGLEN_BBTOUCH;
342 features->y_phy = 368 features->y_phy =
343 get_unaligned_le16(&report[i + 3]); 369 get_unaligned_le16(&report[i + 3]);
344 features->y_max = 370 features->y_max =
@@ -352,10 +378,6 @@ static int wacom_parse_hid(struct usb_interface *intf,
352 i += 4; 378 i += 4;
353 } 379 }
354 } else if (pen) { 380 } else if (pen) {
355 /* penabled only accepts exact bytes of data */
356 if (features->type == TABLETPC2FG)
357 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
358 features->device_type = BTN_TOOL_PEN;
359 features->y_max = 381 features->y_max =
360 get_unaligned_le16(&report[i + 3]); 382 get_unaligned_le16(&report[i + 3]);
361 i += 4; 383 i += 4;
@@ -377,6 +399,11 @@ static int wacom_parse_hid(struct usb_interface *intf,
377 pen = 1; 399 pen = 1;
378 i++; 400 i++;
379 break; 401 break;
402
403 case HID_USAGE_CONTACTMAX:
404 wacom_retrieve_report_data(intf, features);
405 i++;
406 break;
380 } 407 }
381 break; 408 break;
382 409
@@ -413,22 +440,29 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
413 if (!rep_data) 440 if (!rep_data)
414 return error; 441 return error;
415 442
416 /* ask to report tablet data if it is MT Tablet PC or 443 /* ask to report Wacom data */
417 * not a Tablet PC */ 444 if (features->device_type == BTN_TOOL_FINGER) {
418 if (features->type == TABLETPC2FG) { 445 /* if it is an MT Tablet PC touch */
419 do { 446 if (features->type == TABLETPC2FG ||
420 rep_data[0] = 3; 447 features->type == MTSCREEN) {
421 rep_data[1] = 4; 448 do {
422 rep_data[2] = 0; 449 rep_data[0] = 3;
423 rep_data[3] = 0; 450 rep_data[1] = 4;
424 report_id = 3; 451 rep_data[2] = 0;
425 error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, 452 rep_data[3] = 0;
426 report_id, rep_data, 4, 1); 453 report_id = 3;
427 if (error >= 0) 454 error = wacom_set_report(intf,
428 error = wacom_get_report(intf, 455 WAC_HID_FEATURE_REPORT,
429 WAC_HID_FEATURE_REPORT, 456 report_id,
430 report_id, rep_data, 4, 1); 457 rep_data, 4, 1);
431 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); 458 if (error >= 0)
459 error = wacom_get_report(intf,
460 WAC_HID_FEATURE_REPORT,
461 report_id,
462 rep_data, 4, 1);
463 } while ((error < 0 || rep_data[1] != 4) &&
464 limit++ < WAC_MSG_RETRIES);
465 }
432 } else if (features->type != TABLETPC && 466 } else if (features->type != TABLETPC &&
433 features->type != WIRELESS && 467 features->type != WIRELESS &&
434 features->device_type == BTN_TOOL_PEN) { 468 features->device_type == BTN_TOOL_PEN) {
@@ -450,7 +484,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
450} 484}
451 485
452static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, 486static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
453 struct wacom_features *features) 487 struct wacom_features *features)
454{ 488{
455 int error = 0; 489 int error = 0;
456 struct usb_host_interface *interface = intf->cur_altsetting; 490 struct usb_host_interface *interface = intf->cur_altsetting;
@@ -478,16 +512,21 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
478 } 512 }
479 } 513 }
480 514
481 /* only Tablet PCs and Bamboo P&T need to retrieve the info */ 515 /* only devices that support touch need to retrieve the info */
482 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && 516 if (features->type != TABLETPC &&
483 (features->type != BAMBOO_PT)) 517 features->type != TABLETPC2FG &&
518 features->type != BAMBOO_PT &&
519 features->type != MTSCREEN) {
484 goto out; 520 goto out;
521 }
485 522
486 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { 523 error = usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc);
487 if (usb_get_extra_descriptor(&interface->endpoint[0], 524 if (error) {
488 HID_DEVICET_REPORT, &hid_desc)) { 525 error = usb_get_extra_descriptor(&interface->endpoint[0],
489 printk("wacom: can not retrieve extra class descriptor\n"); 526 HID_DEVICET_REPORT, &hid_desc);
490 error = 1; 527 if (error) {
528 dev_err(&intf->dev,
529 "can not retrieve extra class descriptor\n");
491 goto out; 530 goto out;
492 } 531 }
493 } 532 }
@@ -577,23 +616,39 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom)
577static int wacom_led_control(struct wacom *wacom) 616static int wacom_led_control(struct wacom *wacom)
578{ 617{
579 unsigned char *buf; 618 unsigned char *buf;
580 int retval, led = 0; 619 int retval;
581 620
582 buf = kzalloc(9, GFP_KERNEL); 621 buf = kzalloc(9, GFP_KERNEL);
583 if (!buf) 622 if (!buf)
584 return -ENOMEM; 623 return -ENOMEM;
585 624
586 if (wacom->wacom_wac.features.type == WACOM_21UX2 || 625 if (wacom->wacom_wac.features.type >= INTUOS5S &&
587 wacom->wacom_wac.features.type == WACOM_24HD) 626 wacom->wacom_wac.features.type <= INTUOS5L) {
588 led = (wacom->led.select[1] << 4) | 0x40; 627 /*
589 628 * Touch Ring and crop mark LED luminance may take on
590 led |= wacom->led.select[0] | 0x4; 629 * one of four values:
591 630 * 0 = Low; 1 = Medium; 2 = High; 3 = Off
592 buf[0] = WAC_CMD_LED_CONTROL; 631 */
593 buf[1] = led; 632 int ring_led = wacom->led.select[0] & 0x03;
594 buf[2] = wacom->led.llv; 633 int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03;
595 buf[3] = wacom->led.hlv; 634 int crop_lum = 0;
596 buf[4] = wacom->led.img_lum; 635
636 buf[0] = WAC_CMD_LED_CONTROL;
637 buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led);
638 }
639 else {
640 int led = wacom->led.select[0] | 0x4;
641
642 if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
643 wacom->wacom_wac.features.type == WACOM_24HD)
644 led |= (wacom->led.select[1] << 4) | 0x40;
645
646 buf[0] = WAC_CMD_LED_CONTROL;
647 buf[1] = led;
648 buf[2] = wacom->led.llv;
649 buf[3] = wacom->led.hlv;
650 buf[4] = wacom->led.img_lum;
651 }
597 652
598 retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, 653 retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL,
599 buf, 9, WAC_CMD_RETRIES); 654 buf, 9, WAC_CMD_RETRIES);
@@ -786,6 +841,17 @@ static struct attribute_group intuos4_led_attr_group = {
786 .attrs = intuos4_led_attrs, 841 .attrs = intuos4_led_attrs,
787}; 842};
788 843
844static struct attribute *intuos5_led_attrs[] = {
845 &dev_attr_status0_luminance.attr,
846 &dev_attr_status_led0_select.attr,
847 NULL
848};
849
850static struct attribute_group intuos5_led_attr_group = {
851 .name = "wacom_led",
852 .attrs = intuos5_led_attrs,
853};
854
789static int wacom_initialize_leds(struct wacom *wacom) 855static int wacom_initialize_leds(struct wacom *wacom)
790{ 856{
791 int error; 857 int error;
@@ -815,6 +881,19 @@ static int wacom_initialize_leds(struct wacom *wacom)
815 &cintiq_led_attr_group); 881 &cintiq_led_attr_group);
816 break; 882 break;
817 883
884 case INTUOS5S:
885 case INTUOS5:
886 case INTUOS5L:
887 wacom->led.select[0] = 0;
888 wacom->led.select[1] = 0;
889 wacom->led.llv = 32;
890 wacom->led.hlv = 0;
891 wacom->led.img_lum = 0;
892
893 error = sysfs_create_group(&wacom->intf->dev.kobj,
894 &intuos5_led_attr_group);
895 break;
896
818 default: 897 default:
819 return 0; 898 return 0;
820 } 899 }
@@ -843,6 +922,13 @@ static void wacom_destroy_leds(struct wacom *wacom)
843 sysfs_remove_group(&wacom->intf->dev.kobj, 922 sysfs_remove_group(&wacom->intf->dev.kobj,
844 &cintiq_led_attr_group); 923 &cintiq_led_attr_group);
845 break; 924 break;
925
926 case INTUOS5S:
927 case INTUOS5:
928 case INTUOS5L:
929 sysfs_remove_group(&wacom->intf->dev.kobj,
930 &intuos5_led_attr_group);
931 break;
846 } 932 }
847} 933}
848 934
@@ -904,8 +990,10 @@ static int wacom_register_input(struct wacom *wacom)
904 int error; 990 int error;
905 991
906 input_dev = input_allocate_device(); 992 input_dev = input_allocate_device();
907 if (!input_dev) 993 if (!input_dev) {
908 return -ENOMEM; 994 error = -ENOMEM;
995 goto fail1;
996 }
909 997
910 input_dev->name = wacom_wac->name; 998 input_dev->name = wacom_wac->name;
911 input_dev->dev.parent = &intf->dev; 999 input_dev->dev.parent = &intf->dev;
@@ -915,14 +1003,20 @@ static int wacom_register_input(struct wacom *wacom)
915 input_set_drvdata(input_dev, wacom); 1003 input_set_drvdata(input_dev, wacom);
916 1004
917 wacom_wac->input = input_dev; 1005 wacom_wac->input = input_dev;
918 wacom_setup_input_capabilities(input_dev, wacom_wac); 1006 error = wacom_setup_input_capabilities(input_dev, wacom_wac);
1007 if (error)
1008 goto fail1;
919 1009
920 error = input_register_device(input_dev); 1010 error = input_register_device(input_dev);
921 if (error) { 1011 if (error)
922 input_free_device(input_dev); 1012 goto fail2;
923 wacom_wac->input = NULL;
924 }
925 1013
1014 return 0;
1015
1016fail2:
1017 input_free_device(input_dev);
1018 wacom_wac->input = NULL;
1019fail1:
926 return error; 1020 return error;
927} 1021}
928 1022
@@ -941,22 +1035,22 @@ static void wacom_wireless_work(struct work_struct *work)
941 wacom = usb_get_intfdata(usbdev->config->interface[1]); 1035 wacom = usb_get_intfdata(usbdev->config->interface[1]);
942 if (wacom->wacom_wac.input) 1036 if (wacom->wacom_wac.input)
943 input_unregister_device(wacom->wacom_wac.input); 1037 input_unregister_device(wacom->wacom_wac.input);
944 wacom->wacom_wac.input = 0; 1038 wacom->wacom_wac.input = NULL;
945 1039
946 /* Touch interface */ 1040 /* Touch interface */
947 wacom = usb_get_intfdata(usbdev->config->interface[2]); 1041 wacom = usb_get_intfdata(usbdev->config->interface[2]);
948 if (wacom->wacom_wac.input) 1042 if (wacom->wacom_wac.input)
949 input_unregister_device(wacom->wacom_wac.input); 1043 input_unregister_device(wacom->wacom_wac.input);
950 wacom->wacom_wac.input = 0; 1044 wacom->wacom_wac.input = NULL;
951 1045
952 if (wacom_wac->pid == 0) { 1046 if (wacom_wac->pid == 0) {
953 printk(KERN_INFO "wacom: wireless tablet disconnected\n"); 1047 dev_info(&wacom->intf->dev, "wireless tablet disconnected\n");
954 } else { 1048 } else {
955 const struct usb_device_id *id = wacom_ids; 1049 const struct usb_device_id *id = wacom_ids;
956 1050
957 printk(KERN_INFO 1051 dev_info(&wacom->intf->dev,
958 "wacom: wireless tablet connected with PID %x\n", 1052 "wireless tablet connected with PID %x\n",
959 wacom_wac->pid); 1053 wacom_wac->pid);
960 1054
961 while (id->match_flags) { 1055 while (id->match_flags) {
962 if (id->idVendor == USB_VENDOR_ID_WACOM && 1056 if (id->idVendor == USB_VENDOR_ID_WACOM &&
@@ -966,8 +1060,8 @@ static void wacom_wireless_work(struct work_struct *work)
966 } 1060 }
967 1061
968 if (!id->match_flags) { 1062 if (!id->match_flags) {
969 printk(KERN_INFO 1063 dev_info(&wacom->intf->dev,
970 "wacom: ignorning unknown PID.\n"); 1064 "ignoring unknown PID.\n");
971 return; 1065 return;
972 } 1066 }
973 1067
@@ -1038,11 +1132,33 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
1038 1132
1039 endpoint = &intf->cur_altsetting->endpoint[0].desc; 1133 endpoint = &intf->cur_altsetting->endpoint[0].desc;
1040 1134
1041 /* Retrieve the physical and logical size for OEM devices */ 1135 /* Retrieve the physical and logical size for touch devices */
1042 error = wacom_retrieve_hid_descriptor(intf, features); 1136 error = wacom_retrieve_hid_descriptor(intf, features);
1043 if (error) 1137 if (error)
1044 goto fail3; 1138 goto fail3;
1045 1139
1140 /*
1141 * Intuos5 has no useful data about its touch interface in its
1142 * HID descriptor. If this is the touch interface (wMaxPacketSize
1143 * of WACOM_PKGLEN_BBTOUCH3), override the table values.
1144 */
1145 if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
1146 if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
1147 features->device_type = BTN_TOOL_FINGER;
1148 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
1149
1150 features->x_phy =
1151 (features->x_max * 100) / features->x_resolution;
1152 features->y_phy =
1153 (features->y_max * 100) / features->y_resolution;
1154
1155 features->x_max = 4096;
1156 features->y_max = 4096;
1157 } else {
1158 features->device_type = BTN_TOOL_PEN;
1159 }
1160 }
1161
1046 wacom_setup_device_quirks(features); 1162 wacom_setup_device_quirks(features);
1047 1163
1048 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); 1164 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index b327790e9a0c..004bc1bb1544 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -61,7 +61,8 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom)
61 break; 61 break;
62 62
63 default: 63 default:
64 printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]); 64 dev_dbg(input->dev.parent,
65 "%s: received unknown report #%d\n", __func__, data[0]);
65 return 0; 66 return 0;
66 } 67 }
67 68
@@ -76,8 +77,8 @@ static int wacom_pl_irq(struct wacom_wac *wacom)
76 int prox, pressure; 77 int prox, pressure;
77 78
78 if (data[0] != WACOM_REPORT_PENABLED) { 79 if (data[0] != WACOM_REPORT_PENABLED) {
79 dev_dbg(&input->dev, 80 dev_dbg(input->dev.parent,
80 "wacom_pl_irq: received unknown report #%d\n", data[0]); 81 "%s: received unknown report #%d\n", __func__, data[0]);
81 return 0; 82 return 0;
82 } 83 }
83 84
@@ -147,7 +148,8 @@ static int wacom_ptu_irq(struct wacom_wac *wacom)
147 struct input_dev *input = wacom->input; 148 struct input_dev *input = wacom->input;
148 149
149 if (data[0] != WACOM_REPORT_PENABLED) { 150 if (data[0] != WACOM_REPORT_PENABLED) {
150 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); 151 dev_dbg(input->dev.parent,
152 "%s: received unknown report #%d\n", __func__, data[0]);
151 return 0; 153 return 0;
152 } 154 }
153 155
@@ -176,7 +178,8 @@ static int wacom_dtu_irq(struct wacom_wac *wacom)
176 struct input_dev *input = wacom->input; 178 struct input_dev *input = wacom->input;
177 int prox = data[1] & 0x20, pressure; 179 int prox = data[1] & 0x20, pressure;
178 180
179 dev_dbg(&input->dev, "wacom_dtu_irq: received report #%d\n", data[0]); 181 dev_dbg(input->dev.parent,
182 "%s: received report #%d", __func__, data[0]);
180 183
181 if (prox) { 184 if (prox) {
182 /* Going into proximity select tool */ 185 /* Going into proximity select tool */
@@ -212,9 +215,8 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
212 int retval = 0; 215 int retval = 0;
213 216
214 if (data[0] != WACOM_REPORT_PENABLED) { 217 if (data[0] != WACOM_REPORT_PENABLED) {
215 dev_dbg(&input->dev, 218 dev_dbg(input->dev.parent,
216 "wacom_graphire_irq: received unknown report #%d\n", 219 "%s: received unknown report #%d\n", __func__, data[0]);
217 data[0]);
218 goto exit; 220 goto exit;
219 } 221 }
220 222
@@ -324,6 +326,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
324 326
325 /* Enter report */ 327 /* Enter report */
326 if ((data[1] & 0xfc) == 0xc0) { 328 if ((data[1] & 0xfc) == 0xc0) {
329 if (features->type >= INTUOS5S && features->type <= INTUOS5L)
330 wacom->shared->stylus_in_proximity = true;
331
327 /* serial number of the tool */ 332 /* serial number of the tool */
328 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + 333 wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
329 (data[4] << 20) + (data[5] << 12) + 334 (data[4] << 20) + (data[5] << 12) +
@@ -409,6 +414,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
409 414
410 /* Exit report */ 415 /* Exit report */
411 if ((data[1] & 0xfe) == 0x80) { 416 if ((data[1] & 0xfe) == 0x80) {
417 if (features->type >= INTUOS5S && features->type <= INTUOS5L)
418 wacom->shared->stylus_in_proximity = false;
419
412 /* 420 /*
413 * Reset all states otherwise we lose the initial states 421 * Reset all states otherwise we lose the initial states
414 * when in-prox next time 422 * when in-prox next time
@@ -455,6 +463,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
455 if ((data[1] & 0xb8) == 0xa0) { 463 if ((data[1] & 0xb8) == 0xa0) {
456 t = (data[6] << 2) | ((data[7] >> 6) & 3); 464 t = (data[6] << 2) | ((data[7] >> 6) & 3);
457 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || 465 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
466 (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
458 features->type == WACOM_21UX2 || features->type == WACOM_24HD) { 467 features->type == WACOM_21UX2 || features->type == WACOM_24HD) {
459 t = (t << 1) | (data[1] & 1); 468 t = (t << 1) | (data[1] & 1);
460 } 469 }
@@ -485,11 +494,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
485 unsigned int t; 494 unsigned int t;
486 int idx = 0, result; 495 int idx = 0, result;
487 496
488 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD 497 if (data[0] != WACOM_REPORT_PENABLED &&
489 && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { 498 data[0] != WACOM_REPORT_INTUOSREAD &&
490 dev_dbg(&input->dev, 499 data[0] != WACOM_REPORT_INTUOSWRITE &&
491 "wacom_intuos_irq: received unknown report #%d\n", 500 data[0] != WACOM_REPORT_INTUOSPAD &&
492 data[0]); 501 data[0] != WACOM_REPORT_INTUOS5PAD) {
502 dev_dbg(input->dev.parent,
503 "%s: received unknown report #%d\n", __func__, data[0]);
493 return 0; 504 return 0;
494 } 505 }
495 506
@@ -498,7 +509,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
498 idx = data[1] & 0x01; 509 idx = data[1] & 0x01;
499 510
500 /* pad packets. Works as a second tool and is always in prox */ 511 /* pad packets. Works as a second tool and is always in prox */
501 if (data[0] == WACOM_REPORT_INTUOSPAD) { 512 if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) {
502 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { 513 if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
503 input_report_key(input, BTN_0, (data[2] & 0x01)); 514 input_report_key(input, BTN_0, (data[2] & 0x01));
504 input_report_key(input, BTN_1, (data[3] & 0x01)); 515 input_report_key(input, BTN_1, (data[3] & 0x01));
@@ -574,6 +585,34 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
574 input_report_key(input, wacom->tool[1], 0); 585 input_report_key(input, wacom->tool[1], 0);
575 input_report_abs(input, ABS_MISC, 0); 586 input_report_abs(input, ABS_MISC, 0);
576 } 587 }
588 } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
589 int i;
590
591 /* Touch ring mode switch has no capacitive sensor */
592 input_report_key(input, BTN_0, (data[3] & 0x01));
593
594 /*
595 * ExpressKeys on Intuos5 have a capacitive sensor in
596 * addition to the mechanical switch. Switch data is
597 * stored in data[4], capacitive data in data[5].
598 */
599 for (i = 0; i < 8; i++)
600 input_report_key(input, BTN_1 + i, data[4] & (1 << i));
601
602 if (data[2] & 0x80) {
603 input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f));
604 } else {
605 /* Out of proximity, clear wheel value. */
606 input_report_abs(input, ABS_WHEEL, 0);
607 }
608
609 if (data[2] | (data[3] & 0x01) | data[4]) {
610 input_report_key(input, wacom->tool[1], 1);
611 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
612 } else {
613 input_report_key(input, wacom->tool[1], 0);
614 input_report_abs(input, ABS_MISC, 0);
615 }
577 } else { 616 } else {
578 if (features->type == WACOM_21UX2) { 617 if (features->type == WACOM_21UX2) {
579 input_report_key(input, BTN_0, (data[5] & 0x01)); 618 input_report_key(input, BTN_0, (data[5] & 0x01));
@@ -637,7 +676,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
637 (features->type == INTUOS3 || 676 (features->type == INTUOS3 ||
638 features->type == INTUOS3S || 677 features->type == INTUOS3S ||
639 features->type == INTUOS4 || 678 features->type == INTUOS4 ||
640 features->type == INTUOS4S)) { 679 features->type == INTUOS4S ||
680 features->type == INTUOS5 ||
681 features->type == INTUOS5S)) {
641 682
642 return 0; 683 return 0;
643 } 684 }
@@ -690,7 +731,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
690 731
691 } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { 732 } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
692 /* I4 mouse */ 733 /* I4 mouse */
693 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { 734 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
735 (features->type >= INTUOS5S && features->type <= INTUOS5L)) {
694 input_report_key(input, BTN_LEFT, data[6] & 0x01); 736 input_report_key(input, BTN_LEFT, data[6] & 0x01);
695 input_report_key(input, BTN_MIDDLE, data[6] & 0x02); 737 input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
696 input_report_key(input, BTN_RIGHT, data[6] & 0x04); 738 input_report_key(input, BTN_RIGHT, data[6] & 0x04);
@@ -717,7 +759,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
717 } 759 }
718 } 760 }
719 } else if ((features->type < INTUOS3S || features->type == INTUOS3L || 761 } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
720 features->type == INTUOS4L) && 762 features->type == INTUOS4L || features->type == INTUOS5L) &&
721 wacom->tool[idx] == BTN_TOOL_LENS) { 763 wacom->tool[idx] == BTN_TOOL_LENS) {
722 /* Lens cursor packets */ 764 /* Lens cursor packets */
723 input_report_key(input, BTN_LEFT, data[8] & 0x01); 765 input_report_key(input, BTN_LEFT, data[8] & 0x01);
@@ -734,6 +776,72 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
734 return 1; 776 return 1;
735} 777}
736 778
779static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid)
780{
781 int touch_max = wacom->features.touch_max;
782 int i;
783
784 if (!wacom->slots)
785 return -1;
786
787 for (i = 0; i < touch_max; ++i) {
788 if (wacom->slots[i] == contactid)
789 return i;
790 }
791 for (i = 0; i < touch_max; ++i) {
792 if (wacom->slots[i] == -1)
793 return i;
794 }
795 return -1;
796}
797
798static int wacom_mt_touch(struct wacom_wac *wacom)
799{
800 struct input_dev *input = wacom->input;
801 char *data = wacom->data;
802 int i;
803 int current_num_contacts = data[2];
804 int contacts_to_send = 0;
805
806 /*
807 * First packet resets the counter since only the first
808 * packet in series will have non-zero current_num_contacts.
809 */
810 if (current_num_contacts)
811 wacom->num_contacts_left = current_num_contacts;
812
813 /* There are at most 5 contacts per packet */
814 contacts_to_send = min(5, wacom->num_contacts_left);
815
816 for (i = 0; i < contacts_to_send; i++) {
817 int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3;
818 bool touch = data[offset] & 0x1;
819 int id = le16_to_cpup((__le16 *)&data[offset + 1]);
820 int slot = find_slot_from_contactid(wacom, id);
821
822 if (slot < 0)
823 continue;
824
825 input_mt_slot(input, slot);
826 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
827 if (touch) {
828 int x = le16_to_cpup((__le16 *)&data[offset + 7]);
829 int y = le16_to_cpup((__le16 *)&data[offset + 9]);
830 input_report_abs(input, ABS_MT_POSITION_X, x);
831 input_report_abs(input, ABS_MT_POSITION_Y, y);
832 }
833 wacom->slots[slot] = touch ? id : -1;
834 }
835
836 input_mt_report_pointer_emulation(input, true);
837
838 wacom->num_contacts_left -= contacts_to_send;
839 if (wacom->num_contacts_left < 0)
840 wacom->num_contacts_left = 0;
841
842 return 1;
843}
844
737static int wacom_tpc_mt_touch(struct wacom_wac *wacom) 845static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
738{ 846{
739 struct input_dev *input = wacom->input; 847 struct input_dev *input = wacom->input;
@@ -772,6 +880,9 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
772 bool prox; 880 bool prox;
773 int x = 0, y = 0; 881 int x = 0, y = 0;
774 882
883 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
884 return 0;
885
775 if (!wacom->shared->stylus_in_proximity) { 886 if (!wacom->shared->stylus_in_proximity) {
776 if (len == WACOM_PKGLEN_TPC1FG) { 887 if (len == WACOM_PKGLEN_TPC1FG) {
777 prox = data[0] & 0x01; 888 prox = data[0] & 0x01;
@@ -835,15 +946,15 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
835{ 946{
836 char *data = wacom->data; 947 char *data = wacom->data;
837 948
838 dev_dbg(&wacom->input->dev, "wacom_tpc_irq: received report #%d\n", 949 dev_dbg(wacom->input->dev.parent,
839 data[0]); 950 "%s: received report #%d\n", __func__, data[0]);
840 951
841 switch (len) { 952 switch (len) {
842 case WACOM_PKGLEN_TPC1FG: 953 case WACOM_PKGLEN_TPC1FG:
843 return wacom_tpc_single_touch(wacom, len); 954 return wacom_tpc_single_touch(wacom, len);
844 955
845 case WACOM_PKGLEN_TPC2FG: 956 case WACOM_PKGLEN_TPC2FG:
846 return wacom_tpc_mt_touch(wacom); 957 return wacom_tpc_mt_touch(wacom);
847 958
848 default: 959 default:
849 switch (data[0]) { 960 switch (data[0]) {
@@ -852,6 +963,9 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
852 case WACOM_REPORT_TPCST: 963 case WACOM_REPORT_TPCST:
853 return wacom_tpc_single_touch(wacom, len); 964 return wacom_tpc_single_touch(wacom, len);
854 965
966 case WACOM_REPORT_TPCMT:
967 return wacom_mt_touch(wacom);
968
855 case WACOM_REPORT_PENABLED: 969 case WACOM_REPORT_PENABLED:
856 return wacom_tpc_pen(wacom); 970 return wacom_tpc_pen(wacom);
857 } 971 }
@@ -1120,8 +1234,18 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1120 sync = wacom_intuos_irq(wacom_wac); 1234 sync = wacom_intuos_irq(wacom_wac);
1121 break; 1235 break;
1122 1236
1237 case INTUOS5S:
1238 case INTUOS5:
1239 case INTUOS5L:
1240 if (len == WACOM_PKGLEN_BBTOUCH3)
1241 sync = wacom_bpt3_touch(wacom_wac);
1242 else
1243 sync = wacom_intuos_irq(wacom_wac);
1244 break;
1245
1123 case TABLETPC: 1246 case TABLETPC:
1124 case TABLETPC2FG: 1247 case TABLETPC2FG:
1248 case MTSCREEN:
1125 sync = wacom_tpc_irq(wacom_wac, len); 1249 sync = wacom_tpc_irq(wacom_wac, len);
1126 break; 1250 break;
1127 1251
@@ -1194,7 +1318,9 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1194 1318
1195 /* these device have multiple inputs */ 1319 /* these device have multiple inputs */
1196 if (features->type == TABLETPC || features->type == TABLETPC2FG || 1320 if (features->type == TABLETPC || features->type == TABLETPC2FG ||
1197 features->type == BAMBOO_PT || features->type == WIRELESS) 1321 features->type == BAMBOO_PT || features->type == WIRELESS ||
1322 (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
1323 features->type == MTSCREEN)
1198 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1324 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1199 1325
1200 /* quirk for bamboo touch with 2 low res touches */ 1326 /* quirk for bamboo touch with 2 low res touches */
@@ -1225,8 +1351,8 @@ static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
1225 return (logical_max * 100) / physical_max; 1351 return (logical_max * 100) / physical_max;
1226} 1352}
1227 1353
1228void wacom_setup_input_capabilities(struct input_dev *input_dev, 1354int wacom_setup_input_capabilities(struct input_dev *input_dev,
1229 struct wacom_wac *wacom_wac) 1355 struct wacom_wac *wacom_wac)
1230{ 1356{
1231 struct wacom_features *features = &wacom_wac->features; 1357 struct wacom_features *features = &wacom_wac->features;
1232 int i; 1358 int i;
@@ -1361,6 +1487,50 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1361 wacom_setup_intuos(wacom_wac); 1487 wacom_setup_intuos(wacom_wac);
1362 break; 1488 break;
1363 1489
1490 case INTUOS5:
1491 case INTUOS5L:
1492 if (features->device_type == BTN_TOOL_PEN) {
1493 __set_bit(BTN_7, input_dev->keybit);
1494 __set_bit(BTN_8, input_dev->keybit);
1495 }
1496 /* fall through */
1497
1498 case INTUOS5S:
1499 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1500
1501 if (features->device_type == BTN_TOOL_PEN) {
1502 for (i = 0; i < 7; i++)
1503 __set_bit(BTN_0 + i, input_dev->keybit);
1504
1505 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
1506 features->distance_max,
1507 0, 0);
1508
1509 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1510
1511 wacom_setup_intuos(wacom_wac);
1512 } else if (features->device_type == BTN_TOOL_FINGER) {
1513 __clear_bit(ABS_MISC, input_dev->absbit);
1514
1515 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1516 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1517 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
1518 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
1519
1520 input_mt_init_slots(input_dev, features->touch_max);
1521
1522 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
1523 0, 255, 0, 0);
1524
1525 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
1526 0, features->x_max,
1527 features->x_fuzz, 0);
1528 input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
1529 0, features->y_max,
1530 features->y_fuzz, 0);
1531 }
1532 break;
1533
1364 case INTUOS4: 1534 case INTUOS4:
1365 case INTUOS4L: 1535 case INTUOS4L:
1366 __set_bit(BTN_7, input_dev->keybit); 1536 __set_bit(BTN_7, input_dev->keybit);
@@ -1378,9 +1548,19 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1378 break; 1548 break;
1379 1549
1380 case TABLETPC2FG: 1550 case TABLETPC2FG:
1551 case MTSCREEN:
1381 if (features->device_type == BTN_TOOL_FINGER) { 1552 if (features->device_type == BTN_TOOL_FINGER) {
1382 1553
1383 input_mt_init_slots(input_dev, 2); 1554 wacom_wac->slots = kmalloc(features->touch_max *
1555 sizeof(int),
1556 GFP_KERNEL);
1557 if (!wacom_wac->slots)
1558 return -ENOMEM;
1559
1560 for (i = 0; i < features->touch_max; i++)
1561 wacom_wac->slots[i] = -1;
1562
1563 input_mt_init_slots(input_dev, features->touch_max);
1384 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 1564 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
1385 0, MT_TOOL_MAX, 0, 0); 1565 0, MT_TOOL_MAX, 0, 0);
1386 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1566 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
@@ -1435,6 +1615,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1435 1615
1436 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1616 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1437 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1617 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1618 input_mt_init_slots(input_dev, features->touch_max);
1438 1619
1439 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 1620 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1440 __set_bit(BTN_TOOL_TRIPLETAP, 1621 __set_bit(BTN_TOOL_TRIPLETAP,
@@ -1442,13 +1623,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1442 __set_bit(BTN_TOOL_QUADTAP, 1623 __set_bit(BTN_TOOL_QUADTAP,
1443 input_dev->keybit); 1624 input_dev->keybit);
1444 1625
1445 input_mt_init_slots(input_dev, 16);
1446
1447 input_set_abs_params(input_dev, 1626 input_set_abs_params(input_dev,
1448 ABS_MT_TOUCH_MAJOR, 1627 ABS_MT_TOUCH_MAJOR,
1449 0, 255, 0, 0); 1628 0, 255, 0, 0);
1450 } else {
1451 input_mt_init_slots(input_dev, 2);
1452 } 1629 }
1453 1630
1454 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1631 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
@@ -1468,6 +1645,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1468 } 1645 }
1469 break; 1646 break;
1470 } 1647 }
1648 return 0;
1471} 1649}
1472 1650
1473static const struct wacom_features wacom_features_0x00 = 1651static const struct wacom_features wacom_features_0x00 =
@@ -1635,6 +1813,24 @@ static const struct wacom_features wacom_features_0xBB =
1635static const struct wacom_features wacom_features_0xBC = 1813static const struct wacom_features wacom_features_0xBC =
1636 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 1814 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047,
1637 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1815 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1816static const struct wacom_features wacom_features_0x26 =
1817 { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
1818 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
1819 .touch_max = 16 };
1820static const struct wacom_features wacom_features_0x27 =
1821 { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
1822 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
1823 .touch_max = 16 };
1824static const struct wacom_features wacom_features_0x28 =
1825 { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
1826 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
1827 .touch_max = 16 };
1828static const struct wacom_features wacom_features_0x29 =
1829 { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
1830 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1831static const struct wacom_features wacom_features_0x2A =
1832 { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
1833 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1638static const struct wacom_features wacom_features_0xF4 = 1834static const struct wacom_features wacom_features_0xF4 =
1639 { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, 1835 { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047,
1640 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1836 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
@@ -1676,13 +1872,19 @@ static const struct wacom_features wacom_features_0x9F =
1676 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1872 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1677static const struct wacom_features wacom_features_0xE2 = 1873static const struct wacom_features wacom_features_0xE2 =
1678 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 1874 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1679 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1875 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1876 .touch_max = 2 };
1680static const struct wacom_features wacom_features_0xE3 = 1877static const struct wacom_features wacom_features_0xE3 =
1681 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 1878 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1682 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1879 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1880 .touch_max = 2 };
1881static const struct wacom_features wacom_features_0xE5 =
1882 { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255,
1883 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1683static const struct wacom_features wacom_features_0xE6 = 1884static const struct wacom_features wacom_features_0xE6 =
1684 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, 1885 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255,
1685 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1886 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1887 .touch_max = 2 };
1686static const struct wacom_features wacom_features_0xEC = 1888static const struct wacom_features wacom_features_0xEC =
1687 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, 1889 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255,
1688 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1890 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1691,19 +1893,22 @@ static const struct wacom_features wacom_features_0x47 =
1691 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1893 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1692static const struct wacom_features wacom_features_0x84 = 1894static const struct wacom_features wacom_features_0x84 =
1693 { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, 1895 { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0,
1694 0, WIRELESS, 0, 0 }; 1896 0, WIRELESS, 0, 0, .touch_max = 16 };
1695static const struct wacom_features wacom_features_0xD0 = 1897static const struct wacom_features wacom_features_0xD0 =
1696 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1898 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1697 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1899 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1900 .touch_max = 2 };
1698static const struct wacom_features wacom_features_0xD1 = 1901static const struct wacom_features wacom_features_0xD1 =
1699 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1902 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1700 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1903 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1904 .touch_max = 2 };
1701static const struct wacom_features wacom_features_0xD2 = 1905static const struct wacom_features wacom_features_0xD2 =
1702 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1906 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1703 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1907 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1704static const struct wacom_features wacom_features_0xD3 = 1908static const struct wacom_features wacom_features_0xD3 =
1705 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1909 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
1706 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1910 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1911 .touch_max = 2 };
1707static const struct wacom_features wacom_features_0xD4 = 1912static const struct wacom_features wacom_features_0xD4 =
1708 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1913 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1709 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1914 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1712,28 +1917,35 @@ static const struct wacom_features wacom_features_0xD5 =
1712 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1917 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1713static const struct wacom_features wacom_features_0xD6 = 1918static const struct wacom_features wacom_features_0xD6 =
1714 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1919 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1715 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1920 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1921 .touch_max = 2 };
1716static const struct wacom_features wacom_features_0xD7 = 1922static const struct wacom_features wacom_features_0xD7 =
1717 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1923 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1718 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1924 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1925 .touch_max = 2 };
1719static const struct wacom_features wacom_features_0xD8 = 1926static const struct wacom_features wacom_features_0xD8 =
1720 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1927 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
1721 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1928 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1929 .touch_max = 2 };
1722static const struct wacom_features wacom_features_0xDA = 1930static const struct wacom_features wacom_features_0xDA =
1723 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1931 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1724 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1932 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1933 .touch_max = 2 };
1725static struct wacom_features wacom_features_0xDB = 1934static struct wacom_features wacom_features_0xDB =
1726 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1935 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
1727 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1936 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1937 .touch_max = 2 };
1728static const struct wacom_features wacom_features_0xDD = 1938static const struct wacom_features wacom_features_0xDD =
1729 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, 1939 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1730 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1940 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1731static const struct wacom_features wacom_features_0xDE = 1941static const struct wacom_features wacom_features_0xDE =
1732 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, 1942 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1733 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1943 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1944 .touch_max = 16 };
1734static const struct wacom_features wacom_features_0xDF = 1945static const struct wacom_features wacom_features_0xDF =
1735 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, 1946 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023,
1736 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1947 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
1948 .touch_max = 16 };
1737static const struct wacom_features wacom_features_0x6004 = 1949static const struct wacom_features wacom_features_0x6004 =
1738 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 1950 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1739 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1951 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1807,6 +2019,11 @@ const struct usb_device_id wacom_ids[] = {
1807 { USB_DEVICE_WACOM(0xBA) }, 2019 { USB_DEVICE_WACOM(0xBA) },
1808 { USB_DEVICE_WACOM(0xBB) }, 2020 { USB_DEVICE_WACOM(0xBB) },
1809 { USB_DEVICE_WACOM(0xBC) }, 2021 { USB_DEVICE_WACOM(0xBC) },
2022 { USB_DEVICE_WACOM(0x26) },
2023 { USB_DEVICE_WACOM(0x27) },
2024 { USB_DEVICE_WACOM(0x28) },
2025 { USB_DEVICE_WACOM(0x29) },
2026 { USB_DEVICE_WACOM(0x2A) },
1810 { USB_DEVICE_WACOM(0x3F) }, 2027 { USB_DEVICE_WACOM(0x3F) },
1811 { USB_DEVICE_WACOM(0xC5) }, 2028 { USB_DEVICE_WACOM(0xC5) },
1812 { USB_DEVICE_WACOM(0xC6) }, 2029 { USB_DEVICE_WACOM(0xC6) },
@@ -1842,6 +2059,7 @@ const struct usb_device_id wacom_ids[] = {
1842 { USB_DEVICE_WACOM(0x9F) }, 2059 { USB_DEVICE_WACOM(0x9F) },
1843 { USB_DEVICE_WACOM(0xE2) }, 2060 { USB_DEVICE_WACOM(0xE2) },
1844 { USB_DEVICE_WACOM(0xE3) }, 2061 { USB_DEVICE_WACOM(0xE3) },
2062 { USB_DEVICE_WACOM(0xE5) },
1845 { USB_DEVICE_WACOM(0xE6) }, 2063 { USB_DEVICE_WACOM(0xE6) },
1846 { USB_DEVICE_WACOM(0xEC) }, 2064 { USB_DEVICE_WACOM(0xEC) },
1847 { USB_DEVICE_WACOM(0x47) }, 2065 { USB_DEVICE_WACOM(0x47) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index ba5a334e54d6..78fbd3f42009 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -25,6 +25,10 @@
25#define WACOM_PKGLEN_BBTOUCH3 64 25#define WACOM_PKGLEN_BBTOUCH3 64
26#define WACOM_PKGLEN_BBPEN 10 26#define WACOM_PKGLEN_BBPEN 10
27#define WACOM_PKGLEN_WIRELESS 32 27#define WACOM_PKGLEN_WIRELESS 32
28#define WACOM_PKGLEN_MTOUCH 62
29
30/* wacom data size per MT contact */
31#define WACOM_BYTES_PER_MT_PACKET 11
28 32
29/* device IDs */ 33/* device IDs */
30#define STYLUS_DEVICE_ID 0x02 34#define STYLUS_DEVICE_ID 0x02
@@ -38,8 +42,10 @@
38#define WACOM_REPORT_INTUOSREAD 5 42#define WACOM_REPORT_INTUOSREAD 5
39#define WACOM_REPORT_INTUOSWRITE 6 43#define WACOM_REPORT_INTUOSWRITE 6
40#define WACOM_REPORT_INTUOSPAD 12 44#define WACOM_REPORT_INTUOSPAD 12
45#define WACOM_REPORT_INTUOS5PAD 3
41#define WACOM_REPORT_TPC1FG 6 46#define WACOM_REPORT_TPC1FG 6
42#define WACOM_REPORT_TPC2FG 13 47#define WACOM_REPORT_TPC2FG 13
48#define WACOM_REPORT_TPCMT 13
43#define WACOM_REPORT_TPCHID 15 49#define WACOM_REPORT_TPCHID 15
44#define WACOM_REPORT_TPCST 16 50#define WACOM_REPORT_TPCST 16
45 51
@@ -65,6 +71,9 @@ enum {
65 INTUOS4S, 71 INTUOS4S,
66 INTUOS4, 72 INTUOS4,
67 INTUOS4L, 73 INTUOS4L,
74 INTUOS5S,
75 INTUOS5,
76 INTUOS5L,
68 WACOM_24HD, 77 WACOM_24HD,
69 WACOM_21UX2, 78 WACOM_21UX2,
70 CINTIQ, 79 CINTIQ,
@@ -72,6 +81,7 @@ enum {
72 WACOM_MO, 81 WACOM_MO,
73 TABLETPC, 82 TABLETPC,
74 TABLETPC2FG, 83 TABLETPC2FG,
84 MTSCREEN,
75 MAX_TYPE 85 MAX_TYPE
76}; 86};
77 87
@@ -95,6 +105,7 @@ struct wacom_features {
95 int pressure_fuzz; 105 int pressure_fuzz;
96 int distance_fuzz; 106 int distance_fuzz;
97 unsigned quirks; 107 unsigned quirks;
108 unsigned touch_max;
98}; 109};
99 110
100struct wacom_shared { 111struct wacom_shared {
@@ -113,6 +124,8 @@ struct wacom_wac {
113 struct input_dev *input; 124 struct input_dev *input;
114 int pid; 125 int pid;
115 int battery_capacity; 126 int battery_capacity;
127 int num_contacts_left;
128 int *slots;
116}; 129};
117 130
118#endif 131#endif