Lines Matching refs:usbtouch
71 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
81 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
82 int (*alloc) (struct usbtouch_usb *usbtouch);
83 int (*init) (struct usbtouch_usb *usbtouch);
84 void (*exit) (struct usbtouch_usb *usbtouch);
248 static int e2i_init(struct usbtouch_usb *usbtouch) in e2i_init() argument
251 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
257 dev_dbg(&usbtouch->interface->dev, in e2i_init()
292 static int egalax_init(struct usbtouch_usb *usbtouch) in egalax_init() argument
296 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
455 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in mtouch_firmware_rev_show() local
456 struct mtouch_priv *priv = usbtouch->priv; in mtouch_firmware_rev_show()
472 static int mtouch_get_fw_revision(struct usbtouch_usb *usbtouch) in mtouch_get_fw_revision() argument
474 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_get_fw_revision()
475 struct mtouch_priv *priv = usbtouch->priv; in mtouch_get_fw_revision()
489 dev_warn(&usbtouch->interface->dev, in mtouch_get_fw_revision()
505 static int mtouch_alloc(struct usbtouch_usb *usbtouch) in mtouch_alloc() argument
509 usbtouch->priv = kmalloc(sizeof(struct mtouch_priv), GFP_KERNEL); in mtouch_alloc()
510 if (!usbtouch->priv) in mtouch_alloc()
513 ret = sysfs_create_group(&usbtouch->interface->dev.kobj, in mtouch_alloc()
516 kfree(usbtouch->priv); in mtouch_alloc()
517 usbtouch->priv = NULL; in mtouch_alloc()
524 static int mtouch_init(struct usbtouch_usb *usbtouch) in mtouch_init() argument
527 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
529 ret = mtouch_get_fw_revision(usbtouch); in mtouch_init()
537 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
549 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
560 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); in mtouch_init()
561 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); in mtouch_init()
567 static void mtouch_exit(struct usbtouch_usb *usbtouch) in mtouch_exit() argument
569 struct mtouch_priv *priv = usbtouch->priv; in mtouch_exit()
571 sysfs_remove_group(&usbtouch->interface->dev.kobj, &mtouch_attr_group); in mtouch_exit()
685 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) in dmc_tsc10_init() argument
687 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
921 static int nexio_alloc(struct usbtouch_usb *usbtouch) in nexio_alloc() argument
926 usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); in nexio_alloc()
927 if (!usbtouch->priv) in nexio_alloc()
930 priv = usbtouch->priv; in nexio_alloc()
939 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
954 static int nexio_init(struct usbtouch_usb *usbtouch) in nexio_init() argument
956 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in nexio_init()
957 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; in nexio_init()
958 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
1026 nexio_ack_complete, usbtouch); in nexio_init()
1034 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
1036 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1044 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
1047 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1065 if (!usbtouch->type->max_xc) { in nexio_read_data()
1066 usbtouch->type->max_xc = 2 * x_len; in nexio_read_data()
1067 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1068 0, usbtouch->type->max_xc, 0, 0); in nexio_read_data()
1069 usbtouch->type->max_yc = 2 * y_len; in nexio_read_data()
1070 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
1071 0, usbtouch->type->max_yc, 0, 0); in nexio_read_data()
1100 input_report_abs(usbtouch->input, in nexio_read_data()
1102 input_report_abs(usbtouch->input, in nexio_read_data()
1104 input_report_abs(usbtouch->input, in nexio_read_data()
1106 input_report_abs(usbtouch->input, in nexio_read_data()
1108 input_report_abs(usbtouch->input, in nexio_read_data()
1110 input_mt_sync(usbtouch->input); in nexio_read_data()
1113 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1114 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1115 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1151 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
1384 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1387 struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1389 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1392 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1395 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1396 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1398 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1399 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1402 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1403 input_sync(usbtouch->input); in usbtouch_process_pkt()
1408 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1415 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1417 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1418 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1429 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1431 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1432 usbtouch->buf_len += append; in usbtouch_process_multi()
1434 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1435 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1441 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1442 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1444 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1445 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1458 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1469 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1472 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1473 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1480 usbtouch->buf_len = 0; in usbtouch_process_multi()
1488 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1489 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1516 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1519 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1528 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1531 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1533 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1537 mutex_lock(&usbtouch->pm_mutex); in usbtouch_open()
1538 if (!usbtouch->type->irq_always) { in usbtouch_open()
1539 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { in usbtouch_open()
1545 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_open()
1546 usbtouch->is_open = true; in usbtouch_open()
1548 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_open()
1549 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1556 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1559 mutex_lock(&usbtouch->pm_mutex); in usbtouch_close()
1560 if (!usbtouch->type->irq_always) in usbtouch_close()
1561 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1562 usbtouch->is_open = false; in usbtouch_close()
1563 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_close()
1565 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1566 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1568 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1574 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1576 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1583 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1586 mutex_lock(&usbtouch->pm_mutex); in usbtouch_resume()
1587 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1588 result = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1589 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_resume()
1596 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1600 if (usbtouch->type->init) { in usbtouch_reset_resume()
1601 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1611 mutex_lock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1612 if (usbtouch->is_open) in usbtouch_reset_resume()
1613 err = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1614 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1620 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1622 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1623 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1624 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1642 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1657 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); in usbtouch_probe()
1659 if (!usbtouch || !input_dev) in usbtouch_probe()
1662 mutex_init(&usbtouch->pm_mutex); in usbtouch_probe()
1665 usbtouch->type = type; in usbtouch_probe()
1669 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1678 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1682 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1683 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1684 if (!usbtouch->data) in usbtouch_probe()
1688 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1689 if (!usbtouch->buffer) in usbtouch_probe()
1693 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1694 if (!usbtouch->irq) { in usbtouch_probe()
1700 usbtouch->interface = intf; in usbtouch_probe()
1701 usbtouch->input = input_dev; in usbtouch_probe()
1704 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1708 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1709 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1712 if (!strlen(usbtouch->name)) in usbtouch_probe()
1713 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1718 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1719 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1721 input_dev->name = usbtouch->name; in usbtouch_probe()
1722 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1726 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1740 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1742 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1743 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1745 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1747 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1748 usbtouch_irq, usbtouch); in usbtouch_probe()
1750 usbtouch->irq->dev = udev; in usbtouch_probe()
1751 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1752 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1756 err = type->alloc(usbtouch); in usbtouch_probe()
1767 err = type->init(usbtouch); in usbtouch_probe()
1776 err = input_register_device(usbtouch->input); in usbtouch_probe()
1784 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1786 if (usbtouch->type->irq_always) { in usbtouch_probe()
1789 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1806 type->exit(usbtouch); in usbtouch_probe()
1808 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1810 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1813 kfree(usbtouch); in usbtouch_probe()
1819 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1821 if (!usbtouch) in usbtouch_disconnect()
1829 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1830 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1831 if (usbtouch->type->exit) in usbtouch_disconnect()
1832 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1833 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1834 kfree(usbtouch); in usbtouch_disconnect()