aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/tablet/wacom.h7
-rw-r--r--drivers/input/tablet/wacom_sys.c12
-rw-r--r--drivers/input/tablet/wacom_wac.c81
3 files changed, 47 insertions, 53 deletions
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 103a8cc29449..56a37074e0dd 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -115,14 +115,9 @@ struct wacom {
115 char phys[32]; 115 char phys[32];
116}; 116};
117 117
118struct wacom_combo {
119 struct wacom *wacom;
120 struct urb *urb;
121};
122
123extern const struct usb_device_id wacom_ids[]; 118extern const struct usb_device_id wacom_ids[];
124 119
125int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); 120void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
126void wacom_setup_input_capabilities(struct input_dev *input_dev, 121void wacom_setup_input_capabilities(struct input_dev *input_dev,
127 struct wacom_wac *wacom_wac); 122 struct wacom_wac *wacom_wac);
128__u16 wacom_le16_to_cpu(unsigned char *data); 123__u16 wacom_le16_to_cpu(unsigned char *data);
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 58bb763b60dd..c37e22b968d9 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -70,15 +70,9 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
70 buf, size, 1000); 70 buf, size, 1000);
71} 71}
72 72
73static struct input_dev * get_input_dev(struct wacom_combo *wcombo)
74{
75 return wcombo->wacom->wacom_wac.input;
76}
77
78static void wacom_sys_irq(struct urb *urb) 73static void wacom_sys_irq(struct urb *urb)
79{ 74{
80 struct wacom *wacom = urb->context; 75 struct wacom *wacom = urb->context;
81 struct wacom_combo wcombo;
82 int retval; 76 int retval;
83 77
84 switch (urb->status) { 78 switch (urb->status) {
@@ -96,11 +90,7 @@ static void wacom_sys_irq(struct urb *urb)
96 goto exit; 90 goto exit;
97 } 91 }
98 92
99 wcombo.wacom = wacom; 93 wacom_wac_irq(&wacom->wacom_wac, urb->actual_length);
100 wcombo.urb = urb;
101
102 if (wacom_wac_irq(&wacom->wacom_wac, &wcombo))
103 input_sync(get_input_dev(&wcombo));
104 94
105 exit: 95 exit:
106 usb_mark_last_busy(wacom->usbdev); 96 usb_mark_last_busy(wacom->usbdev);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 9cf4854a9818..8163e8f06f29 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -15,7 +15,7 @@
15#include "wacom_wac.h" 15#include "wacom_wac.h"
16#include "wacom.h" 16#include "wacom.h"
17 17
18static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) 18static int wacom_penpartner_irq(struct wacom_wac *wacom)
19{ 19{
20 unsigned char *data = wacom->data; 20 unsigned char *data = wacom->data;
21 struct input_dev *input = wacom->input; 21 struct input_dev *input = wacom->input;
@@ -58,7 +58,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
58 return 1; 58 return 1;
59} 59}
60 60
61static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) 61static int wacom_pl_irq(struct wacom_wac *wacom)
62{ 62{
63 struct wacom_features *features = &wacom->features; 63 struct wacom_features *features = &wacom->features;
64 unsigned char *data = wacom->data; 64 unsigned char *data = wacom->data;
@@ -130,7 +130,7 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
130 return 1; 130 return 1;
131} 131}
132 132
133static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) 133static int wacom_ptu_irq(struct wacom_wac *wacom)
134{ 134{
135 unsigned char *data = wacom->data; 135 unsigned char *data = wacom->data;
136 struct input_dev *input = wacom->input; 136 struct input_dev *input = wacom->input;
@@ -158,7 +158,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
158 return 1; 158 return 1;
159} 159}
160 160
161static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) 161static int wacom_graphire_irq(struct wacom_wac *wacom)
162{ 162{
163 struct wacom_features *features = &wacom->features; 163 struct wacom_features *features = &wacom->features;
164 unsigned char *data = wacom->data; 164 unsigned char *data = wacom->data;
@@ -269,7 +269,7 @@ exit:
269 return retval; 269 return retval;
270} 270}
271 271
272static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) 272static int wacom_intuos_inout(struct wacom_wac *wacom)
273{ 273{
274 struct wacom_features *features = &wacom->features; 274 struct wacom_features *features = &wacom->features;
275 unsigned char *data = wacom->data; 275 unsigned char *data = wacom->data;
@@ -396,7 +396,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
396 return 0; 396 return 0;
397} 397}
398 398
399static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) 399static void wacom_intuos_general(struct wacom_wac *wacom)
400{ 400{
401 struct wacom_features *features = &wacom->features; 401 struct wacom_features *features = &wacom->features;
402 unsigned char *data = wacom->data; 402 unsigned char *data = wacom->data;
@@ -427,7 +427,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
427 } 427 }
428} 428}
429 429
430static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) 430static int wacom_intuos_irq(struct wacom_wac *wacom)
431{ 431{
432 struct wacom_features *features = &wacom->features; 432 struct wacom_features *features = &wacom->features;
433 unsigned char *data = wacom->data; 433 unsigned char *data = wacom->data;
@@ -504,7 +504,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
504 } 504 }
505 505
506 /* process in/out prox events */ 506 /* process in/out prox events */
507 result = wacom_intuos_inout(wacom, wcombo); 507 result = wacom_intuos_inout(wacom);
508 if (result) 508 if (result)
509 return result - 1; 509 return result - 1;
510 510
@@ -537,7 +537,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
537 } 537 }
538 538
539 /* process general packets */ 539 /* process general packets */
540 wacom_intuos_general(wacom, wcombo); 540 wacom_intuos_general(wacom);
541 541
542 /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */ 542 /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
543 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) { 543 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
@@ -615,7 +615,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
615} 615}
616 616
617 617
618static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx) 618static void wacom_tpc_finger_in(struct wacom_wac *wacom, char *data, int idx)
619{ 619{
620 struct input_dev *input = wacom->input; 620 struct input_dev *input = wacom->input;
621 621
@@ -631,7 +631,7 @@ static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *dat
631 input_report_key(input, BTN_TOUCH, 1); 631 input_report_key(input, BTN_TOUCH, 1);
632} 632}
633 633
634static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx) 634static void wacom_tpc_touch_out(struct wacom_wac *wacom, int idx)
635{ 635{
636 struct input_dev *input = wacom->input; 636 struct input_dev *input = wacom->input;
637 637
@@ -645,11 +645,10 @@ static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx)
645 input_report_key(input, BTN_TOUCH, 0); 645 input_report_key(input, BTN_TOUCH, 0);
646} 646}
647 647
648static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo) 648static void wacom_tpc_touch_in(struct wacom_wac *wacom, size_t len)
649{ 649{
650 char *data = wacom->data; 650 char *data = wacom->data;
651 struct input_dev *input = wacom->input; 651 struct input_dev *input = wacom->input;
652 struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
653 static int firstFinger = 0; 652 static int firstFinger = 0;
654 static int secondFinger = 0; 653 static int secondFinger = 0;
655 654
@@ -657,7 +656,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
657 wacom->id[0] = TOUCH_DEVICE_ID; 656 wacom->id[0] = TOUCH_DEVICE_ID;
658 wacom->tool[1] = BTN_TOOL_TRIPLETAP; 657 wacom->tool[1] = BTN_TOOL_TRIPLETAP;
659 658
660 if (urb->actual_length != WACOM_PKGLEN_TPC1FG) { 659 if (len != WACOM_PKGLEN_TPC1FG) {
661 660
662 switch (data[0]) { 661 switch (data[0]) {
663 662
@@ -675,10 +674,10 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
675 wacom->id[1] = data[1] & 0x03; 674 wacom->id[1] = data[1] & 0x03;
676 675
677 if (data[1] & 0x01) { 676 if (data[1] & 0x01) {
678 wacom_tpc_finger_in(wacom, wcombo, data, 0); 677 wacom_tpc_finger_in(wacom, data, 0);
679 firstFinger = 1; 678 firstFinger = 1;
680 } else if (firstFinger) { 679 } else if (firstFinger) {
681 wacom_tpc_touch_out(wacom, wcombo, 0); 680 wacom_tpc_touch_out(wacom, 0);
682 } 681 }
683 682
684 if (data[1] & 0x02) { 683 if (data[1] & 0x02) {
@@ -686,14 +685,14 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
686 if (firstFinger) 685 if (firstFinger)
687 input_sync(input); 686 input_sync(input);
688 687
689 wacom_tpc_finger_in(wacom, wcombo, data, 1); 688 wacom_tpc_finger_in(wacom, data, 1);
690 secondFinger = 1; 689 secondFinger = 1;
691 } else if (secondFinger) { 690 } else if (secondFinger) {
692 /* sync first finger data */ 691 /* sync first finger data */
693 if (firstFinger) 692 if (firstFinger)
694 input_sync(input); 693 input_sync(input);
695 694
696 wacom_tpc_touch_out(wacom, wcombo, 1); 695 wacom_tpc_touch_out(wacom, 1);
697 secondFinger = 0; 696 secondFinger = 0;
698 } 697 }
699 if (!(data[1] & 0x01)) 698 if (!(data[1] & 0x01))
@@ -709,20 +708,19 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
709 } 708 }
710} 709}
711 710
712static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) 711static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
713{ 712{
714 struct wacom_features *features = &wacom->features; 713 struct wacom_features *features = &wacom->features;
715 char *data = wacom->data; 714 char *data = wacom->data;
716 struct input_dev *input = wacom->input; 715 struct input_dev *input = wacom->input;
717 int prox = 0, pressure, idx = -1; 716 int prox = 0, pressure, idx = -1;
718 struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
719 717
720 dbg("wacom_tpc_irq: received report #%d", data[0]); 718 dbg("wacom_tpc_irq: received report #%d", data[0]);
721 719
722 if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */ 720 if (len == WACOM_PKGLEN_TPC1FG || /* single touch */
723 data[0] == WACOM_REPORT_TPC1FG || /* single touch */ 721 data[0] == WACOM_REPORT_TPC1FG || /* single touch */
724 data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */ 722 data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
725 if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */ 723 if (len == WACOM_PKGLEN_TPC1FG) { /* with touch */
726 prox = data[0] & 0x01; 724 prox = data[0] & 0x01;
727 } else { /* with capacity */ 725 } else { /* with capacity */
728 if (data[0] == WACOM_REPORT_TPC1FG) 726 if (data[0] == WACOM_REPORT_TPC1FG)
@@ -735,28 +733,28 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
735 733
736 if (!wacom->shared->stylus_in_proximity) { 734 if (!wacom->shared->stylus_in_proximity) {
737 if (prox) { 735 if (prox) {
738 wacom_tpc_touch_in(wacom, wcombo); 736 wacom_tpc_touch_in(wacom, len);
739 } else { 737 } else {
740 if (data[0] == WACOM_REPORT_TPC2FG) { 738 if (data[0] == WACOM_REPORT_TPC2FG) {
741 /* 2FGT out-prox */ 739 /* 2FGT out-prox */
742 idx = (wacom->id[1] & 0x01) - 1; 740 idx = (wacom->id[1] & 0x01) - 1;
743 if (idx == 0) { 741 if (idx == 0) {
744 wacom_tpc_touch_out(wacom, wcombo, idx); 742 wacom_tpc_touch_out(wacom, idx);
745 /* sync first finger event */ 743 /* sync first finger event */
746 if (wacom->id[1] & 0x02) 744 if (wacom->id[1] & 0x02)
747 input_sync(input); 745 input_sync(input);
748 } 746 }
749 idx = (wacom->id[1] & 0x02) - 1; 747 idx = (wacom->id[1] & 0x02) - 1;
750 if (idx == 1) 748 if (idx == 1)
751 wacom_tpc_touch_out(wacom, wcombo, idx); 749 wacom_tpc_touch_out(wacom, idx);
752 } else { 750 } else {
753 /* one finger touch */ 751 /* one finger touch */
754 wacom_tpc_touch_out(wacom, wcombo, 0); 752 wacom_tpc_touch_out(wacom, 0);
755 } 753 }
756 wacom->id[0] = 0; 754 wacom->id[0] = 0;
757 } 755 }
758 } else if (wacom->id[0]) { /* force touch out-prox */ 756 } else if (wacom->id[0]) { /* force touch out-prox */
759 wacom_tpc_touch_out(wacom, wcombo, 0); 757 wacom_tpc_touch_out(wacom, 0);
760 } 758 }
761 return 1; 759 return 1;
762 } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */ 760 } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
@@ -792,22 +790,28 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
792 return 0; 790 return 0;
793} 791}
794 792
795int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) 793void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
796{ 794{
795 bool sync;
796
797 switch (wacom_wac->features.type) { 797 switch (wacom_wac->features.type) {
798 case PENPARTNER: 798 case PENPARTNER:
799 return wacom_penpartner_irq(wacom_wac, wcombo); 799 sync = wacom_penpartner_irq(wacom_wac);
800 break;
800 801
801 case PL: 802 case PL:
802 return wacom_pl_irq(wacom_wac, wcombo); 803 sync = wacom_pl_irq(wacom_wac);
804 break;
803 805
804 case WACOM_G4: 806 case WACOM_G4:
805 case GRAPHIRE: 807 case GRAPHIRE:
806 case WACOM_MO: 808 case WACOM_MO:
807 return wacom_graphire_irq(wacom_wac, wcombo); 809 sync = wacom_graphire_irq(wacom_wac);
810 break;
808 811
809 case PTU: 812 case PTU:
810 return wacom_ptu_irq(wacom_wac, wcombo); 813 sync = wacom_ptu_irq(wacom_wac);
814 break;
811 815
812 case INTUOS: 816 case INTUOS:
813 case INTUOS3S: 817 case INTUOS3S:
@@ -818,16 +822,21 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
818 case INTUOS4L: 822 case INTUOS4L:
819 case CINTIQ: 823 case CINTIQ:
820 case WACOM_BEE: 824 case WACOM_BEE:
821 return wacom_intuos_irq(wacom_wac, wcombo); 825 sync = wacom_intuos_irq(wacom_wac);
826 break;
822 827
823 case TABLETPC: 828 case TABLETPC:
824 case TABLETPC2FG: 829 case TABLETPC2FG:
825 return wacom_tpc_irq(wacom_wac, wcombo); 830 sync = wacom_tpc_irq(wacom_wac, len);
831 break;
826 832
827 default: 833 default:
828 return 0; 834 sync = false;
835 break;
829 } 836 }
830 return 0; 837
838 if (sync)
839 input_sync(wacom_wac->input);
831} 840}
832 841
833static void wacom_setup_intuos(struct wacom_wac *wacom_wac) 842static void wacom_setup_intuos(struct wacom_wac *wacom_wac)