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