diff options
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 222 |
1 files changed, 81 insertions, 141 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index c34791e7f0b9..5ceeab6e95f1 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -83,86 +83,40 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, | |||
83 | return retval; | 83 | return retval; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void wacom_sys_irq(struct urb *urb) | 86 | static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, |
87 | u8 *raw_data, int size) | ||
87 | { | 88 | { |
88 | struct wacom *wacom = urb->context; | 89 | struct wacom *wacom = hid_get_drvdata(hdev); |
89 | struct device *dev = &wacom->intf->dev; | ||
90 | int retval; | ||
91 | 90 | ||
92 | switch (urb->status) { | 91 | if (size > WACOM_PKGLEN_MAX) |
93 | case 0: | 92 | return 1; |
94 | /* success */ | ||
95 | break; | ||
96 | case -ECONNRESET: | ||
97 | case -ENOENT: | ||
98 | case -ESHUTDOWN: | ||
99 | /* this urb is terminated, clean up */ | ||
100 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", | ||
101 | __func__, urb->status); | ||
102 | return; | ||
103 | default: | ||
104 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", | ||
105 | __func__, urb->status); | ||
106 | goto exit; | ||
107 | } | ||
108 | 93 | ||
109 | wacom_wac_irq(&wacom->wacom_wac, urb->actual_length); | 94 | memcpy(wacom->wacom_wac.data, raw_data, size); |
110 | 95 | ||
111 | exit: | 96 | wacom_wac_irq(&wacom->wacom_wac, size); |
112 | usb_mark_last_busy(wacom->usbdev); | 97 | |
113 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 98 | return 0; |
114 | if (retval) | ||
115 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", | ||
116 | __func__, retval); | ||
117 | } | 99 | } |
118 | 100 | ||
119 | static int wacom_open(struct input_dev *dev) | 101 | static int wacom_open(struct input_dev *dev) |
120 | { | 102 | { |
121 | struct wacom *wacom = input_get_drvdata(dev); | 103 | struct wacom *wacom = input_get_drvdata(dev); |
122 | int retval = 0; | 104 | int retval; |
123 | |||
124 | if (usb_autopm_get_interface(wacom->intf) < 0) | ||
125 | return -EIO; | ||
126 | 105 | ||
127 | mutex_lock(&wacom->lock); | 106 | mutex_lock(&wacom->lock); |
128 | 107 | retval = hid_hw_open(wacom->hdev); | |
129 | if (wacom->open) | ||
130 | goto out; | ||
131 | |||
132 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | ||
133 | retval = -EIO; | ||
134 | goto out; | ||
135 | } | ||
136 | |||
137 | wacom->open = true; | ||
138 | wacom->intf->needs_remote_wakeup = 1; | ||
139 | |||
140 | out: | ||
141 | mutex_unlock(&wacom->lock); | 108 | mutex_unlock(&wacom->lock); |
142 | usb_autopm_put_interface(wacom->intf); | 109 | |
143 | return retval; | 110 | return retval; |
144 | } | 111 | } |
145 | 112 | ||
146 | static void wacom_close(struct input_dev *dev) | 113 | static void wacom_close(struct input_dev *dev) |
147 | { | 114 | { |
148 | struct wacom *wacom = input_get_drvdata(dev); | 115 | struct wacom *wacom = input_get_drvdata(dev); |
149 | int autopm_error; | ||
150 | |||
151 | autopm_error = usb_autopm_get_interface(wacom->intf); | ||
152 | 116 | ||
153 | mutex_lock(&wacom->lock); | 117 | mutex_lock(&wacom->lock); |
154 | if (!wacom->open) | 118 | hid_hw_close(wacom->hdev); |
155 | goto out; | ||
156 | |||
157 | usb_kill_urb(wacom->irq); | ||
158 | wacom->open = false; | ||
159 | wacom->intf->needs_remote_wakeup = 0; | ||
160 | |||
161 | out: | ||
162 | mutex_unlock(&wacom->lock); | 119 | mutex_unlock(&wacom->lock); |
163 | |||
164 | if (!autopm_error) | ||
165 | usb_autopm_put_interface(wacom->intf); | ||
166 | } | 120 | } |
167 | 121 | ||
168 | /* | 122 | /* |
@@ -807,7 +761,8 @@ out: | |||
807 | static ssize_t wacom_led_select_store(struct device *dev, int set_id, | 761 | static ssize_t wacom_led_select_store(struct device *dev, int set_id, |
808 | const char *buf, size_t count) | 762 | const char *buf, size_t count) |
809 | { | 763 | { |
810 | struct wacom *wacom = dev_get_drvdata(dev); | 764 | struct hid_device *hdev = dev_get_drvdata(dev); |
765 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
811 | unsigned int id; | 766 | unsigned int id; |
812 | int err; | 767 | int err; |
813 | 768 | ||
@@ -834,7 +789,8 @@ static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \ | |||
834 | static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ | 789 | static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ |
835 | struct device_attribute *attr, char *buf) \ | 790 | struct device_attribute *attr, char *buf) \ |
836 | { \ | 791 | { \ |
837 | struct wacom *wacom = dev_get_drvdata(dev); \ | 792 | struct hid_device *hdev = dev_get_drvdata(dev); \ |
793 | struct wacom *wacom = hid_get_drvdata(hdev); \ | ||
838 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ | 794 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ |
839 | } \ | 795 | } \ |
840 | static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ | 796 | static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ |
@@ -868,7 +824,8 @@ static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest, | |||
868 | static ssize_t wacom_##name##_luminance_store(struct device *dev, \ | 824 | static ssize_t wacom_##name##_luminance_store(struct device *dev, \ |
869 | struct device_attribute *attr, const char *buf, size_t count) \ | 825 | struct device_attribute *attr, const char *buf, size_t count) \ |
870 | { \ | 826 | { \ |
871 | struct wacom *wacom = dev_get_drvdata(dev); \ | 827 | struct hid_device *hdev = dev_get_drvdata(dev); \ |
828 | struct wacom *wacom = hid_get_drvdata(hdev); \ | ||
872 | \ | 829 | \ |
873 | return wacom_luminance_store(wacom, &wacom->led.field, \ | 830 | return wacom_luminance_store(wacom, &wacom->led.field, \ |
874 | buf, count); \ | 831 | buf, count); \ |
@@ -883,7 +840,8 @@ DEVICE_LUMINANCE_ATTR(buttons, img_lum); | |||
883 | static ssize_t wacom_button_image_store(struct device *dev, int button_id, | 840 | static ssize_t wacom_button_image_store(struct device *dev, int button_id, |
884 | const char *buf, size_t count) | 841 | const char *buf, size_t count) |
885 | { | 842 | { |
886 | struct wacom *wacom = dev_get_drvdata(dev); | 843 | struct hid_device *hdev = dev_get_drvdata(dev); |
844 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
887 | int err; | 845 | int err; |
888 | 846 | ||
889 | if (count != 1024) | 847 | if (count != 1024) |
@@ -1201,6 +1159,7 @@ static void wacom_wireless_work(struct work_struct *work) | |||
1201 | struct wacom *wacom = container_of(work, struct wacom, work); | 1159 | struct wacom *wacom = container_of(work, struct wacom, work); |
1202 | struct usb_device *usbdev = wacom->usbdev; | 1160 | struct usb_device *usbdev = wacom->usbdev; |
1203 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 1161 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
1162 | struct hid_device *hdev1, *hdev2; | ||
1204 | struct wacom *wacom1, *wacom2; | 1163 | struct wacom *wacom1, *wacom2; |
1205 | struct wacom_wac *wacom_wac1, *wacom_wac2; | 1164 | struct wacom_wac *wacom_wac1, *wacom_wac2; |
1206 | int error; | 1165 | int error; |
@@ -1213,32 +1172,34 @@ static void wacom_wireless_work(struct work_struct *work) | |||
1213 | wacom_destroy_battery(wacom); | 1172 | wacom_destroy_battery(wacom); |
1214 | 1173 | ||
1215 | /* Stylus interface */ | 1174 | /* Stylus interface */ |
1216 | wacom1 = usb_get_intfdata(usbdev->config->interface[1]); | 1175 | hdev1 = usb_get_intfdata(usbdev->config->interface[1]); |
1176 | wacom1 = hid_get_drvdata(hdev1); | ||
1217 | wacom_wac1 = &(wacom1->wacom_wac); | 1177 | wacom_wac1 = &(wacom1->wacom_wac); |
1218 | wacom_unregister_inputs(wacom1); | 1178 | wacom_unregister_inputs(wacom1); |
1219 | 1179 | ||
1220 | /* Touch interface */ | 1180 | /* Touch interface */ |
1221 | wacom2 = usb_get_intfdata(usbdev->config->interface[2]); | 1181 | hdev2 = usb_get_intfdata(usbdev->config->interface[2]); |
1182 | wacom2 = hid_get_drvdata(hdev2); | ||
1222 | wacom_wac2 = &(wacom2->wacom_wac); | 1183 | wacom_wac2 = &(wacom2->wacom_wac); |
1223 | wacom_unregister_inputs(wacom2); | 1184 | wacom_unregister_inputs(wacom2); |
1224 | 1185 | ||
1225 | if (wacom_wac->pid == 0) { | 1186 | if (wacom_wac->pid == 0) { |
1226 | dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); | 1187 | dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); |
1227 | } else { | 1188 | } else { |
1228 | const struct usb_device_id *id = wacom_ids; | 1189 | const struct hid_device_id *id = wacom_ids; |
1229 | 1190 | ||
1230 | dev_info(&wacom->intf->dev, | 1191 | dev_info(&wacom->intf->dev, |
1231 | "wireless tablet connected with PID %x\n", | 1192 | "wireless tablet connected with PID %x\n", |
1232 | wacom_wac->pid); | 1193 | wacom_wac->pid); |
1233 | 1194 | ||
1234 | while (id->match_flags) { | 1195 | while (id->bus) { |
1235 | if (id->idVendor == USB_VENDOR_ID_WACOM && | 1196 | if (id->vendor == USB_VENDOR_ID_WACOM && |
1236 | id->idProduct == wacom_wac->pid) | 1197 | id->product == wacom_wac->pid) |
1237 | break; | 1198 | break; |
1238 | id++; | 1199 | id++; |
1239 | } | 1200 | } |
1240 | 1201 | ||
1241 | if (!id->match_flags) { | 1202 | if (!id->bus) { |
1242 | dev_info(&wacom->intf->dev, | 1203 | dev_info(&wacom->intf->dev, |
1243 | "ignoring unknown PID.\n"); | 1204 | "ignoring unknown PID.\n"); |
1244 | return; | 1205 | return; |
@@ -1246,7 +1207,7 @@ static void wacom_wireless_work(struct work_struct *work) | |||
1246 | 1207 | ||
1247 | /* Stylus interface */ | 1208 | /* Stylus interface */ |
1248 | wacom_wac1->features = | 1209 | wacom_wac1->features = |
1249 | *((struct wacom_features *)id->driver_info); | 1210 | *((struct wacom_features *)id->driver_data); |
1250 | wacom_wac1->features.device_type = BTN_TOOL_PEN; | 1211 | wacom_wac1->features.device_type = BTN_TOOL_PEN; |
1251 | snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", | 1212 | snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", |
1252 | wacom_wac1->features.name); | 1213 | wacom_wac1->features.name); |
@@ -1262,7 +1223,7 @@ static void wacom_wireless_work(struct work_struct *work) | |||
1262 | if (wacom_wac1->features.touch_max || | 1223 | if (wacom_wac1->features.touch_max || |
1263 | wacom_wac1->features.type == INTUOSHT) { | 1224 | wacom_wac1->features.type == INTUOSHT) { |
1264 | wacom_wac2->features = | 1225 | wacom_wac2->features = |
1265 | *((struct wacom_features *)id->driver_info); | 1226 | *((struct wacom_features *)id->driver_data); |
1266 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | 1227 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; |
1267 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; | 1228 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; |
1268 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; | 1229 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; |
@@ -1323,8 +1284,10 @@ static void wacom_calculate_res(struct wacom_features *features) | |||
1323 | features->unitExpo); | 1284 | features->unitExpo); |
1324 | } | 1285 | } |
1325 | 1286 | ||
1326 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1287 | static int wacom_probe(struct hid_device *hdev, |
1288 | const struct hid_device_id *id) | ||
1327 | { | 1289 | { |
1290 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
1328 | struct usb_device *dev = interface_to_usbdev(intf); | 1291 | struct usb_device *dev = interface_to_usbdev(intf); |
1329 | struct usb_endpoint_descriptor *endpoint; | 1292 | struct usb_endpoint_descriptor *endpoint; |
1330 | struct wacom *wacom; | 1293 | struct wacom *wacom; |
@@ -1332,34 +1295,29 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1332 | struct wacom_features *features; | 1295 | struct wacom_features *features; |
1333 | int error; | 1296 | int error; |
1334 | 1297 | ||
1335 | if (!id->driver_info) | 1298 | if (!id->driver_data) |
1336 | return -EINVAL; | 1299 | return -EINVAL; |
1337 | 1300 | ||
1338 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 1301 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
1339 | if (!wacom) | 1302 | if (!wacom) |
1340 | return -ENOMEM; | 1303 | return -ENOMEM; |
1341 | 1304 | ||
1305 | hid_set_drvdata(hdev, wacom); | ||
1306 | wacom->hdev = hdev; | ||
1307 | |||
1342 | wacom_wac = &wacom->wacom_wac; | 1308 | wacom_wac = &wacom->wacom_wac; |
1343 | wacom_wac->features = *((struct wacom_features *)id->driver_info); | 1309 | wacom_wac->features = *((struct wacom_features *)id->driver_data); |
1344 | features = &wacom_wac->features; | 1310 | features = &wacom_wac->features; |
1345 | if (features->pktlen > WACOM_PKGLEN_MAX) { | 1311 | if (features->pktlen > WACOM_PKGLEN_MAX) { |
1346 | error = -EINVAL; | 1312 | error = -EINVAL; |
1347 | goto fail1; | 1313 | goto fail1; |
1348 | } | 1314 | } |
1349 | 1315 | ||
1350 | wacom_wac->data = usb_alloc_coherent(dev, WACOM_PKGLEN_MAX, | 1316 | if (features->check_for_hid_type && features->hid_type != hdev->type) { |
1351 | GFP_KERNEL, &wacom->data_dma); | 1317 | error = -ENODEV; |
1352 | if (!wacom_wac->data) { | ||
1353 | error = -ENOMEM; | ||
1354 | goto fail1; | 1318 | goto fail1; |
1355 | } | 1319 | } |
1356 | 1320 | ||
1357 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); | ||
1358 | if (!wacom->irq) { | ||
1359 | error = -ENOMEM; | ||
1360 | goto fail2; | ||
1361 | } | ||
1362 | |||
1363 | wacom->usbdev = dev; | 1321 | wacom->usbdev = dev; |
1364 | wacom->intf = intf; | 1322 | wacom->intf = intf; |
1365 | mutex_init(&wacom->lock); | 1323 | mutex_init(&wacom->lock); |
@@ -1375,7 +1333,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1375 | /* Retrieve the physical and logical size for touch devices */ | 1333 | /* Retrieve the physical and logical size for touch devices */ |
1376 | error = wacom_retrieve_hid_descriptor(intf, features); | 1334 | error = wacom_retrieve_hid_descriptor(intf, features); |
1377 | if (error) | 1335 | if (error) |
1378 | goto fail3; | 1336 | goto fail1; |
1379 | 1337 | ||
1380 | /* | 1338 | /* |
1381 | * Intuos5 has no useful data about its touch interface in its | 1339 | * Intuos5 has no useful data about its touch interface in its |
@@ -1423,38 +1381,38 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1423 | other_dev = dev; | 1381 | other_dev = dev; |
1424 | error = wacom_add_shared_data(wacom_wac, other_dev); | 1382 | error = wacom_add_shared_data(wacom_wac, other_dev); |
1425 | if (error) | 1383 | if (error) |
1426 | goto fail3; | 1384 | goto fail1; |
1427 | } | 1385 | } |
1428 | 1386 | ||
1429 | usb_fill_int_urb(wacom->irq, dev, | ||
1430 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), | ||
1431 | wacom_wac->data, features->pktlen, | ||
1432 | wacom_sys_irq, wacom, endpoint->bInterval); | ||
1433 | wacom->irq->transfer_dma = wacom->data_dma; | ||
1434 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
1435 | |||
1436 | error = wacom_initialize_leds(wacom); | 1387 | error = wacom_initialize_leds(wacom); |
1437 | if (error) | 1388 | if (error) |
1438 | goto fail4; | 1389 | goto fail2; |
1439 | 1390 | ||
1440 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { | 1391 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { |
1441 | error = wacom_register_inputs(wacom); | 1392 | error = wacom_register_inputs(wacom); |
1442 | if (error) | 1393 | if (error) |
1443 | goto fail5; | 1394 | goto fail3; |
1444 | } | 1395 | } |
1445 | 1396 | ||
1446 | /* Note that if query fails it is not a hard failure */ | 1397 | /* Note that if query fails it is not a hard failure */ |
1447 | wacom_query_tablet_data(intf, features); | 1398 | wacom_query_tablet_data(intf, features); |
1448 | 1399 | ||
1449 | usb_set_intfdata(intf, wacom); | 1400 | /* Regular HID work starts now */ |
1401 | error = hid_parse(hdev); | ||
1402 | if (error) { | ||
1403 | hid_err(hdev, "parse failed\n"); | ||
1404 | goto fail4; | ||
1405 | } | ||
1450 | 1406 | ||
1451 | if (features->quirks & WACOM_QUIRK_MONITOR) { | 1407 | error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); |
1452 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | 1408 | if (error) { |
1453 | error = -EIO; | 1409 | hid_err(hdev, "hw start failed\n"); |
1454 | goto fail5; | 1410 | goto fail4; |
1455 | } | ||
1456 | } | 1411 | } |
1457 | 1412 | ||
1413 | if (features->quirks & WACOM_QUIRK_MONITOR) | ||
1414 | error = hid_hw_open(hdev); | ||
1415 | |||
1458 | if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { | 1416 | if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { |
1459 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) | 1417 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) |
1460 | wacom_wac->shared->touch_input = wacom_wac->input; | 1418 | wacom_wac->shared->touch_input = wacom_wac->input; |
@@ -1462,78 +1420,60 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1462 | 1420 | ||
1463 | return 0; | 1421 | return 0; |
1464 | 1422 | ||
1465 | fail5: wacom_destroy_leds(wacom); | 1423 | fail4: wacom_unregister_inputs(wacom); |
1466 | fail4: wacom_remove_shared_data(wacom_wac); | 1424 | fail3: wacom_destroy_leds(wacom); |
1467 | fail3: usb_free_urb(wacom->irq); | 1425 | fail2: wacom_remove_shared_data(wacom_wac); |
1468 | fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); | ||
1469 | fail1: kfree(wacom); | 1426 | fail1: kfree(wacom); |
1427 | hid_set_drvdata(hdev, NULL); | ||
1470 | return error; | 1428 | return error; |
1471 | } | 1429 | } |
1472 | 1430 | ||
1473 | static void wacom_disconnect(struct usb_interface *intf) | 1431 | static void wacom_remove(struct hid_device *hdev) |
1474 | { | 1432 | { |
1475 | struct wacom *wacom = usb_get_intfdata(intf); | 1433 | struct wacom *wacom = hid_get_drvdata(hdev); |
1476 | 1434 | ||
1477 | usb_set_intfdata(intf, NULL); | 1435 | hid_hw_stop(hdev); |
1478 | 1436 | ||
1479 | usb_kill_urb(wacom->irq); | ||
1480 | cancel_work_sync(&wacom->work); | 1437 | cancel_work_sync(&wacom->work); |
1481 | wacom_unregister_inputs(wacom); | 1438 | wacom_unregister_inputs(wacom); |
1482 | wacom_destroy_battery(wacom); | 1439 | wacom_destroy_battery(wacom); |
1483 | wacom_destroy_leds(wacom); | 1440 | wacom_destroy_leds(wacom); |
1484 | usb_free_urb(wacom->irq); | ||
1485 | usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, | ||
1486 | wacom->wacom_wac.data, wacom->data_dma); | ||
1487 | wacom_remove_shared_data(&wacom->wacom_wac); | 1441 | wacom_remove_shared_data(&wacom->wacom_wac); |
1488 | kfree(wacom); | ||
1489 | } | ||
1490 | |||
1491 | static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | ||
1492 | { | ||
1493 | struct wacom *wacom = usb_get_intfdata(intf); | ||
1494 | |||
1495 | mutex_lock(&wacom->lock); | ||
1496 | usb_kill_urb(wacom->irq); | ||
1497 | mutex_unlock(&wacom->lock); | ||
1498 | 1442 | ||
1499 | return 0; | 1443 | hid_set_drvdata(hdev, NULL); |
1444 | kfree(wacom); | ||
1500 | } | 1445 | } |
1501 | 1446 | ||
1502 | static int wacom_resume(struct usb_interface *intf) | 1447 | static int wacom_resume(struct hid_device *hdev) |
1503 | { | 1448 | { |
1504 | struct wacom *wacom = usb_get_intfdata(intf); | 1449 | struct wacom *wacom = hid_get_drvdata(hdev); |
1505 | struct wacom_features *features = &wacom->wacom_wac.features; | 1450 | struct wacom_features *features = &wacom->wacom_wac.features; |
1506 | int rv = 0; | ||
1507 | 1451 | ||
1508 | mutex_lock(&wacom->lock); | 1452 | mutex_lock(&wacom->lock); |
1509 | 1453 | ||
1510 | /* switch to wacom mode first */ | 1454 | /* switch to wacom mode first */ |
1511 | wacom_query_tablet_data(intf, features); | 1455 | wacom_query_tablet_data(wacom->intf, features); |
1512 | wacom_led_control(wacom); | 1456 | wacom_led_control(wacom); |
1513 | 1457 | ||
1514 | if ((wacom->open || (features->quirks & WACOM_QUIRK_MONITOR)) && | ||
1515 | usb_submit_urb(wacom->irq, GFP_NOIO) < 0) | ||
1516 | rv = -EIO; | ||
1517 | |||
1518 | mutex_unlock(&wacom->lock); | 1458 | mutex_unlock(&wacom->lock); |
1519 | 1459 | ||
1520 | return rv; | 1460 | return 0; |
1521 | } | 1461 | } |
1522 | 1462 | ||
1523 | static int wacom_reset_resume(struct usb_interface *intf) | 1463 | static int wacom_reset_resume(struct hid_device *hdev) |
1524 | { | 1464 | { |
1525 | return wacom_resume(intf); | 1465 | return wacom_resume(hdev); |
1526 | } | 1466 | } |
1527 | 1467 | ||
1528 | static struct usb_driver wacom_driver = { | 1468 | static struct hid_driver wacom_driver = { |
1529 | .name = "wacom", | 1469 | .name = "wacom", |
1530 | .id_table = wacom_ids, | 1470 | .id_table = wacom_ids, |
1531 | .probe = wacom_probe, | 1471 | .probe = wacom_probe, |
1532 | .disconnect = wacom_disconnect, | 1472 | .remove = wacom_remove, |
1533 | .suspend = wacom_suspend, | 1473 | #ifdef CONFIG_PM |
1534 | .resume = wacom_resume, | 1474 | .resume = wacom_resume, |
1535 | .reset_resume = wacom_reset_resume, | 1475 | .reset_resume = wacom_reset_resume, |
1536 | .supports_autosuspend = 1, | 1476 | #endif |
1477 | .raw_event = wacom_raw_event, | ||
1537 | }; | 1478 | }; |
1538 | 1479 | module_hid_driver(wacom_driver); | |
1539 | module_usb_driver(wacom_driver); | ||