Lines Matching refs:usbtouch

84 	void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
94 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
95 int (*alloc) (struct usbtouch_usb *usbtouch);
96 int (*init) (struct usbtouch_usb *usbtouch);
97 void (*exit) (struct usbtouch_usb *usbtouch);
261 static int e2i_init(struct usbtouch_usb *usbtouch) in e2i_init() argument
264 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
270 dev_dbg(&usbtouch->interface->dev, in e2i_init()
305 static int egalax_init(struct usbtouch_usb *usbtouch) in egalax_init() argument
309 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
468 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in mtouch_firmware_rev_show() local
469 struct mtouch_priv *priv = usbtouch->priv; in mtouch_firmware_rev_show()
485 static int mtouch_get_fw_revision(struct usbtouch_usb *usbtouch) in mtouch_get_fw_revision() argument
487 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_get_fw_revision()
488 struct mtouch_priv *priv = usbtouch->priv; in mtouch_get_fw_revision()
502 dev_warn(&usbtouch->interface->dev, in mtouch_get_fw_revision()
518 static int mtouch_alloc(struct usbtouch_usb *usbtouch) in mtouch_alloc() argument
522 usbtouch->priv = kmalloc(sizeof(struct mtouch_priv), GFP_KERNEL); in mtouch_alloc()
523 if (!usbtouch->priv) in mtouch_alloc()
526 ret = sysfs_create_group(&usbtouch->interface->dev.kobj, in mtouch_alloc()
529 kfree(usbtouch->priv); in mtouch_alloc()
530 usbtouch->priv = NULL; in mtouch_alloc()
537 static int mtouch_init(struct usbtouch_usb *usbtouch) in mtouch_init() argument
540 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
542 ret = mtouch_get_fw_revision(usbtouch); in mtouch_init()
550 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
562 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
573 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); in mtouch_init()
574 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); in mtouch_init()
580 static void mtouch_exit(struct usbtouch_usb *usbtouch) in mtouch_exit() argument
582 struct mtouch_priv *priv = usbtouch->priv; in mtouch_exit()
584 sysfs_remove_group(&usbtouch->interface->dev.kobj, &mtouch_attr_group); in mtouch_exit()
698 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) in dmc_tsc10_init() argument
700 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
934 static int nexio_alloc(struct usbtouch_usb *usbtouch) in nexio_alloc() argument
939 usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); in nexio_alloc()
940 if (!usbtouch->priv) in nexio_alloc()
943 priv = usbtouch->priv; in nexio_alloc()
952 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
967 static int nexio_init(struct usbtouch_usb *usbtouch) in nexio_init() argument
969 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in nexio_init()
970 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; in nexio_init()
971 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
1039 nexio_ack_complete, usbtouch); in nexio_init()
1047 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
1049 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1057 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
1060 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1078 if (!usbtouch->type->max_xc) { in nexio_read_data()
1079 usbtouch->type->max_xc = 2 * x_len; in nexio_read_data()
1080 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1081 0, usbtouch->type->max_xc, 0, 0); in nexio_read_data()
1082 usbtouch->type->max_yc = 2 * y_len; in nexio_read_data()
1083 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
1084 0, usbtouch->type->max_yc, 0, 0); in nexio_read_data()
1113 input_report_abs(usbtouch->input, in nexio_read_data()
1115 input_report_abs(usbtouch->input, in nexio_read_data()
1117 input_report_abs(usbtouch->input, in nexio_read_data()
1119 input_report_abs(usbtouch->input, in nexio_read_data()
1121 input_report_abs(usbtouch->input, in nexio_read_data()
1123 input_mt_sync(usbtouch->input); in nexio_read_data()
1126 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1127 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1128 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1164 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
1397 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1400 struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1402 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1405 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1408 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1409 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1411 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1412 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1415 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1416 input_sync(usbtouch->input); in usbtouch_process_pkt()
1421 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1428 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1430 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1431 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1442 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1444 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1445 usbtouch->buf_len += append; in usbtouch_process_multi()
1447 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1448 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1454 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1455 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1457 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1458 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1471 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1482 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1485 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1486 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1493 usbtouch->buf_len = 0; in usbtouch_process_multi()
1501 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1502 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1529 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1532 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1541 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1544 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1546 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1550 mutex_lock(&usbtouch->pm_mutex); in usbtouch_open()
1551 if (!usbtouch->type->irq_always) { in usbtouch_open()
1552 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { in usbtouch_open()
1558 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_open()
1559 usbtouch->is_open = true; in usbtouch_open()
1561 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_open()
1562 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1569 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1572 mutex_lock(&usbtouch->pm_mutex); in usbtouch_close()
1573 if (!usbtouch->type->irq_always) in usbtouch_close()
1574 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1575 usbtouch->is_open = false; in usbtouch_close()
1576 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_close()
1578 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1579 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1581 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1587 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1589 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1596 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1599 mutex_lock(&usbtouch->pm_mutex); in usbtouch_resume()
1600 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1601 result = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1602 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_resume()
1609 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1613 if (usbtouch->type->init) { in usbtouch_reset_resume()
1614 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1624 mutex_lock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1625 if (usbtouch->is_open) in usbtouch_reset_resume()
1626 err = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1627 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1633 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1635 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1636 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1637 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1655 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1670 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); in usbtouch_probe()
1672 if (!usbtouch || !input_dev) in usbtouch_probe()
1676 usbtouch->type = type; in usbtouch_probe()
1680 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1689 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1693 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1694 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1695 if (!usbtouch->data) in usbtouch_probe()
1699 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1700 if (!usbtouch->buffer) in usbtouch_probe()
1704 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1705 if (!usbtouch->irq) { in usbtouch_probe()
1711 usbtouch->interface = intf; in usbtouch_probe()
1712 usbtouch->input = input_dev; in usbtouch_probe()
1715 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1719 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1720 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1723 if (!strlen(usbtouch->name)) in usbtouch_probe()
1724 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1729 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1730 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1732 input_dev->name = usbtouch->name; in usbtouch_probe()
1733 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1737 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1751 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1753 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1754 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1756 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1758 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1759 usbtouch_irq, usbtouch); in usbtouch_probe()
1761 usbtouch->irq->dev = udev; in usbtouch_probe()
1762 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1763 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1767 err = type->alloc(usbtouch); in usbtouch_probe()
1778 err = type->init(usbtouch); in usbtouch_probe()
1787 err = input_register_device(usbtouch->input); in usbtouch_probe()
1795 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1797 if (usbtouch->type->irq_always) { in usbtouch_probe()
1800 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1817 type->exit(usbtouch); in usbtouch_probe()
1819 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1821 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1824 kfree(usbtouch); in usbtouch_probe()
1830 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1832 if (!usbtouch) in usbtouch_disconnect()
1840 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1841 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1842 if (usbtouch->type->exit) in usbtouch_disconnect()
1843 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1844 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1845 kfree(usbtouch); in usbtouch_disconnect()