Merge commit 'v3.1-rc4' into next
[deliverable/linux.git] / drivers / input / tablet / wacom_sys.c
CommitLineData
3bea733a 1/*
4104d13f 2 * drivers/input/tablet/wacom_sys.c
3bea733a 3 *
232f5693 4 * USB Wacom tablet support - system specific code
3bea733a
PC
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
3bea733a 14#include "wacom_wac.h"
51269fe8 15#include "wacom.h"
3bea733a 16
545f4e99
PC
17/* defines to get HID report descriptor */
18#define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01)
19#define HID_DEVICET_REPORT (USB_TYPE_CLASS | 0x02)
20#define HID_USAGE_UNDEFINED 0x00
21#define HID_USAGE_PAGE 0x05
22#define HID_USAGE_PAGE_DIGITIZER 0x0d
23#define HID_USAGE_PAGE_DESKTOP 0x01
24#define HID_USAGE 0x09
25#define HID_USAGE_X 0x30
26#define HID_USAGE_Y 0x31
27#define HID_USAGE_X_TILT 0x3d
28#define HID_USAGE_Y_TILT 0x3e
29#define HID_USAGE_FINGER 0x22
30#define HID_USAGE_STYLUS 0x20
31#define HID_COLLECTION 0xc0
32
33enum {
34 WCM_UNDEFINED = 0,
35 WCM_DESKTOP,
36 WCM_DIGITIZER,
37};
38
39struct hid_descriptor {
40 struct usb_descriptor_header header;
41 __le16 bcdHID;
42 u8 bCountryCode;
43 u8 bNumDescriptors;
44 u8 bDescriptorType;
45 __le16 wDescriptorLength;
46} __attribute__ ((packed));
47
48/* defines to get/set USB message */
3bea733a
PC
49#define USB_REQ_GET_REPORT 0x01
50#define USB_REQ_SET_REPORT 0x09
545f4e99 51#define WAC_HID_FEATURE_REPORT 0x03
a417ea44 52#define WAC_MSG_RETRIES 5
3bea733a
PC
53
54static int usb_get_report(struct usb_interface *intf, unsigned char type,
55 unsigned char id, void *buf, int size)
56{
57 return usb_control_msg(interface_to_usbdev(intf),
58 usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
59 USB_REQ_GET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
60 (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber,
61 buf, size, 100);
62}
63
64static int usb_set_report(struct usb_interface *intf, unsigned char type,
65 unsigned char id, void *buf, int size)
66{
67 return usb_control_msg(interface_to_usbdev(intf),
68 usb_sndctrlpipe(interface_to_usbdev(intf), 0),
69 USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
70 (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber,
71 buf, size, 1000);
72}
73
54c9b226 74static void wacom_sys_irq(struct urb *urb)
3bea733a
PC
75{
76 struct wacom *wacom = urb->context;
3bea733a
PC
77 int retval;
78
79 switch (urb->status) {
80 case 0:
81 /* success */
82 break;
83 case -ECONNRESET:
84 case -ENOENT:
85 case -ESHUTDOWN:
86 /* this urb is terminated, clean up */
ea3e6c59 87 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
3bea733a
PC
88 return;
89 default:
ea3e6c59 90 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
3bea733a
PC
91 goto exit;
92 }
93
95dd3b30 94 wacom_wac_irq(&wacom->wacom_wac, urb->actual_length);
3bea733a
PC
95
96 exit:
e7224094 97 usb_mark_last_busy(wacom->usbdev);
73a97f4f 98 retval = usb_submit_urb(urb, GFP_ATOMIC);
3bea733a
PC
99 if (retval)
100 err ("%s - usb_submit_urb failed with result %d",
ea3e6c59 101 __func__, retval);
3bea733a
PC
102}
103
3bea733a
PC
104static int wacom_open(struct input_dev *dev)
105{
7791bdae 106 struct wacom *wacom = input_get_drvdata(dev);
f6cd3783 107 int retval = 0;
3bea733a 108
f6cd3783 109 if (usb_autopm_get_interface(wacom->intf) < 0)
3bea733a 110 return -EIO;
f6cd3783
DT
111
112 mutex_lock(&wacom->lock);
e7224094
ON
113
114 if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
f6cd3783
DT
115 retval = -EIO;
116 goto out;
e7224094
ON
117 }
118
51269fe8 119 wacom->open = true;
e7224094 120 wacom->intf->needs_remote_wakeup = 1;
3bea733a 121
f6cd3783 122out:
e7224094 123 mutex_unlock(&wacom->lock);
62ecae09 124 usb_autopm_put_interface(wacom->intf);
f6cd3783 125 return retval;
3bea733a
PC
126}
127
128static void wacom_close(struct input_dev *dev)
129{
7791bdae 130 struct wacom *wacom = input_get_drvdata(dev);
62ecae09
DT
131 int autopm_error;
132
133 autopm_error = usb_autopm_get_interface(wacom->intf);
3bea733a 134
e7224094 135 mutex_lock(&wacom->lock);
3bea733a 136 usb_kill_urb(wacom->irq);
51269fe8 137 wacom->open = false;
e7224094
ON
138 wacom->intf->needs_remote_wakeup = 0;
139 mutex_unlock(&wacom->lock);
f6cd3783 140
62ecae09
DT
141 if (!autopm_error)
142 usb_autopm_put_interface(wacom->intf);
3bea733a
PC
143}
144
545f4e99 145static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc,
ec67bbed 146 struct wacom_features *features)
545f4e99
PC
147{
148 struct usb_device *dev = interface_to_usbdev(intf);
ec67bbed
PC
149 char limit = 0;
150 /* result has to be defined as int for some devices */
151 int result = 0;
545f4e99
PC
152 int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
153 unsigned char *report;
154
155 report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL);
156 if (!report)
157 return -ENOMEM;
158
159 /* retrive report descriptors */
160 do {
161 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
162 USB_REQ_GET_DESCRIPTOR,
163 USB_RECIP_INTERFACE | USB_DIR_IN,
164 HID_DEVICET_REPORT << 8,
165 intf->altsetting[0].desc.bInterfaceNumber, /* interface */
166 report,
167 hid_desc->wDescriptorLength,
168 5000); /* 5 secs */
a417ea44 169 } while (result < 0 && limit++ < WAC_MSG_RETRIES);
545f4e99 170
384318ec 171 /* No need to parse the Descriptor. It isn't an error though */
545f4e99
PC
172 if (result < 0)
173 goto out;
174
175 for (i = 0; i < hid_desc->wDescriptorLength; i++) {
176
177 switch (report[i]) {
178 case HID_USAGE_PAGE:
179 switch (report[i + 1]) {
180 case HID_USAGE_PAGE_DIGITIZER:
181 usage = WCM_DIGITIZER;
182 i++;
183 break;
184
185 case HID_USAGE_PAGE_DESKTOP:
186 usage = WCM_DESKTOP;
187 i++;
188 break;
189 }
190 break;
191
192 case HID_USAGE:
193 switch (report[i + 1]) {
194 case HID_USAGE_X:
195 if (usage == WCM_DESKTOP) {
196 if (finger) {
84eb5aa6 197 features->device_type = BTN_TOOL_FINGER;
ec67bbed
PC
198 if (features->type == TABLETPC2FG) {
199 /* need to reset back */
200 features->pktlen = WACOM_PKGLEN_TPC2FG;
84eb5aa6 201 features->device_type = BTN_TOOL_DOUBLETAP;
ec67bbed 202 }
4a88081e
PC
203 if (features->type == BAMBOO_PT) {
204 /* need to reset back */
205 features->pktlen = WACOM_PKGLEN_BBTOUCH;
84eb5aa6 206 features->device_type = BTN_TOOL_DOUBLETAP;
4a88081e
PC
207 features->x_phy =
208 get_unaligned_le16(&report[i + 5]);
209 features->x_max =
210 get_unaligned_le16(&report[i + 8]);
211 i += 15;
212 } else {
213 features->x_max =
214 get_unaligned_le16(&report[i + 3]);
215 features->x_phy =
216 get_unaligned_le16(&report[i + 6]);
217 features->unit = report[i + 9];
218 features->unitExpo = report[i + 11];
219 i += 12;
220 }
545f4e99 221 } else if (pen) {
ec67bbed
PC
222 /* penabled only accepts exact bytes of data */
223 if (features->type == TABLETPC2FG)
57e413d9 224 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
4a88081e
PC
225 if (features->type == BAMBOO_PT)
226 features->pktlen = WACOM_PKGLEN_BBFUN;
ec67bbed 227 features->device_type = BTN_TOOL_PEN;
545f4e99 228 features->x_max =
252f7769 229 get_unaligned_le16(&report[i + 3]);
545f4e99
PC
230 i += 4;
231 }
232 } else if (usage == WCM_DIGITIZER) {
233 /* max pressure isn't reported
234 features->pressure_max = (unsigned short)
235 (report[i+4] << 8 | report[i + 3]);
236 */
237 features->pressure_max = 255;
238 i += 4;
239 }
240 break;
241
242 case HID_USAGE_Y:
ec67bbed
PC
243 if (usage == WCM_DESKTOP) {
244 if (finger) {
84eb5aa6 245 features->device_type = BTN_TOOL_FINGER;
ec67bbed
PC
246 if (features->type == TABLETPC2FG) {
247 /* need to reset back */
248 features->pktlen = WACOM_PKGLEN_TPC2FG;
84eb5aa6 249 features->device_type = BTN_TOOL_DOUBLETAP;
ec67bbed 250 features->y_max =
252f7769 251 get_unaligned_le16(&report[i + 3]);
ec67bbed 252 features->y_phy =
252f7769 253 get_unaligned_le16(&report[i + 6]);
ec67bbed 254 i += 7;
4a88081e
PC
255 } else if (features->type == BAMBOO_PT) {
256 /* need to reset back */
257 features->pktlen = WACOM_PKGLEN_BBTOUCH;
84eb5aa6 258 features->device_type = BTN_TOOL_DOUBLETAP;
4a88081e
PC
259 features->y_phy =
260 get_unaligned_le16(&report[i + 3]);
261 features->y_max =
262 get_unaligned_le16(&report[i + 6]);
263 i += 12;
ec67bbed
PC
264 } else {
265 features->y_max =
266 features->x_max;
267 features->y_phy =
252f7769 268 get_unaligned_le16(&report[i + 3]);
ec67bbed
PC
269 i += 4;
270 }
271 } else if (pen) {
272 /* penabled only accepts exact bytes of data */
273 if (features->type == TABLETPC2FG)
57e413d9 274 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
4a88081e
PC
275 if (features->type == BAMBOO_PT)
276 features->pktlen = WACOM_PKGLEN_BBFUN;
ec67bbed
PC
277 features->device_type = BTN_TOOL_PEN;
278 features->y_max =
252f7769 279 get_unaligned_le16(&report[i + 3]);
ec67bbed
PC
280 i += 4;
281 }
282 }
545f4e99
PC
283 break;
284
285 case HID_USAGE_FINGER:
286 finger = 1;
287 i++;
288 break;
289
290 case HID_USAGE_STYLUS:
291 pen = 1;
292 i++;
293 break;
294
295 case HID_USAGE_UNDEFINED:
296 if (usage == WCM_DESKTOP && finger) /* capacity */
297 features->pressure_max =
252f7769 298 get_unaligned_le16(&report[i + 3]);
545f4e99
PC
299 i += 4;
300 break;
301 }
302 break;
303
304 case HID_COLLECTION:
ec67bbed 305 /* reset UsagePage and Finger */
545f4e99
PC
306 finger = usage = 0;
307 break;
308 }
309 }
310
545f4e99 311 out:
384318ec 312 result = 0;
545f4e99
PC
313 kfree(report);
314 return result;
315}
316
ec67bbed 317static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features)
3b7307c2
DT
318{
319 unsigned char *rep_data;
ec67bbed
PC
320 int limit = 0, report_id = 2;
321 int error = -ENOMEM;
3b7307c2 322
3b48c91c 323 rep_data = kmalloc(4, GFP_KERNEL);
3b7307c2 324 if (!rep_data)
ec67bbed
PC
325 return error;
326
3b48c91c 327 /* ask to report tablet data if it is MT Tablet PC or
3dc9f40d
CB
328 * not a Tablet PC */
329 if (features->type == TABLETPC2FG) {
ec67bbed
PC
330 do {
331 rep_data[0] = 3;
332 rep_data[1] = 4;
3b48c91c
PC
333 rep_data[2] = 0;
334 rep_data[3] = 0;
ec67bbed
PC
335 report_id = 3;
336 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
3b48c91c 337 report_id, rep_data, 4);
ec67bbed
PC
338 if (error >= 0)
339 error = usb_get_report(intf,
340 WAC_HID_FEATURE_REPORT, report_id,
3b48c91c 341 rep_data, 4);
a417ea44 342 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
3dc9f40d 343 } else if (features->type != TABLETPC) {
ec67bbed
PC
344 do {
345 rep_data[0] = 2;
346 rep_data[1] = 2;
347 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
348 report_id, rep_data, 2);
349 if (error >= 0)
350 error = usb_get_report(intf,
351 WAC_HID_FEATURE_REPORT, report_id,
352 rep_data, 2);
a417ea44 353 } while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES);
ec67bbed 354 }
3b7307c2
DT
355
356 kfree(rep_data);
357
358 return error < 0 ? error : 0;
359}
360
ec67bbed
PC
361static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
362 struct wacom_features *features)
363{
364 int error = 0;
365 struct usb_host_interface *interface = intf->cur_altsetting;
366 struct hid_descriptor *hid_desc;
367
fed87e65 368 /* default features */
ec67bbed 369 features->device_type = BTN_TOOL_PEN;
fed87e65
HR
370 features->x_fuzz = 4;
371 features->y_fuzz = 4;
372 features->pressure_fuzz = 0;
373 features->distance_fuzz = 0;
ec67bbed 374
3dc9f40d 375 /* only Tablet PCs and Bamboo P&T need to retrieve the info */
4a88081e
PC
376 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
377 (features->type != BAMBOO_PT))
ec67bbed
PC
378 goto out;
379
380 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) {
381 if (usb_get_extra_descriptor(&interface->endpoint[0],
382 HID_DEVICET_REPORT, &hid_desc)) {
383 printk("wacom: can not retrieve extra class descriptor\n");
384 error = 1;
385 goto out;
386 }
387 }
388 error = wacom_parse_hid(intf, hid_desc, features);
389 if (error)
390 goto out;
391
ec67bbed
PC
392 out:
393 return error;
394}
395
4492efff
PC
396struct wacom_usbdev_data {
397 struct list_head list;
398 struct kref kref;
399 struct usb_device *dev;
400 struct wacom_shared shared;
401};
402
403static LIST_HEAD(wacom_udev_list);
404static DEFINE_MUTEX(wacom_udev_list_lock);
405
406static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev)
407{
408 struct wacom_usbdev_data *data;
409
410 list_for_each_entry(data, &wacom_udev_list, list) {
411 if (data->dev == dev) {
412 kref_get(&data->kref);
413 return data;
414 }
415 }
416
417 return NULL;
418}
419
420static int wacom_add_shared_data(struct wacom_wac *wacom,
421 struct usb_device *dev)
422{
423 struct wacom_usbdev_data *data;
424 int retval = 0;
425
426 mutex_lock(&wacom_udev_list_lock);
427
428 data = wacom_get_usbdev_data(dev);
429 if (!data) {
430 data = kzalloc(sizeof(struct wacom_usbdev_data), GFP_KERNEL);
431 if (!data) {
432 retval = -ENOMEM;
433 goto out;
434 }
435
436 kref_init(&data->kref);
437 data->dev = dev;
438 list_add_tail(&data->list, &wacom_udev_list);
439 }
440
441 wacom->shared = &data->shared;
442
443out:
444 mutex_unlock(&wacom_udev_list_lock);
445 return retval;
446}
447
448static void wacom_release_shared_data(struct kref *kref)
449{
450 struct wacom_usbdev_data *data =
451 container_of(kref, struct wacom_usbdev_data, kref);
452
453 mutex_lock(&wacom_udev_list_lock);
454 list_del(&data->list);
455 mutex_unlock(&wacom_udev_list_lock);
456
457 kfree(data);
458}
459
460static void wacom_remove_shared_data(struct wacom_wac *wacom)
461{
462 struct wacom_usbdev_data *data;
463
464 if (wacom->shared) {
465 data = container_of(wacom->shared, struct wacom_usbdev_data, shared);
466 kref_put(&data->kref, wacom_release_shared_data);
467 wacom->shared = NULL;
468 }
469}
470
3bea733a
PC
471static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
472{
473 struct usb_device *dev = interface_to_usbdev(intf);
474 struct usb_endpoint_descriptor *endpoint;
475 struct wacom *wacom;
476 struct wacom_wac *wacom_wac;
e33da8a5 477 struct wacom_features *features;
3bea733a 478 struct input_dev *input_dev;
e33da8a5 479 int error;
3bea733a 480
e33da8a5 481 if (!id->driver_info)
b036f6fb
BB
482 return -EINVAL;
483
3bea733a 484 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
3bea733a 485 input_dev = input_allocate_device();
51269fe8 486 if (!wacom || !input_dev) {
e33da8a5
JC
487 error = -ENOMEM;
488 goto fail1;
489 }
490
51269fe8 491 wacom_wac = &wacom->wacom_wac;
e33da8a5
JC
492 wacom_wac->features = *((struct wacom_features *)id->driver_info);
493 features = &wacom_wac->features;
494 if (features->pktlen > WACOM_PKGLEN_MAX) {
495 error = -EINVAL;
3bea733a 496 goto fail1;
e33da8a5 497 }
3bea733a 498
997ea58e
DM
499 wacom_wac->data = usb_alloc_coherent(dev, WACOM_PKGLEN_MAX,
500 GFP_KERNEL, &wacom->data_dma);
e33da8a5
JC
501 if (!wacom_wac->data) {
502 error = -ENOMEM;
3bea733a 503 goto fail1;
e33da8a5 504 }
3bea733a
PC
505
506 wacom->irq = usb_alloc_urb(0, GFP_KERNEL);
e33da8a5
JC
507 if (!wacom->irq) {
508 error = -ENOMEM;
3bea733a 509 goto fail2;
e33da8a5 510 }
3bea733a
PC
511
512 wacom->usbdev = dev;
e7224094
ON
513 wacom->intf = intf;
514 mutex_init(&wacom->lock);
3bea733a
PC
515 usb_make_path(dev, wacom->phys, sizeof(wacom->phys));
516 strlcat(wacom->phys, "/input0", sizeof(wacom->phys));
517
8da23fc1 518 wacom_wac->input = input_dev;
3bea733a 519
545f4e99
PC
520 endpoint = &intf->cur_altsetting->endpoint[0].desc;
521
ec67bbed
PC
522 /* Retrieve the physical and logical size for OEM devices */
523 error = wacom_retrieve_hid_descriptor(intf, features);
524 if (error)
4b6d4434 525 goto fail3;
545f4e99 526
bc73dd39
HR
527 wacom_setup_device_quirks(features);
528
49b764ae
PC
529 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
530
bc73dd39 531 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
49b764ae
PC
532 /* Append the device type to the name */
533 strlcat(wacom_wac->name,
534 features->device_type == BTN_TOOL_PEN ?
535 " Pen" : " Finger",
536 sizeof(wacom_wac->name));
4492efff
PC
537
538 error = wacom_add_shared_data(wacom_wac, dev);
539 if (error)
540 goto fail3;
49b764ae
PC
541 }
542
8da23fc1
DT
543 input_dev->name = wacom_wac->name;
544 input_dev->dev.parent = &intf->dev;
545 input_dev->open = wacom_open;
546 input_dev->close = wacom_close;
547 usb_to_input_id(dev, &input_dev->id);
548 input_set_drvdata(input_dev, wacom);
e33da8a5 549
8da23fc1 550 wacom_setup_input_capabilities(input_dev, wacom_wac);
3bea733a 551
3bea733a
PC
552 usb_fill_int_urb(wacom->irq, dev,
553 usb_rcvintpipe(dev, endpoint->bEndpointAddress),
ec67bbed 554 wacom_wac->data, features->pktlen,
8d32e3ae 555 wacom_sys_irq, wacom, endpoint->bInterval);
3bea733a
PC
556 wacom->irq->transfer_dma = wacom->data_dma;
557 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
558
8da23fc1 559 error = input_register_device(input_dev);
5014186d 560 if (error)
4492efff 561 goto fail4;
3bea733a 562
ec67bbed
PC
563 /* Note that if query fails it is not a hard failure */
564 wacom_query_tablet_data(intf, features);
3bea733a
PC
565
566 usb_set_intfdata(intf, wacom);
567 return 0;
568
4492efff 569 fail4: wacom_remove_shared_data(wacom_wac);
5014186d 570 fail3: usb_free_urb(wacom->irq);
997ea58e 571 fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma);
5014186d 572 fail1: input_free_device(input_dev);
3bea733a 573 kfree(wacom);
5014186d 574 return error;
3bea733a
PC
575}
576
577static void wacom_disconnect(struct usb_interface *intf)
578{
e7224094 579 struct wacom *wacom = usb_get_intfdata(intf);
3bea733a
PC
580
581 usb_set_intfdata(intf, NULL);
e7224094
ON
582
583 usb_kill_urb(wacom->irq);
8da23fc1 584 input_unregister_device(wacom->wacom_wac.input);
e7224094 585 usb_free_urb(wacom->irq);
997ea58e 586 usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX,
51269fe8
DT
587 wacom->wacom_wac.data, wacom->data_dma);
588 wacom_remove_shared_data(&wacom->wacom_wac);
e7224094
ON
589 kfree(wacom);
590}
591
592static int wacom_suspend(struct usb_interface *intf, pm_message_t message)
593{
594 struct wacom *wacom = usb_get_intfdata(intf);
595
596 mutex_lock(&wacom->lock);
597 usb_kill_urb(wacom->irq);
598 mutex_unlock(&wacom->lock);
599
600 return 0;
601}
602
603static int wacom_resume(struct usb_interface *intf)
604{
605 struct wacom *wacom = usb_get_intfdata(intf);
51269fe8 606 struct wacom_features *features = &wacom->wacom_wac.features;
e7224094
ON
607 int rv;
608
609 mutex_lock(&wacom->lock);
38101475
PC
610
611 /* switch to wacom mode first */
612 wacom_query_tablet_data(intf, features);
613
614 if (wacom->open)
e7224094 615 rv = usb_submit_urb(wacom->irq, GFP_NOIO);
38101475 616 else
e7224094 617 rv = 0;
38101475 618
e7224094
ON
619 mutex_unlock(&wacom->lock);
620
621 return rv;
622}
623
624static int wacom_reset_resume(struct usb_interface *intf)
625{
626 return wacom_resume(intf);
3bea733a
PC
627}
628
629static struct usb_driver wacom_driver = {
630 .name = "wacom",
b036f6fb 631 .id_table = wacom_ids,
3bea733a
PC
632 .probe = wacom_probe,
633 .disconnect = wacom_disconnect,
e7224094
ON
634 .suspend = wacom_suspend,
635 .resume = wacom_resume,
636 .reset_resume = wacom_reset_resume,
637 .supports_autosuspend = 1,
3bea733a
PC
638};
639
640static int __init wacom_init(void)
641{
642 int result;
b036f6fb 643
3bea733a
PC
644 result = usb_register(&wacom_driver);
645 if (result == 0)
899ef6e7
GKH
646 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
647 DRIVER_DESC "\n");
3bea733a
PC
648 return result;
649}
650
651static void __exit wacom_exit(void)
652{
653 usb_deregister(&wacom_driver);
654}
655
656module_init(wacom_init);
657module_exit(wacom_exit);
This page took 0.352982 seconds and 5 git commands to generate.