aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-25 01:43:04 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-25 01:43:04 -0400
commit314820c9e892d8f41ba4db300ec96770d9c8294b (patch)
tree3d5c59a429239b180c77e57f998a78d3f2b79827 /drivers/input/tablet
parente76b8ee25e034ab601b525abb95cea14aa167ed3 (diff)
parent07b8481d4aff73d6f451f25e74ea10240ff5131e (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/acecad.c15
-rw-r--r--drivers/input/tablet/aiptek.c28
-rw-r--r--drivers/input/tablet/gtco.c110
-rw-r--r--drivers/input/tablet/hanwang.c57
-rw-r--r--drivers/input/tablet/kbtab.c15
-rw-r--r--drivers/input/tablet/wacom_sys.c112
-rw-r--r--drivers/input/tablet/wacom_wac.c27
-rw-r--r--drivers/input/tablet/wacom_wac.h8
8 files changed, 230 insertions, 142 deletions
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index f8b0b1df9138..e062ec899ca1 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -51,6 +51,7 @@ struct usb_acecad {
51 char name[128]; 51 char name[128];
52 char phys[64]; 52 char phys[64];
53 struct usb_device *usbdev; 53 struct usb_device *usbdev;
54 struct usb_interface *intf;
54 struct input_dev *input; 55 struct input_dev *input;
55 struct urb *irq; 56 struct urb *irq;
56 57
@@ -63,6 +64,7 @@ static void usb_acecad_irq(struct urb *urb)
63 struct usb_acecad *acecad = urb->context; 64 struct usb_acecad *acecad = urb->context;
64 unsigned char *data = acecad->data; 65 unsigned char *data = acecad->data;
65 struct input_dev *dev = acecad->input; 66 struct input_dev *dev = acecad->input;
67 struct usb_interface *intf = acecad->intf;
66 int prox, status; 68 int prox, status;
67 69
68 switch (urb->status) { 70 switch (urb->status) {
@@ -73,10 +75,12 @@ static void usb_acecad_irq(struct urb *urb)
73 case -ENOENT: 75 case -ENOENT:
74 case -ESHUTDOWN: 76 case -ESHUTDOWN:
75 /* this urb is terminated, clean up */ 77 /* this urb is terminated, clean up */
76 dbg("%s - urb shutting down with status: %d", __func__, urb->status); 78 dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n",
79 __func__, urb->status);
77 return; 80 return;
78 default: 81 default:
79 dbg("%s - nonzero urb status received: %d", __func__, urb->status); 82 dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n",
83 __func__, urb->status);
80 goto resubmit; 84 goto resubmit;
81 } 85 }
82 86
@@ -105,8 +109,10 @@ static void usb_acecad_irq(struct urb *urb)
105resubmit: 109resubmit:
106 status = usb_submit_urb(urb, GFP_ATOMIC); 110 status = usb_submit_urb(urb, GFP_ATOMIC);
107 if (status) 111 if (status)
108 err("can't resubmit intr, %s-%s/input0, status %d", 112 dev_err(&intf->dev,
109 acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); 113 "can't resubmit intr, %s-%s/input0, status %d\n",
114 acecad->usbdev->bus->bus_name,
115 acecad->usbdev->devpath, status);
110} 116}
111 117
112static int usb_acecad_open(struct input_dev *dev) 118static int usb_acecad_open(struct input_dev *dev)
@@ -168,6 +174,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
168 } 174 }
169 175
170 acecad->usbdev = dev; 176 acecad->usbdev = dev;
177 acecad->intf = intf;
171 acecad->input = input_dev; 178 acecad->input = input_dev;
172 179
173 if (dev->manufacturer) 180 if (dev->manufacturer)
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index a33d3470c47a..ee83c3904ee8 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -309,6 +309,7 @@ struct aiptek_settings {
309struct aiptek { 309struct aiptek {
310 struct input_dev *inputdev; /* input device struct */ 310 struct input_dev *inputdev; /* input device struct */
311 struct usb_device *usbdev; /* usb device struct */ 311 struct usb_device *usbdev; /* usb device struct */
312 struct usb_interface *intf; /* usb interface struct */
312 struct urb *urb; /* urb for incoming reports */ 313 struct urb *urb; /* urb for incoming reports */
313 dma_addr_t data_dma; /* our dma stuffage */ 314 dma_addr_t data_dma; /* our dma stuffage */
314 struct aiptek_features features; /* tablet's array of features */ 315 struct aiptek_features features; /* tablet's array of features */
@@ -435,6 +436,7 @@ static void aiptek_irq(struct urb *urb)
435 struct aiptek *aiptek = urb->context; 436 struct aiptek *aiptek = urb->context;
436 unsigned char *data = aiptek->data; 437 unsigned char *data = aiptek->data;
437 struct input_dev *inputdev = aiptek->inputdev; 438 struct input_dev *inputdev = aiptek->inputdev;
439 struct usb_interface *intf = aiptek->intf;
438 int jitterable = 0; 440 int jitterable = 0;
439 int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; 441 int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck;
440 442
@@ -447,13 +449,13 @@ static void aiptek_irq(struct urb *urb)
447 case -ENOENT: 449 case -ENOENT:
448 case -ESHUTDOWN: 450 case -ESHUTDOWN:
449 /* This urb is terminated, clean up */ 451 /* This urb is terminated, clean up */
450 dbg("%s - urb shutting down with status: %d", 452 dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n",
451 __func__, urb->status); 453 __func__, urb->status);
452 return; 454 return;
453 455
454 default: 456 default:
455 dbg("%s - nonzero urb status received: %d", 457 dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n",
456 __func__, urb->status); 458 __func__, urb->status);
457 goto exit; 459 goto exit;
458 } 460 }
459 461
@@ -785,7 +787,7 @@ static void aiptek_irq(struct urb *urb)
785 1 | AIPTEK_REPORT_TOOL_UNKNOWN); 787 1 | AIPTEK_REPORT_TOOL_UNKNOWN);
786 input_sync(inputdev); 788 input_sync(inputdev);
787 } else { 789 } else {
788 dbg("Unknown report %d", data[0]); 790 dev_dbg(&intf->dev, "Unknown report %d\n", data[0]);
789 } 791 }
790 792
791 /* Jitter may occur when the user presses a button on the stlyus 793 /* Jitter may occur when the user presses a button on the stlyus
@@ -811,8 +813,9 @@ static void aiptek_irq(struct urb *urb)
811exit: 813exit:
812 retval = usb_submit_urb(urb, GFP_ATOMIC); 814 retval = usb_submit_urb(urb, GFP_ATOMIC);
813 if (retval != 0) { 815 if (retval != 0) {
814 err("%s - usb_submit_urb failed with result %d", 816 dev_err(&intf->dev,
815 __func__, retval); 817 "%s - usb_submit_urb failed with result %d\n",
818 __func__, retval);
816 } 819 }
817} 820}
818 821
@@ -912,8 +915,9 @@ aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data)
912 915
913 if ((ret = 916 if ((ret =
914 aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { 917 aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
915 dbg("aiptek_program: failed, tried to send: 0x%02x 0x%02x", 918 dev_dbg(&aiptek->intf->dev,
916 command, data); 919 "aiptek_program: failed, tried to send: 0x%02x 0x%02x\n",
920 command, data);
917 } 921 }
918 kfree(buf); 922 kfree(buf);
919 return ret < 0 ? ret : 0; 923 return ret < 0 ? ret : 0;
@@ -947,8 +951,9 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
947 951
948 if ((ret = 952 if ((ret =
949 aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { 953 aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
950 dbg("aiptek_query failed: returned 0x%02x 0x%02x 0x%02x", 954 dev_dbg(&aiptek->intf->dev,
951 buf[0], buf[1], buf[2]); 955 "aiptek_query failed: returned 0x%02x 0x%02x 0x%02x\n",
956 buf[0], buf[1], buf[2]);
952 ret = -EIO; 957 ret = -EIO;
953 } else { 958 } else {
954 ret = get_unaligned_le16(buf + 1); 959 ret = get_unaligned_le16(buf + 1);
@@ -1726,6 +1731,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1726 1731
1727 aiptek->inputdev = inputdev; 1732 aiptek->inputdev = inputdev;
1728 aiptek->usbdev = usbdev; 1733 aiptek->usbdev = usbdev;
1734 aiptek->intf = intf;
1729 aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; 1735 aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
1730 aiptek->inDelay = 0; 1736 aiptek->inDelay = 0;
1731 aiptek->endDelay = 0; 1737 aiptek->endDelay = 0;
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 89a297801dce..29e01ab6859f 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -2,8 +2,6 @@
2 2
3GTCO digitizer USB driver 3GTCO digitizer USB driver
4 4
5Use the err() and dbg() macros from usb.h for system logging
6
7TO CHECK: Is pressure done right on report 5? 5TO CHECK: Is pressure done right on report 5?
8 6
9Copyright (C) 2006 GTCO CalComp 7Copyright (C) 2006 GTCO CalComp
@@ -108,6 +106,7 @@ struct gtco {
108 106
109 struct input_dev *inputdevice; /* input device struct pointer */ 107 struct input_dev *inputdevice; /* input device struct pointer */
110 struct usb_device *usbdev; /* the usb device for this device */ 108 struct usb_device *usbdev; /* the usb device for this device */
109 struct usb_interface *intf; /* the usb interface for this device */
111 struct urb *urbinfo; /* urb for incoming reports */ 110 struct urb *urbinfo; /* urb for incoming reports */
112 dma_addr_t buf_dma; /* dma addr of the data buffer*/ 111 dma_addr_t buf_dma; /* dma addr of the data buffer*/
113 unsigned char * buffer; /* databuffer for reports */ 112 unsigned char * buffer; /* databuffer for reports */
@@ -202,6 +201,7 @@ struct hid_descriptor
202static void parse_hid_report_descriptor(struct gtco *device, char * report, 201static void parse_hid_report_descriptor(struct gtco *device, char * report,
203 int length) 202 int length)
204{ 203{
204 struct device *ddev = &device->intf->dev;
205 int x, i = 0; 205 int x, i = 0;
206 206
207 /* Tag primitive vars */ 207 /* Tag primitive vars */
@@ -228,7 +228,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
228 char indentstr[10] = ""; 228 char indentstr[10] = "";
229 229
230 230
231 dbg("======>>>>>>PARSE<<<<<<======"); 231 dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n");
232 232
233 /* Walk this report and pull out the info we need */ 233 /* Walk this report and pull out the info we need */
234 while (i < length) { 234 while (i < length) {
@@ -277,11 +277,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
277 else if (data == 3) 277 else if (data == 3)
278 strcpy(globtype, "Var|Const"); 278 strcpy(globtype, "Var|Const");
279 279
280 dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", 280 dev_dbg(ddev, "::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\n",
281 globalval[TAG_GLOB_REPORT_ID], inputnum, 281 globalval[TAG_GLOB_REPORT_ID], inputnum,
282 globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], 282 globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],
283 globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], 283 globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],
284 globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); 284 globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);
285 285
286 286
287 /* 287 /*
@@ -292,7 +292,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
292 */ 292 */
293 switch (inputnum) { 293 switch (inputnum) {
294 case 0: /* X coord */ 294 case 0: /* X coord */
295 dbg("GER: X Usage: 0x%x", usage); 295 dev_dbg(ddev, "GER: X Usage: 0x%x\n", usage);
296 if (device->max_X == 0) { 296 if (device->max_X == 0) {
297 device->max_X = globalval[TAG_GLOB_LOG_MAX]; 297 device->max_X = globalval[TAG_GLOB_LOG_MAX];
298 device->min_X = globalval[TAG_GLOB_LOG_MIN]; 298 device->min_X = globalval[TAG_GLOB_LOG_MIN];
@@ -300,7 +300,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
300 break; 300 break;
301 301
302 case 1: /* Y coord */ 302 case 1: /* Y coord */
303 dbg("GER: Y Usage: 0x%x", usage); 303 dev_dbg(ddev, "GER: Y Usage: 0x%x\n", usage);
304 if (device->max_Y == 0) { 304 if (device->max_Y == 0) {
305 device->max_Y = globalval[TAG_GLOB_LOG_MAX]; 305 device->max_Y = globalval[TAG_GLOB_LOG_MAX];
306 device->min_Y = globalval[TAG_GLOB_LOG_MIN]; 306 device->min_Y = globalval[TAG_GLOB_LOG_MIN];
@@ -350,10 +350,10 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
350 maintype = 'S'; 350 maintype = 'S';
351 351
352 if (data == 0) { 352 if (data == 0) {
353 dbg("======>>>>>> Physical"); 353 dev_dbg(ddev, "======>>>>>> Physical\n");
354 strcpy(globtype, "Physical"); 354 strcpy(globtype, "Physical");
355 } else 355 } else
356 dbg("======>>>>>>"); 356 dev_dbg(ddev, "======>>>>>>\n");
357 357
358 /* Indent the debug output */ 358 /* Indent the debug output */
359 indent++; 359 indent++;
@@ -368,7 +368,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
368 break; 368 break;
369 369
370 case TAG_MAIN_COL_END: 370 case TAG_MAIN_COL_END:
371 dbg("<<<<<<======"); 371 dev_dbg(ddev, "<<<<<<======\n");
372 maintype = 'E'; 372 maintype = 'E';
373 indent--; 373 indent--;
374 for (x = 0; x < indent; x++) 374 for (x = 0; x < indent; x++)
@@ -384,18 +384,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
384 384
385 switch (size) { 385 switch (size) {
386 case 1: 386 case 1:
387 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 387 dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
388 indentstr, tag, maintype, size, globtype, data); 388 indentstr, tag, maintype, size, globtype, data);
389 break; 389 break;
390 390
391 case 2: 391 case 2:
392 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 392 dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
393 indentstr, tag, maintype, size, globtype, data16); 393 indentstr, tag, maintype, size, globtype, data16);
394 break; 394 break;
395 395
396 case 4: 396 case 4:
397 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 397 dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
398 indentstr, tag, maintype, size, globtype, data32); 398 indentstr, tag, maintype, size, globtype, data32);
399 break; 399 break;
400 } 400 }
401 break; 401 break;
@@ -465,26 +465,26 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
465 if (tag < TAG_GLOB_MAX) { 465 if (tag < TAG_GLOB_MAX) {
466 switch (size) { 466 switch (size) {
467 case 1: 467 case 1:
468 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", 468 dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
469 indentstr, globtype, tag, size, data); 469 indentstr, globtype, tag, size, data);
470 globalval[tag] = data; 470 globalval[tag] = data;
471 break; 471 break;
472 472
473 case 2: 473 case 2:
474 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", 474 dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
475 indentstr, globtype, tag, size, data16); 475 indentstr, globtype, tag, size, data16);
476 globalval[tag] = data16; 476 globalval[tag] = data16;
477 break; 477 break;
478 478
479 case 4: 479 case 4:
480 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", 480 dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
481 indentstr, globtype, tag, size, data32); 481 indentstr, globtype, tag, size, data32);
482 globalval[tag] = data32; 482 globalval[tag] = data32;
483 break; 483 break;
484 } 484 }
485 } else { 485 } else {
486 dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", 486 dev_dbg(ddev, "%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\n",
487 indentstr, tag, size); 487 indentstr, tag, size);
488 } 488 }
489 break; 489 break;
490 490
@@ -511,18 +511,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
511 511
512 switch (size) { 512 switch (size) {
513 case 1: 513 case 1:
514 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 514 dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
515 indentstr, tag, globtype, size, data); 515 indentstr, tag, globtype, size, data);
516 break; 516 break;
517 517
518 case 2: 518 case 2:
519 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 519 dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
520 indentstr, tag, globtype, size, data16); 520 indentstr, tag, globtype, size, data16);
521 break; 521 break;
522 522
523 case 4: 523 case 4:
524 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 524 dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
525 indentstr, tag, globtype, size, data32); 525 indentstr, tag, globtype, size, data32);
526 break; 526 break;
527 } 527 }
528 528
@@ -714,8 +714,9 @@ static void gtco_urb_callback(struct urb *urbinfo)
714 * the rest as 0 714 * the rest as 0
715 */ 715 */
716 val = device->buffer[5] & MASK_BUTTON; 716 val = device->buffer[5] & MASK_BUTTON;
717 dbg("======>>>>>>REPORT 1: val 0x%X(%d)", 717 dev_dbg(&device->intf->dev,
718 val, val); 718 "======>>>>>>REPORT 1: val 0x%X(%d)\n",
719 val, val);
719 720
720 /* 721 /*
721 * We don't apply any meaning to the button 722 * We don't apply any meaning to the button
@@ -808,7 +809,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
808 resubmit: 809 resubmit:
809 rc = usb_submit_urb(urbinfo, GFP_ATOMIC); 810 rc = usb_submit_urb(urbinfo, GFP_ATOMIC);
810 if (rc != 0) 811 if (rc != 0)
811 err("usb_submit_urb failed rc=0x%x", rc); 812 dev_err(&device->intf->dev,
813 "usb_submit_urb failed rc=0x%x\n", rc);
812} 814}
813 815
814/* 816/*
@@ -838,7 +840,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
838 gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); 840 gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL);
839 input_dev = input_allocate_device(); 841 input_dev = input_allocate_device();
840 if (!gtco || !input_dev) { 842 if (!gtco || !input_dev) {
841 err("No more memory"); 843 dev_err(&usbinterface->dev, "No more memory\n");
842 error = -ENOMEM; 844 error = -ENOMEM;
843 goto err_free_devs; 845 goto err_free_devs;
844 } 846 }
@@ -848,12 +850,13 @@ static int gtco_probe(struct usb_interface *usbinterface,
848 850
849 /* Save interface information */ 851 /* Save interface information */
850 gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); 852 gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface));
853 gtco->intf = usbinterface;
851 854
852 /* Allocate some data for incoming reports */ 855 /* Allocate some data for incoming reports */
853 gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, 856 gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE,
854 GFP_KERNEL, &gtco->buf_dma); 857 GFP_KERNEL, &gtco->buf_dma);
855 if (!gtco->buffer) { 858 if (!gtco->buffer) {
856 err("No more memory for us buffers"); 859 dev_err(&usbinterface->dev, "No more memory for us buffers\n");
857 error = -ENOMEM; 860 error = -ENOMEM;
858 goto err_free_devs; 861 goto err_free_devs;
859 } 862 }
@@ -861,7 +864,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
861 /* Allocate URB for reports */ 864 /* Allocate URB for reports */
862 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); 865 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL);
863 if (!gtco->urbinfo) { 866 if (!gtco->urbinfo) {
864 err("Failed to allocate URB"); 867 dev_err(&usbinterface->dev, "Failed to allocate URB\n");
865 error = -ENOMEM; 868 error = -ENOMEM;
866 goto err_free_buf; 869 goto err_free_buf;
867 } 870 }
@@ -873,14 +876,14 @@ static int gtco_probe(struct usb_interface *usbinterface,
873 endpoint = &usbinterface->altsetting[0].endpoint[0].desc; 876 endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
874 877
875 /* Some debug */ 878 /* Some debug */
876 dbg("gtco # interfaces: %d", usbinterface->num_altsetting); 879 dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting);
877 dbg("num endpoints: %d", usbinterface->cur_altsetting->desc.bNumEndpoints); 880 dev_dbg(&usbinterface->dev, "num endpoints: %d\n", usbinterface->cur_altsetting->desc.bNumEndpoints);
878 dbg("interface class: %d", usbinterface->cur_altsetting->desc.bInterfaceClass); 881 dev_dbg(&usbinterface->dev, "interface class: %d\n", usbinterface->cur_altsetting->desc.bInterfaceClass);
879 dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType); 882 dev_dbg(&usbinterface->dev, "endpoint: attribute:0x%x type:0x%x\n", endpoint->bmAttributes, endpoint->bDescriptorType);
880 if (usb_endpoint_xfer_int(endpoint)) 883 if (usb_endpoint_xfer_int(endpoint))
881 dbg("endpoint: we have interrupt endpoint\n"); 884 dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n");
882 885
883 dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen); 886 dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen);
884 887
885 /* 888 /*
886 * Find the HID descriptor so we can find out the size of the 889 * Find the HID descriptor so we can find out the size of the
@@ -888,17 +891,19 @@ static int gtco_probe(struct usb_interface *usbinterface,
888 */ 891 */
889 if (usb_get_extra_descriptor(usbinterface->cur_altsetting, 892 if (usb_get_extra_descriptor(usbinterface->cur_altsetting,
890 HID_DEVICE_TYPE, &hid_desc) != 0){ 893 HID_DEVICE_TYPE, &hid_desc) != 0){
891 err("Can't retrieve exta USB descriptor to get hid report descriptor length"); 894 dev_err(&usbinterface->dev,
895 "Can't retrieve exta USB descriptor to get hid report descriptor length\n");
892 error = -EIO; 896 error = -EIO;
893 goto err_free_urb; 897 goto err_free_urb;
894 } 898 }
895 899
896 dbg("Extra descriptor success: type:%d len:%d", 900 dev_dbg(&usbinterface->dev,
897 hid_desc->bDescriptorType, hid_desc->wDescriptorLength); 901 "Extra descriptor success: type:%d len:%d\n",
902 hid_desc->bDescriptorType, hid_desc->wDescriptorLength);
898 903
899 report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); 904 report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL);
900 if (!report) { 905 if (!report) {
901 err("No more memory for report"); 906 dev_err(&usbinterface->dev, "No more memory for report\n");
902 error = -ENOMEM; 907 error = -ENOMEM;
903 goto err_free_urb; 908 goto err_free_urb;
904 } 909 }
@@ -915,7 +920,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
915 le16_to_cpu(hid_desc->wDescriptorLength), 920 le16_to_cpu(hid_desc->wDescriptorLength),
916 5000); /* 5 secs */ 921 5000); /* 5 secs */
917 922
918 dbg("usb_control_msg result: %d", result); 923 dev_dbg(&usbinterface->dev, "usb_control_msg result: %d\n", result);
919 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { 924 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) {
920 parse_hid_report_descriptor(gtco, report, result); 925 parse_hid_report_descriptor(gtco, report, result);
921 break; 926 break;
@@ -926,8 +931,9 @@ static int gtco_probe(struct usb_interface *usbinterface,
926 931
927 /* If we didn't get the report, fail */ 932 /* If we didn't get the report, fail */
928 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { 933 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) {
929 err("Failed to get HID Report Descriptor of size: %d", 934 dev_err(&usbinterface->dev,
930 hid_desc->wDescriptorLength); 935 "Failed to get HID Report Descriptor of size: %d\n",
936 hid_desc->wDescriptorLength);
931 error = -EIO; 937 error = -EIO;
932 goto err_free_urb; 938 goto err_free_urb;
933 } 939 }
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index b2db3cfe3084..5cc04124995c 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -63,6 +63,7 @@ MODULE_LICENSE(DRIVER_LICENSE);
63enum hanwang_tablet_type { 63enum hanwang_tablet_type {
64 HANWANG_ART_MASTER_III, 64 HANWANG_ART_MASTER_III,
65 HANWANG_ART_MASTER_HD, 65 HANWANG_ART_MASTER_HD,
66 HANWANG_ART_MASTER_II,
66}; 67};
67 68
68struct hanwang { 69struct hanwang {
@@ -99,6 +100,8 @@ static const struct hanwang_features features_array[] = {
99 ART_MASTER_PKGLEN_MAX, 0x7f00, 0x4f60, 0x3f, 0x7f, 2048 }, 100 ART_MASTER_PKGLEN_MAX, 0x7f00, 0x4f60, 0x3f, 0x7f, 2048 },
100 { 0x8401, "Hanwang Art Master HD 5012", HANWANG_ART_MASTER_HD, 101 { 0x8401, "Hanwang Art Master HD 5012", HANWANG_ART_MASTER_HD,
101 ART_MASTER_PKGLEN_MAX, 0x678e, 0x4150, 0x3f, 0x7f, 1024 }, 102 ART_MASTER_PKGLEN_MAX, 0x678e, 0x4150, 0x3f, 0x7f, 1024 },
103 { 0x8503, "Hanwang Art Master II", HANWANG_ART_MASTER_II,
104 ART_MASTER_PKGLEN_MAX, 0x27de, 0x1cfe, 0x3f, 0x7f, 1024 },
102}; 105};
103 106
104static const int hw_eventtypes[] = { 107static const int hw_eventtypes[] = {
@@ -127,14 +130,30 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
127 struct usb_device *dev = hanwang->usbdev; 130 struct usb_device *dev = hanwang->usbdev;
128 enum hanwang_tablet_type type = hanwang->features->type; 131 enum hanwang_tablet_type type = hanwang->features->type;
129 int i; 132 int i;
130 u16 x, y, p; 133 u16 p;
134
135 if (type == HANWANG_ART_MASTER_II) {
136 hanwang->current_tool = BTN_TOOL_PEN;
137 hanwang->current_id = STYLUS_DEVICE_ID;
138 }
131 139
132 switch (data[0]) { 140 switch (data[0]) {
133 case 0x02: /* data packet */ 141 case 0x02: /* data packet */
134 switch (data[1]) { 142 switch (data[1]) {
135 case 0x80: /* tool prox out */ 143 case 0x80: /* tool prox out */
136 hanwang->current_id = 0; 144 if (type != HANWANG_ART_MASTER_II) {
137 input_report_key(input_dev, hanwang->current_tool, 0); 145 hanwang->current_id = 0;
146 input_report_key(input_dev,
147 hanwang->current_tool, 0);
148 }
149 break;
150
151 case 0x00: /* artmaster ii pen leave */
152 if (type == HANWANG_ART_MASTER_II) {
153 hanwang->current_id = 0;
154 input_report_key(input_dev,
155 hanwang->current_tool, 0);
156 }
138 break; 157 break;
139 158
140 case 0xc2: /* first time tool prox in */ 159 case 0xc2: /* first time tool prox in */
@@ -154,15 +173,12 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
154 default: 173 default:
155 hanwang->current_id = 0; 174 hanwang->current_id = 0;
156 dev_dbg(&dev->dev, 175 dev_dbg(&dev->dev,
157 "unknown tablet tool %02x ", data[0]); 176 "unknown tablet tool %02x\n", data[0]);
158 break; 177 break;
159 } 178 }
160 break; 179 break;
161 180
162 default: /* tool data packet */ 181 default: /* tool data packet */
163 x = (data[2] << 8) | data[3];
164 y = (data[4] << 8) | data[5];
165
166 switch (type) { 182 switch (type) {
167 case HANWANG_ART_MASTER_III: 183 case HANWANG_ART_MASTER_III:
168 p = (data[6] << 3) | 184 p = (data[6] << 3) |
@@ -171,6 +187,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
171 break; 187 break;
172 188
173 case HANWANG_ART_MASTER_HD: 189 case HANWANG_ART_MASTER_HD:
190 case HANWANG_ART_MASTER_II:
174 p = (data[7] >> 6) | (data[6] << 2); 191 p = (data[7] >> 6) | (data[6] << 2);
175 break; 192 break;
176 193
@@ -180,17 +197,23 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
180 } 197 }
181 198
182 input_report_abs(input_dev, ABS_X, 199 input_report_abs(input_dev, ABS_X,
183 le16_to_cpup((__le16 *)&x)); 200 be16_to_cpup((__be16 *)&data[2]));
184 input_report_abs(input_dev, ABS_Y, 201 input_report_abs(input_dev, ABS_Y,
185 le16_to_cpup((__le16 *)&y)); 202 be16_to_cpup((__be16 *)&data[4]));
186 input_report_abs(input_dev, ABS_PRESSURE, 203 input_report_abs(input_dev, ABS_PRESSURE, p);
187 le16_to_cpup((__le16 *)&p));
188 input_report_abs(input_dev, ABS_TILT_X, data[7] & 0x3f); 204 input_report_abs(input_dev, ABS_TILT_X, data[7] & 0x3f);
189 input_report_abs(input_dev, ABS_TILT_Y, data[8] & 0x7f); 205 input_report_abs(input_dev, ABS_TILT_Y, data[8] & 0x7f);
190 input_report_key(input_dev, BTN_STYLUS, data[1] & 0x02); 206 input_report_key(input_dev, BTN_STYLUS, data[1] & 0x02);
191 input_report_key(input_dev, BTN_STYLUS2, data[1] & 0x04); 207
208 if (type != HANWANG_ART_MASTER_II)
209 input_report_key(input_dev, BTN_STYLUS2,
210 data[1] & 0x04);
211 else
212 input_report_key(input_dev, BTN_TOOL_PEN, 1);
213
192 break; 214 break;
193 } 215 }
216
194 input_report_abs(input_dev, ABS_MISC, hanwang->current_id); 217 input_report_abs(input_dev, ABS_MISC, hanwang->current_id);
195 input_event(input_dev, EV_MSC, MSC_SERIAL, 218 input_event(input_dev, EV_MSC, MSC_SERIAL,
196 hanwang->features->pid); 219 hanwang->features->pid);
@@ -202,8 +225,8 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
202 225
203 switch (type) { 226 switch (type) {
204 case HANWANG_ART_MASTER_III: 227 case HANWANG_ART_MASTER_III:
205 input_report_key(input_dev, BTN_TOOL_FINGER, data[1] || 228 input_report_key(input_dev, BTN_TOOL_FINGER,
206 data[2] || data[3]); 229 data[1] || data[2] || data[3]);
207 input_report_abs(input_dev, ABS_WHEEL, data[1]); 230 input_report_abs(input_dev, ABS_WHEEL, data[1]);
208 input_report_key(input_dev, BTN_0, data[2]); 231 input_report_key(input_dev, BTN_0, data[2]);
209 for (i = 0; i < 8; i++) 232 for (i = 0; i < 8; i++)
@@ -227,6 +250,10 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
227 BTN_5 + i, data[6] & (1 << i)); 250 BTN_5 + i, data[6] & (1 << i));
228 } 251 }
229 break; 252 break;
253
254 case HANWANG_ART_MASTER_II:
255 dev_dbg(&dev->dev, "error packet %02x\n", data[0]);
256 return;
230 } 257 }
231 258
232 input_report_abs(input_dev, ABS_MISC, hanwang->current_id); 259 input_report_abs(input_dev, ABS_MISC, hanwang->current_id);
@@ -234,7 +261,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang)
234 break; 261 break;
235 262
236 default: 263 default:
237 dev_dbg(&dev->dev, "error packet %02x ", data[0]); 264 dev_dbg(&dev->dev, "error packet %02x\n", data[0]);
238 break; 265 break;
239 } 266 }
240 267
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 85a5b40333ac..3fba74b9b602 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -33,6 +33,7 @@ struct kbtab {
33 dma_addr_t data_dma; 33 dma_addr_t data_dma;
34 struct input_dev *dev; 34 struct input_dev *dev;
35 struct usb_device *usbdev; 35 struct usb_device *usbdev;
36 struct usb_interface *intf;
36 struct urb *irq; 37 struct urb *irq;
37 char phys[32]; 38 char phys[32];
38}; 39};
@@ -53,10 +54,14 @@ static void kbtab_irq(struct urb *urb)
53 case -ENOENT: 54 case -ENOENT:
54 case -ESHUTDOWN: 55 case -ESHUTDOWN:
55 /* this urb is terminated, clean up */ 56 /* this urb is terminated, clean up */
56 dbg("%s - urb shutting down with status: %d", __func__, urb->status); 57 dev_dbg(&kbtab->intf->dev,
58 "%s - urb shutting down with status: %d\n",
59 __func__, urb->status);
57 return; 60 return;
58 default: 61 default:
59 dbg("%s - nonzero urb status received: %d", __func__, urb->status); 62 dev_dbg(&kbtab->intf->dev,
63 "%s - nonzero urb status received: %d\n",
64 __func__, urb->status);
60 goto exit; 65 goto exit;
61 } 66 }
62 67
@@ -80,8 +85,9 @@ static void kbtab_irq(struct urb *urb)
80 exit: 85 exit:
81 retval = usb_submit_urb(urb, GFP_ATOMIC); 86 retval = usb_submit_urb(urb, GFP_ATOMIC);
82 if (retval) 87 if (retval)
83 err("%s - usb_submit_urb failed with result %d", 88 dev_err(&kbtab->intf->dev,
84 __func__, retval); 89 "%s - usb_submit_urb failed with result %d\n",
90 __func__, retval);
85} 91}
86 92
87static struct usb_device_id kbtab_ids[] = { 93static struct usb_device_id kbtab_ids[] = {
@@ -131,6 +137,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
131 goto fail2; 137 goto fail2;
132 138
133 kbtab->usbdev = dev; 139 kbtab->usbdev = dev;
140 kbtab->intf = intf;
134 kbtab->dev = input_dev; 141 kbtab->dev = input_dev;
135 142
136 usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys)); 143 usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys));
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index b145841bdbe7..0d3219f29744 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -100,6 +100,7 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id,
100static void wacom_sys_irq(struct urb *urb) 100static void wacom_sys_irq(struct urb *urb)
101{ 101{
102 struct wacom *wacom = urb->context; 102 struct wacom *wacom = urb->context;
103 struct device *dev = &wacom->intf->dev;
103 int retval; 104 int retval;
104 105
105 switch (urb->status) { 106 switch (urb->status) {
@@ -110,10 +111,12 @@ static void wacom_sys_irq(struct urb *urb)
110 case -ENOENT: 111 case -ENOENT:
111 case -ESHUTDOWN: 112 case -ESHUTDOWN:
112 /* this urb is terminated, clean up */ 113 /* this urb is terminated, clean up */
113 dbg("%s - urb shutting down with status: %d", __func__, urb->status); 114 dev_dbg(dev, "%s - urb shutting down with status: %d\n",
115 __func__, urb->status);
114 return; 116 return;
115 default: 117 default:
116 dbg("%s - nonzero urb status received: %d", __func__, urb->status); 118 dev_dbg(dev, "%s - nonzero urb status received: %d\n",
119 __func__, urb->status);
117 goto exit; 120 goto exit;
118 } 121 }
119 122
@@ -123,8 +126,8 @@ static void wacom_sys_irq(struct urb *urb)
123 usb_mark_last_busy(wacom->usbdev); 126 usb_mark_last_busy(wacom->usbdev);
124 retval = usb_submit_urb(urb, GFP_ATOMIC); 127 retval = usb_submit_urb(urb, GFP_ATOMIC);
125 if (retval) 128 if (retval)
126 err ("%s - usb_submit_urb failed with result %d", 129 dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
127 __func__, retval); 130 __func__, retval);
128} 131}
129 132
130static int wacom_open(struct input_dev *dev) 133static int wacom_open(struct input_dev *dev)
@@ -442,8 +445,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
442 /* ask to report Wacom data */ 445 /* ask to report Wacom data */
443 if (features->device_type == BTN_TOOL_FINGER) { 446 if (features->device_type == BTN_TOOL_FINGER) {
444 /* if it is an MT Tablet PC touch */ 447 /* if it is an MT Tablet PC touch */
445 if (features->type == TABLETPC2FG || 448 if (features->type > TABLETPC) {
446 features->type == MTSCREEN) {
447 do { 449 do {
448 rep_data[0] = 3; 450 rep_data[0] = 3;
449 rep_data[1] = 4; 451 rep_data[1] = 4;
@@ -462,7 +464,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
462 } while ((error < 0 || rep_data[1] != 4) && 464 } while ((error < 0 || rep_data[1] != 4) &&
463 limit++ < WAC_MSG_RETRIES); 465 limit++ < WAC_MSG_RETRIES);
464 } 466 }
465 } else if (features->type != TABLETPC && 467 } else if (features->type <= BAMBOO_PT &&
466 features->type != WIRELESS && 468 features->type != WIRELESS &&
467 features->device_type == BTN_TOOL_PEN) { 469 features->device_type == BTN_TOOL_PEN) {
468 do { 470 do {
@@ -506,16 +508,13 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
506 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { 508 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
507 features->device_type = 0; 509 features->device_type = 0;
508 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { 510 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
509 features->device_type = BTN_TOOL_DOUBLETAP; 511 features->device_type = BTN_TOOL_FINGER;
510 features->pktlen = WACOM_PKGLEN_BBTOUCH3; 512 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
511 } 513 }
512 } 514 }
513 515
514 /* only devices that support touch need to retrieve the info */ 516 /* only devices that support touch need to retrieve the info */
515 if (features->type != TABLETPC && 517 if (features->type < BAMBOO_PT) {
516 features->type != TABLETPC2FG &&
517 features->type != BAMBOO_PT &&
518 features->type != MTSCREEN) {
519 goto out; 518 goto out;
520 } 519 }
521 520
@@ -857,6 +856,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
857 856
858 /* Initialize default values */ 857 /* Initialize default values */
859 switch (wacom->wacom_wac.features.type) { 858 switch (wacom->wacom_wac.features.type) {
859 case INTUOS4S:
860 case INTUOS4: 860 case INTUOS4:
861 case INTUOS4L: 861 case INTUOS4L:
862 wacom->led.select[0] = 0; 862 wacom->led.select[0] = 0;
@@ -910,6 +910,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
910static void wacom_destroy_leds(struct wacom *wacom) 910static void wacom_destroy_leds(struct wacom *wacom)
911{ 911{
912 switch (wacom->wacom_wac.features.type) { 912 switch (wacom->wacom_wac.features.type) {
913 case INTUOS4S:
913 case INTUOS4: 914 case INTUOS4:
914 case INTUOS4L: 915 case INTUOS4L:
915 sysfs_remove_group(&wacom->intf->dev.kobj, 916 sysfs_remove_group(&wacom->intf->dev.kobj,
@@ -969,6 +970,10 @@ static int wacom_initialize_battery(struct wacom *wacom)
969 970
970 error = power_supply_register(&wacom->usbdev->dev, 971 error = power_supply_register(&wacom->usbdev->dev,
971 &wacom->battery); 972 &wacom->battery);
973
974 if (!error)
975 power_supply_powers(&wacom->battery,
976 &wacom->usbdev->dev);
972 } 977 }
973 978
974 return error; 979 return error;
@@ -976,8 +981,11 @@ static int wacom_initialize_battery(struct wacom *wacom)
976 981
977static void wacom_destroy_battery(struct wacom *wacom) 982static void wacom_destroy_battery(struct wacom *wacom)
978{ 983{
979 if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) 984 if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR &&
985 wacom->battery.dev) {
980 power_supply_unregister(&wacom->battery); 986 power_supply_unregister(&wacom->battery);
987 wacom->battery.dev = NULL;
988 }
981} 989}
982 990
983static int wacom_register_input(struct wacom *wacom) 991static int wacom_register_input(struct wacom *wacom)
@@ -1024,23 +1032,30 @@ static void wacom_wireless_work(struct work_struct *work)
1024 struct wacom *wacom = container_of(work, struct wacom, work); 1032 struct wacom *wacom = container_of(work, struct wacom, work);
1025 struct usb_device *usbdev = wacom->usbdev; 1033 struct usb_device *usbdev = wacom->usbdev;
1026 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1034 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1035 struct wacom *wacom1, *wacom2;
1036 struct wacom_wac *wacom_wac1, *wacom_wac2;
1037 int error;
1027 1038
1028 /* 1039 /*
1029 * Regardless if this is a disconnect or a new tablet, 1040 * Regardless if this is a disconnect or a new tablet,
1030 * remove any existing input devices. 1041 * remove any existing input and battery devices.
1031 */ 1042 */
1032 1043
1044 wacom_destroy_battery(wacom);
1045
1033 /* Stylus interface */ 1046 /* Stylus interface */
1034 wacom = usb_get_intfdata(usbdev->config->interface[1]); 1047 wacom1 = usb_get_intfdata(usbdev->config->interface[1]);
1035 if (wacom->wacom_wac.input) 1048 wacom_wac1 = &(wacom1->wacom_wac);
1036 input_unregister_device(wacom->wacom_wac.input); 1049 if (wacom_wac1->input)
1037 wacom->wacom_wac.input = NULL; 1050 input_unregister_device(wacom_wac1->input);
1051 wacom_wac1->input = NULL;
1038 1052
1039 /* Touch interface */ 1053 /* Touch interface */
1040 wacom = usb_get_intfdata(usbdev->config->interface[2]); 1054 wacom2 = usb_get_intfdata(usbdev->config->interface[2]);
1041 if (wacom->wacom_wac.input) 1055 wacom_wac2 = &(wacom2->wacom_wac);
1042 input_unregister_device(wacom->wacom_wac.input); 1056 if (wacom_wac2->input)
1043 wacom->wacom_wac.input = NULL; 1057 input_unregister_device(wacom_wac2->input);
1058 wacom_wac2->input = NULL;
1044 1059
1045 if (wacom_wac->pid == 0) { 1060 if (wacom_wac->pid == 0) {
1046 dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); 1061 dev_info(&wacom->intf->dev, "wireless tablet disconnected\n");
@@ -1065,24 +1080,39 @@ static void wacom_wireless_work(struct work_struct *work)
1065 } 1080 }
1066 1081
1067 /* Stylus interface */ 1082 /* Stylus interface */
1068 wacom = usb_get_intfdata(usbdev->config->interface[1]); 1083 wacom_wac1->features =
1069 wacom_wac = &wacom->wacom_wac;
1070 wacom_wac->features =
1071 *((struct wacom_features *)id->driver_info); 1084 *((struct wacom_features *)id->driver_info);
1072 wacom_wac->features.device_type = BTN_TOOL_PEN; 1085 wacom_wac1->features.device_type = BTN_TOOL_PEN;
1073 wacom_register_input(wacom); 1086 error = wacom_register_input(wacom1);
1087 if (error)
1088 goto fail1;
1074 1089
1075 /* Touch interface */ 1090 /* Touch interface */
1076 wacom = usb_get_intfdata(usbdev->config->interface[2]); 1091 wacom_wac2->features =
1077 wacom_wac = &wacom->wacom_wac;
1078 wacom_wac->features =
1079 *((struct wacom_features *)id->driver_info); 1092 *((struct wacom_features *)id->driver_info);
1080 wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3; 1093 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
1081 wacom_wac->features.device_type = BTN_TOOL_FINGER; 1094 wacom_wac2->features.device_type = BTN_TOOL_FINGER;
1082 wacom_set_phy_from_res(&wacom_wac->features); 1095 wacom_set_phy_from_res(&wacom_wac2->features);
1083 wacom_wac->features.x_max = wacom_wac->features.y_max = 4096; 1096 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
1084 wacom_register_input(wacom); 1097 error = wacom_register_input(wacom2);
1098 if (error)
1099 goto fail2;
1100
1101 error = wacom_initialize_battery(wacom);
1102 if (error)
1103 goto fail3;
1085 } 1104 }
1105
1106 return;
1107
1108fail3:
1109 input_unregister_device(wacom_wac2->input);
1110 wacom_wac2->input = NULL;
1111fail2:
1112 input_unregister_device(wacom_wac1->input);
1113 wacom_wac1->input = NULL;
1114fail1:
1115 return;
1086} 1116}
1087 1117
1088static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) 1118static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
@@ -1146,10 +1176,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
1146 features->device_type = BTN_TOOL_FINGER; 1176 features->device_type = BTN_TOOL_FINGER;
1147 features->pktlen = WACOM_PKGLEN_BBTOUCH3; 1177 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
1148 1178
1149 features->x_phy = 1179 wacom_set_phy_from_res(features);
1150 (features->x_max * 100) / features->x_resolution;
1151 features->y_phy =
1152 (features->y_max * 100) / features->y_resolution;
1153 1180
1154 features->x_max = 4096; 1181 features->x_max = 4096;
1155 features->y_max = 4096; 1182 features->y_max = 4096;
@@ -1185,14 +1212,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
1185 if (error) 1212 if (error)
1186 goto fail4; 1213 goto fail4;
1187 1214
1188 error = wacom_initialize_battery(wacom);
1189 if (error)
1190 goto fail5;
1191
1192 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { 1215 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
1193 error = wacom_register_input(wacom); 1216 error = wacom_register_input(wacom);
1194 if (error) 1217 if (error)
1195 goto fail6; 1218 goto fail5;
1196 } 1219 }
1197 1220
1198 /* Note that if query fails it is not a hard failure */ 1221 /* Note that if query fails it is not a hard failure */
@@ -1207,7 +1230,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
1207 1230
1208 return 0; 1231 return 0;
1209 1232
1210 fail6: wacom_destroy_battery(wacom);
1211 fail5: wacom_destroy_leds(wacom); 1233 fail5: wacom_destroy_leds(wacom);
1212 fail4: wacom_remove_shared_data(wacom_wac); 1234 fail4: wacom_remove_shared_data(wacom_wac);
1213 fail3: usb_free_urb(wacom->irq); 1235 fail3: usb_free_urb(wacom->irq);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 004bc1bb1544..6533f44be5bd 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -248,7 +248,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
248 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); 248 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
249 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); 249 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
250 if (wacom->tool[0] != BTN_TOOL_MOUSE) { 250 if (wacom->tool[0] != BTN_TOOL_MOUSE) {
251 input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8)); 251 input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8));
252 input_report_key(input, BTN_TOUCH, data[1] & 0x01); 252 input_report_key(input, BTN_TOUCH, data[1] & 0x01);
253 input_report_key(input, BTN_STYLUS, data[1] & 0x02); 253 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
254 input_report_key(input, BTN_STYLUS2, data[1] & 0x04); 254 input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
@@ -888,7 +888,7 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
888 prox = data[0] & 0x01; 888 prox = data[0] & 0x01;
889 x = get_unaligned_le16(&data[1]); 889 x = get_unaligned_le16(&data[1]);
890 y = get_unaligned_le16(&data[3]); 890 y = get_unaligned_le16(&data[3]);
891 } else { /* with capacity */ 891 } else {
892 prox = data[1] & 0x01; 892 prox = data[1] & 0x01;
893 x = le16_to_cpup((__le16 *)&data[2]); 893 x = le16_to_cpup((__le16 *)&data[2]);
894 y = le16_to_cpup((__le16 *)&data[4]); 894 y = le16_to_cpup((__le16 *)&data[4]);
@@ -961,6 +961,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
961 case WACOM_REPORT_TPC1FG: 961 case WACOM_REPORT_TPC1FG:
962 case WACOM_REPORT_TPCHID: 962 case WACOM_REPORT_TPCHID:
963 case WACOM_REPORT_TPCST: 963 case WACOM_REPORT_TPCST:
964 case WACOM_REPORT_TPC1FGE:
964 return wacom_tpc_single_touch(wacom, len); 965 return wacom_tpc_single_touch(wacom, len);
965 966
966 case WACOM_REPORT_TPCMT: 967 case WACOM_REPORT_TPCMT:
@@ -1244,6 +1245,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1244 break; 1245 break;
1245 1246
1246 case TABLETPC: 1247 case TABLETPC:
1248 case TABLETPCE:
1247 case TABLETPC2FG: 1249 case TABLETPC2FG:
1248 case MTSCREEN: 1250 case MTSCREEN:
1249 sync = wacom_tpc_irq(wacom_wac, len); 1251 sync = wacom_tpc_irq(wacom_wac, len);
@@ -1317,10 +1319,8 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1317 } 1319 }
1318 1320
1319 /* these device have multiple inputs */ 1321 /* these device have multiple inputs */
1320 if (features->type == TABLETPC || features->type == TABLETPC2FG || 1322 if (features->type >= WIRELESS ||
1321 features->type == BAMBOO_PT || features->type == WIRELESS || 1323 (features->type >= INTUOS5S && features->type <= INTUOS5L))
1322 (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
1323 features->type == MTSCREEN)
1324 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1324 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1325 1325
1326 /* quirk for bamboo touch with 2 low res touches */ 1326 /* quirk for bamboo touch with 2 low res touches */
@@ -1547,10 +1547,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1547 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 1547 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1548 break; 1548 break;
1549 1549
1550 case TABLETPC2FG:
1551 case MTSCREEN: 1550 case MTSCREEN:
1552 if (features->device_type == BTN_TOOL_FINGER) { 1551 if (features->device_type == BTN_TOOL_FINGER) {
1553
1554 wacom_wac->slots = kmalloc(features->touch_max * 1552 wacom_wac->slots = kmalloc(features->touch_max *
1555 sizeof(int), 1553 sizeof(int),
1556 GFP_KERNEL); 1554 GFP_KERNEL);
@@ -1559,7 +1557,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1559 1557
1560 for (i = 0; i < features->touch_max; i++) 1558 for (i = 0; i < features->touch_max; i++)
1561 wacom_wac->slots[i] = -1; 1559 wacom_wac->slots[i] = -1;
1560 }
1561 /* fall through */
1562 1562
1563 case TABLETPC2FG:
1564 if (features->device_type == BTN_TOOL_FINGER) {
1563 input_mt_init_slots(input_dev, features->touch_max); 1565 input_mt_init_slots(input_dev, features->touch_max);
1564 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 1566 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
1565 0, MT_TOOL_MAX, 0, 0); 1567 0, MT_TOOL_MAX, 0, 0);
@@ -1571,6 +1573,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1571 /* fall through */ 1573 /* fall through */
1572 1574
1573 case TABLETPC: 1575 case TABLETPC:
1576 case TABLETPCE:
1574 __clear_bit(ABS_MISC, input_dev->absbit); 1577 __clear_bit(ABS_MISC, input_dev->absbit);
1575 1578
1576 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 1579 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -1888,6 +1891,12 @@ static const struct wacom_features wacom_features_0xE6 =
1888static const struct wacom_features wacom_features_0xEC = 1891static const struct wacom_features wacom_features_0xEC =
1889 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, 1892 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255,
1890 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1893 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1894static const struct wacom_features wacom_features_0xED =
1895 { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1896 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1897static const struct wacom_features wacom_features_0xEF =
1898 { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1899 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1891static const struct wacom_features wacom_features_0x47 = 1900static const struct wacom_features wacom_features_0x47 =
1892 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 1901 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1893 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1902 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2062,6 +2071,8 @@ const struct usb_device_id wacom_ids[] = {
2062 { USB_DEVICE_WACOM(0xE5) }, 2071 { USB_DEVICE_WACOM(0xE5) },
2063 { USB_DEVICE_WACOM(0xE6) }, 2072 { USB_DEVICE_WACOM(0xE6) },
2064 { USB_DEVICE_WACOM(0xEC) }, 2073 { USB_DEVICE_WACOM(0xEC) },
2074 { USB_DEVICE_WACOM(0xED) },
2075 { USB_DEVICE_WACOM(0xEF) },
2065 { USB_DEVICE_WACOM(0x47) }, 2076 { USB_DEVICE_WACOM(0x47) },
2066 { USB_DEVICE_WACOM(0xF4) }, 2077 { USB_DEVICE_WACOM(0xF4) },
2067 { USB_DEVICE_LENOVO(0x6004) }, 2078 { USB_DEVICE_LENOVO(0x6004) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 78fbd3f42009..bd5d37b28714 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -48,6 +48,7 @@
48#define WACOM_REPORT_TPCMT 13 48#define WACOM_REPORT_TPCMT 13
49#define WACOM_REPORT_TPCHID 15 49#define WACOM_REPORT_TPCHID 15
50#define WACOM_REPORT_TPCST 16 50#define WACOM_REPORT_TPCST 16
51#define WACOM_REPORT_TPC1FGE 18
51 52
52/* device quirks */ 53/* device quirks */
53#define WACOM_QUIRK_MULTI_INPUT 0x0001 54#define WACOM_QUIRK_MULTI_INPUT 0x0001
@@ -62,8 +63,6 @@ enum {
62 PTU, 63 PTU,
63 PL, 64 PL,
64 DTU, 65 DTU,
65 BAMBOO_PT,
66 WIRELESS,
67 INTUOS, 66 INTUOS,
68 INTUOS3S, 67 INTUOS3S,
69 INTUOS3, 68 INTUOS3,
@@ -79,7 +78,10 @@ enum {
79 CINTIQ, 78 CINTIQ,
80 WACOM_BEE, 79 WACOM_BEE,
81 WACOM_MO, 80 WACOM_MO,
82 TABLETPC, 81 WIRELESS,
82 BAMBOO_PT,
83 TABLETPC, /* add new TPC below */
84 TABLETPCE,
83 TABLETPC2FG, 85 TABLETPC2FG,
84 MTSCREEN, 86 MTSCREEN,
85 MAX_TYPE 87 MAX_TYPE