2 * drivers/input/tablet/wacom_sys.c
4 * USB Wacom tablet support - system specific code
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.
14 #include "wacom_wac.h"
17 #define WAC_MSG_RETRIES 5
19 #define WAC_CMD_WL_LED_CONTROL 0x03
20 #define WAC_CMD_LED_CONTROL 0x20
21 #define WAC_CMD_ICON_START 0x21
22 #define WAC_CMD_ICON_XFER 0x23
23 #define WAC_CMD_ICON_BT_XFER 0x26
24 #define WAC_CMD_RETRIES 10
26 #define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP)
27 #define DEV_ATTR_WO_PERM (S_IWUSR | S_IWGRP)
29 static int wacom_get_report(struct hid_device
*hdev
, u8 type
, u8
*buf
,
30 size_t size
, unsigned int retries
)
35 retval
= hid_hw_raw_request(hdev
, buf
[0], buf
, size
, type
,
37 } while ((retval
== -ETIMEDOUT
|| retval
== -EPIPE
) && --retries
);
42 static int wacom_set_report(struct hid_device
*hdev
, u8 type
, u8
*buf
,
43 size_t size
, unsigned int retries
)
48 retval
= hid_hw_raw_request(hdev
, buf
[0], buf
, size
, type
,
50 } while ((retval
== -ETIMEDOUT
|| retval
== -EPIPE
) && --retries
);
55 static int wacom_raw_event(struct hid_device
*hdev
, struct hid_report
*report
,
56 u8
*raw_data
, int size
)
58 struct wacom
*wacom
= hid_get_drvdata(hdev
);
60 if (size
> WACOM_PKGLEN_MAX
)
63 memcpy(wacom
->wacom_wac
.data
, raw_data
, size
);
65 wacom_wac_irq(&wacom
->wacom_wac
, size
);
70 static int wacom_open(struct input_dev
*dev
)
72 struct wacom
*wacom
= input_get_drvdata(dev
);
75 mutex_lock(&wacom
->lock
);
76 retval
= hid_hw_open(wacom
->hdev
);
77 mutex_unlock(&wacom
->lock
);
82 static void wacom_close(struct input_dev
*dev
)
84 struct wacom
*wacom
= input_get_drvdata(dev
);
86 mutex_lock(&wacom
->lock
);
87 hid_hw_close(wacom
->hdev
);
88 mutex_unlock(&wacom
->lock
);
92 * Calculate the resolution of the X or Y axis using hidinput_calc_abs_res.
94 static int wacom_calc_hid_res(int logical_extents
, int physical_extents
,
95 unsigned unit
, int exponent
)
97 struct hid_field field
= {
98 .logical_maximum
= logical_extents
,
99 .physical_maximum
= physical_extents
,
101 .unit_exponent
= exponent
,
104 return hidinput_calc_abs_res(&field
, ABS_X
);
107 static void wacom_feature_mapping(struct hid_device
*hdev
,
108 struct hid_field
*field
, struct hid_usage
*usage
)
110 struct wacom
*wacom
= hid_get_drvdata(hdev
);
111 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
112 struct hid_data
*hid_data
= &wacom
->wacom_wac
.hid_data
;
116 switch (usage
->hid
) {
117 case HID_DG_CONTACTMAX
:
118 /* leave touch_max as is if predefined */
119 if (!features
->touch_max
) {
121 data
= kzalloc(2, GFP_KERNEL
);
124 data
[0] = field
->report
->id
;
125 ret
= wacom_get_report(hdev
, HID_FEATURE_REPORT
,
128 features
->touch_max
= data
[1];
132 case HID_DG_INPUTMODE
:
133 /* Ignore if value index is out of bounds. */
134 if (usage
->usage_index
>= field
->report_count
) {
135 dev_err(&hdev
->dev
, "HID_DG_INPUTMODE out of range\n");
139 hid_data
->inputmode
= field
->report
->id
;
140 hid_data
->inputmode_index
= usage
->usage_index
;
146 * Interface Descriptor of wacom devices can be incomplete and
147 * inconsistent so wacom_features table is used to store stylus
148 * device's packet lengths, various maximum values, and tablet
149 * resolution based on product ID's.
151 * For devices that contain 2 interfaces, wacom_features table is
152 * inaccurate for the touch interface. Since the Interface Descriptor
153 * for touch interfaces has pretty complete data, this function exists
154 * to query tablet for this missing information instead of hard coding in
155 * an additional table.
157 * A typical Interface Descriptor for a stylus will contain a
158 * boot mouse application collection that is not of interest and this
159 * function will ignore it.
161 * It also contains a digitizer application collection that also is not
162 * of interest since any information it contains would be duplicate
163 * of what is in wacom_features. Usually it defines a report of an array
164 * of bytes that could be used as max length of the stylus packet returned.
165 * If it happens to define a Digitizer-Stylus Physical Collection then
166 * the X and Y logical values contain valid data but it is ignored.
168 * A typical Interface Descriptor for a touch interface will contain a
169 * Digitizer-Finger Physical Collection which will define both logical
170 * X/Y maximum as well as the physical size of tablet. Since touch
171 * interfaces haven't supported pressure or distance, this is enough
172 * information to override invalid values in the wacom_features table.
174 * Intuos5 touch interface and 3rd gen Bamboo Touch do not contain useful
175 * data. We deal with them after returning from this function.
177 static void wacom_usage_mapping(struct hid_device
*hdev
,
178 struct hid_field
*field
, struct hid_usage
*usage
)
180 struct wacom
*wacom
= hid_get_drvdata(hdev
);
181 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
182 bool finger
= (field
->logical
== HID_DG_FINGER
) ||
183 (field
->physical
== HID_DG_FINGER
);
184 bool pen
= (field
->logical
== HID_DG_STYLUS
) ||
185 (field
->physical
== HID_DG_STYLUS
);
188 * Requiring Stylus Usage will ignore boot mouse
189 * X/Y values and some cases of invalid Digitizer X/Y
190 * values commonly reported.
195 if (finger
&& !features
->touch_max
)
196 /* touch device at least supports one touch point */
197 features
->touch_max
= 1;
199 switch (usage
->hid
) {
201 features
->x_max
= field
->logical_maximum
;
203 features
->device_type
= BTN_TOOL_FINGER
;
204 features
->x_phy
= field
->physical_maximum
;
205 if (features
->type
!= BAMBOO_PT
) {
206 features
->unit
= field
->unit
;
207 features
->unitExpo
= field
->unit_exponent
;
210 features
->device_type
= BTN_TOOL_PEN
;
214 features
->y_max
= field
->logical_maximum
;
216 features
->y_phy
= field
->physical_maximum
;
217 if (features
->type
!= BAMBOO_PT
) {
218 features
->unit
= field
->unit
;
219 features
->unitExpo
= field
->unit_exponent
;
223 case HID_DG_TIPPRESSURE
:
225 features
->pressure_max
= field
->logical_maximum
;
229 if (features
->type
== HID_GENERIC
)
230 wacom_wac_usage_mapping(hdev
, field
, usage
);
233 static void wacom_parse_hid(struct hid_device
*hdev
,
234 struct wacom_features
*features
)
236 struct hid_report_enum
*rep_enum
;
237 struct hid_report
*hreport
;
240 /* check features first */
241 rep_enum
= &hdev
->report_enum
[HID_FEATURE_REPORT
];
242 list_for_each_entry(hreport
, &rep_enum
->report_list
, list
) {
243 for (i
= 0; i
< hreport
->maxfield
; i
++) {
244 /* Ignore if report count is out of bounds. */
245 if (hreport
->field
[i
]->report_count
< 1)
248 for (j
= 0; j
< hreport
->field
[i
]->maxusage
; j
++) {
249 wacom_feature_mapping(hdev
, hreport
->field
[i
],
250 hreport
->field
[i
]->usage
+ j
);
255 /* now check the input usages */
256 rep_enum
= &hdev
->report_enum
[HID_INPUT_REPORT
];
257 list_for_each_entry(hreport
, &rep_enum
->report_list
, list
) {
259 if (!hreport
->maxfield
)
262 for (i
= 0; i
< hreport
->maxfield
; i
++)
263 for (j
= 0; j
< hreport
->field
[i
]->maxusage
; j
++)
264 wacom_usage_mapping(hdev
, hreport
->field
[i
],
265 hreport
->field
[i
]->usage
+ j
);
269 static int wacom_hid_set_device_mode(struct hid_device
*hdev
)
271 struct wacom
*wacom
= hid_get_drvdata(hdev
);
272 struct hid_data
*hid_data
= &wacom
->wacom_wac
.hid_data
;
273 struct hid_report
*r
;
274 struct hid_report_enum
*re
;
276 if (hid_data
->inputmode
< 0)
279 re
= &(hdev
->report_enum
[HID_FEATURE_REPORT
]);
280 r
= re
->report_id_hash
[hid_data
->inputmode
];
282 r
->field
[0]->value
[hid_data
->inputmode_index
] = 2;
283 hid_hw_request(hdev
, r
, HID_REQ_SET_REPORT
);
288 static int wacom_set_device_mode(struct hid_device
*hdev
, int report_id
,
289 int length
, int mode
)
291 unsigned char *rep_data
;
292 int error
= -ENOMEM
, limit
= 0;
294 rep_data
= kzalloc(length
, GFP_KERNEL
);
299 rep_data
[0] = report_id
;
302 error
= wacom_set_report(hdev
, HID_FEATURE_REPORT
, rep_data
,
305 error
= wacom_get_report(hdev
, HID_FEATURE_REPORT
,
306 rep_data
, length
, 1);
307 } while ((error
< 0 || rep_data
[1] != mode
) && limit
++ < WAC_MSG_RETRIES
);
311 return error
< 0 ? error
: 0;
314 static int wacom_bt_query_tablet_data(struct hid_device
*hdev
, u8 speed
,
315 struct wacom_features
*features
)
317 struct wacom
*wacom
= hid_get_drvdata(hdev
);
321 switch (features
->type
) {
325 ret
= wacom_set_report(hdev
, HID_FEATURE_REPORT
, rep_data
, 2,
329 rep_data
[0] = speed
== 0 ? 0x05 : 0x06;
332 ret
= wacom_set_report(hdev
, HID_FEATURE_REPORT
,
336 wacom
->wacom_wac
.bt_high_speed
= speed
;
342 * Note that if the raw queries fail, it's not a hard failure
343 * and it is safe to continue
345 hid_warn(hdev
, "failed to poke device, command %d, err %d\n",
350 wacom
->wacom_wac
.bt_features
&= ~0x20;
352 wacom
->wacom_wac
.bt_features
|= 0x20;
355 rep_data
[1] = wacom
->wacom_wac
.bt_features
;
357 ret
= wacom_set_report(hdev
, HID_FEATURE_REPORT
, rep_data
, 2,
360 wacom
->wacom_wac
.bt_high_speed
= speed
;
368 * Switch the tablet into its most-capable mode. Wacom tablets are
369 * typically configured to power-up in a mode which sends mouse-like
370 * reports to the OS. To get absolute position, pressure data, etc.
371 * from the tablet, it is necessary to switch the tablet out of this
372 * mode and into one which sends the full range of tablet data.
374 static int wacom_query_tablet_data(struct hid_device
*hdev
,
375 struct wacom_features
*features
)
377 if (hdev
->bus
== BUS_BLUETOOTH
)
378 return wacom_bt_query_tablet_data(hdev
, 1, features
);
380 if (features
->type
== HID_GENERIC
)
381 return wacom_hid_set_device_mode(hdev
);
383 if (features
->device_type
== BTN_TOOL_FINGER
) {
384 if (features
->type
> TABLETPC
) {
385 /* MT Tablet PC touch */
386 return wacom_set_device_mode(hdev
, 3, 4, 4);
388 else if (features
->type
== WACOM_24HDT
|| features
->type
== CINTIQ_HYBRID
) {
389 return wacom_set_device_mode(hdev
, 18, 3, 2);
391 } else if (features
->device_type
== BTN_TOOL_PEN
) {
392 if (features
->type
<= BAMBOO_PT
&& features
->type
!= WIRELESS
) {
393 return wacom_set_device_mode(hdev
, 2, 2, 2);
400 static void wacom_retrieve_hid_descriptor(struct hid_device
*hdev
,
401 struct wacom_features
*features
)
403 struct wacom
*wacom
= hid_get_drvdata(hdev
);
404 struct usb_interface
*intf
= wacom
->intf
;
406 /* default features */
407 features
->device_type
= BTN_TOOL_PEN
;
408 features
->x_fuzz
= 4;
409 features
->y_fuzz
= 4;
410 features
->pressure_fuzz
= 0;
411 features
->distance_fuzz
= 0;
414 * The wireless device HID is basic and layout conflicts with
415 * other tablets (monitor and touch interface can look like pen).
416 * Skip the query for this type and modify defaults based on
419 if (features
->type
== WIRELESS
) {
420 if (intf
->cur_altsetting
->desc
.bInterfaceNumber
== 0) {
421 features
->device_type
= 0;
422 } else if (intf
->cur_altsetting
->desc
.bInterfaceNumber
== 2) {
423 features
->device_type
= BTN_TOOL_FINGER
;
424 features
->pktlen
= WACOM_PKGLEN_BBTOUCH3
;
428 /* only devices that support touch need to retrieve the info */
429 if (features
->type
< BAMBOO_PT
)
432 wacom_parse_hid(hdev
, features
);
435 struct wacom_hdev_data
{
436 struct list_head list
;
438 struct hid_device
*dev
;
439 struct wacom_shared shared
;
442 static LIST_HEAD(wacom_udev_list
);
443 static DEFINE_MUTEX(wacom_udev_list_lock
);
445 static bool wacom_are_sibling(struct hid_device
*hdev
,
446 struct hid_device
*sibling
)
448 struct wacom
*wacom
= hid_get_drvdata(hdev
);
449 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
450 int vid
= features
->oVid
;
451 int pid
= features
->oPid
;
454 if (vid
== 0 && pid
== 0) {
459 if (vid
!= sibling
->vendor
|| pid
!= sibling
->product
)
462 /* Compare the physical path. */
463 n1
= strrchr(hdev
->phys
, '.') - hdev
->phys
;
464 n2
= strrchr(sibling
->phys
, '.') - sibling
->phys
;
465 if (n1
!= n2
|| n1
<= 0 || n2
<= 0)
468 return !strncmp(hdev
->phys
, sibling
->phys
, n1
);
471 static struct wacom_hdev_data
*wacom_get_hdev_data(struct hid_device
*hdev
)
473 struct wacom_hdev_data
*data
;
475 list_for_each_entry(data
, &wacom_udev_list
, list
) {
476 if (wacom_are_sibling(hdev
, data
->dev
)) {
477 kref_get(&data
->kref
);
485 static int wacom_add_shared_data(struct hid_device
*hdev
)
487 struct wacom
*wacom
= hid_get_drvdata(hdev
);
488 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
489 struct wacom_hdev_data
*data
;
492 mutex_lock(&wacom_udev_list_lock
);
494 data
= wacom_get_hdev_data(hdev
);
496 data
= kzalloc(sizeof(struct wacom_hdev_data
), GFP_KERNEL
);
502 kref_init(&data
->kref
);
504 list_add_tail(&data
->list
, &wacom_udev_list
);
507 wacom_wac
->shared
= &data
->shared
;
510 mutex_unlock(&wacom_udev_list_lock
);
514 static void wacom_release_shared_data(struct kref
*kref
)
516 struct wacom_hdev_data
*data
=
517 container_of(kref
, struct wacom_hdev_data
, kref
);
519 mutex_lock(&wacom_udev_list_lock
);
520 list_del(&data
->list
);
521 mutex_unlock(&wacom_udev_list_lock
);
526 static void wacom_remove_shared_data(struct wacom_wac
*wacom
)
528 struct wacom_hdev_data
*data
;
531 data
= container_of(wacom
->shared
, struct wacom_hdev_data
, shared
);
532 kref_put(&data
->kref
, wacom_release_shared_data
);
533 wacom
->shared
= NULL
;
537 static int wacom_led_control(struct wacom
*wacom
)
541 unsigned char report_id
= WAC_CMD_LED_CONTROL
;
544 if (wacom
->wacom_wac
.pid
) { /* wireless connected */
545 report_id
= WAC_CMD_WL_LED_CONTROL
;
548 buf
= kzalloc(buf_size
, GFP_KERNEL
);
552 if (wacom
->wacom_wac
.features
.type
>= INTUOS5S
&&
553 wacom
->wacom_wac
.features
.type
<= INTUOSPL
) {
555 * Touch Ring and crop mark LED luminance may take on
556 * one of four values:
557 * 0 = Low; 1 = Medium; 2 = High; 3 = Off
559 int ring_led
= wacom
->led
.select
[0] & 0x03;
560 int ring_lum
= (((wacom
->led
.llv
& 0x60) >> 5) - 1) & 0x03;
562 unsigned char led_bits
= (crop_lum
<< 4) | (ring_lum
<< 2) | (ring_led
);
565 if (wacom
->wacom_wac
.pid
) {
566 wacom_get_report(wacom
->hdev
, HID_FEATURE_REPORT
,
567 buf
, buf_size
, WAC_CMD_RETRIES
);
574 int led
= wacom
->led
.select
[0] | 0x4;
576 if (wacom
->wacom_wac
.features
.type
== WACOM_21UX2
||
577 wacom
->wacom_wac
.features
.type
== WACOM_24HD
)
578 led
|= (wacom
->led
.select
[1] << 4) | 0x40;
582 buf
[2] = wacom
->led
.llv
;
583 buf
[3] = wacom
->led
.hlv
;
584 buf
[4] = wacom
->led
.img_lum
;
587 retval
= wacom_set_report(wacom
->hdev
, HID_FEATURE_REPORT
, buf
, buf_size
,
594 static int wacom_led_putimage(struct wacom
*wacom
, int button_id
, u8 xfer_id
,
595 const unsigned len
, const void *img
)
599 const unsigned chunk_len
= len
/ 4; /* 4 chunks are needed to be sent */
601 buf
= kzalloc(chunk_len
+ 3 , GFP_KERNEL
);
605 /* Send 'start' command */
606 buf
[0] = WAC_CMD_ICON_START
;
608 retval
= wacom_set_report(wacom
->hdev
, HID_FEATURE_REPORT
, buf
, 2,
614 buf
[1] = button_id
& 0x07;
615 for (i
= 0; i
< 4; i
++) {
617 memcpy(buf
+ 3, img
+ i
* chunk_len
, chunk_len
);
619 retval
= wacom_set_report(wacom
->hdev
, HID_FEATURE_REPORT
,
620 buf
, chunk_len
+ 3, WAC_CMD_RETRIES
);
626 buf
[0] = WAC_CMD_ICON_START
;
628 wacom_set_report(wacom
->hdev
, HID_FEATURE_REPORT
, buf
, 2,
636 static ssize_t
wacom_led_select_store(struct device
*dev
, int set_id
,
637 const char *buf
, size_t count
)
639 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
640 struct wacom
*wacom
= hid_get_drvdata(hdev
);
644 err
= kstrtouint(buf
, 10, &id
);
648 mutex_lock(&wacom
->lock
);
650 wacom
->led
.select
[set_id
] = id
& 0x3;
651 err
= wacom_led_control(wacom
);
653 mutex_unlock(&wacom
->lock
);
655 return err
< 0 ? err
: count
;
658 #define DEVICE_LED_SELECT_ATTR(SET_ID) \
659 static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \
660 struct device_attribute *attr, const char *buf, size_t count) \
662 return wacom_led_select_store(dev, SET_ID, buf, count); \
664 static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \
665 struct device_attribute *attr, char *buf) \
667 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
668 struct wacom *wacom = hid_get_drvdata(hdev); \
669 return scnprintf(buf, PAGE_SIZE, "%d\n", \
670 wacom->led.select[SET_ID]); \
672 static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \
673 wacom_led##SET_ID##_select_show, \
674 wacom_led##SET_ID##_select_store)
676 DEVICE_LED_SELECT_ATTR(0);
677 DEVICE_LED_SELECT_ATTR(1);
679 static ssize_t
wacom_luminance_store(struct wacom
*wacom
, u8
*dest
,
680 const char *buf
, size_t count
)
685 err
= kstrtouint(buf
, 10, &value
);
689 mutex_lock(&wacom
->lock
);
691 *dest
= value
& 0x7f;
692 err
= wacom_led_control(wacom
);
694 mutex_unlock(&wacom
->lock
);
696 return err
< 0 ? err
: count
;
699 #define DEVICE_LUMINANCE_ATTR(name, field) \
700 static ssize_t wacom_##name##_luminance_store(struct device *dev, \
701 struct device_attribute *attr, const char *buf, size_t count) \
703 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
704 struct wacom *wacom = hid_get_drvdata(hdev); \
706 return wacom_luminance_store(wacom, &wacom->led.field, \
709 static ssize_t wacom_##name##_luminance_show(struct device *dev, \
710 struct device_attribute *attr, char *buf) \
712 struct wacom *wacom = dev_get_drvdata(dev); \
713 return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \
715 static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \
716 wacom_##name##_luminance_show, \
717 wacom_##name##_luminance_store)
719 DEVICE_LUMINANCE_ATTR(status0
, llv
);
720 DEVICE_LUMINANCE_ATTR(status1
, hlv
);
721 DEVICE_LUMINANCE_ATTR(buttons
, img_lum
);
723 static ssize_t
wacom_button_image_store(struct device
*dev
, int button_id
,
724 const char *buf
, size_t count
)
726 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
727 struct wacom
*wacom
= hid_get_drvdata(hdev
);
732 if (hdev
->bus
== BUS_BLUETOOTH
) {
734 xfer_id
= WAC_CMD_ICON_BT_XFER
;
737 xfer_id
= WAC_CMD_ICON_XFER
;
743 mutex_lock(&wacom
->lock
);
745 err
= wacom_led_putimage(wacom
, button_id
, xfer_id
, len
, buf
);
747 mutex_unlock(&wacom
->lock
);
749 return err
< 0 ? err
: count
;
752 #define DEVICE_BTNIMG_ATTR(BUTTON_ID) \
753 static ssize_t wacom_btnimg##BUTTON_ID##_store(struct device *dev, \
754 struct device_attribute *attr, const char *buf, size_t count) \
756 return wacom_button_image_store(dev, BUTTON_ID, buf, count); \
758 static DEVICE_ATTR(button##BUTTON_ID##_rawimg, DEV_ATTR_WO_PERM, \
759 NULL, wacom_btnimg##BUTTON_ID##_store)
761 DEVICE_BTNIMG_ATTR(0);
762 DEVICE_BTNIMG_ATTR(1);
763 DEVICE_BTNIMG_ATTR(2);
764 DEVICE_BTNIMG_ATTR(3);
765 DEVICE_BTNIMG_ATTR(4);
766 DEVICE_BTNIMG_ATTR(5);
767 DEVICE_BTNIMG_ATTR(6);
768 DEVICE_BTNIMG_ATTR(7);
770 static struct attribute
*cintiq_led_attrs
[] = {
771 &dev_attr_status_led0_select
.attr
,
772 &dev_attr_status_led1_select
.attr
,
776 static struct attribute_group cintiq_led_attr_group
= {
778 .attrs
= cintiq_led_attrs
,
781 static struct attribute
*intuos4_led_attrs
[] = {
782 &dev_attr_status0_luminance
.attr
,
783 &dev_attr_status1_luminance
.attr
,
784 &dev_attr_status_led0_select
.attr
,
785 &dev_attr_buttons_luminance
.attr
,
786 &dev_attr_button0_rawimg
.attr
,
787 &dev_attr_button1_rawimg
.attr
,
788 &dev_attr_button2_rawimg
.attr
,
789 &dev_attr_button3_rawimg
.attr
,
790 &dev_attr_button4_rawimg
.attr
,
791 &dev_attr_button5_rawimg
.attr
,
792 &dev_attr_button6_rawimg
.attr
,
793 &dev_attr_button7_rawimg
.attr
,
797 static struct attribute_group intuos4_led_attr_group
= {
799 .attrs
= intuos4_led_attrs
,
802 static struct attribute
*intuos5_led_attrs
[] = {
803 &dev_attr_status0_luminance
.attr
,
804 &dev_attr_status_led0_select
.attr
,
808 static struct attribute_group intuos5_led_attr_group
= {
810 .attrs
= intuos5_led_attrs
,
813 static int wacom_initialize_leds(struct wacom
*wacom
)
817 /* Initialize default values */
818 switch (wacom
->wacom_wac
.features
.type
) {
823 wacom
->led
.select
[0] = 0;
824 wacom
->led
.select
[1] = 0;
827 wacom
->led
.img_lum
= 10;
828 error
= sysfs_create_group(&wacom
->hdev
->dev
.kobj
,
829 &intuos4_led_attr_group
);
834 wacom
->led
.select
[0] = 0;
835 wacom
->led
.select
[1] = 0;
838 wacom
->led
.img_lum
= 0;
840 error
= sysfs_create_group(&wacom
->hdev
->dev
.kobj
,
841 &cintiq_led_attr_group
);
850 if (wacom
->wacom_wac
.features
.device_type
== BTN_TOOL_PEN
) {
851 wacom
->led
.select
[0] = 0;
852 wacom
->led
.select
[1] = 0;
855 wacom
->led
.img_lum
= 0;
857 error
= sysfs_create_group(&wacom
->hdev
->dev
.kobj
,
858 &intuos5_led_attr_group
);
869 "cannot create sysfs group err: %d\n", error
);
872 wacom_led_control(wacom
);
873 wacom
->led_initialized
= true;
878 static void wacom_destroy_leds(struct wacom
*wacom
)
880 if (!wacom
->led_initialized
)
883 wacom
->led_initialized
= false;
885 switch (wacom
->wacom_wac
.features
.type
) {
890 sysfs_remove_group(&wacom
->hdev
->dev
.kobj
,
891 &intuos4_led_attr_group
);
896 sysfs_remove_group(&wacom
->hdev
->dev
.kobj
,
897 &cintiq_led_attr_group
);
906 if (wacom
->wacom_wac
.features
.device_type
== BTN_TOOL_PEN
)
907 sysfs_remove_group(&wacom
->hdev
->dev
.kobj
,
908 &intuos5_led_attr_group
);
913 static enum power_supply_property wacom_battery_props
[] = {
914 POWER_SUPPLY_PROP_STATUS
,
915 POWER_SUPPLY_PROP_SCOPE
,
916 POWER_SUPPLY_PROP_CAPACITY
919 static enum power_supply_property wacom_ac_props
[] = {
920 POWER_SUPPLY_PROP_PRESENT
,
921 POWER_SUPPLY_PROP_ONLINE
,
922 POWER_SUPPLY_PROP_SCOPE
,
925 static int wacom_battery_get_property(struct power_supply
*psy
,
926 enum power_supply_property psp
,
927 union power_supply_propval
*val
)
929 struct wacom
*wacom
= container_of(psy
, struct wacom
, battery
);
933 case POWER_SUPPLY_PROP_SCOPE
:
934 val
->intval
= POWER_SUPPLY_SCOPE_DEVICE
;
936 case POWER_SUPPLY_PROP_CAPACITY
:
938 wacom
->wacom_wac
.battery_capacity
;
940 case POWER_SUPPLY_PROP_STATUS
:
941 if (wacom
->wacom_wac
.bat_charging
)
942 val
->intval
= POWER_SUPPLY_STATUS_CHARGING
;
943 else if (wacom
->wacom_wac
.battery_capacity
== 100 &&
944 wacom
->wacom_wac
.ps_connected
)
945 val
->intval
= POWER_SUPPLY_STATUS_FULL
;
947 val
->intval
= POWER_SUPPLY_STATUS_DISCHARGING
;
957 static int wacom_ac_get_property(struct power_supply
*psy
,
958 enum power_supply_property psp
,
959 union power_supply_propval
*val
)
961 struct wacom
*wacom
= container_of(psy
, struct wacom
, ac
);
965 case POWER_SUPPLY_PROP_PRESENT
:
967 case POWER_SUPPLY_PROP_ONLINE
:
968 val
->intval
= wacom
->wacom_wac
.ps_connected
;
970 case POWER_SUPPLY_PROP_SCOPE
:
971 val
->intval
= POWER_SUPPLY_SCOPE_DEVICE
;
980 static int wacom_initialize_battery(struct wacom
*wacom
)
982 static atomic_t battery_no
= ATOMIC_INIT(0);
986 if (wacom
->wacom_wac
.features
.quirks
& WACOM_QUIRK_BATTERY
) {
987 n
= atomic_inc_return(&battery_no
) - 1;
989 wacom
->battery
.properties
= wacom_battery_props
;
990 wacom
->battery
.num_properties
= ARRAY_SIZE(wacom_battery_props
);
991 wacom
->battery
.get_property
= wacom_battery_get_property
;
992 sprintf(wacom
->wacom_wac
.bat_name
, "wacom_battery_%ld", n
);
993 wacom
->battery
.name
= wacom
->wacom_wac
.bat_name
;
994 wacom
->battery
.type
= POWER_SUPPLY_TYPE_BATTERY
;
995 wacom
->battery
.use_for_apm
= 0;
997 wacom
->ac
.properties
= wacom_ac_props
;
998 wacom
->ac
.num_properties
= ARRAY_SIZE(wacom_ac_props
);
999 wacom
->ac
.get_property
= wacom_ac_get_property
;
1000 sprintf(wacom
->wacom_wac
.ac_name
, "wacom_ac_%ld", n
);
1001 wacom
->ac
.name
= wacom
->wacom_wac
.ac_name
;
1002 wacom
->ac
.type
= POWER_SUPPLY_TYPE_MAINS
;
1003 wacom
->ac
.use_for_apm
= 0;
1005 error
= power_supply_register(&wacom
->hdev
->dev
,
1010 power_supply_powers(&wacom
->battery
, &wacom
->hdev
->dev
);
1012 error
= power_supply_register(&wacom
->hdev
->dev
, &wacom
->ac
);
1014 power_supply_unregister(&wacom
->battery
);
1018 power_supply_powers(&wacom
->ac
, &wacom
->hdev
->dev
);
1024 static void wacom_destroy_battery(struct wacom
*wacom
)
1026 if ((wacom
->wacom_wac
.features
.quirks
& WACOM_QUIRK_BATTERY
) &&
1027 wacom
->battery
.dev
) {
1028 power_supply_unregister(&wacom
->battery
);
1029 wacom
->battery
.dev
= NULL
;
1030 power_supply_unregister(&wacom
->ac
);
1031 wacom
->ac
.dev
= NULL
;
1035 static ssize_t
wacom_show_speed(struct device
*dev
,
1036 struct device_attribute
1039 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1040 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1042 return snprintf(buf
, PAGE_SIZE
, "%i\n", wacom
->wacom_wac
.bt_high_speed
);
1045 static ssize_t
wacom_store_speed(struct device
*dev
,
1046 struct device_attribute
*attr
,
1047 const char *buf
, size_t count
)
1049 struct hid_device
*hdev
= container_of(dev
, struct hid_device
, dev
);
1050 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1053 if (kstrtou8(buf
, 0, &new_speed
))
1056 if (new_speed
!= 0 && new_speed
!= 1)
1059 wacom_bt_query_tablet_data(hdev
, new_speed
, &wacom
->wacom_wac
.features
);
1064 static DEVICE_ATTR(speed
, DEV_ATTR_RW_PERM
,
1065 wacom_show_speed
, wacom_store_speed
);
1067 static struct input_dev
*wacom_allocate_input(struct wacom
*wacom
)
1069 struct input_dev
*input_dev
;
1070 struct hid_device
*hdev
= wacom
->hdev
;
1071 struct wacom_wac
*wacom_wac
= &(wacom
->wacom_wac
);
1073 input_dev
= input_allocate_device();
1077 input_dev
->name
= wacom_wac
->name
;
1078 input_dev
->phys
= hdev
->phys
;
1079 input_dev
->dev
.parent
= &hdev
->dev
;
1080 input_dev
->open
= wacom_open
;
1081 input_dev
->close
= wacom_close
;
1082 input_dev
->uniq
= hdev
->uniq
;
1083 input_dev
->id
.bustype
= hdev
->bus
;
1084 input_dev
->id
.vendor
= hdev
->vendor
;
1085 input_dev
->id
.product
= wacom_wac
->pid
? wacom_wac
->pid
: hdev
->product
;
1086 input_dev
->id
.version
= hdev
->version
;
1087 input_set_drvdata(input_dev
, wacom
);
1092 static void wacom_free_inputs(struct wacom
*wacom
)
1094 struct wacom_wac
*wacom_wac
= &(wacom
->wacom_wac
);
1096 if (wacom_wac
->input
)
1097 input_free_device(wacom_wac
->input
);
1098 if (wacom_wac
->pad_input
)
1099 input_free_device(wacom_wac
->pad_input
);
1100 wacom_wac
->input
= NULL
;
1101 wacom_wac
->pad_input
= NULL
;
1104 static int wacom_allocate_inputs(struct wacom
*wacom
)
1106 struct input_dev
*input_dev
, *pad_input_dev
;
1107 struct wacom_wac
*wacom_wac
= &(wacom
->wacom_wac
);
1109 input_dev
= wacom_allocate_input(wacom
);
1110 pad_input_dev
= wacom_allocate_input(wacom
);
1111 if (!input_dev
|| !pad_input_dev
) {
1112 wacom_free_inputs(wacom
);
1116 wacom_wac
->input
= input_dev
;
1117 wacom_wac
->pad_input
= pad_input_dev
;
1118 wacom_wac
->pad_input
->name
= wacom_wac
->pad_name
;
1123 static void wacom_clean_inputs(struct wacom
*wacom
)
1125 if (wacom
->wacom_wac
.input
) {
1126 if (wacom
->wacom_wac
.input_registered
)
1127 input_unregister_device(wacom
->wacom_wac
.input
);
1129 input_free_device(wacom
->wacom_wac
.input
);
1131 if (wacom
->wacom_wac
.pad_input
) {
1132 if (wacom
->wacom_wac
.input_registered
)
1133 input_unregister_device(wacom
->wacom_wac
.pad_input
);
1135 input_free_device(wacom
->wacom_wac
.pad_input
);
1137 wacom
->wacom_wac
.input
= NULL
;
1138 wacom
->wacom_wac
.pad_input
= NULL
;
1139 wacom_destroy_leds(wacom
);
1142 static int wacom_register_inputs(struct wacom
*wacom
)
1144 struct input_dev
*input_dev
, *pad_input_dev
;
1145 struct wacom_wac
*wacom_wac
= &(wacom
->wacom_wac
);
1148 input_dev
= wacom_wac
->input
;
1149 pad_input_dev
= wacom_wac
->pad_input
;
1151 if (!input_dev
|| !pad_input_dev
)
1154 error
= wacom_setup_input_capabilities(input_dev
, wacom_wac
);
1158 error
= input_register_device(input_dev
);
1162 error
= wacom_setup_pad_input_capabilities(pad_input_dev
, wacom_wac
);
1164 /* no pad in use on this interface */
1165 input_free_device(pad_input_dev
);
1166 wacom_wac
->pad_input
= NULL
;
1167 pad_input_dev
= NULL
;
1169 error
= input_register_device(pad_input_dev
);
1171 goto fail_register_pad_input
;
1173 error
= wacom_initialize_leds(wacom
);
1178 wacom_wac
->input_registered
= true;
1183 input_unregister_device(pad_input_dev
);
1184 pad_input_dev
= NULL
;
1185 fail_register_pad_input
:
1186 input_unregister_device(input_dev
);
1187 wacom_wac
->input
= NULL
;
1191 static void wacom_wireless_work(struct work_struct
*work
)
1193 struct wacom
*wacom
= container_of(work
, struct wacom
, work
);
1194 struct usb_device
*usbdev
= wacom
->usbdev
;
1195 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1196 struct hid_device
*hdev1
, *hdev2
;
1197 struct wacom
*wacom1
, *wacom2
;
1198 struct wacom_wac
*wacom_wac1
, *wacom_wac2
;
1202 * Regardless if this is a disconnect or a new tablet,
1203 * remove any existing input and battery devices.
1206 wacom_destroy_battery(wacom
);
1208 /* Stylus interface */
1209 hdev1
= usb_get_intfdata(usbdev
->config
->interface
[1]);
1210 wacom1
= hid_get_drvdata(hdev1
);
1211 wacom_wac1
= &(wacom1
->wacom_wac
);
1212 wacom_clean_inputs(wacom1
);
1214 /* Touch interface */
1215 hdev2
= usb_get_intfdata(usbdev
->config
->interface
[2]);
1216 wacom2
= hid_get_drvdata(hdev2
);
1217 wacom_wac2
= &(wacom2
->wacom_wac
);
1218 wacom_clean_inputs(wacom2
);
1220 if (wacom_wac
->pid
== 0) {
1221 hid_info(wacom
->hdev
, "wireless tablet disconnected\n");
1222 wacom_wac1
->shared
->type
= 0;
1224 const struct hid_device_id
*id
= wacom_ids
;
1226 hid_info(wacom
->hdev
, "wireless tablet connected with PID %x\n",
1230 if (id
->vendor
== USB_VENDOR_ID_WACOM
&&
1231 id
->product
== wacom_wac
->pid
)
1237 hid_info(wacom
->hdev
, "ignoring unknown PID.\n");
1241 /* Stylus interface */
1242 wacom_wac1
->features
=
1243 *((struct wacom_features
*)id
->driver_data
);
1244 wacom_wac1
->features
.device_type
= BTN_TOOL_PEN
;
1245 snprintf(wacom_wac1
->name
, WACOM_NAME_MAX
, "%s (WL) Pen",
1246 wacom_wac1
->features
.name
);
1247 snprintf(wacom_wac1
->pad_name
, WACOM_NAME_MAX
, "%s (WL) Pad",
1248 wacom_wac1
->features
.name
);
1249 wacom_wac1
->shared
->touch_max
= wacom_wac1
->features
.touch_max
;
1250 wacom_wac1
->shared
->type
= wacom_wac1
->features
.type
;
1251 wacom_wac1
->pid
= wacom_wac
->pid
;
1252 error
= wacom_allocate_inputs(wacom1
) ||
1253 wacom_register_inputs(wacom1
);
1257 /* Touch interface */
1258 if (wacom_wac1
->features
.touch_max
||
1259 wacom_wac1
->features
.type
== INTUOSHT
) {
1260 wacom_wac2
->features
=
1261 *((struct wacom_features
*)id
->driver_data
);
1262 wacom_wac2
->features
.pktlen
= WACOM_PKGLEN_BBTOUCH3
;
1263 wacom_wac2
->features
.device_type
= BTN_TOOL_FINGER
;
1264 wacom_wac2
->features
.x_max
= wacom_wac2
->features
.y_max
= 4096;
1265 if (wacom_wac2
->features
.touch_max
)
1266 snprintf(wacom_wac2
->name
, WACOM_NAME_MAX
,
1267 "%s (WL) Finger",wacom_wac2
->features
.name
);
1269 snprintf(wacom_wac2
->name
, WACOM_NAME_MAX
,
1270 "%s (WL) Pad",wacom_wac2
->features
.name
);
1271 snprintf(wacom_wac2
->pad_name
, WACOM_NAME_MAX
,
1272 "%s (WL) Pad", wacom_wac2
->features
.name
);
1273 wacom_wac2
->pid
= wacom_wac
->pid
;
1274 error
= wacom_allocate_inputs(wacom2
) ||
1275 wacom_register_inputs(wacom2
);
1279 if (wacom_wac1
->features
.type
== INTUOSHT
&&
1280 wacom_wac1
->features
.touch_max
)
1281 wacom_wac
->shared
->touch_input
= wacom_wac2
->input
;
1284 error
= wacom_initialize_battery(wacom
);
1292 wacom_clean_inputs(wacom1
);
1293 wacom_clean_inputs(wacom2
);
1298 * Not all devices report physical dimensions from HID.
1299 * Compute the default from hardcoded logical dimension
1300 * and resolution before driver overwrites them.
1302 static void wacom_set_default_phy(struct wacom_features
*features
)
1304 if (features
->x_resolution
) {
1305 features
->x_phy
= (features
->x_max
* 100) /
1306 features
->x_resolution
;
1307 features
->y_phy
= (features
->y_max
* 100) /
1308 features
->y_resolution
;
1312 static void wacom_calculate_res(struct wacom_features
*features
)
1314 features
->x_resolution
= wacom_calc_hid_res(features
->x_max
,
1317 features
->unitExpo
);
1318 features
->y_resolution
= wacom_calc_hid_res(features
->y_max
,
1321 features
->unitExpo
);
1324 static int wacom_hid_report_len(struct hid_report
*report
)
1326 /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1327 return ((report
->size
- 1) >> 3) + 1 + (report
->id
> 0);
1330 static size_t wacom_compute_pktlen(struct hid_device
*hdev
)
1332 struct hid_report_enum
*report_enum
;
1333 struct hid_report
*report
;
1336 report_enum
= hdev
->report_enum
+ HID_INPUT_REPORT
;
1338 list_for_each_entry(report
, &report_enum
->report_list
, list
) {
1339 size_t report_size
= wacom_hid_report_len(report
);
1340 if (report_size
> size
)
1347 static int wacom_probe(struct hid_device
*hdev
,
1348 const struct hid_device_id
*id
)
1350 struct usb_interface
*intf
= to_usb_interface(hdev
->dev
.parent
);
1351 struct usb_device
*dev
= interface_to_usbdev(intf
);
1352 struct wacom
*wacom
;
1353 struct wacom_wac
*wacom_wac
;
1354 struct wacom_features
*features
;
1356 unsigned int connect_mask
= HID_CONNECT_HIDRAW
;
1358 if (!id
->driver_data
)
1361 hdev
->quirks
|= HID_QUIRK_NO_INIT_REPORTS
;
1363 wacom
= kzalloc(sizeof(struct wacom
), GFP_KERNEL
);
1367 hid_set_drvdata(hdev
, wacom
);
1370 /* ask for the report descriptor to be loaded by HID */
1371 error
= hid_parse(hdev
);
1373 hid_err(hdev
, "parse failed\n");
1377 wacom_wac
= &wacom
->wacom_wac
;
1378 wacom_wac
->features
= *((struct wacom_features
*)id
->driver_data
);
1379 features
= &wacom_wac
->features
;
1380 features
->pktlen
= wacom_compute_pktlen(hdev
);
1381 if (features
->pktlen
> WACOM_PKGLEN_MAX
) {
1386 if (features
->check_for_hid_type
&& features
->hid_type
!= hdev
->type
) {
1391 wacom
->usbdev
= dev
;
1393 mutex_init(&wacom
->lock
);
1394 INIT_WORK(&wacom
->work
, wacom_wireless_work
);
1396 if (!(features
->quirks
& WACOM_QUIRK_NO_INPUT
)) {
1397 error
= wacom_allocate_inputs(wacom
);
1399 goto fail_allocate_inputs
;
1402 /* set the default size in case we do not get them from hid */
1403 wacom_set_default_phy(features
);
1405 /* Retrieve the physical and logical size for touch devices */
1406 wacom_retrieve_hid_descriptor(hdev
, features
);
1409 * Intuos5 has no useful data about its touch interface in its
1410 * HID descriptor. If this is the touch interface (PacketSize
1411 * of WACOM_PKGLEN_BBTOUCH3), override the table values.
1413 if (features
->type
>= INTUOS5S
&& features
->type
<= INTUOSHT
) {
1414 if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) {
1415 features
->device_type
= BTN_TOOL_FINGER
;
1417 features
->x_max
= 4096;
1418 features
->y_max
= 4096;
1420 features
->device_type
= BTN_TOOL_PEN
;
1425 * Same thing for Bamboo 3rd gen.
1427 if ((features
->type
== BAMBOO_PT
) &&
1428 (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) &&
1429 (features
->device_type
== BTN_TOOL_PEN
)) {
1430 features
->device_type
= BTN_TOOL_FINGER
;
1432 features
->x_max
= 4096;
1433 features
->y_max
= 4096;
1436 if (hdev
->bus
== BUS_BLUETOOTH
)
1437 features
->quirks
|= WACOM_QUIRK_BATTERY
;
1439 wacom_setup_device_quirks(features
);
1441 /* set unit to "100th of a mm" for devices not reported by HID */
1442 if (!features
->unit
) {
1443 features
->unit
= 0x11;
1444 features
->unitExpo
= -3;
1446 wacom_calculate_res(features
);
1448 strlcpy(wacom_wac
->name
, features
->name
, sizeof(wacom_wac
->name
));
1449 snprintf(wacom_wac
->pad_name
, sizeof(wacom_wac
->pad_name
),
1450 "%s Pad", features
->name
);
1452 if (features
->quirks
& WACOM_QUIRK_MULTI_INPUT
) {
1453 /* Append the device type to the name */
1454 if (features
->device_type
!= BTN_TOOL_FINGER
)
1455 strlcat(wacom_wac
->name
, " Pen", WACOM_NAME_MAX
);
1456 else if (features
->touch_max
)
1457 strlcat(wacom_wac
->name
, " Finger", WACOM_NAME_MAX
);
1459 strlcat(wacom_wac
->name
, " Pad", WACOM_NAME_MAX
);
1461 error
= wacom_add_shared_data(hdev
);
1463 goto fail_shared_data
;
1466 if (!(features
->quirks
& WACOM_QUIRK_MONITOR
) &&
1467 (features
->quirks
& WACOM_QUIRK_BATTERY
)) {
1468 error
= wacom_initialize_battery(wacom
);
1473 if (!(features
->quirks
& WACOM_QUIRK_NO_INPUT
)) {
1474 error
= wacom_register_inputs(wacom
);
1476 goto fail_register_inputs
;
1479 if (hdev
->bus
== BUS_BLUETOOTH
) {
1480 error
= device_create_file(&hdev
->dev
, &dev_attr_speed
);
1483 "can't create sysfs speed attribute err: %d\n",
1487 if (features
->type
== HID_GENERIC
)
1488 connect_mask
|= HID_CONNECT_DRIVER
;
1490 /* Regular HID work starts now */
1491 error
= hid_hw_start(hdev
, connect_mask
);
1493 hid_err(hdev
, "hw start failed\n");
1497 /* Note that if query fails it is not a hard failure */
1498 wacom_query_tablet_data(hdev
, features
);
1500 if (features
->quirks
& WACOM_QUIRK_MONITOR
)
1501 error
= hid_hw_open(hdev
);
1503 if (wacom_wac
->features
.type
== INTUOSHT
&& wacom_wac
->features
.touch_max
) {
1504 if (wacom_wac
->features
.device_type
== BTN_TOOL_FINGER
)
1505 wacom_wac
->shared
->touch_input
= wacom_wac
->input
;
1511 if (hdev
->bus
== BUS_BLUETOOTH
)
1512 device_remove_file(&hdev
->dev
, &dev_attr_speed
);
1513 fail_register_inputs
:
1514 wacom_clean_inputs(wacom
);
1515 wacom_destroy_battery(wacom
);
1517 wacom_remove_shared_data(wacom_wac
);
1519 wacom_clean_inputs(wacom
);
1520 fail_allocate_inputs
:
1525 hid_set_drvdata(hdev
, NULL
);
1529 static void wacom_remove(struct hid_device
*hdev
)
1531 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1535 cancel_work_sync(&wacom
->work
);
1536 wacom_clean_inputs(wacom
);
1537 if (hdev
->bus
== BUS_BLUETOOTH
)
1538 device_remove_file(&hdev
->dev
, &dev_attr_speed
);
1539 wacom_destroy_battery(wacom
);
1540 wacom_remove_shared_data(&wacom
->wacom_wac
);
1542 hid_set_drvdata(hdev
, NULL
);
1547 static int wacom_resume(struct hid_device
*hdev
)
1549 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1550 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
1552 mutex_lock(&wacom
->lock
);
1554 /* switch to wacom mode first */
1555 wacom_query_tablet_data(hdev
, features
);
1556 wacom_led_control(wacom
);
1558 mutex_unlock(&wacom
->lock
);
1563 static int wacom_reset_resume(struct hid_device
*hdev
)
1565 return wacom_resume(hdev
);
1567 #endif /* CONFIG_PM */
1569 static struct hid_driver wacom_driver
= {
1571 .id_table
= wacom_ids
,
1572 .probe
= wacom_probe
,
1573 .remove
= wacom_remove
,
1574 .event
= wacom_wac_event
,
1575 .report
= wacom_wac_report
,
1577 .resume
= wacom_resume
,
1578 .reset_resume
= wacom_reset_resume
,
1580 .raw_event
= wacom_raw_event
,
1582 module_hid_driver(wacom_driver
);
1584 MODULE_VERSION(DRIVER_VERSION
);
1585 MODULE_AUTHOR(DRIVER_AUTHOR
);
1586 MODULE_DESCRIPTION(DRIVER_DESC
);
1587 MODULE_LICENSE(DRIVER_LICENSE
);