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);
249 static int e2i_init(struct usbtouch_usb *usbtouch) in e2i_init() argument
252 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
258 dev_dbg(&usbtouch->interface->dev, in e2i_init()
293 static int egalax_init(struct usbtouch_usb *usbtouch) in egalax_init() argument
297 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
456 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in mtouch_firmware_rev_show() local
457 struct mtouch_priv *priv = usbtouch->priv; in mtouch_firmware_rev_show()
473 static int mtouch_get_fw_revision(struct usbtouch_usb *usbtouch) in mtouch_get_fw_revision() argument
475 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_get_fw_revision()
476 struct mtouch_priv *priv = usbtouch->priv; in mtouch_get_fw_revision()
490 dev_warn(&usbtouch->interface->dev, in mtouch_get_fw_revision()
506 static int mtouch_alloc(struct usbtouch_usb *usbtouch) in mtouch_alloc() argument
510 usbtouch->priv = kmalloc(sizeof(struct mtouch_priv), GFP_KERNEL); in mtouch_alloc()
511 if (!usbtouch->priv) in mtouch_alloc()
514 ret = sysfs_create_group(&usbtouch->interface->dev.kobj, in mtouch_alloc()
517 kfree(usbtouch->priv); in mtouch_alloc()
518 usbtouch->priv = NULL; in mtouch_alloc()
525 static int mtouch_init(struct usbtouch_usb *usbtouch) in mtouch_init() argument
528 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
530 ret = mtouch_get_fw_revision(usbtouch); in mtouch_init()
538 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
550 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
561 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); in mtouch_init()
562 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); in mtouch_init()
568 static void mtouch_exit(struct usbtouch_usb *usbtouch) in mtouch_exit() argument
570 struct mtouch_priv *priv = usbtouch->priv; in mtouch_exit()
572 sysfs_remove_group(&usbtouch->interface->dev.kobj, &mtouch_attr_group); in mtouch_exit()
686 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) in dmc_tsc10_init() argument
688 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
922 static int nexio_alloc(struct usbtouch_usb *usbtouch) in nexio_alloc() argument
927 usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); in nexio_alloc()
928 if (!usbtouch->priv) in nexio_alloc()
931 priv = usbtouch->priv; in nexio_alloc()
940 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
955 static int nexio_init(struct usbtouch_usb *usbtouch) in nexio_init() argument
957 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in nexio_init()
958 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; in nexio_init()
959 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
1027 nexio_ack_complete, usbtouch); in nexio_init()
1035 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
1037 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1045 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
1047 struct device *dev = &usbtouch->interface->dev; in nexio_read_data()
1049 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1069 if (!usbtouch->type->max_xc) { in nexio_read_data()
1070 usbtouch->type->max_xc = 2 * x_len; in nexio_read_data()
1071 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1072 0, usbtouch->type->max_xc, 0, 0); in nexio_read_data()
1073 usbtouch->type->max_yc = 2 * y_len; in nexio_read_data()
1074 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
1075 0, usbtouch->type->max_yc, 0, 0); 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_report_abs(usbtouch->input, in nexio_read_data()
1112 input_report_abs(usbtouch->input, in nexio_read_data()
1114 input_mt_sync(usbtouch->input); in nexio_read_data()
1117 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1118 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1119 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1155 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
1388 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1391 struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1393 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1396 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1399 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1400 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1402 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1403 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1406 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1407 input_sync(usbtouch->input); in usbtouch_process_pkt()
1412 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1419 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1421 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1422 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1433 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1435 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1436 usbtouch->buf_len += append; in usbtouch_process_multi()
1438 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1439 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1445 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1446 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1448 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1449 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1462 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1473 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1476 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1477 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1484 usbtouch->buf_len = 0; in usbtouch_process_multi()
1492 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1493 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1520 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1523 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1532 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1535 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1537 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1541 mutex_lock(&usbtouch->pm_mutex); in usbtouch_open()
1542 if (!usbtouch->type->irq_always) { in usbtouch_open()
1543 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { in usbtouch_open()
1549 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_open()
1550 usbtouch->is_open = true; in usbtouch_open()
1552 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_open()
1553 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1560 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1563 mutex_lock(&usbtouch->pm_mutex); in usbtouch_close()
1564 if (!usbtouch->type->irq_always) in usbtouch_close()
1565 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1566 usbtouch->is_open = false; in usbtouch_close()
1567 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_close()
1569 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1570 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1572 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1578 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1580 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1587 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1590 mutex_lock(&usbtouch->pm_mutex); in usbtouch_resume()
1591 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1592 result = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1593 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_resume()
1600 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1604 if (usbtouch->type->init) { in usbtouch_reset_resume()
1605 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1615 mutex_lock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1616 if (usbtouch->is_open) in usbtouch_reset_resume()
1617 err = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1618 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1624 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1626 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1627 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1628 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1646 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1664 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); in usbtouch_probe()
1666 if (!usbtouch || !input_dev) in usbtouch_probe()
1669 mutex_init(&usbtouch->pm_mutex); in usbtouch_probe()
1672 usbtouch->type = type; in usbtouch_probe()
1676 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1685 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1689 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1690 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1691 if (!usbtouch->data) in usbtouch_probe()
1695 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1696 if (!usbtouch->buffer) in usbtouch_probe()
1700 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1701 if (!usbtouch->irq) { in usbtouch_probe()
1707 usbtouch->interface = intf; in usbtouch_probe()
1708 usbtouch->input = input_dev; in usbtouch_probe()
1711 strscpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1715 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1716 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1719 if (!strlen(usbtouch->name)) in usbtouch_probe()
1720 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1725 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1726 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1728 input_dev->name = usbtouch->name; in usbtouch_probe()
1729 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1733 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1747 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1749 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1750 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1752 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1754 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1755 usbtouch_irq, usbtouch); in usbtouch_probe()
1757 usbtouch->irq->dev = udev; in usbtouch_probe()
1758 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1759 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1763 err = type->alloc(usbtouch); in usbtouch_probe()
1774 err = type->init(usbtouch); in usbtouch_probe()
1783 err = input_register_device(usbtouch->input); in usbtouch_probe()
1791 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1793 if (usbtouch->type->irq_always) { in usbtouch_probe()
1796 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1813 type->exit(usbtouch); in usbtouch_probe()
1815 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1817 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1820 kfree(usbtouch); in usbtouch_probe()
1826 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1828 if (!usbtouch) in usbtouch_disconnect()
1836 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1837 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1838 if (usbtouch->type->exit) in usbtouch_disconnect()
1839 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1840 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1841 kfree(usbtouch); in usbtouch_disconnect()