diff options
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 215 |
1 files changed, 155 insertions, 60 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 567d57215c28..f45f80f6d336 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -95,6 +95,7 @@ struct usbtouch_device_info { | |||
95 | int (*get_pkt_len) (unsigned char *pkt, int len); | 95 | int (*get_pkt_len) (unsigned char *pkt, int len); |
96 | 96 | ||
97 | int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); | 97 | int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); |
98 | int (*alloc) (struct usbtouch_usb *usbtouch); | ||
98 | int (*init) (struct usbtouch_usb *usbtouch); | 99 | int (*init) (struct usbtouch_usb *usbtouch); |
99 | void (*exit) (struct usbtouch_usb *usbtouch); | 100 | void (*exit) (struct usbtouch_usb *usbtouch); |
100 | }; | 101 | }; |
@@ -135,7 +136,7 @@ enum { | |||
135 | DEVTYPE_JASTEC, | 136 | DEVTYPE_JASTEC, |
136 | DEVTYPE_E2I, | 137 | DEVTYPE_E2I, |
137 | DEVTYPE_ZYTRONIC, | 138 | DEVTYPE_ZYTRONIC, |
138 | DEVTYPE_TC5UH, | 139 | DEVTYPE_TC45USB, |
139 | DEVTYPE_NEXIO, | 140 | DEVTYPE_NEXIO, |
140 | }; | 141 | }; |
141 | 142 | ||
@@ -222,8 +223,11 @@ static const struct usb_device_id usbtouch_devices[] = { | |||
222 | {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, | 223 | {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, |
223 | #endif | 224 | #endif |
224 | 225 | ||
225 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | 226 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB |
226 | {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, | 227 | /* TC5UH */ |
228 | {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC45USB}, | ||
229 | /* TC4UM */ | ||
230 | {USB_DEVICE(0x0664, 0x0306), .driver_info = DEVTYPE_TC45USB}, | ||
227 | #endif | 231 | #endif |
228 | 232 | ||
229 | #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO | 233 | #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO |
@@ -507,7 +511,7 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) | |||
507 | int ret = -ENOMEM; | 511 | int ret = -ENOMEM; |
508 | unsigned char *buf; | 512 | unsigned char *buf; |
509 | 513 | ||
510 | buf = kmalloc(2, GFP_KERNEL); | 514 | buf = kmalloc(2, GFP_NOIO); |
511 | if (!buf) | 515 | if (!buf) |
512 | goto err_nobuf; | 516 | goto err_nobuf; |
513 | /* reset */ | 517 | /* reset */ |
@@ -574,10 +578,10 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
574 | #endif | 578 | #endif |
575 | 579 | ||
576 | /***************************************************************************** | 580 | /***************************************************************************** |
577 | * ET&T TC5UH part | 581 | * ET&T TC5UH/TC4UM part |
578 | */ | 582 | */ |
579 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | 583 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB |
580 | static int tc5uh_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 584 | static int tc45usb_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
581 | { | 585 | { |
582 | dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; | 586 | dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; |
583 | dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; | 587 | dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; |
@@ -732,11 +736,43 @@ static void nexio_ack_complete(struct urb *urb) | |||
732 | { | 736 | { |
733 | } | 737 | } |
734 | 738 | ||
739 | static int nexio_alloc(struct usbtouch_usb *usbtouch) | ||
740 | { | ||
741 | struct nexio_priv *priv; | ||
742 | int ret = -ENOMEM; | ||
743 | |||
744 | usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); | ||
745 | if (!usbtouch->priv) | ||
746 | goto out_buf; | ||
747 | |||
748 | priv = usbtouch->priv; | ||
749 | |||
750 | priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt), | ||
751 | GFP_KERNEL); | ||
752 | if (!priv->ack_buf) | ||
753 | goto err_priv; | ||
754 | |||
755 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); | ||
756 | if (!priv->ack) { | ||
757 | dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); | ||
758 | goto err_ack_buf; | ||
759 | } | ||
760 | |||
761 | return 0; | ||
762 | |||
763 | err_ack_buf: | ||
764 | kfree(priv->ack_buf); | ||
765 | err_priv: | ||
766 | kfree(priv); | ||
767 | out_buf: | ||
768 | return ret; | ||
769 | } | ||
770 | |||
735 | static int nexio_init(struct usbtouch_usb *usbtouch) | 771 | static int nexio_init(struct usbtouch_usb *usbtouch) |
736 | { | 772 | { |
737 | struct usb_device *dev = interface_to_usbdev(usbtouch->interface); | 773 | struct usb_device *dev = interface_to_usbdev(usbtouch->interface); |
738 | struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; | 774 | struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; |
739 | struct nexio_priv *priv; | 775 | struct nexio_priv *priv = usbtouch->priv; |
740 | int ret = -ENOMEM; | 776 | int ret = -ENOMEM; |
741 | int actual_len, i; | 777 | int actual_len, i; |
742 | unsigned char *buf; | 778 | unsigned char *buf; |
@@ -755,7 +791,7 @@ static int nexio_init(struct usbtouch_usb *usbtouch) | |||
755 | if (!input_ep || !output_ep) | 791 | if (!input_ep || !output_ep) |
756 | return -ENXIO; | 792 | return -ENXIO; |
757 | 793 | ||
758 | buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL); | 794 | buf = kmalloc(NEXIO_BUFSIZE, GFP_NOIO); |
759 | if (!buf) | 795 | if (!buf) |
760 | goto out_buf; | 796 | goto out_buf; |
761 | 797 | ||
@@ -787,11 +823,11 @@ static int nexio_init(struct usbtouch_usb *usbtouch) | |||
787 | switch (buf[0]) { | 823 | switch (buf[0]) { |
788 | case 0x83: /* firmware version */ | 824 | case 0x83: /* firmware version */ |
789 | if (!firmware_ver) | 825 | if (!firmware_ver) |
790 | firmware_ver = kstrdup(&buf[2], GFP_KERNEL); | 826 | firmware_ver = kstrdup(&buf[2], GFP_NOIO); |
791 | break; | 827 | break; |
792 | case 0x84: /* device name */ | 828 | case 0x84: /* device name */ |
793 | if (!device_name) | 829 | if (!device_name) |
794 | device_name = kstrdup(&buf[2], GFP_KERNEL); | 830 | device_name = kstrdup(&buf[2], GFP_NOIO); |
795 | break; | 831 | break; |
796 | } | 832 | } |
797 | } | 833 | } |
@@ -802,36 +838,11 @@ static int nexio_init(struct usbtouch_usb *usbtouch) | |||
802 | kfree(firmware_ver); | 838 | kfree(firmware_ver); |
803 | kfree(device_name); | 839 | kfree(device_name); |
804 | 840 | ||
805 | /* prepare ACK URB */ | ||
806 | ret = -ENOMEM; | ||
807 | |||
808 | usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); | ||
809 | if (!usbtouch->priv) | ||
810 | goto out_buf; | ||
811 | |||
812 | priv = usbtouch->priv; | ||
813 | |||
814 | priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt), | ||
815 | GFP_KERNEL); | ||
816 | if (!priv->ack_buf) | ||
817 | goto err_priv; | ||
818 | |||
819 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); | ||
820 | if (!priv->ack) { | ||
821 | dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); | ||
822 | goto err_ack_buf; | ||
823 | } | ||
824 | |||
825 | usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep), | 841 | usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep), |
826 | priv->ack_buf, sizeof(nexio_ack_pkt), | 842 | priv->ack_buf, sizeof(nexio_ack_pkt), |
827 | nexio_ack_complete, usbtouch); | 843 | nexio_ack_complete, usbtouch); |
828 | ret = 0; | 844 | ret = 0; |
829 | goto out_buf; | ||
830 | 845 | ||
831 | err_ack_buf: | ||
832 | kfree(priv->ack_buf); | ||
833 | err_priv: | ||
834 | kfree(priv); | ||
835 | out_buf: | 846 | out_buf: |
836 | kfree(buf); | 847 | kfree(buf); |
837 | return ret; | 848 | return ret; |
@@ -849,29 +860,32 @@ static void nexio_exit(struct usbtouch_usb *usbtouch) | |||
849 | 860 | ||
850 | static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) | 861 | static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) |
851 | { | 862 | { |
852 | int x, y, begin_x, begin_y, end_x, end_y, w, h, ret; | ||
853 | struct nexio_touch_packet *packet = (void *) pkt; | 863 | struct nexio_touch_packet *packet = (void *) pkt; |
854 | struct nexio_priv *priv = usbtouch->priv; | 864 | struct nexio_priv *priv = usbtouch->priv; |
865 | unsigned int data_len = be16_to_cpu(packet->data_len); | ||
866 | unsigned int x_len = be16_to_cpu(packet->x_len); | ||
867 | unsigned int y_len = be16_to_cpu(packet->y_len); | ||
868 | int x, y, begin_x, begin_y, end_x, end_y, w, h, ret; | ||
855 | 869 | ||
856 | /* got touch data? */ | 870 | /* got touch data? */ |
857 | if ((pkt[0] & 0xe0) != 0xe0) | 871 | if ((pkt[0] & 0xe0) != 0xe0) |
858 | return 0; | 872 | return 0; |
859 | 873 | ||
860 | if (be16_to_cpu(packet->data_len) > 0xff) | 874 | if (data_len > 0xff) |
861 | packet->data_len = cpu_to_be16(be16_to_cpu(packet->data_len) - 0x100); | 875 | data_len -= 0x100; |
862 | if (be16_to_cpu(packet->x_len) > 0xff) | 876 | if (x_len > 0xff) |
863 | packet->x_len = cpu_to_be16(be16_to_cpu(packet->x_len) - 0x80); | 877 | x_len -= 0x80; |
864 | 878 | ||
865 | /* send ACK */ | 879 | /* send ACK */ |
866 | ret = usb_submit_urb(priv->ack, GFP_ATOMIC); | 880 | ret = usb_submit_urb(priv->ack, GFP_ATOMIC); |
867 | 881 | ||
868 | if (!usbtouch->type->max_xc) { | 882 | if (!usbtouch->type->max_xc) { |
869 | usbtouch->type->max_xc = 2 * be16_to_cpu(packet->x_len); | 883 | usbtouch->type->max_xc = 2 * x_len; |
870 | input_set_abs_params(usbtouch->input, ABS_X, 0, | 884 | input_set_abs_params(usbtouch->input, ABS_X, |
871 | 2 * be16_to_cpu(packet->x_len), 0, 0); | 885 | 0, usbtouch->type->max_xc, 0, 0); |
872 | usbtouch->type->max_yc = 2 * be16_to_cpu(packet->y_len); | 886 | usbtouch->type->max_yc = 2 * y_len; |
873 | input_set_abs_params(usbtouch->input, ABS_Y, 0, | 887 | input_set_abs_params(usbtouch->input, ABS_Y, |
874 | 2 * be16_to_cpu(packet->y_len), 0, 0); | 888 | 0, usbtouch->type->max_yc, 0, 0); |
875 | } | 889 | } |
876 | /* | 890 | /* |
877 | * The device reports state of IR sensors on X and Y axes. | 891 | * The device reports state of IR sensors on X and Y axes. |
@@ -881,22 +895,21 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) | |||
881 | * it's disabled (and untested) here as there's no X driver for that. | 895 | * it's disabled (and untested) here as there's no X driver for that. |
882 | */ | 896 | */ |
883 | begin_x = end_x = begin_y = end_y = -1; | 897 | begin_x = end_x = begin_y = end_y = -1; |
884 | for (x = 0; x < be16_to_cpu(packet->x_len); x++) { | 898 | for (x = 0; x < x_len; x++) { |
885 | if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) { | 899 | if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) { |
886 | begin_x = x; | 900 | begin_x = x; |
887 | continue; | 901 | continue; |
888 | } | 902 | } |
889 | if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) { | 903 | if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) { |
890 | end_x = x - 1; | 904 | end_x = x - 1; |
891 | for (y = be16_to_cpu(packet->x_len); | 905 | for (y = x_len; y < data_len; y++) { |
892 | y < be16_to_cpu(packet->data_len); y++) { | ||
893 | if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) { | 906 | if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) { |
894 | begin_y = y - be16_to_cpu(packet->x_len); | 907 | begin_y = y - x_len; |
895 | continue; | 908 | continue; |
896 | } | 909 | } |
897 | if (end_y == -1 && | 910 | if (end_y == -1 && |
898 | begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) { | 911 | begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) { |
899 | end_y = y - 1 - be16_to_cpu(packet->x_len); | 912 | end_y = y - 1 - x_len; |
900 | w = end_x - begin_x; | 913 | w = end_x - begin_x; |
901 | h = end_y - begin_y; | 914 | h = end_y - begin_y; |
902 | #if 0 | 915 | #if 0 |
@@ -1104,14 +1117,14 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
1104 | }, | 1117 | }, |
1105 | #endif | 1118 | #endif |
1106 | 1119 | ||
1107 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH | 1120 | #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB |
1108 | [DEVTYPE_TC5UH] = { | 1121 | [DEVTYPE_TC45USB] = { |
1109 | .min_xc = 0x0, | 1122 | .min_xc = 0x0, |
1110 | .max_xc = 0x0fff, | 1123 | .max_xc = 0x0fff, |
1111 | .min_yc = 0x0, | 1124 | .min_yc = 0x0, |
1112 | .max_yc = 0x0fff, | 1125 | .max_yc = 0x0fff, |
1113 | .rept_size = 5, | 1126 | .rept_size = 5, |
1114 | .read_data = tc5uh_read_data, | 1127 | .read_data = tc45usb_read_data, |
1115 | }, | 1128 | }, |
1116 | #endif | 1129 | #endif |
1117 | 1130 | ||
@@ -1120,6 +1133,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
1120 | .rept_size = 1024, | 1133 | .rept_size = 1024, |
1121 | .irq_always = true, | 1134 | .irq_always = true, |
1122 | .read_data = nexio_read_data, | 1135 | .read_data = nexio_read_data, |
1136 | .alloc = nexio_alloc, | ||
1123 | .init = nexio_init, | 1137 | .init = nexio_init, |
1124 | .exit = nexio_exit, | 1138 | .exit = nexio_exit, |
1125 | }, | 1139 | }, |
@@ -1263,6 +1277,7 @@ static void usbtouch_irq(struct urb *urb) | |||
1263 | usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); | 1277 | usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); |
1264 | 1278 | ||
1265 | exit: | 1279 | exit: |
1280 | usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); | ||
1266 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1281 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1267 | if (retval) | 1282 | if (retval) |
1268 | err("%s - usb_submit_urb failed with result: %d", | 1283 | err("%s - usb_submit_urb failed with result: %d", |
@@ -1272,25 +1287,89 @@ exit: | |||
1272 | static int usbtouch_open(struct input_dev *input) | 1287 | static int usbtouch_open(struct input_dev *input) |
1273 | { | 1288 | { |
1274 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); | 1289 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); |
1290 | int r; | ||
1275 | 1291 | ||
1276 | usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); | 1292 | usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); |
1277 | 1293 | ||
1294 | r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; | ||
1295 | if (r < 0) | ||
1296 | goto out; | ||
1297 | |||
1278 | if (!usbtouch->type->irq_always) { | 1298 | if (!usbtouch->type->irq_always) { |
1279 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) | 1299 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { |
1280 | return -EIO; | 1300 | r = -EIO; |
1301 | goto out_put; | ||
1302 | } | ||
1281 | } | 1303 | } |
1282 | 1304 | ||
1283 | return 0; | 1305 | usbtouch->interface->needs_remote_wakeup = 1; |
1306 | out_put: | ||
1307 | usb_autopm_put_interface(usbtouch->interface); | ||
1308 | out: | ||
1309 | return r; | ||
1284 | } | 1310 | } |
1285 | 1311 | ||
1286 | static void usbtouch_close(struct input_dev *input) | 1312 | static void usbtouch_close(struct input_dev *input) |
1287 | { | 1313 | { |
1288 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); | 1314 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); |
1315 | int r; | ||
1289 | 1316 | ||
1290 | if (!usbtouch->type->irq_always) | 1317 | if (!usbtouch->type->irq_always) |
1291 | usb_kill_urb(usbtouch->irq); | 1318 | usb_kill_urb(usbtouch->irq); |
1319 | r = usb_autopm_get_interface(usbtouch->interface); | ||
1320 | usbtouch->interface->needs_remote_wakeup = 0; | ||
1321 | if (!r) | ||
1322 | usb_autopm_put_interface(usbtouch->interface); | ||
1292 | } | 1323 | } |
1293 | 1324 | ||
1325 | static int usbtouch_suspend | ||
1326 | (struct usb_interface *intf, pm_message_t message) | ||
1327 | { | ||
1328 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | ||
1329 | |||
1330 | usb_kill_urb(usbtouch->irq); | ||
1331 | |||
1332 | return 0; | ||
1333 | } | ||
1334 | |||
1335 | static int usbtouch_resume(struct usb_interface *intf) | ||
1336 | { | ||
1337 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | ||
1338 | struct input_dev *input = usbtouch->input; | ||
1339 | int result = 0; | ||
1340 | |||
1341 | mutex_lock(&input->mutex); | ||
1342 | if (input->users || usbtouch->type->irq_always) | ||
1343 | result = usb_submit_urb(usbtouch->irq, GFP_NOIO); | ||
1344 | mutex_unlock(&input->mutex); | ||
1345 | |||
1346 | return result; | ||
1347 | } | ||
1348 | |||
1349 | static int usbtouch_reset_resume(struct usb_interface *intf) | ||
1350 | { | ||
1351 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | ||
1352 | struct input_dev *input = usbtouch->input; | ||
1353 | int err = 0; | ||
1354 | |||
1355 | /* reinit the device */ | ||
1356 | if (usbtouch->type->init) { | ||
1357 | err = usbtouch->type->init(usbtouch); | ||
1358 | if (err) { | ||
1359 | dbg("%s - type->init() failed, err: %d", | ||
1360 | __func__, err); | ||
1361 | return err; | ||
1362 | } | ||
1363 | } | ||
1364 | |||
1365 | /* restart IO if needed */ | ||
1366 | mutex_lock(&input->mutex); | ||
1367 | if (input->users) | ||
1368 | err = usb_submit_urb(usbtouch->irq, GFP_NOIO); | ||
1369 | mutex_unlock(&input->mutex); | ||
1370 | |||
1371 | return err; | ||
1372 | } | ||
1294 | 1373 | ||
1295 | static void usbtouch_free_buffers(struct usb_device *udev, | 1374 | static void usbtouch_free_buffers(struct usb_device *udev, |
1296 | struct usbtouch_usb *usbtouch) | 1375 | struct usbtouch_usb *usbtouch) |
@@ -1411,12 +1490,21 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1411 | usbtouch->irq->transfer_dma = usbtouch->data_dma; | 1490 | usbtouch->irq->transfer_dma = usbtouch->data_dma; |
1412 | usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1491 | usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1413 | 1492 | ||
1414 | /* device specific init */ | 1493 | /* device specific allocations */ |
1494 | if (type->alloc) { | ||
1495 | err = type->alloc(usbtouch); | ||
1496 | if (err) { | ||
1497 | dbg("%s - type->alloc() failed, err: %d", __func__, err); | ||
1498 | goto out_free_urb; | ||
1499 | } | ||
1500 | } | ||
1501 | |||
1502 | /* device specific initialisation*/ | ||
1415 | if (type->init) { | 1503 | if (type->init) { |
1416 | err = type->init(usbtouch); | 1504 | err = type->init(usbtouch); |
1417 | if (err) { | 1505 | if (err) { |
1418 | dbg("%s - type->init() failed, err: %d", __func__, err); | 1506 | dbg("%s - type->init() failed, err: %d", __func__, err); |
1419 | goto out_free_urb; | 1507 | goto out_do_exit; |
1420 | } | 1508 | } |
1421 | } | 1509 | } |
1422 | 1510 | ||
@@ -1429,8 +1517,11 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1429 | usb_set_intfdata(intf, usbtouch); | 1517 | usb_set_intfdata(intf, usbtouch); |
1430 | 1518 | ||
1431 | if (usbtouch->type->irq_always) { | 1519 | if (usbtouch->type->irq_always) { |
1520 | /* this can't fail */ | ||
1521 | usb_autopm_get_interface(intf); | ||
1432 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); | 1522 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); |
1433 | if (err) { | 1523 | if (err) { |
1524 | usb_autopm_put_interface(intf); | ||
1434 | err("%s - usb_submit_urb failed with result: %d", | 1525 | err("%s - usb_submit_urb failed with result: %d", |
1435 | __func__, err); | 1526 | __func__, err); |
1436 | goto out_unregister_input; | 1527 | goto out_unregister_input; |
@@ -1481,7 +1572,11 @@ static struct usb_driver usbtouch_driver = { | |||
1481 | .name = "usbtouchscreen", | 1572 | .name = "usbtouchscreen", |
1482 | .probe = usbtouch_probe, | 1573 | .probe = usbtouch_probe, |
1483 | .disconnect = usbtouch_disconnect, | 1574 | .disconnect = usbtouch_disconnect, |
1575 | .suspend = usbtouch_suspend, | ||
1576 | .resume = usbtouch_resume, | ||
1577 | .reset_resume = usbtouch_reset_resume, | ||
1484 | .id_table = usbtouch_devices, | 1578 | .id_table = usbtouch_devices, |
1579 | .supports_autosuspend = 1, | ||
1485 | }; | 1580 | }; |
1486 | 1581 | ||
1487 | static int __init usbtouch_init(void) | 1582 | static int __init usbtouch_init(void) |