Lines Matching +full:multi +full:- +full:touch
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * - eGalax Touchkit
6 * includes eTurboTouch CT-410/510/700
7 * - 3M/Microtouch EX II series
8 * - ITM
9 * - PanJit TouchSet
10 * - eTurboTouch
11 * - Gunze AHL61
12 * - DMC TSC-10/25
13 * - IRTOUCHSYSTEMS/UNITOP
14 * - IdealTEK URTC1000
15 * - General Touch
16 * - GoTop Super_Q2/GogoPen/PenPower tablets
17 * - JASTEC USB touch controller/DigiTech DTR-02U
18 * - Zytronic capacitive touchscreen
19 * - NEXIO/iNexio
20 * - Elo TouchSystems 2700 IntelliTouch
21 * - EasyTouch USB Dual/Multi touch controller from Data Modul
23 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
27 * - ITM parts are from itmtouch.c
28 * - 3M parts are from mtouchusb.c
29 * - PanJit parts are from an unmerged driver by Lanslott Gish
30 * - DMC TSC 10/25 are from Holger Schurig, with ideas from an unmerged
52 MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
75 * < 0: -return value more bytes needed
103 int touch, press; member
117 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in e2i_init()
123 dev_dbg(&usbtouch->interface->dev, in e2i_init()
124 "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", in e2i_init()
132 dev->x = (pkt[2] << 8) | pkt[3]; in e2i_read_data()
133 dev->y = (pkt[4] << 8) | pkt[5]; in e2i_read_data()
135 tmp = tmp - 0xA000; in e2i_read_data()
136 dev->touch = (tmp > 0); in e2i_read_data()
137 dev->press = (tmp > 0 ? tmp : 0); in e2i_read_data()
170 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in egalax_init()
181 return -ENOMEM; in egalax_init()
185 buf[2] = 'A'; /* command - check active */ in egalax_init()
193 if (ret != -EPIPE) in egalax_init()
205 dev->x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F); in egalax_read_data()
206 dev->y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F); in egalax_read_data()
207 dev->touch = pkt[0] & 0x01; in egalax_read_data()
220 return -1; in egalax_get_pkt_len()
261 dev->x = ((pkt[1] & 0x1F) << 7) | (pkt[2] & 0x7F); in etouch_read_data()
262 dev->y = ((pkt[3] & 0x1F) << 7) | (pkt[4] & 0x7F); in etouch_read_data()
263 dev->touch = pkt[0] & 0x01; in etouch_read_data()
277 return -1; in etouch_get_pkt_len()
302 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; in panjit_read_data()
303 dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; in panjit_read_data()
304 dev->touch = pkt[0] & 0x01; in panjit_read_data()
334 dev->x = (pkt[4] << 8) | pkt[3]; in mtouch_read_data()
335 dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]); in mtouch_read_data()
337 dev->x = (pkt[8] << 8) | pkt[7]; in mtouch_read_data()
338 dev->y = (pkt[10] << 8) | pkt[9]; in mtouch_read_data()
340 dev->touch = (pkt[2] & 0x40) ? 1 : 0; in mtouch_read_data()
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()
358 return -ENOMEM; in mtouch_get_fw_revision()
366 dev_warn(&usbtouch->interface->dev, in mtouch_get_fw_revision()
368 return ret < 0 ? ret : -EIO; in mtouch_get_fw_revision()
371 priv->fw_rev_major = buf[3]; in mtouch_get_fw_revision()
372 priv->fw_rev_minor = buf[4]; in mtouch_get_fw_revision()
383 return -ENOMEM; in mtouch_alloc()
385 usbtouch->priv = priv; in mtouch_alloc()
392 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); in mtouch_init()
402 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
403 "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", in mtouch_init()
414 dev_dbg(&usbtouch->interface->dev, in mtouch_init()
415 "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", in mtouch_init()
419 if (ret != -EPIPE) in mtouch_init()
423 /* Default min/max xy are the raw values, override if using hw-calib */ 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()
434 struct mtouch_priv *priv = usbtouch->priv; in mtouch_exit()
456 struct mtouch_priv *priv = usbtouch->priv; in mtouch_firmware_rev_show()
459 priv->fw_rev_major, priv->fw_rev_minor); in mtouch_firmware_rev_show()
474 return usbtouch->type == &mtouch_dev_info; in mtouch_group_visible()
492 int touch; in itm_read_data() local
496 * report touch as 0 with the last valid x/y data once. then stop in itm_read_data()
499 dev->press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F); in itm_read_data()
501 touch = ~pkt[7] & 0x20; in itm_read_data()
502 if (!touch) { in itm_read_data()
503 if (dev->touch) { in itm_read_data()
504 dev->touch = 0; in itm_read_data()
511 dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); in itm_read_data()
512 dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); in itm_read_data()
513 dev->touch = touch; in itm_read_data()
545 shift = (6 - (pkt[0] & 0x03)); in eturbo_read_data()
546 dev->x = ((pkt[3] << 7) | pkt[4]) >> shift; in eturbo_read_data()
547 dev->y = ((pkt[1] << 7) | pkt[2]) >> shift; in eturbo_read_data()
548 dev->touch = (pkt[0] & 0x10) ? 1 : 0; in eturbo_read_data()
583 dev->x = ((pkt[0] & 0x1F) << 7) | (pkt[2] & 0x7F); in gunze_read_data()
584 dev->y = ((pkt[1] & 0x1F) << 7) | (pkt[3] & 0x7F); in gunze_read_data()
585 dev->touch = pkt[0] & 0x20; in gunze_read_data()
601 * DMC TSC-10/25 Part
625 struct usb_device *dev = interface_to_usbdev(usbtouch->interface); in dmc_tsc10_init()
630 return -ENOMEM; in dmc_tsc10_init()
642 return -ENODEV; in dmc_tsc10_init()
644 /* TSC-25 data sheet specifies a delay after the RESET command */ in dmc_tsc10_init()
657 return -ENODEV; in dmc_tsc10_init()
668 dev->x = ((pkt[2] & 0x03) << 8) | pkt[1]; in dmc_tsc10_read_data()
669 dev->y = ((pkt[4] & 0x03) << 8) | pkt[3]; in dmc_tsc10_read_data()
670 dev->touch = pkt[0] & 0x01; in dmc_tsc10_read_data()
693 dev->x = (pkt[3] << 8) | pkt[2]; in irtouch_read_data()
694 dev->y = (pkt[5] << 8) | pkt[4]; in irtouch_read_data()
695 dev->touch = (pkt[1] & 0x03) ? 1 : 0; in irtouch_read_data()
725 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; in tc45usb_read_data()
726 dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; in tc45usb_read_data()
727 dev->touch = pkt[0] & 0x01; in tc45usb_read_data()
762 /* touch data in IdealTEK mode */ in idealtek_read_data()
763 dev->x = (pkt[1] << 5) | (pkt[2] >> 2); in idealtek_read_data()
764 dev->y = (pkt[3] << 5) | (pkt[4] >> 2); in idealtek_read_data()
765 dev->touch = (pkt[0] & 0x40) ? 1 : 0; in idealtek_read_data()
769 /* touch data in MT emulation mode */ in idealtek_read_data()
770 dev->x = (pkt[2] << 5) | (pkt[1] >> 2); in idealtek_read_data()
771 dev->y = (pkt[4] << 5) | (pkt[3] >> 2); in idealtek_read_data()
772 dev->touch = (pkt[0] & 0x40) ? 1 : 0; in idealtek_read_data()
792 * General Touch Part
797 dev->x = (pkt[2] << 8) | pkt[1]; in general_touch_read_data()
798 dev->y = (pkt[4] << 8) | pkt[3]; in general_touch_read_data()
799 dev->press = pkt[5] & 0xff; in general_touch_read_data()
800 dev->touch = pkt[0] & 0x01; in general_touch_read_data()
821 dev->x = ((pkt[1] & 0x38) << 4) | pkt[2]; in gotop_read_data()
822 dev->y = ((pkt[1] & 0x07) << 7) | pkt[3]; in gotop_read_data()
823 dev->touch = pkt[0] & 0x01; in gotop_read_data()
844 dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f); in jastec_read_data()
845 dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f); in jastec_read_data()
846 dev->touch = (pkt[0] & 0x40) >> 6; in jastec_read_data()
867 struct usb_interface *intf = dev->interface; in zytronic_read_data()
871 dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]); in zytronic_read_data()
875 dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); in zytronic_read_data()
876 dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); in zytronic_read_data()
877 dev->touch = 1; in zytronic_read_data()
878 dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); in zytronic_read_data()
882 dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); in zytronic_read_data()
883 dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); in zytronic_read_data()
884 dev->touch = 0; in zytronic_read_data()
885 dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); in zytronic_read_data()
889 dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); in zytronic_read_data()
922 u8 flags; /* 0xe1 = touch, 0xe1 = release */
923 __be16 data_len; /* total bytes of touch data */
939 int ret = -ENOMEM; in nexio_alloc()
945 usbtouch->priv = priv; in nexio_alloc()
946 priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt), in nexio_alloc()
948 if (!priv->ack_buf) in nexio_alloc()
951 priv->ack = usb_alloc_urb(0, GFP_KERNEL); in nexio_alloc()
952 if (!priv->ack) { in nexio_alloc()
953 dev_dbg(&usbtouch->interface->dev, in nexio_alloc()
954 "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); in nexio_alloc()
961 kfree(priv->ack_buf); in nexio_alloc()
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()
973 int ret = -ENOMEM; in nexio_init()
979 for (i = 0; i < interface->desc.bNumEndpoints; i++) { in nexio_init()
981 usb_endpoint_dir_in(&interface->endpoint[i].desc)) in nexio_init()
982 input_ep = interface->endpoint[i].desc.bEndpointAddress; in nexio_init()
984 usb_endpoint_dir_out(&interface->endpoint[i].desc)) in nexio_init()
985 output_ep = interface->endpoint[i].desc.bEndpointAddress; in nexio_init()
988 return -ENXIO; in nexio_init()
992 return -ENOMEM; in nexio_init()
1037 usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep), in nexio_init()
1038 priv->ack_buf, sizeof(nexio_ack_pkt), in nexio_init()
1046 struct nexio_priv *priv = usbtouch->priv; in nexio_exit()
1048 usb_kill_urb(priv->ack); in nexio_exit()
1049 usb_free_urb(priv->ack); in nexio_exit()
1050 kfree(priv->ack_buf); in nexio_exit()
1056 struct device *dev = &usbtouch->interface->dev; in nexio_read_data()
1058 struct nexio_priv *priv = usbtouch->priv; in nexio_read_data()
1059 unsigned int data_len = be16_to_cpu(packet->data_len); in nexio_read_data()
1060 unsigned int x_len = be16_to_cpu(packet->x_len); in nexio_read_data()
1061 unsigned int y_len = be16_to_cpu(packet->y_len); in nexio_read_data()
1064 /* got touch data? */ in nexio_read_data()
1069 data_len -= 0x100; in nexio_read_data()
1071 x_len -= 0x80; in nexio_read_data()
1074 ret = usb_submit_urb(priv->ack, GFP_ATOMIC); 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()
1086 * Each byte represents "darkness" percentage (0-100) of one element. in nexio_read_data()
1088 * This also means that there's a limited multi-touch capability but in nexio_read_data()
1091 begin_x = end_x = begin_y = end_y = -1; in nexio_read_data()
1093 if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) { in nexio_read_data()
1097 if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) { in nexio_read_data()
1098 end_x = x - 1; in nexio_read_data()
1100 if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) { in nexio_read_data()
1101 begin_y = y - x_len; in nexio_read_data()
1104 if (end_y == -1 && in nexio_read_data()
1105 begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) { in nexio_read_data()
1106 end_y = y - 1 - x_len; in nexio_read_data()
1107 w = end_x - begin_x; in nexio_read_data()
1108 h = end_y - begin_y; in nexio_read_data()
1110 /* multi-touch */ 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()
1123 /* single touch */ 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()
1127 begin_y = end_y = -1; in nexio_read_data()
1131 begin_x = end_x = -1; in nexio_read_data()
1157 dev->x = (pkt[3] << 8) | pkt[2]; in elo_read_data()
1158 dev->y = (pkt[5] << 8) | pkt[4]; in elo_read_data()
1159 dev->touch = pkt[6] > 0; in elo_read_data()
1160 dev->press = pkt[6]; in elo_read_data()
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()
1197 if (type->max_press) 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()
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()
1220 /* need to append -pkt_len bytes before able to get size */ in usbtouch_process_multi()
1222 int append = -pkt_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()
1244 buf_len = len - tmp; in usbtouch_process_multi()
1254 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, in usbtouch_process_multi()
1255 buf_len - pos); in usbtouch_process_multi()
1264 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) { 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()
1283 dev_WARN_ONCE(&usbtouch->interface->dev, 1, in usbtouch_process_multi()
1284 "Protocol has ->get_pkt_len() without #define MULTI_PACKET"); in usbtouch_process_multi()
1290 struct usbtouch_usb *usbtouch = urb->context; in usbtouch_irq()
1291 struct device *dev = &usbtouch->interface->dev; in usbtouch_irq()
1294 switch (urb->status) { in usbtouch_irq()
1298 case -ETIME: in usbtouch_irq()
1301 "%s - urb timed out - was the device unplugged?\n", in usbtouch_irq()
1304 case -ECONNRESET: in usbtouch_irq()
1305 case -ENOENT: in usbtouch_irq()
1306 case -ESHUTDOWN: in usbtouch_irq()
1307 case -EPIPE: in usbtouch_irq()
1309 dev_dbg(dev, "%s - urb shutting down with status: %d\n", in usbtouch_irq()
1310 __func__, urb->status); in usbtouch_irq()
1313 dev_dbg(dev, "%s - nonzero urb status received: %d\n", in usbtouch_irq()
1314 __func__, urb->status); 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()
1324 dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", in usbtouch_irq()
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()
1334 return -EIO; in usbtouch_start_io()
1336 usbtouch->interface->needs_remote_wakeup = 1; in usbtouch_start_io()
1337 usbtouch->is_open = true; in usbtouch_start_io()
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()
1355 usb_autopm_put_interface(usbtouch->interface); in usbtouch_open()
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()
1380 usb_kill_urb(usbtouch->irq); in usbtouch_suspend()
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()
1403 if (usbtouch->type->init) { in usbtouch_reset_resume()
1404 err = usbtouch->type->init(usbtouch); in usbtouch_reset_resume()
1406 dev_dbg(&intf->dev, in usbtouch_reset_resume()
1407 "%s - type->init() failed, err: %d\n", 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()
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()
1435 for (i = 0; i < interface->desc.bNumEndpoints; i++) in usbtouch_get_input_endpoint()
1436 if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) in usbtouch_get_input_endpoint()
1437 return &interface->endpoint[i].desc; in usbtouch_get_input_endpoint()
1450 int err = -ENOMEM; in usbtouch_probe()
1453 type = (const struct usbtouch_device_info *)id->driver_info; in usbtouch_probe()
1455 return -ENODEV; in usbtouch_probe()
1457 endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting); in usbtouch_probe()
1459 return -ENXIO; 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()
1470 if (type->get_pkt_len) { in usbtouch_probe()
1472 * When dealing with variable-length packets we should 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()
1487 if (type->get_pkt_len) { 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()
1498 dev_dbg(&intf->dev, in usbtouch_probe()
1499 "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__); in usbtouch_probe()
1503 usbtouch->interface = intf; in usbtouch_probe()
1504 usbtouch->input = input_dev; in usbtouch_probe()
1506 if (udev->manufacturer) in usbtouch_probe()
1507 strscpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); in usbtouch_probe()
1509 if (udev->product) { in usbtouch_probe()
1510 if (udev->manufacturer) 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()
1518 le16_to_cpu(udev->descriptor.idVendor), in usbtouch_probe()
1519 le16_to_cpu(udev->descriptor.idProduct)); 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()
1526 usb_to_input_id(udev, &input_dev->id); in usbtouch_probe()
1527 input_dev->dev.parent = &intf->dev; in usbtouch_probe()
1531 input_dev->open = usbtouch_open; in usbtouch_probe()
1532 input_dev->close = usbtouch_close; in usbtouch_probe()
1534 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in usbtouch_probe()
1535 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); in usbtouch_probe()
1536 input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0); in usbtouch_probe()
1537 input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0); in usbtouch_probe()
1538 if (type->max_press) in usbtouch_probe()
1539 input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press, in usbtouch_probe()
1540 type->max_press, 0, 0); in usbtouch_probe()
1543 usb_fill_int_urb(usbtouch->irq, udev, in usbtouch_probe()
1544 usb_rcvintpipe(udev, endpoint->bEndpointAddress), 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()
1549 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), in usbtouch_probe()
1550 usbtouch->data, usbtouch->data_size, 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()
1558 if (type->alloc) { in usbtouch_probe()
1559 err = type->alloc(usbtouch); in usbtouch_probe()
1561 dev_dbg(&intf->dev, in usbtouch_probe()
1562 "%s - type->alloc() failed, err: %d\n", in usbtouch_probe()
1569 if (type->init) { in usbtouch_probe()
1570 err = type->init(usbtouch); in usbtouch_probe()
1572 dev_dbg(&intf->dev, in usbtouch_probe()
1573 "%s - type->init() failed, err: %d\n", in usbtouch_probe()
1579 err = input_register_device(usbtouch->input); in usbtouch_probe()
1581 dev_dbg(&intf->dev, in usbtouch_probe()
1582 "%s - input_register_device failed, err: %d\n", in usbtouch_probe()
1589 if (usbtouch->type->irq_always) { in usbtouch_probe()
1592 err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); in usbtouch_probe()
1595 dev_err(&intf->dev, in usbtouch_probe()
1596 "%s - usb_submit_urb failed with result: %d\n", in usbtouch_probe()
1608 if (type->exit) in usbtouch_probe()
1609 type->exit(usbtouch); in usbtouch_probe()
1611 usb_free_urb(usbtouch->irq); in usbtouch_probe()
1627 dev_dbg(&intf->dev, in usbtouch_disconnect()
1628 "%s - usbtouch is initialized, cleaning up\n", __func__); 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()