Lines Matching +full:alert +full:- +full:celsius
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()
41 return -1; in synaptics_send_cmd()
53 struct ps2dev *ps2dev = &psmouse->ps2dev; 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()
104 return -EIO; in elantech_read_reg_params()
127 return -EIO; in elantech_write_reg_params()
139 struct elantech_data *etd = psmouse->private; in elantech_read_reg()
144 return -1; in elantech_read_reg()
147 return -1; in elantech_read_reg()
149 switch (etd->info.hw_version) { in elantech_read_reg()
151 if (ps2_sliced_command(&psmouse->ps2dev, ETP_REGISTER_READ) || in elantech_read_reg()
152 ps2_sliced_command(&psmouse->ps2dev, reg) || in elantech_read_reg()
153 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { in elantech_read_reg()
154 rc = -1; in elantech_read_reg()
164 rc = -1; in elantech_read_reg()
174 rc = -1; in elantech_read_reg()
181 else if (etd->info.hw_version != 4) in elantech_read_reg()
195 struct elantech_data *etd = psmouse->private; in elantech_write_reg()
199 return -1; in elantech_write_reg()
202 return -1; in elantech_write_reg()
204 switch (etd->info.hw_version) { in elantech_write_reg()
206 if (ps2_sliced_command(&psmouse->ps2dev, ETP_REGISTER_WRITE) || in elantech_write_reg()
207 ps2_sliced_command(&psmouse->ps2dev, reg) || in elantech_write_reg()
208 ps2_sliced_command(&psmouse->ps2dev, val) || in elantech_write_reg()
209 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11)) { in elantech_write_reg()
210 rc = -1; in elantech_write_reg()
222 rc = -1; in elantech_write_reg()
234 rc = -1; in elantech_write_reg()
248 rc = -1; in elantech_write_reg()
267 psmouse->pktsize, psmouse->packet); in elantech_packet_dump()
274 * Laptop-model: fw_version: caps: buttons:
276 * Acer S7-392 0x581f01 50, 17, 0d clickpad
277 * Acer V5-131 0x461f02 01, 16, 0c clickpad
278 * Acer V5-551 0x461f00 ? clickpad
286 * Avatar AVIU-145A2 0x361f00 ? clickpad
287 * Fujitsu CELSIUS H760 0x570f02 40, 14, 0c 3 hw buttons (**)
288 * Fujitsu CELSIUS H780 0x5d0f02 41, 16, 0d 3 hw buttons (**)
302 * Samsung NP900X3E-A02 0x575f03 ? clickpad
303 * Samsung NP-QX410 0x851b00 19, 14, 0c clickpad
313 return info->fw_version & 0x001000; in elantech_is_buttonpad()
322 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v1()
323 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v1()
324 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v1()
327 if (etd->info.fw_version < 0x020000) { in elantech_report_absolute_v1()
342 if (etd->info.jumpy_cursor) { in elantech_report_absolute_v1()
344 etd->single_finger_reports = 0; in elantech_report_absolute_v1()
345 } else if (etd->single_finger_reports < 2) { in elantech_report_absolute_v1()
347 etd->single_finger_reports++; in elantech_report_absolute_v1()
363 etd->y_max - (((packet[1] & 0x03) << 8) | packet[3])); in elantech_report_absolute_v1()
372 if (etd->info.fw_version < 0x020000 && in elantech_report_absolute_v1()
373 (etd->info.capabilities[0] & ETP_CAP_HAS_ROCKER)) { in elantech_report_absolute_v1()
410 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v2()
411 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v2()
412 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v2()
438 y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v2()
453 y1 = etd->y_max - in elantech_report_absolute_v2()
461 y2 = etd->y_max - in elantech_report_absolute_v2()
481 if (etd->info.reports_pressure) { in elantech_report_absolute_v2()
507 struct elantech_data *etd = psmouse->private; in elantech_report_trackpoint()
508 struct input_dev *tp_dev = etd->tp_dev; in elantech_report_trackpoint()
509 unsigned char *packet = psmouse->packet; in elantech_report_trackpoint()
523 * occasionally. Discard packets outside of [-127, 127] range in elantech_report_trackpoint()
533 x = packet[4] - (int)((packet[1]^0x80) << 1); in elantech_report_trackpoint()
534 y = (int)((packet[2]^0x80) << 1) - packet[5]; in elantech_report_trackpoint()
547 if (etd->info.debug == 1) in elantech_report_trackpoint()
561 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v3()
562 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v3()
563 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v3()
582 y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
591 etd->mt[0].x = ((packet[1] & 0x0f) << 8) | packet[2]; in elantech_report_absolute_v3()
596 etd->mt[0].y = etd->y_max - in elantech_report_absolute_v3()
605 x1 = etd->mt[0].x; in elantech_report_absolute_v3()
606 y1 = etd->mt[0].y; in elantech_report_absolute_v3()
608 y2 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
626 if (elantech_is_buttonpad(&etd->info)) in elantech_report_absolute_v3()
639 struct input_dev *dev = psmouse->dev; in elantech_input_sync_v4()
640 struct elantech_data *etd = psmouse->private; in elantech_input_sync_v4()
641 unsigned char *packet = psmouse->packet; in elantech_input_sync_v4()
644 if (elantech_is_buttonpad(&etd->info)) in elantech_input_sync_v4()
655 struct input_dev *dev = psmouse->dev; in process_packet_status_v4()
656 unsigned char *packet = psmouse->packet; in process_packet_status_v4()
674 struct input_dev *dev = psmouse->dev; in process_packet_head_v4()
675 struct elantech_data *etd = psmouse->private; in process_packet_head_v4()
676 unsigned char *packet = psmouse->packet; in process_packet_head_v4()
677 int id = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_head_v4()
683 etd->mt[id].x = ((packet[1] & 0x0f) << 8) | packet[2]; in process_packet_head_v4()
684 etd->mt[id].y = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in process_packet_head_v4()
691 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_head_v4()
692 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_head_v4()
694 input_report_abs(dev, ABS_MT_TOUCH_MAJOR, traces * etd->width); in process_packet_head_v4()
703 struct input_dev *dev = psmouse->dev; in process_packet_motion_v4()
704 struct elantech_data *etd = psmouse->private; in process_packet_motion_v4()
705 unsigned char *packet = psmouse->packet; in process_packet_motion_v4()
709 id = ((packet[0] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
713 sid = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
725 etd->mt[id].x += delta_x1 * weight; in process_packet_motion_v4()
726 etd->mt[id].y -= delta_y1 * weight; in process_packet_motion_v4()
728 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_motion_v4()
729 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_motion_v4()
732 etd->mt[sid].x += delta_x2 * weight; in process_packet_motion_v4()
733 etd->mt[sid].y -= delta_y2 * weight; in process_packet_motion_v4()
735 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[sid].x); in process_packet_motion_v4()
736 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[sid].y); in process_packet_motion_v4()
767 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v1()
768 unsigned char *packet = psmouse->packet; in elantech_packet_check_v1()
772 if (etd->info.fw_version < 0x020000) { in elantech_packet_check_v1()
784 return etd->parity[packet[1]] == p1 && in elantech_packet_check_v1()
785 etd->parity[packet[2]] == p2 && in elantech_packet_check_v1()
786 etd->parity[packet[3]] == p3; in elantech_packet_check_v1()
798 unsigned char *packet = psmouse->packet; in elantech_debounce_check_v2()
805 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v2()
806 unsigned char *packet = psmouse->packet; in elantech_packet_check_v2()
817 if (etd->info.reports_pressure) in elantech_packet_check_v2()
837 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v3()
841 unsigned char *packet = psmouse->packet; in elantech_packet_check_v3()
854 if (etd->info.crc_enabled) { in elantech_packet_check_v3()
875 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v4()
876 unsigned char *packet = psmouse->packet; in elantech_packet_check_v4()
881 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) in elantech_packet_check_v4()
885 ic_version = (etd->info.fw_version & 0x0f0000) >> 16; in elantech_packet_check_v4()
894 if (etd->info.crc_enabled) in elantech_packet_check_v4()
896 else if (ic_version == 7 && etd->info.samples[1] == 0x2A) in elantech_packet_check_v4()
924 struct elantech_data *etd = psmouse->private; in elantech_process_byte()
927 if (psmouse->pktcnt < psmouse->pktsize) in elantech_process_byte()
930 if (etd->info.debug > 1) in elantech_process_byte()
933 switch (etd->info.hw_version) { in elantech_process_byte()
935 if (etd->info.paritycheck && !elantech_packet_check_v1(psmouse)) in elantech_process_byte()
946 if (etd->info.paritycheck && !elantech_packet_check_v2(psmouse)) in elantech_process_byte()
1002 struct elantech_data *etd = psmouse->private; in elantech_set_rate_restore_reg_07()
1004 etd->original_set_rate(psmouse, rate); in elantech_set_rate_restore_reg_07()
1005 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_rate_restore_reg_07()
1014 struct elantech_data *etd = psmouse->private; in elantech_set_absolute_mode()
1019 switch (etd->info.hw_version) { in elantech_set_absolute_mode()
1021 etd->reg_10 = 0x16; in elantech_set_absolute_mode()
1022 etd->reg_11 = 0x8f; in elantech_set_absolute_mode()
1023 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
1024 elantech_write_reg(psmouse, 0x11, etd->reg_11)) { in elantech_set_absolute_mode()
1025 rc = -1; in elantech_set_absolute_mode()
1031 etd->reg_10 = 0x54; in elantech_set_absolute_mode()
1032 etd->reg_11 = 0x88; /* 0x8a */ in elantech_set_absolute_mode()
1033 etd->reg_21 = 0x60; /* 0x00 */ in elantech_set_absolute_mode()
1034 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
1035 elantech_write_reg(psmouse, 0x11, etd->reg_11) || in elantech_set_absolute_mode()
1036 elantech_write_reg(psmouse, 0x21, etd->reg_21)) { in elantech_set_absolute_mode()
1037 rc = -1; in elantech_set_absolute_mode()
1042 if (etd->info.set_hw_resolution) in elantech_set_absolute_mode()
1043 etd->reg_10 = 0x0b; in elantech_set_absolute_mode()
1045 etd->reg_10 = 0x01; in elantech_set_absolute_mode()
1047 if (elantech_write_reg(psmouse, 0x10, etd->reg_10)) in elantech_set_absolute_mode()
1048 rc = -1; in elantech_set_absolute_mode()
1053 etd->reg_07 = 0x01; in elantech_set_absolute_mode()
1054 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_absolute_mode()
1055 rc = -1; in elantech_set_absolute_mode()
1071 tries--; in elantech_set_absolute_mode()
1079 } else if (etd->info.hw_version == 1 && in elantech_set_absolute_mode()
1083 rc = -1; in elantech_set_absolute_mode()
1111 return -1; in elantech_get_resolution_v4()
1122 struct input_dev *dev = psmouse->dev; in elantech_set_buttonpad_prop()
1123 struct elantech_data *etd = psmouse->private; in elantech_set_buttonpad_prop()
1125 if (elantech_is_buttonpad(&etd->info)) { in elantech_set_buttonpad_prop()
1126 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); in elantech_set_buttonpad_prop()
1127 __clear_bit(BTN_RIGHT, dev->keybit); in elantech_set_buttonpad_prop()
1140 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
1147 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"),
1154 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H780"),
1166 struct input_dev *dev = psmouse->dev; in elantech_set_input_params()
1167 struct elantech_data *etd = psmouse->private; in elantech_set_input_params()
1168 struct elantech_device_info *info = &etd->info; in elantech_set_input_params()
1169 unsigned int x_min = info->x_min, y_min = info->y_min, in elantech_set_input_params()
1170 x_max = info->x_max, y_max = info->y_max, in elantech_set_input_params()
1171 width = info->width; in elantech_set_input_params()
1173 __set_bit(INPUT_PROP_POINTER, dev->propbit); in elantech_set_input_params()
1174 __set_bit(EV_KEY, dev->evbit); in elantech_set_input_params()
1175 __set_bit(EV_ABS, dev->evbit); in elantech_set_input_params()
1176 __clear_bit(EV_REL, dev->evbit); in elantech_set_input_params()
1178 __set_bit(BTN_LEFT, dev->keybit); in elantech_set_input_params()
1179 if (info->has_middle_button) in elantech_set_input_params()
1180 __set_bit(BTN_MIDDLE, dev->keybit); in elantech_set_input_params()
1181 __set_bit(BTN_RIGHT, dev->keybit); in elantech_set_input_params()
1183 __set_bit(BTN_TOUCH, dev->keybit); in elantech_set_input_params()
1184 __set_bit(BTN_TOOL_FINGER, dev->keybit); in elantech_set_input_params()
1185 __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); in elantech_set_input_params()
1186 __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); in elantech_set_input_params()
1188 switch (info->hw_version) { in elantech_set_input_params()
1191 if (info->fw_version < 0x020000 && in elantech_set_input_params()
1192 (info->capabilities[0] & ETP_CAP_HAS_ROCKER)) { in elantech_set_input_params()
1193 __set_bit(BTN_FORWARD, dev->keybit); in elantech_set_input_params()
1194 __set_bit(BTN_BACK, dev->keybit); in elantech_set_input_params()
1201 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1202 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); in elantech_set_input_params()
1205 if (info->hw_version == 3) in elantech_set_input_params()
1209 if (info->reports_pressure) { in elantech_set_input_params()
1222 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1242 * convert to surface unit as Protocol-B requires. in elantech_set_input_params()
1249 input_abs_set_res(dev, ABS_X, info->x_res); in elantech_set_input_params()
1250 input_abs_set_res(dev, ABS_Y, info->y_res); in elantech_set_input_params()
1251 if (info->hw_version > 1) { in elantech_set_input_params()
1252 input_abs_set_res(dev, ABS_MT_POSITION_X, info->x_res); in elantech_set_input_params()
1253 input_abs_set_res(dev, ABS_MT_POSITION_Y, info->y_res); in elantech_set_input_params()
1256 etd->y_max = y_max; in elantech_set_input_params()
1257 etd->width = width; in elantech_set_input_params()
1273 struct elantech_data *etd = psmouse->private; in elantech_show_int_attr()
1275 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_show_int_attr()
1278 if (attr->reg) in elantech_show_int_attr()
1279 rc = elantech_read_reg(psmouse, attr->reg, reg); in elantech_show_int_attr()
1281 return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); in elantech_show_int_attr()
1290 struct elantech_data *etd = psmouse->private; in elantech_set_int_attr()
1292 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_set_int_attr()
1301 if (etd->info.hw_version == 1) { in elantech_set_int_attr()
1302 if (attr->reg == 0x10) in elantech_set_int_attr()
1305 else if (attr->reg == 0x11) in elantech_set_int_attr()
1310 if (!attr->reg || elantech_write_reg(psmouse, attr->reg, value) == 0) in elantech_set_int_attr()
1403 struct ps2dev *ps2dev = &psmouse->ps2dev; in elantech_detect()
1414 return -1; in elantech_detect()
1426 return -1; in elantech_detect()
1431 * value to avoid mis-detection. Logitech mice are known to respond in elantech_detect()
1436 return -1; in elantech_detect()
1446 return -1; in elantech_detect()
1450 psmouse->vendor = "Elantech"; in elantech_detect()
1451 psmouse->name = "Touchpad"; in elantech_detect()
1462 struct elantech_data *etd = psmouse->private; in elantech_disconnect()
1470 if (etd->tp_dev) in elantech_disconnect()
1471 input_unregister_device(etd->tp_dev); in elantech_disconnect()
1472 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_disconnect()
1474 kfree(psmouse->private); in elantech_disconnect()
1475 psmouse->private = NULL; in elantech_disconnect()
1486 return -1; in elantech_reconnect()
1491 return -1; in elantech_reconnect()
1506 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
1513 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"),
1595 * stack out-of-bound accesses. in elantech_change_report_id()
1603 return -EIO; in elantech_change_report_id()
1614 info->ic_version = (info->fw_version & 0x0f0000) >> 16; in elantech_set_properties()
1617 if (info->fw_version < 0x020030 || info->fw_version == 0x020600) in elantech_set_properties()
1618 info->hw_version = 1; in elantech_set_properties()
1620 switch (info->ic_version) { in elantech_set_properties()
1623 info->hw_version = 2; in elantech_set_properties()
1626 info->hw_version = 3; in elantech_set_properties()
1629 info->hw_version = 4; in elantech_set_properties()
1632 return -1; in elantech_set_properties()
1637 info->pattern = 0x00; in elantech_set_properties()
1638 if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02) in elantech_set_properties()
1639 info->pattern = info->fw_version & 0xff; in elantech_set_properties()
1642 info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : in elantech_set_properties()
1646 info->paritycheck = 1; in elantech_set_properties()
1653 info->jumpy_cursor = in elantech_set_properties()
1654 (info->fw_version == 0x020022 || info->fw_version == 0x020600); in elantech_set_properties()
1656 if (info->hw_version > 1) { in elantech_set_properties()
1658 info->debug = 1; in elantech_set_properties()
1660 if (info->fw_version >= 0x020800) in elantech_set_properties()
1661 info->reports_pressure = true; in elantech_set_properties()
1668 info->crc_enabled = (info->fw_version & 0x4000) == 0x4000 || in elantech_set_properties()
1672 info->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); in elantech_set_properties()
1691 return -EINVAL; in elantech_query_info()
1693 info->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; in elantech_query_info()
1697 return -EINVAL; in elantech_query_info()
1701 info->hw_version, param[0], param[1], param[2]); in elantech_query_info()
1703 if (info->send_cmd(psmouse, ETP_CAPABILITIES_QUERY, in elantech_query_info()
1704 info->capabilities)) { in elantech_query_info()
1706 return -EINVAL; in elantech_query_info()
1710 info->capabilities[0], info->capabilities[1], in elantech_query_info()
1711 info->capabilities[2]); in elantech_query_info()
1713 if (info->hw_version != 1) { in elantech_query_info()
1714 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, info->samples)) { in elantech_query_info()
1716 return -EINVAL; in elantech_query_info()
1720 info->samples[0], in elantech_query_info()
1721 info->samples[1], in elantech_query_info()
1722 info->samples[2]); in elantech_query_info()
1725 if (info->pattern > 0x00 && info->ic_version == 0xf) { in elantech_query_info()
1726 if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) { in elantech_query_info()
1728 return -EINVAL; in elantech_query_info()
1730 info->ic_version = be16_to_cpup((__be16 *)ic_body); in elantech_query_info()
1733 info->ic_version, ic_body[2]); in elantech_query_info()
1736 info->product_id = be16_to_cpup((__be16 *)info->samples); in elantech_query_info()
1737 if (info->pattern == 0x00) in elantech_query_info()
1738 info->product_id &= 0xff; in elantech_query_info()
1740 if (info->samples[1] == 0x74 && info->hw_version == 0x03) { in elantech_query_info()
1748 return -ENODEV; in elantech_query_info()
1752 info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; in elantech_query_info()
1754 if (info->has_trackpoint && info->ic_version == 0x0011 && in elantech_query_info()
1755 (info->product_id == 0x08 || info->product_id == 0x09 || in elantech_query_info()
1756 info->product_id == 0x0d || info->product_id == 0x0e)) { in elantech_query_info()
1767 return -ENODEV; in elantech_query_info()
1771 info->x_res = 31; in elantech_query_info()
1772 info->y_res = 31; in elantech_query_info()
1773 if (info->hw_version == 4) { in elantech_query_info()
1775 &info->x_res, in elantech_query_info()
1776 &info->y_res, in elantech_query_info()
1777 &info->bus)) { in elantech_query_info()
1784 switch (info->hw_version) { in elantech_query_info()
1786 info->x_min = ETP_XMIN_V1; in elantech_query_info()
1787 info->y_min = ETP_YMIN_V1; in elantech_query_info()
1788 info->x_max = ETP_XMAX_V1; in elantech_query_info()
1789 info->y_max = ETP_YMAX_V1; in elantech_query_info()
1793 if (info->fw_version == 0x020800 || in elantech_query_info()
1794 info->fw_version == 0x020b00 || in elantech_query_info()
1795 info->fw_version == 0x020030) { in elantech_query_info()
1796 info->x_min = ETP_XMIN_V2; in elantech_query_info()
1797 info->y_min = ETP_YMIN_V2; in elantech_query_info()
1798 info->x_max = ETP_XMAX_V2; in elantech_query_info()
1799 info->y_max = ETP_YMAX_V2; in elantech_query_info()
1804 i = (info->fw_version > 0x020800 && in elantech_query_info()
1805 info->fw_version < 0x020900) ? 1 : 2; in elantech_query_info()
1807 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1808 return -EINVAL; in elantech_query_info()
1812 if (((info->fw_version >> 16) == 0x14) && fixed_dpi) { in elantech_query_info()
1813 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) in elantech_query_info()
1814 return -EINVAL; in elantech_query_info()
1816 info->x_max = (info->capabilities[1] - i) * param[1] / 2; in elantech_query_info()
1817 info->y_max = (info->capabilities[2] - i) * param[2] / 2; in elantech_query_info()
1818 } else if (info->fw_version == 0x040216) { in elantech_query_info()
1819 info->x_max = 819; in elantech_query_info()
1820 info->y_max = 405; in elantech_query_info()
1821 } else if (info->fw_version == 0x040219 || info->fw_version == 0x040215) { in elantech_query_info()
1822 info->x_max = 900; in elantech_query_info()
1823 info->y_max = 500; in elantech_query_info()
1825 info->x_max = (info->capabilities[1] - i) * 64; in elantech_query_info()
1826 info->y_max = (info->capabilities[2] - i) * 64; in elantech_query_info()
1832 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1833 return -EINVAL; in elantech_query_info()
1835 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1836 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1840 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1841 return -EINVAL; in elantech_query_info()
1843 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1844 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1845 traces = info->capabilities[1]; in elantech_query_info()
1846 if ((traces < 2) || (traces > info->x_max)) in elantech_query_info()
1847 return -EINVAL; in elantech_query_info()
1849 info->width = info->x_max / (traces - 1); in elantech_query_info()
1852 info->x_traces = traces; in elantech_query_info()
1855 traces = info->capabilities[2]; in elantech_query_info()
1856 if ((traces >= 2) && (traces <= info->y_max)) in elantech_query_info()
1857 info->y_traces = traces; in elantech_query_info()
1863 info->has_middle_button = dmi_check_system(elantech_dmi_has_middle_button) || in elantech_query_info()
1864 (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) && in elantech_query_info()
1878 ELANTECH_SMBUS_NOT_SET = -1,
1907 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x", in elantech_create_smbus()
1908 info->x_max + 1); in elantech_create_smbus()
1909 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y", in elantech_create_smbus()
1910 info->y_max + 1); in elantech_create_smbus()
1911 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-x", in elantech_create_smbus()
1912 info->x_min); in elantech_create_smbus()
1913 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y", in elantech_create_smbus()
1914 info->y_min); in elantech_create_smbus()
1915 if (info->x_res) in elantech_create_smbus()
1916 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm", in elantech_create_smbus()
1917 (info->x_max + 1) / info->x_res); in elantech_create_smbus()
1918 if (info->y_res) in elantech_create_smbus()
1919 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-y-mm", in elantech_create_smbus()
1920 (info->y_max + 1) / info->y_res); in elantech_create_smbus()
1922 if (info->has_trackpoint) in elantech_create_smbus()
1925 if (info->has_middle_button) in elantech_create_smbus()
1926 i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,middle-button"); in elantech_create_smbus()
1928 if (info->x_traces) in elantech_create_smbus()
1930 info->x_traces); in elantech_create_smbus()
1931 if (info->y_traces) in elantech_create_smbus()
1933 info->y_traces); in elantech_create_smbus()
1947 * elantech_setup_smbus - called once the PS/2 devices are enumerated
1957 return -ENXIO; in elantech_setup_smbus()
1965 if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || in elantech_setup_smbus()
1967 return -ENXIO; in elantech_setup_smbus()
1974 if (error == -EAGAIN) in elantech_setup_smbus()
1988 if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) in elantech_use_host_notify()
1991 switch (info->bus) { in elantech_use_host_notify()
1997 psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); in elantech_use_host_notify()
2005 info->bus); in elantech_use_host_notify()
2023 error = -ENXIO; in elantech_init_smbus()
2042 int error = -EINVAL; in elantech_setup_ps2()
2045 psmouse->private = etd = kzalloc(sizeof(*etd), GFP_KERNEL); in elantech_setup_ps2()
2047 return -ENOMEM; in elantech_setup_ps2()
2049 etd->info = *info; in elantech_setup_ps2()
2051 etd->parity[0] = 1; in elantech_setup_ps2()
2053 etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; in elantech_setup_ps2()
2061 if (info->fw_version == 0x381f17) { in elantech_setup_ps2()
2062 etd->original_set_rate = psmouse->set_rate; in elantech_setup_ps2()
2063 psmouse->set_rate = elantech_set_rate_restore_reg_07; in elantech_setup_ps2()
2071 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()
2080 if (info->has_trackpoint) { in elantech_setup_ps2()
2084 error = -ENOMEM; in elantech_setup_ps2()
2088 etd->tp_dev = tp_dev; in elantech_setup_ps2()
2089 snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", in elantech_setup_ps2()
2090 psmouse->ps2dev.serio->phys); in elantech_setup_ps2()
2091 tp_dev->phys = etd->tp_phys; in elantech_setup_ps2()
2092 tp_dev->name = "ETPS/2 Elantech TrackPoint"; in elantech_setup_ps2()
2093 tp_dev->id.bustype = BUS_I8042; in elantech_setup_ps2()
2094 tp_dev->id.vendor = 0x0002; in elantech_setup_ps2()
2095 tp_dev->id.product = PSMOUSE_ELANTECH; in elantech_setup_ps2()
2096 tp_dev->id.version = 0x0000; in elantech_setup_ps2()
2097 tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; in elantech_setup_ps2()
2098 tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in elantech_setup_ps2()
2099 tp_dev->relbit[BIT_WORD(REL_X)] = in elantech_setup_ps2()
2101 tp_dev->keybit[BIT_WORD(BTN_LEFT)] = in elantech_setup_ps2()
2105 __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); in elantech_setup_ps2()
2106 __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); in elantech_setup_ps2()
2108 error = input_register_device(etd->tp_dev); in elantech_setup_ps2()
2113 psmouse->protocol_handler = elantech_process_byte; in elantech_setup_ps2()
2114 psmouse->disconnect = elantech_disconnect; in elantech_setup_ps2()
2115 psmouse->reconnect = elantech_reconnect; in elantech_setup_ps2()
2116 psmouse->pktsize = info->hw_version > 1 ? 6 : 4; in elantech_setup_ps2()
2122 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()