Lines Matching +full:touchscreen +full:- +full:x +full:- +full:mm
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
27 if (etd->info.debug) \
38 if (ps2_sliced_command(&psmouse->ps2dev, c) || in synaptics_send_cmd()
39 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { in synaptics_send_cmd()
40 psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c); in synaptics_send_cmd()
41 return -1; in synaptics_send_cmd()
53 struct ps2dev *ps2dev = &psmouse->ps2dev; in elantech_send_cmd()
58 psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c); in elantech_send_cmd()
59 return -1; in elantech_send_cmd()
71 struct ps2dev *ps2dev = &psmouse->ps2dev; in elantech_ps2_command()
72 struct elantech_data *etd = psmouse->private; in elantech_ps2_command()
80 tries--; in elantech_ps2_command()
81 elantech_debug("retrying ps2 command 0x%02x (%d).\n", in elantech_ps2_command()
87 psmouse_err(psmouse, "ps2 command 0x%02x failed.\n", command); in elantech_ps2_command()
98 struct elantech_data *etd = psmouse->private; in elantech_read_reg()
103 return -1; in elantech_read_reg()
106 return -1; in elantech_read_reg()
108 switch (etd->info.hw_version) { in elantech_read_reg()
110 if (ps2_sliced_command(&psmouse->ps2dev, ETP_REGISTER_READ) || in elantech_read_reg()
111 ps2_sliced_command(&psmouse->ps2dev, reg) || in elantech_read_reg()
112 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { in elantech_read_reg()
113 rc = -1; in elantech_read_reg()
123 rc = -1; in elantech_read_reg()
133 rc = -1; in elantech_read_reg()
139 psmouse_err(psmouse, "failed to read register 0x%02x.\n", reg); in elantech_read_reg()
140 else if (etd->info.hw_version != 4) in elantech_read_reg()
154 struct elantech_data *etd = psmouse->private; in elantech_write_reg()
158 return -1; in elantech_write_reg()
161 return -1; in elantech_write_reg()
163 switch (etd->info.hw_version) { in elantech_write_reg()
165 if (ps2_sliced_command(&psmouse->ps2dev, ETP_REGISTER_WRITE) || in elantech_write_reg()
166 ps2_sliced_command(&psmouse->ps2dev, reg) || in elantech_write_reg()
167 ps2_sliced_command(&psmouse->ps2dev, val) || in elantech_write_reg()
168 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11)) { in elantech_write_reg()
169 rc = -1; in elantech_write_reg()
181 rc = -1; in elantech_write_reg()
193 rc = -1; in elantech_write_reg()
207 rc = -1; in elantech_write_reg()
214 "failed to write register 0x%02x with value 0x%02x.\n", in elantech_write_reg()
226 psmouse->pktsize, psmouse->packet); in elantech_packet_dump()
233 * Laptop-model: fw_version: caps: buttons:
235 * Acer S7-392 0x581f01 50, 17, 0d clickpad
236 * Acer V5-131 0x461f02 01, 16, 0c clickpad
237 * Acer V5-551 0x461f00 ? clickpad
245 * Avatar AVIU-145A2 0x361f00 ? clickpad
261 * Samsung NP900X3E-A02 0x575f03 ? clickpad
262 * Samsung NP-QX410 0x851b00 19, 14, 0c clickpad
272 return info->fw_version & 0x001000; in elantech_is_buttonpad()
281 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v1()
282 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v1()
283 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v1()
286 if (etd->info.fw_version < 0x020000) { in elantech_report_absolute_v1()
301 if (etd->info.jumpy_cursor) { in elantech_report_absolute_v1()
303 etd->single_finger_reports = 0; in elantech_report_absolute_v1()
304 } else if (etd->single_finger_reports < 2) { in elantech_report_absolute_v1()
306 etd->single_finger_reports++; in elantech_report_absolute_v1()
322 etd->y_max - (((packet[1] & 0x03) << 8) | packet[3])); in elantech_report_absolute_v1()
331 if (etd->info.fw_version < 0x020000 && in elantech_report_absolute_v1()
332 (etd->info.capabilities[0] & ETP_CAP_HAS_ROCKER)) { in elantech_report_absolute_v1()
343 unsigned int x, unsigned int y) in elantech_set_slot() argument
348 input_report_abs(dev, ABS_MT_POSITION_X, x); in elantech_set_slot()
353 /* x1 < x2 and y1 < y2 when two fingers, x = y = 0 when not pressed */
369 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v2()
370 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v2()
371 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v2()
397 y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v2()
412 y1 = etd->y_max - in elantech_report_absolute_v2()
420 y2 = etd->y_max - in elantech_report_absolute_v2()
440 if (etd->info.reports_pressure) { in elantech_report_absolute_v2()
459 * x and y are written in two's complement spread in elantech_report_trackpoint()
466 struct elantech_data *etd = psmouse->private; in elantech_report_trackpoint()
467 struct input_dev *tp_dev = etd->tp_dev; in elantech_report_trackpoint()
468 unsigned char *packet = psmouse->packet; in elantech_report_trackpoint()
469 int x, y; in elantech_report_trackpoint() local
479 x = packet[4] - (int)((packet[1]^0x80) << 1); in elantech_report_trackpoint()
480 y = (int)((packet[2]^0x80) << 1) - packet[5]; in elantech_report_trackpoint()
484 input_report_rel(tp_dev, REL_X, x); in elantech_report_trackpoint()
493 if (etd->info.debug == 1) in elantech_report_trackpoint()
507 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v3()
508 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v3()
509 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v3()
528 y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
537 etd->mt[0].x = ((packet[1] & 0x0f) << 8) | packet[2]; in elantech_report_absolute_v3()
542 etd->mt[0].y = etd->y_max - in elantech_report_absolute_v3()
551 x1 = etd->mt[0].x; in elantech_report_absolute_v3()
552 y1 = etd->mt[0].y; in elantech_report_absolute_v3()
554 y2 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
572 if (elantech_is_buttonpad(&etd->info)) in elantech_report_absolute_v3()
585 struct input_dev *dev = psmouse->dev; in elantech_input_sync_v4()
586 struct elantech_data *etd = psmouse->private; in elantech_input_sync_v4()
587 unsigned char *packet = psmouse->packet; in elantech_input_sync_v4()
590 if (elantech_is_buttonpad(&etd->info)) in elantech_input_sync_v4()
601 struct input_dev *dev = psmouse->dev; in process_packet_status_v4()
602 unsigned char *packet = psmouse->packet; in process_packet_status_v4()
620 struct input_dev *dev = psmouse->dev; in process_packet_head_v4()
621 struct elantech_data *etd = psmouse->private; in process_packet_head_v4()
622 unsigned char *packet = psmouse->packet; in process_packet_head_v4()
623 int id = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_head_v4()
629 etd->mt[id].x = ((packet[1] & 0x0f) << 8) | packet[2]; in process_packet_head_v4()
630 etd->mt[id].y = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in process_packet_head_v4()
637 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_head_v4()
638 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_head_v4()
640 input_report_abs(dev, ABS_MT_TOUCH_MAJOR, traces * etd->width); in process_packet_head_v4()
649 struct input_dev *dev = psmouse->dev; in process_packet_motion_v4()
650 struct elantech_data *etd = psmouse->private; in process_packet_motion_v4()
651 unsigned char *packet = psmouse->packet; in process_packet_motion_v4()
655 id = ((packet[0] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
659 sid = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
662 * Motion packets give us the delta of x, y values of specific fingers, in process_packet_motion_v4()
671 etd->mt[id].x += delta_x1 * weight; in process_packet_motion_v4()
672 etd->mt[id].y -= delta_y1 * weight; in process_packet_motion_v4()
674 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_motion_v4()
675 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_motion_v4()
678 etd->mt[sid].x += delta_x2 * weight; in process_packet_motion_v4()
679 etd->mt[sid].y -= delta_y2 * weight; in process_packet_motion_v4()
681 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[sid].x); in process_packet_motion_v4()
682 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[sid].y); in process_packet_motion_v4()
713 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v1()
714 unsigned char *packet = psmouse->packet; in elantech_packet_check_v1()
718 if (etd->info.fw_version < 0x020000) { in elantech_packet_check_v1()
730 return etd->parity[packet[1]] == p1 && in elantech_packet_check_v1()
731 etd->parity[packet[2]] == p2 && in elantech_packet_check_v1()
732 etd->parity[packet[3]] == p3; in elantech_packet_check_v1()
744 unsigned char *packet = psmouse->packet; in elantech_debounce_check_v2()
751 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v2()
752 unsigned char *packet = psmouse->packet; in elantech_packet_check_v2()
763 if (etd->info.reports_pressure) in elantech_packet_check_v2()
783 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v3()
787 unsigned char *packet = psmouse->packet; in elantech_packet_check_v3()
800 if (etd->info.crc_enabled) { in elantech_packet_check_v3()
821 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v4()
822 unsigned char *packet = psmouse->packet; in elantech_packet_check_v4()
827 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) in elantech_packet_check_v4()
831 ic_version = (etd->info.fw_version & 0x0f0000) >> 16; in elantech_packet_check_v4()
840 if (etd->info.crc_enabled) in elantech_packet_check_v4()
842 else if (ic_version == 7 && etd->info.samples[1] == 0x2A) in elantech_packet_check_v4()
870 struct elantech_data *etd = psmouse->private; in elantech_process_byte()
873 if (psmouse->pktcnt < psmouse->pktsize) in elantech_process_byte()
876 if (etd->info.debug > 1) in elantech_process_byte()
879 switch (etd->info.hw_version) { in elantech_process_byte()
881 if (etd->info.paritycheck && !elantech_packet_check_v1(psmouse)) in elantech_process_byte()
892 if (etd->info.paritycheck && !elantech_packet_check_v2(psmouse)) in elantech_process_byte()
948 struct elantech_data *etd = psmouse->private; in elantech_set_rate_restore_reg_07()
950 etd->original_set_rate(psmouse, rate); in elantech_set_rate_restore_reg_07()
951 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_rate_restore_reg_07()
960 struct elantech_data *etd = psmouse->private; in elantech_set_absolute_mode()
965 switch (etd->info.hw_version) { in elantech_set_absolute_mode()
967 etd->reg_10 = 0x16; in elantech_set_absolute_mode()
968 etd->reg_11 = 0x8f; in elantech_set_absolute_mode()
969 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
970 elantech_write_reg(psmouse, 0x11, etd->reg_11)) { in elantech_set_absolute_mode()
971 rc = -1; in elantech_set_absolute_mode()
977 etd->reg_10 = 0x54; in elantech_set_absolute_mode()
978 etd->reg_11 = 0x88; /* 0x8a */ in elantech_set_absolute_mode()
979 etd->reg_21 = 0x60; /* 0x00 */ in elantech_set_absolute_mode()
980 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
981 elantech_write_reg(psmouse, 0x11, etd->reg_11) || in elantech_set_absolute_mode()
982 elantech_write_reg(psmouse, 0x21, etd->reg_21)) { in elantech_set_absolute_mode()
983 rc = -1; in elantech_set_absolute_mode()
988 if (etd->info.set_hw_resolution) in elantech_set_absolute_mode()
989 etd->reg_10 = 0x0b; in elantech_set_absolute_mode()
991 etd->reg_10 = 0x01; in elantech_set_absolute_mode()
993 if (elantech_write_reg(psmouse, 0x10, etd->reg_10)) in elantech_set_absolute_mode()
994 rc = -1; in elantech_set_absolute_mode()
999 etd->reg_07 = 0x01; in elantech_set_absolute_mode()
1000 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_absolute_mode()
1001 rc = -1; in elantech_set_absolute_mode()
1017 tries--; in elantech_set_absolute_mode()
1025 } else if (etd->info.hw_version == 1 && in elantech_set_absolute_mode()
1029 rc = -1; in elantech_set_absolute_mode()
1042 * we also have to convert dpi to dots/mm (*10/254 to avoid floating point)
1057 return -1; in elantech_get_resolution_v4()
1068 struct input_dev *dev = psmouse->dev; in elantech_set_buttonpad_prop()
1069 struct elantech_data *etd = psmouse->private; in elantech_set_buttonpad_prop()
1071 if (elantech_is_buttonpad(&etd->info)) { in elantech_set_buttonpad_prop()
1072 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); in elantech_set_buttonpad_prop()
1073 __clear_bit(BTN_RIGHT, dev->keybit); in elantech_set_buttonpad_prop()
1112 struct input_dev *dev = psmouse->dev; in elantech_set_input_params()
1113 struct elantech_data *etd = psmouse->private; in elantech_set_input_params()
1114 struct elantech_device_info *info = &etd->info; in elantech_set_input_params()
1115 unsigned int x_min = info->x_min, y_min = info->y_min, in elantech_set_input_params()
1116 x_max = info->x_max, y_max = info->y_max, in elantech_set_input_params()
1117 width = info->width; in elantech_set_input_params()
1119 __set_bit(INPUT_PROP_POINTER, dev->propbit); in elantech_set_input_params()
1120 __set_bit(EV_KEY, dev->evbit); in elantech_set_input_params()
1121 __set_bit(EV_ABS, dev->evbit); in elantech_set_input_params()
1122 __clear_bit(EV_REL, dev->evbit); in elantech_set_input_params()
1124 __set_bit(BTN_LEFT, dev->keybit); in elantech_set_input_params()
1125 if (info->has_middle_button) in elantech_set_input_params()
1126 __set_bit(BTN_MIDDLE, dev->keybit); in elantech_set_input_params()
1127 __set_bit(BTN_RIGHT, dev->keybit); in elantech_set_input_params()
1129 __set_bit(BTN_TOUCH, dev->keybit); in elantech_set_input_params()
1130 __set_bit(BTN_TOOL_FINGER, dev->keybit); in elantech_set_input_params()
1131 __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); in elantech_set_input_params()
1132 __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); in elantech_set_input_params()
1134 switch (info->hw_version) { in elantech_set_input_params()
1137 if (info->fw_version < 0x020000 && in elantech_set_input_params()
1138 (info->capabilities[0] & ETP_CAP_HAS_ROCKER)) { in elantech_set_input_params()
1139 __set_bit(BTN_FORWARD, dev->keybit); in elantech_set_input_params()
1140 __set_bit(BTN_BACK, dev->keybit); in elantech_set_input_params()
1147 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1148 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); in elantech_set_input_params()
1151 if (info->hw_version == 3) in elantech_set_input_params()
1155 if (info->reports_pressure) { in elantech_set_input_params()
1168 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1169 /* For X to recognize me as touchpad. */ in elantech_set_input_params()
1188 * convert to surface unit as Protocol-B requires. in elantech_set_input_params()
1195 input_abs_set_res(dev, ABS_X, info->x_res); in elantech_set_input_params()
1196 input_abs_set_res(dev, ABS_Y, info->y_res); in elantech_set_input_params()
1197 if (info->hw_version > 1) { in elantech_set_input_params()
1198 input_abs_set_res(dev, ABS_MT_POSITION_X, info->x_res); in elantech_set_input_params()
1199 input_abs_set_res(dev, ABS_MT_POSITION_Y, info->y_res); in elantech_set_input_params()
1202 etd->y_max = y_max; in elantech_set_input_params()
1203 etd->width = width; in elantech_set_input_params()
1219 struct elantech_data *etd = psmouse->private; in elantech_show_int_attr()
1221 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_show_int_attr()
1224 if (attr->reg) in elantech_show_int_attr()
1225 rc = elantech_read_reg(psmouse, attr->reg, reg); in elantech_show_int_attr()
1227 return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); in elantech_show_int_attr()
1236 struct elantech_data *etd = psmouse->private; in elantech_set_int_attr()
1238 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_set_int_attr()
1247 if (etd->info.hw_version == 1) { in elantech_set_int_attr()
1248 if (attr->reg == 0x10) in elantech_set_int_attr()
1251 else if (attr->reg == 0x11) in elantech_set_int_attr()
1256 if (!attr->reg || elantech_write_reg(psmouse, attr->reg, value) == 0) in elantech_set_int_attr()
1349 struct ps2dev *ps2dev = &psmouse->ps2dev; in elantech_detect()
1360 return -1; in elantech_detect()
1370 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", in elantech_detect()
1372 return -1; in elantech_detect()
1377 * value to avoid mis-detection. Logitech mice are known to respond in elantech_detect()
1382 return -1; in elantech_detect()
1386 "Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", in elantech_detect()
1392 return -1; in elantech_detect()
1396 psmouse->vendor = "Elantech"; in elantech_detect()
1397 psmouse->name = "Touchpad"; in elantech_detect()
1408 struct elantech_data *etd = psmouse->private; in elantech_disconnect()
1416 if (etd->tp_dev) in elantech_disconnect()
1417 input_unregister_device(etd->tp_dev); in elantech_disconnect()
1418 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_disconnect()
1420 kfree(psmouse->private); in elantech_disconnect()
1421 psmouse->private = NULL; in elantech_disconnect()
1432 return -1; in elantech_reconnect()
1437 return -1; in elantech_reconnect()
1538 int ver = (info->fw_version & 0x0f0000) >> 16; in elantech_set_properties()
1541 if (info->fw_version < 0x020030 || info->fw_version == 0x020600) in elantech_set_properties()
1542 info->hw_version = 1; in elantech_set_properties()
1547 info->hw_version = 2; in elantech_set_properties()
1550 info->hw_version = 3; in elantech_set_properties()
1553 info->hw_version = 4; in elantech_set_properties()
1556 return -1; in elantech_set_properties()
1561 info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : in elantech_set_properties()
1565 info->paritycheck = 1; in elantech_set_properties()
1572 info->jumpy_cursor = in elantech_set_properties()
1573 (info->fw_version == 0x020022 || info->fw_version == 0x020600); in elantech_set_properties()
1575 if (info->hw_version > 1) { in elantech_set_properties()
1577 info->debug = 1; in elantech_set_properties()
1579 if (info->fw_version >= 0x020800) in elantech_set_properties()
1580 info->reports_pressure = true; in elantech_set_properties()
1587 info->crc_enabled = (info->fw_version & 0x4000) == 0x4000 || in elantech_set_properties()
1591 info->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); in elantech_set_properties()
1609 return -EINVAL; in elantech_query_info()
1611 info->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; in elantech_query_info()
1615 return -EINVAL; in elantech_query_info()
1618 "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n", in elantech_query_info()
1619 info->hw_version, param[0], param[1], param[2]); in elantech_query_info()
1621 if (info->send_cmd(psmouse, ETP_CAPABILITIES_QUERY, in elantech_query_info()
1622 info->capabilities)) { in elantech_query_info()
1624 return -EINVAL; in elantech_query_info()
1627 "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", in elantech_query_info()
1628 info->capabilities[0], info->capabilities[1], in elantech_query_info()
1629 info->capabilities[2]); in elantech_query_info()
1631 if (info->hw_version != 1) { in elantech_query_info()
1632 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, info->samples)) { in elantech_query_info()
1634 return -EINVAL; in elantech_query_info()
1637 "Elan sample query result %02x, %02x, %02x\n", in elantech_query_info()
1638 info->samples[0], in elantech_query_info()
1639 info->samples[1], in elantech_query_info()
1640 info->samples[2]); in elantech_query_info()
1643 if (info->samples[1] == 0x74 && info->hw_version == 0x03) { in elantech_query_info()
1651 return -ENODEV; in elantech_query_info()
1655 info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; in elantech_query_info()
1657 info->x_res = 31; in elantech_query_info()
1658 info->y_res = 31; in elantech_query_info()
1659 if (info->hw_version == 4) { in elantech_query_info()
1661 &info->x_res, in elantech_query_info()
1662 &info->y_res, in elantech_query_info()
1663 &info->bus)) { in elantech_query_info()
1670 switch (info->hw_version) { in elantech_query_info()
1672 info->x_min = ETP_XMIN_V1; in elantech_query_info()
1673 info->y_min = ETP_YMIN_V1; in elantech_query_info()
1674 info->x_max = ETP_XMAX_V1; in elantech_query_info()
1675 info->y_max = ETP_YMAX_V1; in elantech_query_info()
1679 if (info->fw_version == 0x020800 || in elantech_query_info()
1680 info->fw_version == 0x020b00 || in elantech_query_info()
1681 info->fw_version == 0x020030) { in elantech_query_info()
1682 info->x_min = ETP_XMIN_V2; in elantech_query_info()
1683 info->y_min = ETP_YMIN_V2; in elantech_query_info()
1684 info->x_max = ETP_XMAX_V2; in elantech_query_info()
1685 info->y_max = ETP_YMAX_V2; in elantech_query_info()
1690 i = (info->fw_version > 0x020800 && in elantech_query_info()
1691 info->fw_version < 0x020900) ? 1 : 2; in elantech_query_info()
1693 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1694 return -EINVAL; in elantech_query_info()
1698 if (((info->fw_version >> 16) == 0x14) && fixed_dpi) { in elantech_query_info()
1699 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) in elantech_query_info()
1700 return -EINVAL; in elantech_query_info()
1702 info->x_max = (info->capabilities[1] - i) * param[1] / 2; in elantech_query_info()
1703 info->y_max = (info->capabilities[2] - i) * param[2] / 2; in elantech_query_info()
1704 } else if (info->fw_version == 0x040216) { in elantech_query_info()
1705 info->x_max = 819; in elantech_query_info()
1706 info->y_max = 405; in elantech_query_info()
1707 } else if (info->fw_version == 0x040219 || info->fw_version == 0x040215) { in elantech_query_info()
1708 info->x_max = 900; in elantech_query_info()
1709 info->y_max = 500; in elantech_query_info()
1711 info->x_max = (info->capabilities[1] - i) * 64; in elantech_query_info()
1712 info->y_max = (info->capabilities[2] - i) * 64; in elantech_query_info()
1718 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1719 return -EINVAL; in elantech_query_info()
1721 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1722 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1726 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1727 return -EINVAL; in elantech_query_info()
1729 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1730 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1731 traces = info->capabilities[1]; in elantech_query_info()
1732 if ((traces < 2) || (traces > info->x_max)) in elantech_query_info()
1733 return -EINVAL; in elantech_query_info()
1735 info->width = info->x_max / (traces - 1); in elantech_query_info()
1738 info->x_traces = traces; in elantech_query_info()
1741 traces = info->capabilities[2]; in elantech_query_info()
1742 if ((traces >= 2) && (traces <= info->y_max)) in elantech_query_info()
1743 info->y_traces = traces; in elantech_query_info()
1749 info->has_middle_button = dmi_check_system(elantech_dmi_has_middle_button) || in elantech_query_info()
1750 (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) && in elantech_query_info()
1764 ELANTECH_SMBUS_NOT_SET = -1,
1795 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x", in elantech_create_smbus()
1796 info->x_max + 1); in elantech_create_smbus()
1797 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y", in elantech_create_smbus()
1798 info->y_max + 1); in elantech_create_smbus()
1799 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-x", in elantech_create_smbus()
1800 info->x_min); in elantech_create_smbus()
1801 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y", in elantech_create_smbus()
1802 info->y_min); in elantech_create_smbus()
1803 if (info->x_res) in elantech_create_smbus()
1804 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm", in elantech_create_smbus()
1805 (info->x_max + 1) / info->x_res); in elantech_create_smbus()
1806 if (info->y_res) in elantech_create_smbus()
1807 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-y-mm", in elantech_create_smbus()
1808 (info->y_max + 1) / info->y_res); in elantech_create_smbus()
1810 if (info->has_trackpoint) in elantech_create_smbus()
1813 if (info->has_middle_button) in elantech_create_smbus()
1814 i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,middle-button"); in elantech_create_smbus()
1816 if (info->x_traces) in elantech_create_smbus()
1818 info->x_traces); in elantech_create_smbus()
1819 if (info->y_traces) in elantech_create_smbus()
1821 info->y_traces); in elantech_create_smbus()
1831 * elantech_setup_smbus - called once the PS/2 devices are enumerated
1841 return -ENXIO; in elantech_setup_smbus()
1849 if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || in elantech_setup_smbus()
1851 return -ENXIO; in elantech_setup_smbus()
1858 if (error == -EAGAIN) in elantech_setup_smbus()
1872 if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) in elantech_use_host_notify()
1875 switch (info->bus) { in elantech_use_host_notify()
1889 info->bus); in elantech_use_host_notify()
1907 error = -ENXIO; in elantech_init_smbus()
1926 int error = -EINVAL; in elantech_setup_ps2()
1929 psmouse->private = etd = kzalloc(sizeof(*etd), GFP_KERNEL); in elantech_setup_ps2()
1931 return -ENOMEM; in elantech_setup_ps2()
1933 etd->info = *info; in elantech_setup_ps2()
1935 etd->parity[0] = 1; in elantech_setup_ps2()
1937 etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; in elantech_setup_ps2()
1945 if (info->fw_version == 0x381f17) { in elantech_setup_ps2()
1946 etd->original_set_rate = psmouse->set_rate; in elantech_setup_ps2()
1947 psmouse->set_rate = elantech_set_rate_restore_reg_07; in elantech_setup_ps2()
1955 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()
1964 if (info->has_trackpoint) { in elantech_setup_ps2()
1968 error = -ENOMEM; in elantech_setup_ps2()
1972 etd->tp_dev = tp_dev; in elantech_setup_ps2()
1973 snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", in elantech_setup_ps2()
1974 psmouse->ps2dev.serio->phys); in elantech_setup_ps2()
1975 tp_dev->phys = etd->tp_phys; in elantech_setup_ps2()
1976 tp_dev->name = "ETPS/2 Elantech TrackPoint"; in elantech_setup_ps2()
1977 tp_dev->id.bustype = BUS_I8042; in elantech_setup_ps2()
1978 tp_dev->id.vendor = 0x0002; in elantech_setup_ps2()
1979 tp_dev->id.product = PSMOUSE_ELANTECH; in elantech_setup_ps2()
1980 tp_dev->id.version = 0x0000; in elantech_setup_ps2()
1981 tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; in elantech_setup_ps2()
1982 tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in elantech_setup_ps2()
1983 tp_dev->relbit[BIT_WORD(REL_X)] = in elantech_setup_ps2()
1985 tp_dev->keybit[BIT_WORD(BTN_LEFT)] = in elantech_setup_ps2()
1989 __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); in elantech_setup_ps2()
1990 __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); in elantech_setup_ps2()
1992 error = input_register_device(etd->tp_dev); in elantech_setup_ps2()
1997 psmouse->protocol_handler = elantech_process_byte; in elantech_setup_ps2()
1998 psmouse->disconnect = elantech_disconnect; in elantech_setup_ps2()
1999 psmouse->reconnect = elantech_reconnect; in elantech_setup_ps2()
2000 psmouse->pktsize = info->hw_version > 1 ? 6 : 4; in elantech_setup_ps2()
2006 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()