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()
972 struct nexio_priv *priv = usbtouch->priv; in nexio_init()
1039 nexio_ack_complete, usbtouch); in nexio_init()
1044 static void nexio_exit(struct usbtouch_usb *usbtouch) in nexio_exit() argument
1046 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1054 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) in nexio_read_data() argument
1056 struct device *dev = &usbtouch->interface->dev; in nexio_read_data()
1058 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1078 if (!input_abs_get_max(usbtouch->input, ABS_X)) { in nexio_read_data()
1079 input_set_abs_params(usbtouch->input, ABS_X, in nexio_read_data()
1081 input_set_abs_params(usbtouch->input, ABS_Y, in nexio_read_data()
1111 input_report_abs(usbtouch->input, 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_mt_sync(usbtouch->input); in nexio_read_data()
1124 usbtouch->x = 2 * begin_x + w; in nexio_read_data()
1125 usbtouch->y = 2 * begin_y + h; in nexio_read_data()
1126 usbtouch->touch = packet->flags & 0x01; in nexio_read_data()
1180 static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, in usbtouch_process_pkt() argument
1183 const struct usbtouch_device_info *type = usbtouch->type; in usbtouch_process_pkt()
1185 if (!type->read_data(usbtouch, pkt)) in usbtouch_process_pkt()
1188 input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch); in usbtouch_process_pkt()
1191 input_report_abs(usbtouch->input, ABS_X, usbtouch->y); in usbtouch_process_pkt()
1192 input_report_abs(usbtouch->input, ABS_Y, usbtouch->x); in usbtouch_process_pkt()
1194 input_report_abs(usbtouch->input, ABS_X, usbtouch->x); in usbtouch_process_pkt()
1195 input_report_abs(usbtouch->input, ABS_Y, usbtouch->y); in usbtouch_process_pkt()
1198 input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press); in usbtouch_process_pkt()
1199 input_sync(usbtouch->input); in usbtouch_process_pkt()
1204 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1211 if (unlikely(usbtouch->buf_len)) { in usbtouch_process_multi()
1213 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1214 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1225 if (usbtouch->buf_len + append >= usbtouch->type->rept_size) in usbtouch_process_multi()
1227 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, append); in usbtouch_process_multi()
1228 usbtouch->buf_len += append; in usbtouch_process_multi()
1230 pkt_len = usbtouch->type->get_pkt_len( in usbtouch_process_multi()
1231 usbtouch->buffer, usbtouch->buf_len); in usbtouch_process_multi()
1237 tmp = pkt_len - usbtouch->buf_len; in usbtouch_process_multi()
1238 if (usbtouch->buf_len + tmp >= usbtouch->type->rept_size) in usbtouch_process_multi()
1240 memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); in usbtouch_process_multi()
1241 usbtouch_process_pkt(usbtouch, usbtouch->buffer, pkt_len); in usbtouch_process_multi()
1254 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1265 usbtouch_process_pkt(usbtouch, buffer + pos, pkt_len); in usbtouch_process_multi()
1268 memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); in usbtouch_process_multi()
1269 usbtouch->buf_len = buf_len - pos; in usbtouch_process_multi()
1276 usbtouch->buf_len = 0; in usbtouch_process_multi()
1280 static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, in usbtouch_process_multi() argument
1283 dev_WARN_ONCE(&usbtouch->interface->dev, 1, in usbtouch_process_multi()
1290 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq() local
1291 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1318 usbtouch->process_pkt(usbtouch, usbtouch->data, urb->actual_length); in usbtouch_irq()
1321 usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); in usbtouch_irq()
1328 static int usbtouch_start_io(struct usbtouch_usb *usbtouch) in usbtouch_start_io() argument
1330 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_start_io()
1332 if (!usbtouch->type->irq_always) in usbtouch_start_io()
1333 if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) in usbtouch_start_io()
1336 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_start_io()
1337 usbtouch->is_open = true; in usbtouch_start_io()
1344 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_open() local
1347 usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); in usbtouch_open()
1349 r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0; in usbtouch_open()
1353 r = usbtouch_start_io(usbtouch); in usbtouch_open()
1355 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
1361 struct usbtouch_usb *usbtouch = input_get_drvdata(input); in usbtouch_close() local
1364 scoped_guard(mutex, &usbtouch->pm_mutex) { in usbtouch_close()
1365 if (!usbtouch->type->irq_always) in usbtouch_close()
1366 usb_kill_urb(usbtouch->irq); in usbtouch_close()
1367 usbtouch->is_open = false; in usbtouch_close()
1370 r = usb_autopm_get_interface(usbtouch->interface); in usbtouch_close()
1371 usbtouch->interface->needs_remote_wakeup = 0; in usbtouch_close()
1373 usb_autopm_put_interface(usbtouch->interface); in usbtouch_close()
1378 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_suspend() local
1380 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
1387 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_resume() local
1389 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_resume()
1391 if (usbtouch->is_open || usbtouch->type->irq_always) in usbtouch_resume()
1392 return usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_resume()
1399 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_reset_resume() local
1403 if (usbtouch->type->init) { in usbtouch_reset_resume()
1404 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1414 guard(mutex)(&usbtouch->pm_mutex); in usbtouch_reset_resume()
1416 if (usbtouch->is_open) in usbtouch_reset_resume()
1417 return usb_submit_urb(usbtouch->irq, GFP_NOIO); in usbtouch_reset_resume()
1423 struct usbtouch_usb *usbtouch) in usbtouch_free_buffers() argument
1425 usb_free_coherent(udev, usbtouch->data_size, in usbtouch_free_buffers()
1426 usbtouch->data, usbtouch->data_dma); in usbtouch_free_buffers()
1427 kfree(usbtouch->buffer); in usbtouch_free_buffers()
1445 struct usbtouch_usb *usbtouch; in usbtouch_probe() local
1461 usbtouch = kzalloc(sizeof(*usbtouch), GFP_KERNEL); in usbtouch_probe()
1463 if (!usbtouch || !input_dev) in usbtouch_probe()
1466 mutex_init(&usbtouch->pm_mutex); in usbtouch_probe()
1467 usbtouch->type = type; in usbtouch_probe()
1469 usbtouch->data_size = type->rept_size; in usbtouch_probe()
1478 usbtouch->data_size = min(usbtouch->data_size, in usbtouch_probe()
1482 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, in usbtouch_probe()
1483 GFP_KERNEL, &usbtouch->data_dma); in usbtouch_probe()
1484 if (!usbtouch->data) in usbtouch_probe()
1488 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); in usbtouch_probe()
1489 if (!usbtouch->buffer) in usbtouch_probe()
1491 usbtouch->process_pkt = usbtouch_process_multi; in usbtouch_probe()
1493 usbtouch->process_pkt = usbtouch_process_pkt; in usbtouch_probe()
1496 usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); in usbtouch_probe()
1497 if (!usbtouch->irq) { in usbtouch_probe()
1503 usbtouch->interface = intf; in usbtouch_probe()
1504 usbtouch->input = input_dev; in usbtouch_probe()
1507 strscpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1511 strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); in usbtouch_probe()
1512 strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); in usbtouch_probe()
1515 if (!strlen(usbtouch->name)) in usbtouch_probe()
1516 snprintf(usbtouch->name, sizeof(usbtouch->name), in usbtouch_probe()
1521 usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); in usbtouch_probe()
1522 strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); in usbtouch_probe()
1524 input_dev->name = usbtouch->name; in usbtouch_probe()
1525 input_dev->phys = usbtouch->phys; in usbtouch_probe()
1529 input_set_drvdata(input_dev, usbtouch); in usbtouch_probe()
1543 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1545 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1546 usbtouch_irq, usbtouch, endpoint->bInterval); in usbtouch_probe()
1548 usb_fill_bulk_urb(usbtouch->irq, udev, in usbtouch_probe()
1550 usbtouch->data, usbtouch->data_size, in usbtouch_probe()
1551 usbtouch_irq, usbtouch); in usbtouch_probe()
1553 usbtouch->irq->dev = udev; in usbtouch_probe()
1554 usbtouch->irq->transfer_dma = usbtouch->data_dma; in usbtouch_probe()
1555 usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usbtouch_probe()
1559 err = type->alloc(usbtouch); in usbtouch_probe()
1570 err = type->init(usbtouch); in usbtouch_probe()
1579 err = input_register_device(usbtouch->input); in usbtouch_probe()
1587 usb_set_intfdata(intf, usbtouch); in usbtouch_probe()
1589 if (usbtouch->type->irq_always) { in usbtouch_probe()
1592 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1609 type->exit(usbtouch); in usbtouch_probe()
1611 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1613 usbtouch_free_buffers(udev, usbtouch); in usbtouch_probe()
1616 kfree(usbtouch); in usbtouch_probe()
1622 struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); in usbtouch_disconnect() local
1624 if (!usbtouch) in usbtouch_disconnect()
1632 input_unregister_device(usbtouch->input); in usbtouch_disconnect()
1633 usb_free_urb(usbtouch->irq); in usbtouch_disconnect()
1634 if (usbtouch->type->exit) in usbtouch_disconnect()
1635 usbtouch->type->exit(usbtouch); in usbtouch_disconnect()
1636 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); in usbtouch_disconnect()
1637 kfree(usbtouch); in usbtouch_disconnect()