Lines Matching refs:usbtouch

88 	void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
98 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
99 int (*alloc) (struct usbtouch_usb *usbtouch);
100 int (*init) (struct usbtouch_usb *usbtouch);
101 void (*exit) (struct usbtouch_usb *usbtouch);
263 static int e2i_init(struct usbtouch_usb *usbtouch) in e2i_init() argument
266 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
272 dev_dbg(&usbtouch->interface->dev, in e2i_init()
307 static int egalax_init(struct usbtouch_usb *usbtouch) in egalax_init() argument
311 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
459 static int mtouch_init(struct usbtouch_usb *usbtouch) in mtouch_init() argument
462 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
468 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
480 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
491 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); in mtouch_init()
492 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); in mtouch_init()
608 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) in dmc_tsc10_init() argument
610 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
844 static int nexio_alloc(struct usbtouch_usb *usbtouch) in nexio_alloc() argument
849 usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); in nexio_alloc()
850 if (!usbtouch->priv) in nexio_alloc()
853 priv = usbtouch->priv; in nexio_alloc()
862 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
877 static int nexio_init(struct usbtouch_usb *usbtouch) in nexio_init() argument
879 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in nexio_init()
880 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; in nexio_init()
881 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
949 nexio_ack_complete, usbtouch); in nexio_init()
957 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
959 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
967 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
970 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
988 if (!usbtouch->type->max_xc) { in nexio_read_data()
989 usbtouch->type->max_xc = 2 * x_len; in nexio_read_data()
990 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
991 0, usbtouch->type->max_xc, 0, 0); in nexio_read_data()
992 usbtouch->type->max_yc = 2 * y_len; in nexio_read_data()
993 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
994 0, usbtouch->type->max_yc, 0, 0); in nexio_read_data()
1023 input_report_abs(usbtouch->input, in nexio_read_data()
1025 input_report_abs(usbtouch->input, in nexio_read_data()
1027 input_report_abs(usbtouch->input, in nexio_read_data()
1029 input_report_abs(usbtouch->input, in nexio_read_data()
1031 input_report_abs(usbtouch->input, in nexio_read_data()
1033 input_mt_sync(usbtouch->input); in nexio_read_data()
1036 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1037 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1038 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1074 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
1305 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1308 struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1310 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1313 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1316 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1317 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1319 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1320 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1323 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1324 input_sync(usbtouch->input); in usbtouch_process_pkt()
1329 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1336 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1338 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1339 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1350 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1352 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1353 usbtouch->buf_len += append; in usbtouch_process_multi()
1355 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1356 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1362 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1363 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1365 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1366 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1379 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1390 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1393 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1394 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1401 usbtouch->buf_len = 0; in usbtouch_process_multi()
1409 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1410 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1437 usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1440 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1449 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1452 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1454 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1458 if (!usbtouch->type->irq_always) { in usbtouch_open()
1459 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { in usbtouch_open()
1465 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_open()
1467 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1474 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1477 if (!usbtouch->type->irq_always) in usbtouch_close()
1478 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1479 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1480 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1482 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1488 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1490 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1497 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1498 struct input_dev *input = usbtouch->input; in usbtouch_resume()
1502 if (input->users || usbtouch->type->irq_always) in usbtouch_resume()
1503 result = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1511 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1512 struct input_dev *input = usbtouch->input; in usbtouch_reset_resume()
1516 if (usbtouch->type->init) { in usbtouch_reset_resume()
1517 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1529 err = usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1536 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1538 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1539 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1540 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1558 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1573 usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); in usbtouch_probe()
1575 if (!usbtouch || !input_dev) in usbtouch_probe()
1579 usbtouch->type = type; in usbtouch_probe()
1583 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1592 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1596 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1597 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1598 if (!usbtouch->data) in usbtouch_probe()
1602 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1603 if (!usbtouch->buffer) in usbtouch_probe()
1607 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1608 if (!usbtouch->irq) { in usbtouch_probe()
1614 usbtouch->interface = intf; in usbtouch_probe()
1615 usbtouch->input = input_dev; in usbtouch_probe()
1618 strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1622 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1623 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1626 if (!strlen(usbtouch->name)) in usbtouch_probe()
1627 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1632 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1633 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1635 input_dev->name = usbtouch->name; in usbtouch_probe()
1636 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1640 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1654 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1656 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1657 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1659 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1661 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1662 usbtouch_irq, usbtouch); in usbtouch_probe()
1664 usbtouch->irq->dev = udev; in usbtouch_probe()
1665 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1666 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1670 err = type->alloc(usbtouch); in usbtouch_probe()
1681 err = type->init(usbtouch); in usbtouch_probe()
1690 err = input_register_device(usbtouch->input); in usbtouch_probe()
1698 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1700 if (usbtouch->type->irq_always) { in usbtouch_probe()
1703 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1720 type->exit(usbtouch); in usbtouch_probe()
1722 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1724 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1727 kfree(usbtouch); in usbtouch_probe()
1733 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1735 if (!usbtouch) in usbtouch_disconnect()
1743 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1744 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1745 if (usbtouch->type->exit) in usbtouch_disconnect()
1746 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1747 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1748 kfree(usbtouch); in usbtouch_disconnect()