diff options
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 130 |
1 files changed, 110 insertions, 20 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 847fd0135bcf..40d77ba8fdc1 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -158,6 +158,39 @@ static int wacom_ptu_irq(struct wacom_wac *wacom) | |||
158 | return 1; | 158 | return 1; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int wacom_dtu_irq(struct wacom_wac *wacom) | ||
162 | { | ||
163 | struct wacom_features *features = &wacom->features; | ||
164 | char *data = wacom->data; | ||
165 | struct input_dev *input = wacom->input; | ||
166 | int prox = data[1] & 0x20, pressure; | ||
167 | |||
168 | dbg("wacom_dtu_irq: received report #%d", data[0]); | ||
169 | |||
170 | if (prox) { | ||
171 | /* Going into proximity select tool */ | ||
172 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | ||
173 | if (wacom->tool[0] == BTN_TOOL_PEN) | ||
174 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
175 | else | ||
176 | wacom->id[0] = ERASER_DEVICE_ID; | ||
177 | } | ||
178 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | ||
179 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | ||
180 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | ||
181 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | ||
182 | pressure = ((data[7] & 0x01) << 8) | data[6]; | ||
183 | if (pressure < 0) | ||
184 | pressure = features->pressure_max + pressure + 1; | ||
185 | input_report_abs(input, ABS_PRESSURE, pressure); | ||
186 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | ||
187 | if (!prox) /* out-prox */ | ||
188 | wacom->id[0] = 0; | ||
189 | input_report_key(input, wacom->tool[0], prox); | ||
190 | input_report_abs(input, ABS_MISC, wacom->id[0]); | ||
191 | return 1; | ||
192 | } | ||
193 | |||
161 | static int wacom_graphire_irq(struct wacom_wac *wacom) | 194 | static int wacom_graphire_irq(struct wacom_wac *wacom) |
162 | { | 195 | { |
163 | struct wacom_features *features = &wacom->features; | 196 | struct wacom_features *features = &wacom->features; |
@@ -284,12 +317,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
284 | (data[4] << 20) + (data[5] << 12) + | 317 | (data[4] << 20) + (data[5] << 12) + |
285 | (data[6] << 4) + (data[7] >> 4); | 318 | (data[6] << 4) + (data[7] >> 4); |
286 | 319 | ||
287 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4); | 320 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
321 | ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); | ||
288 | 322 | ||
289 | switch (wacom->id[idx]) { | 323 | switch (wacom->id[idx] & 0xfffff) { |
290 | case 0x812: /* Inking pen */ | 324 | case 0x812: /* Inking pen */ |
291 | case 0x801: /* Intuos3 Inking pen */ | 325 | case 0x801: /* Intuos3 Inking pen */ |
292 | case 0x20802: /* Intuos4 Classic Pen */ | 326 | case 0x20802: /* Intuos4 Inking Pen */ |
293 | case 0x012: | 327 | case 0x012: |
294 | wacom->tool[idx] = BTN_TOOL_PENCIL; | 328 | wacom->tool[idx] = BTN_TOOL_PENCIL; |
295 | break; | 329 | break; |
@@ -300,7 +334,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
300 | case 0x823: /* Intuos3 Grip Pen */ | 334 | case 0x823: /* Intuos3 Grip Pen */ |
301 | case 0x813: /* Intuos3 Classic Pen */ | 335 | case 0x813: /* Intuos3 Classic Pen */ |
302 | case 0x885: /* Intuos3 Marker Pen */ | 336 | case 0x885: /* Intuos3 Marker Pen */ |
303 | case 0x802: /* Intuos4 Grip Pen Eraser */ | 337 | case 0x802: /* Intuos4 General Pen */ |
304 | case 0x804: /* Intuos4 Marker Pen */ | 338 | case 0x804: /* Intuos4 Marker Pen */ |
305 | case 0x40802: /* Intuos4 Classic Pen */ | 339 | case 0x40802: /* Intuos4 Classic Pen */ |
306 | case 0x022: | 340 | case 0x022: |
@@ -335,7 +369,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
335 | case 0x81b: /* Intuos3 Classic Pen Eraser */ | 369 | case 0x81b: /* Intuos3 Classic Pen Eraser */ |
336 | case 0x91b: /* Intuos3 Airbrush Eraser */ | 370 | case 0x91b: /* Intuos3 Airbrush Eraser */ |
337 | case 0x80c: /* Intuos4 Marker Pen Eraser */ | 371 | case 0x80c: /* Intuos4 Marker Pen Eraser */ |
338 | case 0x80a: /* Intuos4 Grip Pen Eraser */ | 372 | case 0x80a: /* Intuos4 General Pen Eraser */ |
339 | case 0x4080a: /* Intuos4 Classic Pen Eraser */ | 373 | case 0x4080a: /* Intuos4 Classic Pen Eraser */ |
340 | case 0x90a: /* Intuos4 Airbrush Eraser */ | 374 | case 0x90a: /* Intuos4 Airbrush Eraser */ |
341 | wacom->tool[idx] = BTN_TOOL_RUBBER; | 375 | wacom->tool[idx] = BTN_TOOL_RUBBER; |
@@ -356,6 +390,11 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
356 | return 1; | 390 | return 1; |
357 | } | 391 | } |
358 | 392 | ||
393 | /* older I4 styli don't work with new Cintiqs */ | ||
394 | if (!((wacom->id[idx] >> 20) & 0x01) && | ||
395 | (features->type == WACOM_21UX2)) | ||
396 | return 1; | ||
397 | |||
359 | /* Exit report */ | 398 | /* Exit report */ |
360 | if ((data[1] & 0xfe) == 0x80) { | 399 | if ((data[1] & 0xfe) == 0x80) { |
361 | /* | 400 | /* |
@@ -474,21 +513,43 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
474 | input_report_abs(input, ABS_MISC, 0); | 513 | input_report_abs(input, ABS_MISC, 0); |
475 | } | 514 | } |
476 | } else { | 515 | } else { |
477 | input_report_key(input, BTN_0, (data[5] & 0x01)); | 516 | if (features->type == WACOM_21UX2) { |
478 | input_report_key(input, BTN_1, (data[5] & 0x02)); | 517 | input_report_key(input, BTN_0, (data[5] & 0x01)); |
479 | input_report_key(input, BTN_2, (data[5] & 0x04)); | 518 | input_report_key(input, BTN_1, (data[6] & 0x01)); |
480 | input_report_key(input, BTN_3, (data[5] & 0x08)); | 519 | input_report_key(input, BTN_2, (data[6] & 0x02)); |
481 | input_report_key(input, BTN_4, (data[6] & 0x01)); | 520 | input_report_key(input, BTN_3, (data[6] & 0x04)); |
482 | input_report_key(input, BTN_5, (data[6] & 0x02)); | 521 | input_report_key(input, BTN_4, (data[6] & 0x08)); |
483 | input_report_key(input, BTN_6, (data[6] & 0x04)); | 522 | input_report_key(input, BTN_5, (data[6] & 0x10)); |
484 | input_report_key(input, BTN_7, (data[6] & 0x08)); | 523 | input_report_key(input, BTN_6, (data[6] & 0x20)); |
485 | input_report_key(input, BTN_8, (data[5] & 0x10)); | 524 | input_report_key(input, BTN_7, (data[6] & 0x40)); |
486 | input_report_key(input, BTN_9, (data[6] & 0x10)); | 525 | input_report_key(input, BTN_8, (data[6] & 0x80)); |
526 | input_report_key(input, BTN_9, (data[7] & 0x01)); | ||
527 | input_report_key(input, BTN_A, (data[8] & 0x01)); | ||
528 | input_report_key(input, BTN_B, (data[8] & 0x02)); | ||
529 | input_report_key(input, BTN_C, (data[8] & 0x04)); | ||
530 | input_report_key(input, BTN_X, (data[8] & 0x08)); | ||
531 | input_report_key(input, BTN_Y, (data[8] & 0x10)); | ||
532 | input_report_key(input, BTN_Z, (data[8] & 0x20)); | ||
533 | input_report_key(input, BTN_BASE, (data[8] & 0x40)); | ||
534 | input_report_key(input, BTN_BASE2, (data[8] & 0x80)); | ||
535 | } else { | ||
536 | input_report_key(input, BTN_0, (data[5] & 0x01)); | ||
537 | input_report_key(input, BTN_1, (data[5] & 0x02)); | ||
538 | input_report_key(input, BTN_2, (data[5] & 0x04)); | ||
539 | input_report_key(input, BTN_3, (data[5] & 0x08)); | ||
540 | input_report_key(input, BTN_4, (data[6] & 0x01)); | ||
541 | input_report_key(input, BTN_5, (data[6] & 0x02)); | ||
542 | input_report_key(input, BTN_6, (data[6] & 0x04)); | ||
543 | input_report_key(input, BTN_7, (data[6] & 0x08)); | ||
544 | input_report_key(input, BTN_8, (data[5] & 0x10)); | ||
545 | input_report_key(input, BTN_9, (data[6] & 0x10)); | ||
546 | } | ||
487 | input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); | 547 | input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
488 | input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | 548 | input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
489 | 549 | ||
490 | if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) | | 550 | if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | |
491 | data[2] | (data[3] & 0x1f) | data[4]) { | 551 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | |
552 | (data[7] & 0x01)) { | ||
492 | input_report_key(input, wacom->tool[1], 1); | 553 | input_report_key(input, wacom->tool[1], 1); |
493 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 554 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
494 | } else { | 555 | } else { |
@@ -626,10 +687,10 @@ static void wacom_tpc_finger_in(struct wacom_wac *wacom, char *data, int idx) | |||
626 | * protocol. | 687 | * protocol. |
627 | */ | 688 | */ |
628 | if (wacom->last_finger != finger) { | 689 | if (wacom->last_finger != finger) { |
629 | if (x == input->abs[ABS_X]) | 690 | if (x == input_abs_get_val(input, ABS_X)) |
630 | x++; | 691 | x++; |
631 | 692 | ||
632 | if (y == input->abs[ABS_Y]) | 693 | if (y == input_abs_get_val(input, ABS_Y)) |
633 | y++; | 694 | y++; |
634 | } | 695 | } |
635 | 696 | ||
@@ -640,7 +701,7 @@ static void wacom_tpc_finger_in(struct wacom_wac *wacom, char *data, int idx) | |||
640 | if (!idx) | 701 | if (!idx) |
641 | input_report_key(input, BTN_TOUCH, 1); | 702 | input_report_key(input, BTN_TOUCH, 1); |
642 | input_event(input, EV_MSC, MSC_SERIAL, finger); | 703 | input_event(input, EV_MSC, MSC_SERIAL, finger); |
643 | input_sync(wacom->input); | 704 | input_sync(input); |
644 | 705 | ||
645 | wacom->last_finger = finger; | 706 | wacom->last_finger = finger; |
646 | } | 707 | } |
@@ -817,6 +878,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
817 | sync = wacom_ptu_irq(wacom_wac); | 878 | sync = wacom_ptu_irq(wacom_wac); |
818 | break; | 879 | break; |
819 | 880 | ||
881 | case DTU: | ||
882 | sync = wacom_dtu_irq(wacom_wac); | ||
883 | break; | ||
884 | |||
820 | case INTUOS: | 885 | case INTUOS: |
821 | case INTUOS3S: | 886 | case INTUOS3S: |
822 | case INTUOS3: | 887 | case INTUOS3: |
@@ -826,6 +891,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
826 | case INTUOS4L: | 891 | case INTUOS4L: |
827 | case CINTIQ: | 892 | case CINTIQ: |
828 | case WACOM_BEE: | 893 | case WACOM_BEE: |
894 | case WACOM_21UX2: | ||
829 | sync = wacom_intuos_irq(wacom_wac); | 895 | sync = wacom_intuos_irq(wacom_wac); |
830 | break; | 896 | break; |
831 | 897 | ||
@@ -921,6 +987,17 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
921 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 987 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
922 | break; | 988 | break; |
923 | 989 | ||
990 | case WACOM_21UX2: | ||
991 | __set_bit(BTN_A, input_dev->keybit); | ||
992 | __set_bit(BTN_B, input_dev->keybit); | ||
993 | __set_bit(BTN_C, input_dev->keybit); | ||
994 | __set_bit(BTN_X, input_dev->keybit); | ||
995 | __set_bit(BTN_Y, input_dev->keybit); | ||
996 | __set_bit(BTN_Z, input_dev->keybit); | ||
997 | __set_bit(BTN_BASE, input_dev->keybit); | ||
998 | __set_bit(BTN_BASE2, input_dev->keybit); | ||
999 | /* fall through */ | ||
1000 | |||
924 | case WACOM_BEE: | 1001 | case WACOM_BEE: |
925 | __set_bit(BTN_8, input_dev->keybit); | 1002 | __set_bit(BTN_8, input_dev->keybit); |
926 | __set_bit(BTN_9, input_dev->keybit); | 1003 | __set_bit(BTN_9, input_dev->keybit); |
@@ -990,6 +1067,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
990 | 1067 | ||
991 | case PL: | 1068 | case PL: |
992 | case PTU: | 1069 | case PTU: |
1070 | case DTU: | ||
993 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1071 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
994 | __set_bit(BTN_STYLUS, input_dev->keybit); | 1072 | __set_bit(BTN_STYLUS, input_dev->keybit); |
995 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 1073 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
@@ -1105,6 +1183,8 @@ static const struct wacom_features wacom_features_0xBA = | |||
1105 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; | 1183 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; |
1106 | static const struct wacom_features wacom_features_0xBB = | 1184 | static const struct wacom_features wacom_features_0xBB = |
1107 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; | 1185 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; |
1186 | static const struct wacom_features wacom_features_0xBC = | ||
1187 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 63, INTUOS4 }; | ||
1108 | static const struct wacom_features wacom_features_0x3F = | 1188 | static const struct wacom_features wacom_features_0x3F = |
1109 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; | 1189 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; |
1110 | static const struct wacom_features wacom_features_0xC5 = | 1190 | static const struct wacom_features wacom_features_0xC5 = |
@@ -1113,6 +1193,12 @@ static const struct wacom_features wacom_features_0xC6 = | |||
1113 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; | 1193 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; |
1114 | static const struct wacom_features wacom_features_0xC7 = | 1194 | static const struct wacom_features wacom_features_0xC7 = |
1115 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; | 1195 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; |
1196 | static const struct wacom_features wacom_features_0xCE = | ||
1197 | { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, 0, DTU }; | ||
1198 | static const struct wacom_features wacom_features_0xF0 = | ||
1199 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, 0, DTU }; | ||
1200 | static const struct wacom_features wacom_features_0xCC = | ||
1201 | { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047, 63, WACOM_21UX2 }; | ||
1116 | static const struct wacom_features wacom_features_0x90 = | 1202 | static const struct wacom_features wacom_features_0x90 = |
1117 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; | 1203 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; |
1118 | static const struct wacom_features wacom_features_0x93 = | 1204 | static const struct wacom_features wacom_features_0x93 = |
@@ -1185,10 +1271,14 @@ const struct usb_device_id wacom_ids[] = { | |||
1185 | { USB_DEVICE_WACOM(0xB9) }, | 1271 | { USB_DEVICE_WACOM(0xB9) }, |
1186 | { USB_DEVICE_WACOM(0xBA) }, | 1272 | { USB_DEVICE_WACOM(0xBA) }, |
1187 | { USB_DEVICE_WACOM(0xBB) }, | 1273 | { USB_DEVICE_WACOM(0xBB) }, |
1274 | { USB_DEVICE_WACOM(0xBC) }, | ||
1188 | { USB_DEVICE_WACOM(0x3F) }, | 1275 | { USB_DEVICE_WACOM(0x3F) }, |
1189 | { USB_DEVICE_WACOM(0xC5) }, | 1276 | { USB_DEVICE_WACOM(0xC5) }, |
1190 | { USB_DEVICE_WACOM(0xC6) }, | 1277 | { USB_DEVICE_WACOM(0xC6) }, |
1191 | { USB_DEVICE_WACOM(0xC7) }, | 1278 | { USB_DEVICE_WACOM(0xC7) }, |
1279 | { USB_DEVICE_WACOM(0xCE) }, | ||
1280 | { USB_DEVICE_WACOM(0xF0) }, | ||
1281 | { USB_DEVICE_WACOM(0xCC) }, | ||
1192 | { USB_DEVICE_WACOM(0x90) }, | 1282 | { USB_DEVICE_WACOM(0x90) }, |
1193 | { USB_DEVICE_WACOM(0x93) }, | 1283 | { USB_DEVICE_WACOM(0x93) }, |
1194 | { USB_DEVICE_WACOM(0x9A) }, | 1284 | { USB_DEVICE_WACOM(0x9A) }, |