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
1048 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1066 if (!usbtouch->type->max_xc) { in nexio_read_data()
1067 usbtouch->type->max_xc = 2 * x_len; in nexio_read_data()
1068 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1069 0, usbtouch->type->max_xc, 0, 0); in nexio_read_data()
1070 usbtouch->type->max_yc = 2 * y_len; in nexio_read_data()
1071 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
1072 0, usbtouch->type->max_yc, 0, 0); in nexio_read_data()
1101 input_report_abs(usbtouch->input, in nexio_read_data()
1103 input_report_abs(usbtouch->input, in nexio_read_data()
1105 input_report_abs(usbtouch->input, in nexio_read_data()
1107 input_report_abs(usbtouch->input, in nexio_read_data()
1109 input_report_abs(usbtouch->input, in nexio_read_data()
1111 input_mt_sync(usbtouch->input); in nexio_read_data()
1114 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1115 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1116 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1152 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
1385 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1388 struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1390 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1393 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1396 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1397 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1399 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1400 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1403 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1404 input_sync(usbtouch->input); in usbtouch_process_pkt()
1409 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1416 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1418 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1419 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1430 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1432 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1433 usbtouch->buf_len += append; in usbtouch_process_multi()
1435 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1436 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1442 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1443 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1445 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1446 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1459 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1470 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1473 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1474 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1481 usbtouch->buf_len = 0; in usbtouch_process_multi()
1489 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1490 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1517 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1520 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1529 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1532 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1534 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1538 mutex_lock(&usbtouch->pm_mutex); in usbtouch_open()
1539 if (!usbtouch->type->irq_always) { in usbtouch_open()
1540 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { in usbtouch_open()
1546 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_open()
1547 usbtouch->is_open = true; in usbtouch_open()
1549 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_open()
1550 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1557 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1560 mutex_lock(&usbtouch->pm_mutex); in usbtouch_close()
1561 if (!usbtouch->type->irq_always) in usbtouch_close()
1562 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1563 usbtouch->is_open = false; in usbtouch_close()
1564 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_close()
1566 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1567 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1569 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1575 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1577 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1584 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1587 mutex_lock(&usbtouch->pm_mutex); in usbtouch_resume()
1588 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1589 result = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1590 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_resume()
1597 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1601 if (usbtouch->type->init) { in usbtouch_reset_resume()
1602 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1612 mutex_lock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1613 if (usbtouch->is_open) in usbtouch_reset_resume()
1614 err = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1615 mutex_unlock(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1621 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1623 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1624 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1625 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1643 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1658 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); in usbtouch_probe()
1660 if (!usbtouch || !input_dev) in usbtouch_probe()
1663 mutex_init(&usbtouch->pm_mutex); in usbtouch_probe()
1666 usbtouch->type = type; in usbtouch_probe()
1670 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1679 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1683 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1684 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1685 if (!usbtouch->data) in usbtouch_probe()
1689 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1690 if (!usbtouch->buffer) in usbtouch_probe()
1694 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1695 if (!usbtouch->irq) { in usbtouch_probe()
1701 usbtouch->interface = intf; in usbtouch_probe()
1702 usbtouch->input = input_dev; in usbtouch_probe()
1705 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1709 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1710 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1713 if (!strlen(usbtouch->name)) in usbtouch_probe()
1714 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1719 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1720 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1722 input_dev->name = usbtouch->name; in usbtouch_probe()
1723 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1727 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1741 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1743 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1744 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1746 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1748 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1749 usbtouch_irq, usbtouch); in usbtouch_probe()
1751 usbtouch->irq->dev = udev; in usbtouch_probe()
1752 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1753 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1757 err = type->alloc(usbtouch); in usbtouch_probe()
1768 err = type->init(usbtouch); in usbtouch_probe()
1777 err = input_register_device(usbtouch->input); in usbtouch_probe()
1785 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1787 if (usbtouch->type->irq_always) { in usbtouch_probe()
1790 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1807 type->exit(usbtouch); in usbtouch_probe()
1809 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1811 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1814 kfree(usbtouch); in usbtouch_probe()
1820 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1822 if (!usbtouch) in usbtouch_disconnect()
1830 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1831 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1832 if (usbtouch->type->exit) in usbtouch_disconnect()
1833 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1834 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1835 kfree(usbtouch); in usbtouch_disconnect()