Lines Matching refs:usbtouch

79 	int  (*read_data)   (struct usbtouch_usb *usbtouch, unsigned char *pkt);
80 int (*alloc) (struct usbtouch_usb *usbtouch);
81 int (*init) (struct usbtouch_usb *usbtouch);
82 void (*exit) (struct usbtouch_usb *usbtouch);
105 void (*process_pkt)(struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
114 static int e2i_init(struct usbtouch_usb *usbtouch) in e2i_init() argument
117 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
123 dev_dbg(&usbtouch->interface->dev, in e2i_init()
168 static int egalax_init(struct usbtouch_usb *usbtouch) in egalax_init() argument
170 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
350 static int mtouch_get_fw_revision(struct usbtouch_usb *usbtouch) in mtouch_get_fw_revision() argument
352 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_get_fw_revision()
353 struct mtouch_priv *priv = usbtouch->priv; in mtouch_get_fw_revision()
366 dev_warn(&usbtouch->interface->dev, in mtouch_get_fw_revision()
377 static int mtouch_alloc(struct usbtouch_usb *usbtouch) in mtouch_alloc() argument
385 usbtouch->priv = priv; in mtouch_alloc()
389 static int mtouch_init(struct usbtouch_usb *usbtouch) in mtouch_init() argument
392 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
394 ret = mtouch_get_fw_revision(usbtouch); in mtouch_init()
402 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
414 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
425 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); in mtouch_init()
426 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); in mtouch_init()
432 static void mtouch_exit(struct usbtouch_usb *usbtouch) in mtouch_exit() argument
434 struct mtouch_priv *priv = usbtouch->priv; in mtouch_exit()
455 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in mtouch_firmware_rev_show() local
456 struct mtouch_priv *priv = usbtouch->priv; in mtouch_firmware_rev_show()
472 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in mtouch_group_visible() local
474 return usbtouch->type == &mtouch_dev_info; in mtouch_group_visible()
623 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) in dmc_tsc10_init() argument
625 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
936 static int nexio_alloc(struct usbtouch_usb *usbtouch) in nexio_alloc() argument
945 usbtouch->priv = priv; in nexio_alloc()
953 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
968 static int nexio_init(struct usbtouch_usb *usbtouch) in nexio_init() argument
970 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in nexio_init()
971 struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; in nexio_init()
973 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
1036 nexio_ack_complete, usbtouch); in nexio_init()
1041 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
1043 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1051 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
1053 struct device *dev = &usbtouch->interface->dev; in nexio_read_data()
1055 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1070 if (data_len > usbtouch->data_size - sizeof(*packet)) in nexio_read_data()
1071 data_len = usbtouch->data_size - sizeof(*packet); in nexio_read_data()
1080 if (!input_abs_get_max(usbtouch->input, ABS_X)) { in nexio_read_data()
1081 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1083 input_set_abs_params(usbtouch->input, ABS_Y, 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()
1182 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1185 const struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1187 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1190 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1193 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1194 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1196 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1197 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1200 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1201 input_sync(usbtouch->input); in usbtouch_process_pkt()
1206 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1213 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1215 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1216 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1227 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1229 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1230 usbtouch->buf_len += append; in usbtouch_process_multi()
1232 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1233 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1239 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1240 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1242 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1243 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1256 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1267 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1270 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1271 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1278 usbtouch->buf_len = 0; in usbtouch_process_multi()
1282 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1285 dev_WARN_ONCE(&usbtouch->interface->dev, 1, in usbtouch_process_multi()
1292 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1293 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1320 usbtouch->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1323 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1330 static int usbtouch_start_io(struct usbtouch_usb *usbtouch) in usbtouch_start_io() argument
1332 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_start_io()
1334 if (!usbtouch->type->irq_always) in usbtouch_start_io()
1335 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) in usbtouch_start_io()
1338 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_start_io()
1339 usbtouch->is_open = true; in usbtouch_start_io()
1346 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1349 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1351 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1355 r = usbtouch_start_io(usbtouch); in usbtouch_open()
1357 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1363 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1366 scoped_guard(mutex, &usbtouch->pm_mutex) { in usbtouch_close()
1367 if (!usbtouch->type->irq_always) in usbtouch_close()
1368 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1369 usbtouch->is_open = false; in usbtouch_close()
1372 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1373 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1375 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1380 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1382 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1389 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1391 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_resume()
1393 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1394 return usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1401 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1405 if (usbtouch->type->init) { in usbtouch_reset_resume()
1406 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1416 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1418 if (usbtouch->is_open) in usbtouch_reset_resume()
1419 return usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1425 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1427 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1428 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1429 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1435 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1455 usbtouch = kzalloc_obj(*usbtouch); in usbtouch_probe()
1457 if (!usbtouch || !input_dev) in usbtouch_probe()
1460 mutex_init(&usbtouch->pm_mutex); in usbtouch_probe()
1461 usbtouch->type = type; in usbtouch_probe()
1463 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1472 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1476 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1477 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1478 if (!usbtouch->data) in usbtouch_probe()
1482 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1483 if (!usbtouch->buffer) in usbtouch_probe()
1485 usbtouch->process_pkt = usbtouch_process_multi; in usbtouch_probe()
1487 usbtouch->process_pkt = usbtouch_process_pkt; in usbtouch_probe()
1490 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1491 if (!usbtouch->irq) { in usbtouch_probe()
1497 usbtouch->interface = intf; in usbtouch_probe()
1498 usbtouch->input = input_dev; in usbtouch_probe()
1501 strscpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1505 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1506 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1509 if (!strlen(usbtouch->name)) in usbtouch_probe()
1510 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1515 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1516 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1518 input_dev->name = usbtouch->name; in usbtouch_probe()
1519 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1523 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1537 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1539 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1540 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1542 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1544 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1545 usbtouch_irq, usbtouch); in usbtouch_probe()
1547 usbtouch->irq->dev = udev; in usbtouch_probe()
1548 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1549 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1553 err = type->alloc(usbtouch); in usbtouch_probe()
1564 err = type->init(usbtouch); in usbtouch_probe()
1573 err = input_register_device(usbtouch->input); in usbtouch_probe()
1581 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1583 if (usbtouch->type->irq_always) { in usbtouch_probe()
1586 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1603 type->exit(usbtouch); in usbtouch_probe()
1605 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1607 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1610 kfree(usbtouch); in usbtouch_probe()
1616 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1618 if (!usbtouch) in usbtouch_disconnect()
1626 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1627 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1628 if (usbtouch->type->exit) in usbtouch_disconnect()
1629 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1630 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1631 kfree(usbtouch); in usbtouch_disconnect()