diff options
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 22cd96f58c99..e32709e0dd65 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -269,8 +269,9 @@ static int e2i_init(struct usbtouch_usb *usbtouch) | |||
269 | 0x01, 0x02, 0x0000, 0x0081, | 269 | 0x01, 0x02, 0x0000, 0x0081, |
270 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 270 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
271 | 271 | ||
272 | dbg("%s - usb_control_msg - E2I_RESET - bytes|err: %d", | 272 | dev_dbg(&usbtouch->interface->dev, |
273 | __func__, ret); | 273 | "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", |
274 | __func__, ret); | ||
274 | return ret; | 275 | return ret; |
275 | } | 276 | } |
276 | 277 | ||
@@ -425,8 +426,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
425 | MTOUCHUSB_RESET, | 426 | MTOUCHUSB_RESET, |
426 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 427 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
427 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | 428 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
428 | dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", | 429 | dev_dbg(&usbtouch->interface->dev, |
429 | __func__, ret); | 430 | "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", |
431 | __func__, ret); | ||
430 | if (ret < 0) | 432 | if (ret < 0) |
431 | return ret; | 433 | return ret; |
432 | msleep(150); | 434 | msleep(150); |
@@ -436,8 +438,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
436 | MTOUCHUSB_ASYNC_REPORT, | 438 | MTOUCHUSB_ASYNC_REPORT, |
437 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 439 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
438 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); | 440 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); |
439 | dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", | 441 | dev_dbg(&usbtouch->interface->dev, |
440 | __func__, ret); | 442 | "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", |
443 | __func__, ret); | ||
441 | if (ret >= 0) | 444 | if (ret >= 0) |
442 | break; | 445 | break; |
443 | if (ret != -EPIPE) | 446 | if (ret != -EPIPE) |
@@ -737,27 +740,29 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
737 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | 740 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC |
738 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 741 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
739 | { | 742 | { |
743 | struct usb_interface *intf = dev->interface; | ||
744 | |||
740 | switch (pkt[0]) { | 745 | switch (pkt[0]) { |
741 | case 0x3A: /* command response */ | 746 | case 0x3A: /* command response */ |
742 | dbg("%s: Command response %d", __func__, pkt[1]); | 747 | dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]); |
743 | break; | 748 | break; |
744 | 749 | ||
745 | case 0xC0: /* down */ | 750 | case 0xC0: /* down */ |
746 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | 751 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); |
747 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | 752 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); |
748 | dev->touch = 1; | 753 | dev->touch = 1; |
749 | dbg("%s: down %d,%d", __func__, dev->x, dev->y); | 754 | dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); |
750 | return 1; | 755 | return 1; |
751 | 756 | ||
752 | case 0x80: /* up */ | 757 | case 0x80: /* up */ |
753 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | 758 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); |
754 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | 759 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); |
755 | dev->touch = 0; | 760 | dev->touch = 0; |
756 | dbg("%s: up %d,%d", __func__, dev->x, dev->y); | 761 | dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); |
757 | return 1; | 762 | return 1; |
758 | 763 | ||
759 | default: | 764 | default: |
760 | dbg("%s: Unknown return %d", __func__, pkt[0]); | 765 | dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); |
761 | break; | 766 | break; |
762 | } | 767 | } |
763 | 768 | ||
@@ -812,7 +817,8 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) | |||
812 | 817 | ||
813 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); | 818 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); |
814 | if (!priv->ack) { | 819 | if (!priv->ack) { |
815 | dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); | 820 | dev_dbg(&usbtouch->interface->dev, |
821 | "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); | ||
816 | goto err_ack_buf; | 822 | goto err_ack_buf; |
817 | } | 823 | } |
818 | 824 | ||
@@ -1349,6 +1355,7 @@ out_flush_buf: | |||
1349 | static void usbtouch_irq(struct urb *urb) | 1355 | static void usbtouch_irq(struct urb *urb) |
1350 | { | 1356 | { |
1351 | struct usbtouch_usb *usbtouch = urb->context; | 1357 | struct usbtouch_usb *usbtouch = urb->context; |
1358 | struct device *dev = &usbtouch->interface->dev; | ||
1352 | int retval; | 1359 | int retval; |
1353 | 1360 | ||
1354 | switch (urb->status) { | 1361 | switch (urb->status) { |
@@ -1357,20 +1364,21 @@ static void usbtouch_irq(struct urb *urb) | |||
1357 | break; | 1364 | break; |
1358 | case -ETIME: | 1365 | case -ETIME: |
1359 | /* this urb is timing out */ | 1366 | /* this urb is timing out */ |
1360 | dbg("%s - urb timed out - was the device unplugged?", | 1367 | dev_dbg(dev, |
1361 | __func__); | 1368 | "%s - urb timed out - was the device unplugged?\n", |
1369 | __func__); | ||
1362 | return; | 1370 | return; |
1363 | case -ECONNRESET: | 1371 | case -ECONNRESET: |
1364 | case -ENOENT: | 1372 | case -ENOENT: |
1365 | case -ESHUTDOWN: | 1373 | case -ESHUTDOWN: |
1366 | case -EPIPE: | 1374 | case -EPIPE: |
1367 | /* this urb is terminated, clean up */ | 1375 | /* this urb is terminated, clean up */ |
1368 | dbg("%s - urb shutting down with status: %d", | 1376 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
1369 | __func__, urb->status); | 1377 | __func__, urb->status); |
1370 | return; | 1378 | return; |
1371 | default: | 1379 | default: |
1372 | dbg("%s - nonzero urb status received: %d", | 1380 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
1373 | __func__, urb->status); | 1381 | __func__, urb->status); |
1374 | goto exit; | 1382 | goto exit; |
1375 | } | 1383 | } |
1376 | 1384 | ||
@@ -1380,8 +1388,8 @@ exit: | |||
1380 | usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); | 1388 | usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); |
1381 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1389 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1382 | if (retval) | 1390 | if (retval) |
1383 | err("%s - usb_submit_urb failed with result: %d", | 1391 | dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", |
1384 | __func__, retval); | 1392 | __func__, retval); |
1385 | } | 1393 | } |
1386 | 1394 | ||
1387 | static int usbtouch_open(struct input_dev *input) | 1395 | static int usbtouch_open(struct input_dev *input) |
@@ -1456,8 +1464,9 @@ static int usbtouch_reset_resume(struct usb_interface *intf) | |||
1456 | if (usbtouch->type->init) { | 1464 | if (usbtouch->type->init) { |
1457 | err = usbtouch->type->init(usbtouch); | 1465 | err = usbtouch->type->init(usbtouch); |
1458 | if (err) { | 1466 | if (err) { |
1459 | dbg("%s - type->init() failed, err: %d", | 1467 | dev_dbg(&intf->dev, |
1460 | __func__, err); | 1468 | "%s - type->init() failed, err: %d\n", |
1469 | __func__, err); | ||
1461 | return err; | 1470 | return err; |
1462 | } | 1471 | } |
1463 | } | 1472 | } |
@@ -1532,7 +1541,8 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1532 | 1541 | ||
1533 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); | 1542 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); |
1534 | if (!usbtouch->irq) { | 1543 | if (!usbtouch->irq) { |
1535 | dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); | 1544 | dev_dbg(&intf->dev, |
1545 | "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__); | ||
1536 | goto out_free_buffers; | 1546 | goto out_free_buffers; |
1537 | } | 1547 | } |
1538 | 1548 | ||
@@ -1594,7 +1604,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1594 | if (type->alloc) { | 1604 | if (type->alloc) { |
1595 | err = type->alloc(usbtouch); | 1605 | err = type->alloc(usbtouch); |
1596 | if (err) { | 1606 | if (err) { |
1597 | dbg("%s - type->alloc() failed, err: %d", __func__, err); | 1607 | dev_dbg(&intf->dev, |
1608 | "%s - type->alloc() failed, err: %d\n", | ||
1609 | __func__, err); | ||
1598 | goto out_free_urb; | 1610 | goto out_free_urb; |
1599 | } | 1611 | } |
1600 | } | 1612 | } |
@@ -1603,14 +1615,18 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1603 | if (type->init) { | 1615 | if (type->init) { |
1604 | err = type->init(usbtouch); | 1616 | err = type->init(usbtouch); |
1605 | if (err) { | 1617 | if (err) { |
1606 | dbg("%s - type->init() failed, err: %d", __func__, err); | 1618 | dev_dbg(&intf->dev, |
1619 | "%s - type->init() failed, err: %d\n", | ||
1620 | __func__, err); | ||
1607 | goto out_do_exit; | 1621 | goto out_do_exit; |
1608 | } | 1622 | } |
1609 | } | 1623 | } |
1610 | 1624 | ||
1611 | err = input_register_device(usbtouch->input); | 1625 | err = input_register_device(usbtouch->input); |
1612 | if (err) { | 1626 | if (err) { |
1613 | dbg("%s - input_register_device failed, err: %d", __func__, err); | 1627 | dev_dbg(&intf->dev, |
1628 | "%s - input_register_device failed, err: %d\n", | ||
1629 | __func__, err); | ||
1614 | goto out_do_exit; | 1630 | goto out_do_exit; |
1615 | } | 1631 | } |
1616 | 1632 | ||
@@ -1622,8 +1638,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1622 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); | 1638 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); |
1623 | if (err) { | 1639 | if (err) { |
1624 | usb_autopm_put_interface(intf); | 1640 | usb_autopm_put_interface(intf); |
1625 | err("%s - usb_submit_urb failed with result: %d", | 1641 | dev_err(&intf->dev, |
1626 | __func__, err); | 1642 | "%s - usb_submit_urb failed with result: %d\n", |
1643 | __func__, err); | ||
1627 | goto out_unregister_input; | 1644 | goto out_unregister_input; |
1628 | } | 1645 | } |
1629 | } | 1646 | } |
@@ -1650,12 +1667,12 @@ static void usbtouch_disconnect(struct usb_interface *intf) | |||
1650 | { | 1667 | { |
1651 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | 1668 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); |
1652 | 1669 | ||
1653 | dbg("%s - called", __func__); | ||
1654 | |||
1655 | if (!usbtouch) | 1670 | if (!usbtouch) |
1656 | return; | 1671 | return; |
1657 | 1672 | ||
1658 | dbg("%s - usbtouch is initialized, cleaning up", __func__); | 1673 | dev_dbg(&intf->dev, |
1674 | "%s - usbtouch is initialized, cleaning up\n", __func__); | ||
1675 | |||
1659 | usb_set_intfdata(intf, NULL); | 1676 | usb_set_intfdata(intf, NULL); |
1660 | /* this will stop IO via close */ | 1677 | /* this will stop IO via close */ |
1661 | input_unregister_device(usbtouch->input); | 1678 | input_unregister_device(usbtouch->input); |