aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorChris Bagwell <chris@cnpbagwell.com>2012-03-26 02:26:11 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-03-26 02:31:32 -0400
commitd3825d51c3eddb8a3c7d1281f27181aff6db19b8 (patch)
treeb493c50841f11e097ddcf45f462b6da764ba1c64 /drivers/input/tablet
parent3aac0ef10bf5c76ba4262cfd9b044a6c067d5aae (diff)
Input: wacom - wireless monitor framework
The 3rd gen Bamboo Pen & Touch and Intuos5 tablets support an optional wireless module. When its receiver is plugged into USB, it presents 3 interfaces: 0) Monitor 1) Pen and 2) Touch. The exact capabilities of the Pen and Touch interfaces can not be determined until a tablet connection is established and reported over the Monitor interface. This patch detects this wireless receiver and enables interrupt packets to be processed for the Monitor interface. Processing the data in packets will be left to another patch. Since it doesn't make sense to create an input device for the Monitor interface, it is not created. Creation of Pen and Touch input device is also delayed until monitor packets can be processed. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Tested-by: Jason Gerecke <killertofu@gmail.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/wacom_sys.c36
-rw-r--r--drivers/input/tablet/wacom_wac.c28
-rw-r--r--drivers/input/tablet/wacom_wac.h4
3 files changed, 62 insertions, 6 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index f6da2f8a9c18..d8cc9ce165ff 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -422,6 +422,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
422 report_id, rep_data, 4, 1); 422 report_id, rep_data, 4, 1);
423 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); 423 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
424 } else if (features->type != TABLETPC && 424 } else if (features->type != TABLETPC &&
425 features->type != WIRELESS &&
425 features->device_type == BTN_TOOL_PEN) { 426 features->device_type == BTN_TOOL_PEN) {
426 do { 427 do {
427 rep_data[0] = 2; 428 rep_data[0] = 2;
@@ -454,6 +455,21 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
454 features->pressure_fuzz = 0; 455 features->pressure_fuzz = 0;
455 features->distance_fuzz = 0; 456 features->distance_fuzz = 0;
456 457
458 /*
459 * The wireless device HID is basic and layout conflicts with
460 * other tablets (monitor and touch interface can look like pen).
461 * Skip the query for this type and modify defaults based on
462 * interface number.
463 */
464 if (features->type == WIRELESS) {
465 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
466 features->device_type = 0;
467 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
468 features->device_type = BTN_TOOL_DOUBLETAP;
469 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
470 }
471 }
472
457 /* only Tablet PCs and Bamboo P&T need to retrieve the info */ 473 /* only Tablet PCs and Bamboo P&T need to retrieve the info */
458 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && 474 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
459 (features->type != BAMBOO_PT)) 475 (features->type != BAMBOO_PT))
@@ -928,14 +944,22 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
928 if (error) 944 if (error)
929 goto fail4; 945 goto fail4;
930 946
931 error = wacom_register_input(wacom); 947 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
932 if (error) 948 error = wacom_register_input(wacom);
933 goto fail5; 949 if (error)
950 goto fail5;
951 }
934 952
935 /* Note that if query fails it is not a hard failure */ 953 /* Note that if query fails it is not a hard failure */
936 wacom_query_tablet_data(intf, features); 954 wacom_query_tablet_data(intf, features);
937 955
938 usb_set_intfdata(intf, wacom); 956 usb_set_intfdata(intf, wacom);
957
958 if (features->quirks & WACOM_QUIRK_MONITOR) {
959 if (usb_submit_urb(wacom->irq, GFP_KERNEL))
960 goto fail5;
961 }
962
939 return 0; 963 return 0;
940 964
941 fail5: wacom_destroy_leds(wacom); 965 fail5: wacom_destroy_leds(wacom);
@@ -953,7 +977,8 @@ static void wacom_disconnect(struct usb_interface *intf)
953 usb_set_intfdata(intf, NULL); 977 usb_set_intfdata(intf, NULL);
954 978
955 usb_kill_urb(wacom->irq); 979 usb_kill_urb(wacom->irq);
956 input_unregister_device(wacom->wacom_wac.input); 980 if (wacom->wacom_wac.input)
981 input_unregister_device(wacom->wacom_wac.input);
957 wacom_destroy_leds(wacom); 982 wacom_destroy_leds(wacom);
958 usb_free_urb(wacom->irq); 983 usb_free_urb(wacom->irq);
959 usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, 984 usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX,
@@ -985,7 +1010,8 @@ static int wacom_resume(struct usb_interface *intf)
985 wacom_query_tablet_data(intf, features); 1010 wacom_query_tablet_data(intf, features);
986 wacom_led_control(wacom); 1011 wacom_led_control(wacom);
987 1012
988 if (wacom->open && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) 1013 if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR)
1014 && usb_submit_urb(wacom->irq, GFP_NOIO) < 0)
989 rv = -EIO; 1015 rv = -EIO;
990 1016
991 mutex_unlock(&wacom->lock); 1017 mutex_unlock(&wacom->lock);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 07a1f218b5c1..6264e6a8d513 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1044,6 +1044,14 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
1044 return 0; 1044 return 0;
1045} 1045}
1046 1046
1047static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
1048{
1049 if (len != WACOM_PKGLEN_WIRELESS)
1050 return 0;
1051
1052 return 0;
1053}
1054
1047void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) 1055void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1048{ 1056{
1049 bool sync; 1057 bool sync;
@@ -1094,6 +1102,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1094 sync = wacom_bpt_irq(wacom_wac, len); 1102 sync = wacom_bpt_irq(wacom_wac, len);
1095 break; 1103 break;
1096 1104
1105 case WIRELESS:
1106 sync = wacom_wireless_irq(wacom_wac, len);
1107 break;
1108
1097 default: 1109 default:
1098 sync = false; 1110 sync = false;
1099 break; 1111 break;
@@ -1155,7 +1167,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1155 1167
1156 /* these device have multiple inputs */ 1168 /* these device have multiple inputs */
1157 if (features->type == TABLETPC || features->type == TABLETPC2FG || 1169 if (features->type == TABLETPC || features->type == TABLETPC2FG ||
1158 features->type == BAMBOO_PT) 1170 features->type == BAMBOO_PT || features->type == WIRELESS)
1159 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1171 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1160 1172
1161 /* quirk for bamboo touch with 2 low res touches */ 1173 /* quirk for bamboo touch with 2 low res touches */
@@ -1167,6 +1179,16 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1167 features->y_fuzz <<= 5; 1179 features->y_fuzz <<= 5;
1168 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; 1180 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
1169 } 1181 }
1182
1183 if (features->type == WIRELESS) {
1184
1185 /* monitor never has input and pen/touch have delayed create */
1186 features->quirks |= WACOM_QUIRK_NO_INPUT;
1187
1188 /* must be monitor interface if no device_type set */
1189 if (!features->device_type)
1190 features->quirks |= WACOM_QUIRK_MONITOR;
1191 }
1170} 1192}
1171 1193
1172static unsigned int wacom_calculate_touch_res(unsigned int logical_max, 1194static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
@@ -1640,6 +1662,9 @@ static const struct wacom_features wacom_features_0xEC =
1640static const struct wacom_features wacom_features_0x47 = 1662static const struct wacom_features wacom_features_0x47 =
1641 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 1663 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1642 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1664 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1665static const struct wacom_features wacom_features_0x84 =
1666 { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0,
1667 0, WIRELESS, 0, 0 };
1643static const struct wacom_features wacom_features_0xD0 = 1668static const struct wacom_features wacom_features_0xD0 =
1644 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1669 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1645 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1670 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1766,6 +1791,7 @@ const struct usb_device_id wacom_ids[] = {
1766 { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID, 1791 { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID,
1767 USB_INTERFACE_SUBCLASS_BOOT, 1792 USB_INTERFACE_SUBCLASS_BOOT,
1768 USB_INTERFACE_PROTOCOL_MOUSE) }, 1793 USB_INTERFACE_PROTOCOL_MOUSE) },
1794 { USB_DEVICE_WACOM(0x84) },
1769 { USB_DEVICE_WACOM(0xD0) }, 1795 { USB_DEVICE_WACOM(0xD0) },
1770 { USB_DEVICE_WACOM(0xD1) }, 1796 { USB_DEVICE_WACOM(0xD1) },
1771 { USB_DEVICE_WACOM(0xD2) }, 1797 { USB_DEVICE_WACOM(0xD2) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 4f0ba21b0196..2c04b6248a56 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -24,6 +24,7 @@
24#define WACOM_PKGLEN_BBTOUCH 20 24#define WACOM_PKGLEN_BBTOUCH 20
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 28
28/* device IDs */ 29/* device IDs */
29#define STYLUS_DEVICE_ID 0x02 30#define STYLUS_DEVICE_ID 0x02
@@ -45,6 +46,8 @@
45/* device quirks */ 46/* device quirks */
46#define WACOM_QUIRK_MULTI_INPUT 0x0001 47#define WACOM_QUIRK_MULTI_INPUT 0x0001
47#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 48#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
49#define WACOM_QUIRK_NO_INPUT 0x0004
50#define WACOM_QUIRK_MONITOR 0x0008
48 51
49enum { 52enum {
50 PENPARTNER = 0, 53 PENPARTNER = 0,
@@ -54,6 +57,7 @@ enum {
54 PL, 57 PL,
55 DTU, 58 DTU,
56 BAMBOO_PT, 59 BAMBOO_PT,
60 WIRELESS,
57 INTUOS, 61 INTUOS,
58 INTUOS3S, 62 INTUOS3S,
59 INTUOS3, 63 INTUOS3,