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