aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-01-09 02:38:23 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-01-09 02:38:23 -0500
commitda733563be5a9da26fe81d9f007262d00b846e22 (patch)
treedb28291df94a2043af2123911984c5c173da4e6f /drivers/input/tablet
parent6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff)
parentdab78d7924598ea4031663dd10db814e2e324928 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/aiptek.c34
-rw-r--r--drivers/input/tablet/wacom_sys.c101
-rw-r--r--drivers/input/tablet/wacom_wac.c187
-rw-r--r--drivers/input/tablet/wacom_wac.h5
4 files changed, 290 insertions, 37 deletions
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 6d89fd1842c3..85bace2c8fe8 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1198,9 +1198,9 @@ static ssize_t
1198store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1198store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1199{ 1199{
1200 struct aiptek *aiptek = dev_get_drvdata(dev); 1200 struct aiptek *aiptek = dev_get_drvdata(dev);
1201 long x; 1201 int x;
1202 1202
1203 if (strict_strtol(buf, 10, &x)) { 1203 if (kstrtoint(buf, 10, &x)) {
1204 size_t len = buf[count - 1] == '\n' ? count - 1 : count; 1204 size_t len = buf[count - 1] == '\n' ? count - 1 : count;
1205 1205
1206 if (strncmp(buf, "disable", len)) 1206 if (strncmp(buf, "disable", len))
@@ -1240,9 +1240,9 @@ static ssize_t
1240store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1240store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1241{ 1241{
1242 struct aiptek *aiptek = dev_get_drvdata(dev); 1242 struct aiptek *aiptek = dev_get_drvdata(dev);
1243 long y; 1243 int y;
1244 1244
1245 if (strict_strtol(buf, 10, &y)) { 1245 if (kstrtoint(buf, 10, &y)) {
1246 size_t len = buf[count - 1] == '\n' ? count - 1 : count; 1246 size_t len = buf[count - 1] == '\n' ? count - 1 : count;
1247 1247
1248 if (strncmp(buf, "disable", len)) 1248 if (strncmp(buf, "disable", len))
@@ -1277,12 +1277,13 @@ static ssize_t
1277store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1277store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1278{ 1278{
1279 struct aiptek *aiptek = dev_get_drvdata(dev); 1279 struct aiptek *aiptek = dev_get_drvdata(dev);
1280 long j; 1280 int err, j;
1281 1281
1282 if (strict_strtol(buf, 10, &j)) 1282 err = kstrtoint(buf, 10, &j);
1283 return -EINVAL; 1283 if (err)
1284 return err;
1284 1285
1285 aiptek->newSetting.jitterDelay = (int)j; 1286 aiptek->newSetting.jitterDelay = j;
1286 return count; 1287 return count;
1287} 1288}
1288 1289
@@ -1306,12 +1307,13 @@ static ssize_t
1306store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1307store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1307{ 1308{
1308 struct aiptek *aiptek = dev_get_drvdata(dev); 1309 struct aiptek *aiptek = dev_get_drvdata(dev);
1309 long d; 1310 int err, d;
1310 1311
1311 if (strict_strtol(buf, 10, &d)) 1312 err = kstrtoint(buf, 10, &d);
1312 return -EINVAL; 1313 if (err)
1314 return err;
1313 1315
1314 aiptek->newSetting.programmableDelay = (int)d; 1316 aiptek->newSetting.programmableDelay = d;
1315 return count; 1317 return count;
1316} 1318}
1317 1319
@@ -1557,11 +1559,13 @@ static ssize_t
1557store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1559store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1558{ 1560{
1559 struct aiptek *aiptek = dev_get_drvdata(dev); 1561 struct aiptek *aiptek = dev_get_drvdata(dev);
1560 long w; 1562 int err, w;
1561 1563
1562 if (strict_strtol(buf, 10, &w)) return -EINVAL; 1564 err = kstrtoint(buf, 10, &w);
1565 if (err)
1566 return err;
1563 1567
1564 aiptek->newSetting.wheel = (int)w; 1568 aiptek->newSetting.wheel = w;
1565 return count; 1569 return count;
1566} 1570}
1567 1571
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 1c1b7b43cf92..7e63183a6c68 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -28,7 +28,9 @@
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_COLLECTION 0xc0 31#define HID_COLLECTION 0xa1
32#define HID_COLLECTION_LOGICAL 0x02
33#define HID_COLLECTION_END 0xc0
32 34
33enum { 35enum {
34 WCM_UNDEFINED = 0, 36 WCM_UNDEFINED = 0,
@@ -66,7 +68,8 @@ static int wacom_get_report(struct usb_interface *intf, u8 type, u8 id,
66 do { 68 do {
67 retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 69 retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
68 USB_REQ_GET_REPORT, 70 USB_REQ_GET_REPORT,
69 USB_TYPE_CLASS | USB_RECIP_INTERFACE, 71 USB_DIR_IN | USB_TYPE_CLASS |
72 USB_RECIP_INTERFACE,
70 (type << 8) + id, 73 (type << 8) + id,
71 intf->altsetting[0].desc.bInterfaceNumber, 74 intf->altsetting[0].desc.bInterfaceNumber,
72 buf, size, 100); 75 buf, size, 100);
@@ -164,7 +167,70 @@ static void wacom_close(struct input_dev *dev)
164 usb_autopm_put_interface(wacom->intf); 167 usb_autopm_put_interface(wacom->intf);
165} 168}
166 169
167static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, 170static int wacom_parse_logical_collection(unsigned char *report,
171 struct wacom_features *features)
172{
173 int length = 0;
174
175 if (features->type == BAMBOO_PT) {
176
177 /* Logical collection is only used by 3rd gen Bamboo Touch */
178 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
179 features->device_type = BTN_TOOL_DOUBLETAP;
180
181 /*
182 * Stylus and Touch have same active area
183 * so compute physical size based on stylus
184 * data before its overwritten.
185 */
186 features->x_phy =
187 (features->x_max * features->x_resolution) / 100;
188 features->y_phy =
189 (features->y_max * features->y_resolution) / 100;
190
191 features->x_max = features->y_max =
192 get_unaligned_le16(&report[10]);
193
194 length = 11;
195 }
196 return length;
197}
198
199/*
200 * Interface Descriptor of wacom devices can be incomplete and
201 * inconsistent so wacom_features table is used to store stylus
202 * device's packet lengths, various maximum values, and tablet
203 * resolution based on product ID's.
204 *
205 * For devices that contain 2 interfaces, wacom_features table is
206 * inaccurate for the touch interface. Since the Interface Descriptor
207 * for touch interfaces has pretty complete data, this function exists
208 * to query tablet for this missing information instead of hard coding in
209 * an additional table.
210 *
211 * A typical Interface Descriptor for a stylus will contain a
212 * boot mouse application collection that is not of interest and this
213 * function will ignore it.
214 *
215 * It also contains a digitizer application collection that also is not
216 * of interest since any information it contains would be duplicate
217 * of what is in wacom_features. Usually it defines a report of an array
218 * of bytes that could be used as max length of the stylus packet returned.
219 * If it happens to define a Digitizer-Stylus Physical Collection then
220 * the X and Y logical values contain valid data but it is ignored.
221 *
222 * A typical Interface Descriptor for a touch interface will contain a
223 * Digitizer-Finger Physical Collection which will define both logical
224 * X/Y maximum as well as the physical size of tablet. Since touch
225 * interfaces haven't supported pressure or distance, this is enough
226 * information to override invalid values in the wacom_features table.
227 *
228 * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical
229 * Collection. Instead they define a Logical Collection with a single
230 * Logical Maximum for both X and Y.
231 */
232static int wacom_parse_hid(struct usb_interface *intf,
233 struct hid_descriptor *hid_desc,
168 struct wacom_features *features) 234 struct wacom_features *features)
169{ 235{
170 struct usb_device *dev = interface_to_usbdev(intf); 236 struct usb_device *dev = interface_to_usbdev(intf);
@@ -244,8 +310,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
244 /* penabled only accepts exact bytes of data */ 310 /* penabled only accepts exact bytes of data */
245 if (features->type == TABLETPC2FG) 311 if (features->type == TABLETPC2FG)
246 features->pktlen = WACOM_PKGLEN_GRAPHIRE; 312 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
247 if (features->type == BAMBOO_PT)
248 features->pktlen = WACOM_PKGLEN_BBFUN;
249 features->device_type = BTN_TOOL_PEN; 313 features->device_type = BTN_TOOL_PEN;
250 features->x_max = 314 features->x_max =
251 get_unaligned_le16(&report[i + 3]); 315 get_unaligned_le16(&report[i + 3]);
@@ -287,8 +351,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
287 /* penabled only accepts exact bytes of data */ 351 /* penabled only accepts exact bytes of data */
288 if (features->type == TABLETPC2FG) 352 if (features->type == TABLETPC2FG)
289 features->pktlen = WACOM_PKGLEN_GRAPHIRE; 353 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
290 if (features->type == BAMBOO_PT)
291 features->pktlen = WACOM_PKGLEN_BBFUN;
292 features->device_type = BTN_TOOL_PEN; 354 features->device_type = BTN_TOOL_PEN;
293 features->y_max = 355 features->y_max =
294 get_unaligned_le16(&report[i + 3]); 356 get_unaligned_le16(&report[i + 3]);
@@ -302,6 +364,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
302 i++; 364 i++;
303 break; 365 break;
304 366
367 /*
368 * Requiring Stylus Usage will ignore boot mouse
369 * X/Y values and some cases of invalid Digitizer X/Y
370 * values commonly reported.
371 */
305 case HID_USAGE_STYLUS: 372 case HID_USAGE_STYLUS:
306 pen = 1; 373 pen = 1;
307 i++; 374 i++;
@@ -309,10 +376,20 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
309 } 376 }
310 break; 377 break;
311 378
312 case HID_COLLECTION: 379 case HID_COLLECTION_END:
313 /* reset UsagePage and Finger */ 380 /* reset UsagePage and Finger */
314 finger = usage = 0; 381 finger = usage = 0;
315 break; 382 break;
383
384 case HID_COLLECTION:
385 i++;
386 switch (report[i]) {
387 case HID_COLLECTION_LOGICAL:
388 i += wacom_parse_logical_collection(&report[i],
389 features);
390 break;
391 }
392 break;
316 } 393 }
317 } 394 }
318 395
@@ -348,7 +425,8 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
348 WAC_HID_FEATURE_REPORT, 425 WAC_HID_FEATURE_REPORT,
349 report_id, rep_data, 4, 1); 426 report_id, rep_data, 4, 1);
350 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); 427 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
351 } else if (features->type != TABLETPC) { 428 } else if (features->type != TABLETPC &&
429 features->device_type == BTN_TOOL_PEN) {
352 do { 430 do {
353 rep_data[0] = 2; 431 rep_data[0] = 2;
354 rep_data[1] = 2; 432 rep_data[1] = 2;
@@ -485,7 +563,8 @@ static int wacom_led_control(struct wacom *wacom)
485 if (!buf) 563 if (!buf)
486 return -ENOMEM; 564 return -ENOMEM;
487 565
488 if (wacom->wacom_wac.features.type == WACOM_21UX2) 566 if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
567 wacom->wacom_wac.features.type == WACOM_24HD)
489 led = (wacom->led.select[1] << 4) | 0x40; 568 led = (wacom->led.select[1] << 4) | 0x40;
490 569
491 led |= wacom->led.select[0] | 0x4; 570 led |= wacom->led.select[0] | 0x4;
@@ -704,6 +783,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
704 &intuos4_led_attr_group); 783 &intuos4_led_attr_group);
705 break; 784 break;
706 785
786 case WACOM_24HD:
707 case WACOM_21UX2: 787 case WACOM_21UX2:
708 wacom->led.select[0] = 0; 788 wacom->led.select[0] = 0;
709 wacom->led.select[1] = 0; 789 wacom->led.select[1] = 0;
@@ -738,6 +818,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
738 &intuos4_led_attr_group); 818 &intuos4_led_attr_group);
739 break; 819 break;
740 820
821 case WACOM_24HD:
741 case WACOM_21UX2: 822 case WACOM_21UX2:
742 sysfs_remove_group(&wacom->intf->dev.kobj, 823 sysfs_remove_group(&wacom->intf->dev.kobj,
743 &cintiq_led_attr_group); 824 &cintiq_led_attr_group);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 2ee47d01a3b4..88672ec296c1 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -452,7 +452,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
452 if ((data[1] & 0xb8) == 0xa0) { 452 if ((data[1] & 0xb8) == 0xa0) {
453 t = (data[6] << 2) | ((data[7] >> 6) & 3); 453 t = (data[6] << 2) | ((data[7] >> 6) & 3);
454 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || 454 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) ||
455 features->type == WACOM_21UX2) { 455 features->type == WACOM_21UX2 || features->type == WACOM_24HD) {
456 t = (t << 1) | (data[1] & 1); 456 t = (t << 1) | (data[1] & 1);
457 } 457 }
458 input_report_abs(input, ABS_PRESSURE, t); 458 input_report_abs(input, ABS_PRESSURE, t);
@@ -519,6 +519,56 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
519 input_report_key(input, wacom->tool[1], 0); 519 input_report_key(input, wacom->tool[1], 0);
520 input_report_abs(input, ABS_MISC, 0); 520 input_report_abs(input, ABS_MISC, 0);
521 } 521 }
522 } else if (features->type == WACOM_24HD) {
523 input_report_key(input, BTN_0, (data[6] & 0x01));
524 input_report_key(input, BTN_1, (data[6] & 0x02));
525 input_report_key(input, BTN_2, (data[6] & 0x04));
526 input_report_key(input, BTN_3, (data[6] & 0x08));
527 input_report_key(input, BTN_4, (data[6] & 0x10));
528 input_report_key(input, BTN_5, (data[6] & 0x20));
529 input_report_key(input, BTN_6, (data[6] & 0x40));
530 input_report_key(input, BTN_7, (data[6] & 0x80));
531 input_report_key(input, BTN_8, (data[8] & 0x01));
532 input_report_key(input, BTN_9, (data[8] & 0x02));
533 input_report_key(input, BTN_A, (data[8] & 0x04));
534 input_report_key(input, BTN_B, (data[8] & 0x08));
535 input_report_key(input, BTN_C, (data[8] & 0x10));
536 input_report_key(input, BTN_X, (data[8] & 0x20));
537 input_report_key(input, BTN_Y, (data[8] & 0x40));
538 input_report_key(input, BTN_Z, (data[8] & 0x80));
539
540 /*
541 * Three "buttons" are available on the 24HD which are
542 * physically implemented as a touchstrip. Each button
543 * is approximately 3 bits wide with a 2 bit spacing.
544 * The raw touchstrip bits are stored at:
545 * ((data[3] & 0x1f) << 8) | data[4])
546 */
547 input_report_key(input, KEY_PROG1, data[4] & 0x07);
548 input_report_key(input, KEY_PROG2, data[4] & 0xE0);
549 input_report_key(input, KEY_PROG3, data[3] & 0x1C);
550
551 if (data[1] & 0x80) {
552 input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
553 } else {
554 /* Out of proximity, clear wheel value. */
555 input_report_abs(input, ABS_WHEEL, 0);
556 }
557
558 if (data[2] & 0x80) {
559 input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f));
560 } else {
561 /* Out of proximity, clear second wheel value. */
562 input_report_abs(input, ABS_THROTTLE, 0);
563 }
564
565 if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) {
566 input_report_key(input, wacom->tool[1], 1);
567 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
568 } else {
569 input_report_key(input, wacom->tool[1], 0);
570 input_report_abs(input, ABS_MISC, 0);
571 }
522 } else { 572 } else {
523 if (features->type == WACOM_21UX2) { 573 if (features->type == WACOM_21UX2) {
524 input_report_key(input, BTN_0, (data[5] & 0x01)); 574 input_report_key(input, BTN_0, (data[5] & 0x01));
@@ -799,6 +849,9 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
799 unsigned char *data = wacom->data; 849 unsigned char *data = wacom->data;
800 int i; 850 int i;
801 851
852 if (data[0] != 0x02)
853 return 0;
854
802 for (i = 0; i < 2; i++) { 855 for (i = 0; i < 2; i++) {
803 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); 856 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i);
804 bool touch = data[offset + 3] & 0x80; 857 bool touch = data[offset + 3] & 0x80;
@@ -837,18 +890,77 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
837 return 0; 890 return 0;
838} 891}
839 892
893static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
894{
895 struct input_dev *input = wacom->input;
896 int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */
897 bool touch = data[1] & 0x80;
898
899 touch = touch && !wacom->shared->stylus_in_proximity;
900
901 input_mt_slot(input, slot_id);
902 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
903
904 if (touch) {
905 int x = (data[2] << 4) | (data[4] >> 4);
906 int y = (data[3] << 4) | (data[4] & 0x0f);
907 int w = data[6];
908
909 input_report_abs(input, ABS_MT_POSITION_X, x);
910 input_report_abs(input, ABS_MT_POSITION_Y, y);
911 input_report_abs(input, ABS_MT_TOUCH_MAJOR, w);
912 }
913}
914
915static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
916{
917 struct input_dev *input = wacom->input;
918
919 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
920 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
921 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
922 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
923}
924
925static int wacom_bpt3_touch(struct wacom_wac *wacom)
926{
927 struct input_dev *input = wacom->input;
928 unsigned char *data = wacom->data;
929 int count = data[1] & 0x03;
930 int i;
931
932 if (data[0] != 0x02)
933 return 0;
934
935 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */
936 for (i = 0; i < count; i++) {
937 int offset = (8 * i) + 2;
938 int msg_id = data[offset];
939
940 if (msg_id >= 2 && msg_id <= 17)
941 wacom_bpt3_touch_msg(wacom, data + offset);
942 else if (msg_id == 128)
943 wacom_bpt3_button_msg(wacom, data + offset);
944
945 }
946
947 input_mt_report_pointer_emulation(input, true);
948
949 input_sync(input);
950
951 return 0;
952}
953
840static int wacom_bpt_pen(struct wacom_wac *wacom) 954static int wacom_bpt_pen(struct wacom_wac *wacom)
841{ 955{
842 struct input_dev *input = wacom->input; 956 struct input_dev *input = wacom->input;
843 unsigned char *data = wacom->data; 957 unsigned char *data = wacom->data;
844 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; 958 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
845 959
846 /* 960 if (data[0] != 0x02)
847 * Similar to Graphire protocol, data[1] & 0x20 is proximity and 961 return 0;
848 * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore 962
849 * 2 unused tool ID's. 963 prox = (data[1] & 0x20) == 0x20;
850 */
851 prox = (data[1] & 0x30) == 0x30;
852 964
853 /* 965 /*
854 * All reports shared between PEN and RUBBER tool must be 966 * All reports shared between PEN and RUBBER tool must be
@@ -912,7 +1024,9 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
912{ 1024{
913 if (len == WACOM_PKGLEN_BBTOUCH) 1025 if (len == WACOM_PKGLEN_BBTOUCH)
914 return wacom_bpt_touch(wacom); 1026 return wacom_bpt_touch(wacom);
915 else if (len == WACOM_PKGLEN_BBFUN) 1027 else if (len == WACOM_PKGLEN_BBTOUCH3)
1028 return wacom_bpt3_touch(wacom);
1029 else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN)
916 return wacom_bpt_pen(wacom); 1030 return wacom_bpt_pen(wacom);
917 1031
918 return 0; 1032 return 0;
@@ -955,6 +1069,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
955 case CINTIQ: 1069 case CINTIQ:
956 case WACOM_BEE: 1070 case WACOM_BEE:
957 case WACOM_21UX2: 1071 case WACOM_21UX2:
1072 case WACOM_24HD:
958 sync = wacom_intuos_irq(wacom_wac); 1073 sync = wacom_intuos_irq(wacom_wac);
959 break; 1074 break;
960 1075
@@ -1031,9 +1146,9 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1031 features->type == BAMBOO_PT) 1146 features->type == BAMBOO_PT)
1032 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1147 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1033 1148
1034 /* quirks for bamboo touch */ 1149 /* quirk for bamboo touch with 2 low res touches */
1035 if (features->type == BAMBOO_PT && 1150 if (features->type == BAMBOO_PT &&
1036 features->device_type == BTN_TOOL_DOUBLETAP) { 1151 features->pktlen == WACOM_PKGLEN_BBTOUCH) {
1037 features->x_max <<= 5; 1152 features->x_max <<= 5;
1038 features->y_max <<= 5; 1153 features->y_max <<= 5;
1039 features->x_fuzz <<= 5; 1154 features->x_fuzz <<= 5;
@@ -1110,6 +1225,26 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1110 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 1225 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1111 break; 1226 break;
1112 1227
1228 case WACOM_24HD:
1229 __set_bit(BTN_A, input_dev->keybit);
1230 __set_bit(BTN_B, input_dev->keybit);
1231 __set_bit(BTN_C, input_dev->keybit);
1232 __set_bit(BTN_X, input_dev->keybit);
1233 __set_bit(BTN_Y, input_dev->keybit);
1234 __set_bit(BTN_Z, input_dev->keybit);
1235
1236 for (i = 0; i < 10; i++)
1237 __set_bit(BTN_0 + i, input_dev->keybit);
1238
1239 __set_bit(KEY_PROG1, input_dev->keybit);
1240 __set_bit(KEY_PROG2, input_dev->keybit);
1241 __set_bit(KEY_PROG3, input_dev->keybit);
1242
1243 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1244 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
1245 wacom_setup_cintiq(wacom_wac);
1246 break;
1247
1113 case WACOM_21UX2: 1248 case WACOM_21UX2:
1114 __set_bit(BTN_A, input_dev->keybit); 1249 __set_bit(BTN_A, input_dev->keybit);
1115 __set_bit(BTN_B, input_dev->keybit); 1250 __set_bit(BTN_B, input_dev->keybit);
@@ -1240,7 +1375,21 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1240 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1375 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1241 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1376 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1242 1377
1243 input_mt_init_slots(input_dev, 2); 1378 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1379 __set_bit(BTN_TOOL_TRIPLETAP,
1380 input_dev->keybit);
1381 __set_bit(BTN_TOOL_QUADTAP,
1382 input_dev->keybit);
1383
1384 input_mt_init_slots(input_dev, 16);
1385
1386 input_set_abs_params(input_dev,
1387 ABS_MT_TOUCH_MAJOR,
1388 0, 255, 0, 0);
1389 } else {
1390 input_mt_init_slots(input_dev, 2);
1391 }
1392
1244 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1393 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
1245 0, features->x_max, 1394 0, features->x_max,
1246 features->x_fuzz, 0); 1395 features->x_fuzz, 0);
@@ -1425,6 +1574,9 @@ static const struct wacom_features wacom_features_0xBB =
1425static const struct wacom_features wacom_features_0xBC = 1574static const struct wacom_features wacom_features_0xBC =
1426 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 1575 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047,
1427 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1576 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1577static const struct wacom_features wacom_features_0xF4 =
1578 { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047,
1579 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1428static const struct wacom_features wacom_features_0x3F = 1580static const struct wacom_features wacom_features_0x3F =
1429 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 1581 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023,
1430 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1582 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
@@ -1509,6 +1661,15 @@ static const struct wacom_features wacom_features_0xDA =
1509static struct wacom_features wacom_features_0xDB = 1661static struct wacom_features wacom_features_0xDB =
1510 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1662 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
1511 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1663 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1664static const struct wacom_features wacom_features_0xDD =
1665 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1666 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1667static const struct wacom_features wacom_features_0xDE =
1668 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1669 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1670static const struct wacom_features wacom_features_0xDF =
1671 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023,
1672 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1512static const struct wacom_features wacom_features_0x6004 = 1673static const struct wacom_features wacom_features_0x6004 =
1513 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 1674 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1514 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1675 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1604,6 +1765,9 @@ const struct usb_device_id wacom_ids[] = {
1604 { USB_DEVICE_WACOM(0xD8) }, 1765 { USB_DEVICE_WACOM(0xD8) },
1605 { USB_DEVICE_WACOM(0xDA) }, 1766 { USB_DEVICE_WACOM(0xDA) },
1606 { USB_DEVICE_WACOM(0xDB) }, 1767 { USB_DEVICE_WACOM(0xDB) },
1768 { USB_DEVICE_WACOM(0xDD) },
1769 { USB_DEVICE_WACOM(0xDE) },
1770 { USB_DEVICE_WACOM(0xDF) },
1607 { USB_DEVICE_WACOM(0xF0) }, 1771 { USB_DEVICE_WACOM(0xF0) },
1608 { USB_DEVICE_WACOM(0xCC) }, 1772 { USB_DEVICE_WACOM(0xCC) },
1609 { USB_DEVICE_WACOM(0x90) }, 1773 { USB_DEVICE_WACOM(0x90) },
@@ -1616,6 +1780,7 @@ const struct usb_device_id wacom_ids[] = {
1616 { USB_DEVICE_WACOM(0xE6) }, 1780 { USB_DEVICE_WACOM(0xE6) },
1617 { USB_DEVICE_WACOM(0xEC) }, 1781 { USB_DEVICE_WACOM(0xEC) },
1618 { USB_DEVICE_WACOM(0x47) }, 1782 { USB_DEVICE_WACOM(0x47) },
1783 { USB_DEVICE_WACOM(0xF4) },
1619 { USB_DEVICE_LENOVO(0x6004) }, 1784 { USB_DEVICE_LENOVO(0x6004) },
1620 { } 1785 { }
1621}; 1786};
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 53eb71b68330..050acaefee7d 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -12,7 +12,7 @@
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14/* maximum packet length for USB devices */ 14/* maximum packet length for USB devices */
15#define WACOM_PKGLEN_MAX 32 15#define WACOM_PKGLEN_MAX 64
16 16
17/* packet length for individual models */ 17/* packet length for individual models */
18#define WACOM_PKGLEN_PENPRTN 7 18#define WACOM_PKGLEN_PENPRTN 7
@@ -22,6 +22,8 @@
22#define WACOM_PKGLEN_TPC1FG 5 22#define WACOM_PKGLEN_TPC1FG 5
23#define WACOM_PKGLEN_TPC2FG 14 23#define WACOM_PKGLEN_TPC2FG 14
24#define WACOM_PKGLEN_BBTOUCH 20 24#define WACOM_PKGLEN_BBTOUCH 20
25#define WACOM_PKGLEN_BBTOUCH3 64
26#define WACOM_PKGLEN_BBPEN 10
25 27
26/* device IDs */ 28/* device IDs */
27#define STYLUS_DEVICE_ID 0x02 29#define STYLUS_DEVICE_ID 0x02
@@ -57,6 +59,7 @@ enum {
57 INTUOS4S, 59 INTUOS4S,
58 INTUOS4, 60 INTUOS4,
59 INTUOS4L, 61 INTUOS4L,
62 WACOM_24HD,
60 WACOM_21UX2, 63 WACOM_21UX2,
61 CINTIQ, 64 CINTIQ,
62 WACOM_BEE, 65 WACOM_BEE,