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()
520 x = packet[4] - (int)((packet[1]^0x80) << 1); in elantech_report_trackpoint()
521 y = (int)((packet[2]^0x80) << 1) - packet[5]; in elantech_report_trackpoint()
534 if (etd->info.debug == 1) in elantech_report_trackpoint()
548 struct input_dev *dev = psmouse->dev; in elantech_report_absolute_v3()
549 struct elantech_data *etd = psmouse->private; in elantech_report_absolute_v3()
550 unsigned char *packet = psmouse->packet; in elantech_report_absolute_v3()
569 y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
578 etd->mt[0].x = ((packet[1] & 0x0f) << 8) | packet[2]; in elantech_report_absolute_v3()
583 etd->mt[0].y = etd->y_max - in elantech_report_absolute_v3()
592 x1 = etd->mt[0].x; in elantech_report_absolute_v3()
593 y1 = etd->mt[0].y; in elantech_report_absolute_v3()
595 y2 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in elantech_report_absolute_v3()
613 if (elantech_is_buttonpad(&etd->info)) in elantech_report_absolute_v3()
626 struct input_dev *dev = psmouse->dev; in elantech_input_sync_v4()
627 struct elantech_data *etd = psmouse->private; in elantech_input_sync_v4()
628 unsigned char *packet = psmouse->packet; in elantech_input_sync_v4()
631 if (elantech_is_buttonpad(&etd->info)) in elantech_input_sync_v4()
642 struct input_dev *dev = psmouse->dev; in process_packet_status_v4()
643 unsigned char *packet = psmouse->packet; in process_packet_status_v4()
661 struct input_dev *dev = psmouse->dev; in process_packet_head_v4()
662 struct elantech_data *etd = psmouse->private; in process_packet_head_v4()
663 unsigned char *packet = psmouse->packet; in process_packet_head_v4()
664 int id = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_head_v4()
670 etd->mt[id].x = ((packet[1] & 0x0f) << 8) | packet[2]; in process_packet_head_v4()
671 etd->mt[id].y = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]); in process_packet_head_v4()
678 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_head_v4()
679 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_head_v4()
681 input_report_abs(dev, ABS_MT_TOUCH_MAJOR, traces * etd->width); in process_packet_head_v4()
690 struct input_dev *dev = psmouse->dev; in process_packet_motion_v4()
691 struct elantech_data *etd = psmouse->private; in process_packet_motion_v4()
692 unsigned char *packet = psmouse->packet; in process_packet_motion_v4()
696 id = ((packet[0] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
700 sid = ((packet[3] & 0xe0) >> 5) - 1; in process_packet_motion_v4()
712 etd->mt[id].x += delta_x1 * weight; in process_packet_motion_v4()
713 etd->mt[id].y -= delta_y1 * weight; in process_packet_motion_v4()
715 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x); in process_packet_motion_v4()
716 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y); in process_packet_motion_v4()
719 etd->mt[sid].x += delta_x2 * weight; in process_packet_motion_v4()
720 etd->mt[sid].y -= delta_y2 * weight; in process_packet_motion_v4()
722 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[sid].x); in process_packet_motion_v4()
723 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[sid].y); in process_packet_motion_v4()
754 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v1()
755 unsigned char *packet = psmouse->packet; in elantech_packet_check_v1()
759 if (etd->info.fw_version < 0x020000) { in elantech_packet_check_v1()
771 return etd->parity[packet[1]] == p1 && in elantech_packet_check_v1()
772 etd->parity[packet[2]] == p2 && in elantech_packet_check_v1()
773 etd->parity[packet[3]] == p3; in elantech_packet_check_v1()
785 unsigned char *packet = psmouse->packet; in elantech_debounce_check_v2()
792 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v2()
793 unsigned char *packet = psmouse->packet; in elantech_packet_check_v2()
804 if (etd->info.reports_pressure) in elantech_packet_check_v2()
824 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v3()
828 unsigned char *packet = psmouse->packet; in elantech_packet_check_v3()
841 if (etd->info.crc_enabled) { in elantech_packet_check_v3()
862 struct elantech_data *etd = psmouse->private; in elantech_packet_check_v4()
863 unsigned char *packet = psmouse->packet; in elantech_packet_check_v4()
868 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) in elantech_packet_check_v4()
872 ic_version = (etd->info.fw_version & 0x0f0000) >> 16; in elantech_packet_check_v4()
881 if (etd->info.crc_enabled) in elantech_packet_check_v4()
883 else if (ic_version == 7 && etd->info.samples[1] == 0x2A) in elantech_packet_check_v4()
911 struct elantech_data *etd = psmouse->private; in elantech_process_byte()
914 if (psmouse->pktcnt < psmouse->pktsize) in elantech_process_byte()
917 if (etd->info.debug > 1) in elantech_process_byte()
920 switch (etd->info.hw_version) { in elantech_process_byte()
922 if (etd->info.paritycheck && !elantech_packet_check_v1(psmouse)) in elantech_process_byte()
933 if (etd->info.paritycheck && !elantech_packet_check_v2(psmouse)) in elantech_process_byte()
989 struct elantech_data *etd = psmouse->private; in elantech_set_rate_restore_reg_07()
991 etd->original_set_rate(psmouse, rate); in elantech_set_rate_restore_reg_07()
992 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_rate_restore_reg_07()
1001 struct elantech_data *etd = psmouse->private; in elantech_set_absolute_mode()
1006 switch (etd->info.hw_version) { in elantech_set_absolute_mode()
1008 etd->reg_10 = 0x16; in elantech_set_absolute_mode()
1009 etd->reg_11 = 0x8f; in elantech_set_absolute_mode()
1010 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
1011 elantech_write_reg(psmouse, 0x11, etd->reg_11)) { in elantech_set_absolute_mode()
1012 rc = -1; in elantech_set_absolute_mode()
1018 etd->reg_10 = 0x54; in elantech_set_absolute_mode()
1019 etd->reg_11 = 0x88; /* 0x8a */ in elantech_set_absolute_mode()
1020 etd->reg_21 = 0x60; /* 0x00 */ in elantech_set_absolute_mode()
1021 if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || in elantech_set_absolute_mode()
1022 elantech_write_reg(psmouse, 0x11, etd->reg_11) || in elantech_set_absolute_mode()
1023 elantech_write_reg(psmouse, 0x21, etd->reg_21)) { in elantech_set_absolute_mode()
1024 rc = -1; in elantech_set_absolute_mode()
1029 if (etd->info.set_hw_resolution) in elantech_set_absolute_mode()
1030 etd->reg_10 = 0x0b; in elantech_set_absolute_mode()
1032 etd->reg_10 = 0x01; in elantech_set_absolute_mode()
1034 if (elantech_write_reg(psmouse, 0x10, etd->reg_10)) in elantech_set_absolute_mode()
1035 rc = -1; in elantech_set_absolute_mode()
1040 etd->reg_07 = 0x01; in elantech_set_absolute_mode()
1041 if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) in elantech_set_absolute_mode()
1042 rc = -1; in elantech_set_absolute_mode()
1058 tries--; in elantech_set_absolute_mode()
1066 } else if (etd->info.hw_version == 1 && in elantech_set_absolute_mode()
1070 rc = -1; in elantech_set_absolute_mode()
1098 return -1; in elantech_get_resolution_v4()
1109 struct input_dev *dev = psmouse->dev; in elantech_set_buttonpad_prop()
1110 struct elantech_data *etd = psmouse->private; in elantech_set_buttonpad_prop()
1112 if (elantech_is_buttonpad(&etd->info)) { in elantech_set_buttonpad_prop()
1113 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); in elantech_set_buttonpad_prop()
1114 __clear_bit(BTN_RIGHT, dev->keybit); in elantech_set_buttonpad_prop()
1127 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
1134 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"),
1141 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H780"),
1153 struct input_dev *dev = psmouse->dev; in elantech_set_input_params()
1154 struct elantech_data *etd = psmouse->private; in elantech_set_input_params()
1155 struct elantech_device_info *info = &etd->info; in elantech_set_input_params()
1156 unsigned int x_min = info->x_min, y_min = info->y_min, in elantech_set_input_params()
1157 x_max = info->x_max, y_max = info->y_max, in elantech_set_input_params()
1158 width = info->width; in elantech_set_input_params()
1160 __set_bit(INPUT_PROP_POINTER, dev->propbit); in elantech_set_input_params()
1161 __set_bit(EV_KEY, dev->evbit); in elantech_set_input_params()
1162 __set_bit(EV_ABS, dev->evbit); in elantech_set_input_params()
1163 __clear_bit(EV_REL, dev->evbit); in elantech_set_input_params()
1165 __set_bit(BTN_LEFT, dev->keybit); in elantech_set_input_params()
1166 if (info->has_middle_button) in elantech_set_input_params()
1167 __set_bit(BTN_MIDDLE, dev->keybit); in elantech_set_input_params()
1168 __set_bit(BTN_RIGHT, dev->keybit); in elantech_set_input_params()
1170 __set_bit(BTN_TOUCH, dev->keybit); in elantech_set_input_params()
1171 __set_bit(BTN_TOOL_FINGER, dev->keybit); in elantech_set_input_params()
1172 __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); in elantech_set_input_params()
1173 __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); in elantech_set_input_params()
1175 switch (info->hw_version) { in elantech_set_input_params()
1178 if (info->fw_version < 0x020000 && in elantech_set_input_params()
1179 (info->capabilities[0] & ETP_CAP_HAS_ROCKER)) { in elantech_set_input_params()
1180 __set_bit(BTN_FORWARD, dev->keybit); in elantech_set_input_params()
1181 __set_bit(BTN_BACK, dev->keybit); in elantech_set_input_params()
1188 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1189 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); in elantech_set_input_params()
1192 if (info->hw_version == 3) in elantech_set_input_params()
1196 if (info->reports_pressure) { in elantech_set_input_params()
1209 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in elantech_set_input_params()
1229 * convert to surface unit as Protocol-B requires. in elantech_set_input_params()
1236 input_abs_set_res(dev, ABS_X, info->x_res); in elantech_set_input_params()
1237 input_abs_set_res(dev, ABS_Y, info->y_res); in elantech_set_input_params()
1238 if (info->hw_version > 1) { in elantech_set_input_params()
1239 input_abs_set_res(dev, ABS_MT_POSITION_X, info->x_res); in elantech_set_input_params()
1240 input_abs_set_res(dev, ABS_MT_POSITION_Y, info->y_res); in elantech_set_input_params()
1243 etd->y_max = y_max; in elantech_set_input_params()
1244 etd->width = width; in elantech_set_input_params()
1260 struct elantech_data *etd = psmouse->private; in elantech_show_int_attr()
1262 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_show_int_attr()
1265 if (attr->reg) in elantech_show_int_attr()
1266 rc = elantech_read_reg(psmouse, attr->reg, reg); in elantech_show_int_attr()
1268 return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); in elantech_show_int_attr()
1277 struct elantech_data *etd = psmouse->private; in elantech_set_int_attr()
1279 unsigned char *reg = (unsigned char *) etd + attr->field_offset; in elantech_set_int_attr()
1288 if (etd->info.hw_version == 1) { in elantech_set_int_attr()
1289 if (attr->reg == 0x10) in elantech_set_int_attr()
1292 else if (attr->reg == 0x11) in elantech_set_int_attr()
1297 if (!attr->reg || elantech_write_reg(psmouse, attr->reg, value) == 0) in elantech_set_int_attr()
1390 struct ps2dev *ps2dev = &psmouse->ps2dev; in elantech_detect()
1401 return -1; in elantech_detect()
1413 return -1; in elantech_detect()
1418 * value to avoid mis-detection. Logitech mice are known to respond in elantech_detect()
1423 return -1; in elantech_detect()
1433 return -1; in elantech_detect()
1437 psmouse->vendor = "Elantech"; in elantech_detect()
1438 psmouse->name = "Touchpad"; in elantech_detect()
1449 struct elantech_data *etd = psmouse->private; in elantech_disconnect()
1457 if (etd->tp_dev) in elantech_disconnect()
1458 input_unregister_device(etd->tp_dev); in elantech_disconnect()
1459 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_disconnect()
1461 kfree(psmouse->private); in elantech_disconnect()
1462 psmouse->private = NULL; in elantech_disconnect()
1473 return -1; in elantech_reconnect()
1478 return -1; in elantech_reconnect()
1493 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
1500 DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"),
1584 return -EIO; in elantech_change_report_id()
1595 info->ic_version = (info->fw_version & 0x0f0000) >> 16; in elantech_set_properties()
1598 if (info->fw_version < 0x020030 || info->fw_version == 0x020600) in elantech_set_properties()
1599 info->hw_version = 1; in elantech_set_properties()
1601 switch (info->ic_version) { in elantech_set_properties()
1604 info->hw_version = 2; in elantech_set_properties()
1607 info->hw_version = 3; in elantech_set_properties()
1610 info->hw_version = 4; in elantech_set_properties()
1613 return -1; in elantech_set_properties()
1618 info->pattern = 0x00; in elantech_set_properties()
1619 if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02) in elantech_set_properties()
1620 info->pattern = info->fw_version & 0xff; in elantech_set_properties()
1623 info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : in elantech_set_properties()
1627 info->paritycheck = 1; in elantech_set_properties()
1634 info->jumpy_cursor = in elantech_set_properties()
1635 (info->fw_version == 0x020022 || info->fw_version == 0x020600); in elantech_set_properties()
1637 if (info->hw_version > 1) { in elantech_set_properties()
1639 info->debug = 1; in elantech_set_properties()
1641 if (info->fw_version >= 0x020800) in elantech_set_properties()
1642 info->reports_pressure = true; in elantech_set_properties()
1649 info->crc_enabled = (info->fw_version & 0x4000) == 0x4000 || in elantech_set_properties()
1653 info->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); in elantech_set_properties()
1672 return -EINVAL; in elantech_query_info()
1674 info->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; in elantech_query_info()
1678 return -EINVAL; in elantech_query_info()
1682 info->hw_version, param[0], param[1], param[2]); in elantech_query_info()
1684 if (info->send_cmd(psmouse, ETP_CAPABILITIES_QUERY, in elantech_query_info()
1685 info->capabilities)) { in elantech_query_info()
1687 return -EINVAL; in elantech_query_info()
1691 info->capabilities[0], info->capabilities[1], in elantech_query_info()
1692 info->capabilities[2]); in elantech_query_info()
1694 if (info->hw_version != 1) { in elantech_query_info()
1695 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, info->samples)) { in elantech_query_info()
1697 return -EINVAL; in elantech_query_info()
1701 info->samples[0], in elantech_query_info()
1702 info->samples[1], in elantech_query_info()
1703 info->samples[2]); in elantech_query_info()
1706 if (info->pattern > 0x00 && info->ic_version == 0xf) { in elantech_query_info()
1707 if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) { in elantech_query_info()
1709 return -EINVAL; in elantech_query_info()
1711 info->ic_version = be16_to_cpup((__be16 *)ic_body); in elantech_query_info()
1714 info->ic_version, ic_body[2]); in elantech_query_info()
1717 info->product_id = be16_to_cpup((__be16 *)info->samples); in elantech_query_info()
1718 if (info->pattern == 0x00) in elantech_query_info()
1719 info->product_id &= 0xff; in elantech_query_info()
1721 if (info->samples[1] == 0x74 && info->hw_version == 0x03) { in elantech_query_info()
1729 return -ENODEV; in elantech_query_info()
1733 info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; in elantech_query_info()
1735 if (info->has_trackpoint && info->ic_version == 0x0011 && in elantech_query_info()
1736 (info->product_id == 0x08 || info->product_id == 0x09 || in elantech_query_info()
1737 info->product_id == 0x0d || info->product_id == 0x0e)) { in elantech_query_info()
1748 return -ENODEV; in elantech_query_info()
1752 info->x_res = 31; in elantech_query_info()
1753 info->y_res = 31; in elantech_query_info()
1754 if (info->hw_version == 4) { in elantech_query_info()
1756 &info->x_res, in elantech_query_info()
1757 &info->y_res, in elantech_query_info()
1758 &info->bus)) { in elantech_query_info()
1765 switch (info->hw_version) { in elantech_query_info()
1767 info->x_min = ETP_XMIN_V1; in elantech_query_info()
1768 info->y_min = ETP_YMIN_V1; in elantech_query_info()
1769 info->x_max = ETP_XMAX_V1; in elantech_query_info()
1770 info->y_max = ETP_YMAX_V1; in elantech_query_info()
1774 if (info->fw_version == 0x020800 || in elantech_query_info()
1775 info->fw_version == 0x020b00 || in elantech_query_info()
1776 info->fw_version == 0x020030) { in elantech_query_info()
1777 info->x_min = ETP_XMIN_V2; in elantech_query_info()
1778 info->y_min = ETP_YMIN_V2; in elantech_query_info()
1779 info->x_max = ETP_XMAX_V2; in elantech_query_info()
1780 info->y_max = ETP_YMAX_V2; in elantech_query_info()
1785 i = (info->fw_version > 0x020800 && in elantech_query_info()
1786 info->fw_version < 0x020900) ? 1 : 2; in elantech_query_info()
1788 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1789 return -EINVAL; in elantech_query_info()
1793 if (((info->fw_version >> 16) == 0x14) && fixed_dpi) { in elantech_query_info()
1794 if (info->send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) in elantech_query_info()
1795 return -EINVAL; in elantech_query_info()
1797 info->x_max = (info->capabilities[1] - i) * param[1] / 2; in elantech_query_info()
1798 info->y_max = (info->capabilities[2] - i) * param[2] / 2; in elantech_query_info()
1799 } else if (info->fw_version == 0x040216) { in elantech_query_info()
1800 info->x_max = 819; in elantech_query_info()
1801 info->y_max = 405; in elantech_query_info()
1802 } else if (info->fw_version == 0x040219 || info->fw_version == 0x040215) { in elantech_query_info()
1803 info->x_max = 900; in elantech_query_info()
1804 info->y_max = 500; in elantech_query_info()
1806 info->x_max = (info->capabilities[1] - i) * 64; in elantech_query_info()
1807 info->y_max = (info->capabilities[2] - i) * 64; in elantech_query_info()
1813 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1814 return -EINVAL; in elantech_query_info()
1816 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1817 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1821 if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) in elantech_query_info()
1822 return -EINVAL; in elantech_query_info()
1824 info->x_max = (0x0f & param[0]) << 8 | param[1]; in elantech_query_info()
1825 info->y_max = (0xf0 & param[0]) << 4 | param[2]; in elantech_query_info()
1826 traces = info->capabilities[1]; in elantech_query_info()
1827 if ((traces < 2) || (traces > info->x_max)) in elantech_query_info()
1828 return -EINVAL; in elantech_query_info()
1830 info->width = info->x_max / (traces - 1); in elantech_query_info()
1833 info->x_traces = traces; in elantech_query_info()
1836 traces = info->capabilities[2]; in elantech_query_info()
1837 if ((traces >= 2) && (traces <= info->y_max)) in elantech_query_info()
1838 info->y_traces = traces; in elantech_query_info()
1844 info->has_middle_button = dmi_check_system(elantech_dmi_has_middle_button) || in elantech_query_info()
1845 (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) && in elantech_query_info()
1859 ELANTECH_SMBUS_NOT_SET = -1,
1888 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x", in elantech_create_smbus()
1889 info->x_max + 1); in elantech_create_smbus()
1890 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y", in elantech_create_smbus()
1891 info->y_max + 1); in elantech_create_smbus()
1892 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-x", in elantech_create_smbus()
1893 info->x_min); in elantech_create_smbus()
1894 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y", in elantech_create_smbus()
1895 info->y_min); in elantech_create_smbus()
1896 if (info->x_res) in elantech_create_smbus()
1897 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm", in elantech_create_smbus()
1898 (info->x_max + 1) / info->x_res); in elantech_create_smbus()
1899 if (info->y_res) in elantech_create_smbus()
1900 i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-y-mm", in elantech_create_smbus()
1901 (info->y_max + 1) / info->y_res); in elantech_create_smbus()
1903 if (info->has_trackpoint) in elantech_create_smbus()
1906 if (info->has_middle_button) in elantech_create_smbus()
1907 i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,middle-button"); in elantech_create_smbus()
1909 if (info->x_traces) in elantech_create_smbus()
1911 info->x_traces); in elantech_create_smbus()
1912 if (info->y_traces) in elantech_create_smbus()
1914 info->y_traces); in elantech_create_smbus()
1928 * elantech_setup_smbus - called once the PS/2 devices are enumerated
1938 return -ENXIO; in elantech_setup_smbus()
1946 if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || in elantech_setup_smbus()
1948 return -ENXIO; in elantech_setup_smbus()
1955 if (error == -EAGAIN) in elantech_setup_smbus()
1969 if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) in elantech_use_host_notify()
1972 switch (info->bus) { in elantech_use_host_notify()
1978 psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); in elantech_use_host_notify()
1986 info->bus); in elantech_use_host_notify()
2004 error = -ENXIO; in elantech_init_smbus()
2023 int error = -EINVAL; in elantech_setup_ps2()
2026 psmouse->private = etd = kzalloc(sizeof(*etd), GFP_KERNEL); in elantech_setup_ps2()
2028 return -ENOMEM; in elantech_setup_ps2()
2030 etd->info = *info; in elantech_setup_ps2()
2032 etd->parity[0] = 1; in elantech_setup_ps2()
2034 etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; in elantech_setup_ps2()
2042 if (info->fw_version == 0x381f17) { in elantech_setup_ps2()
2043 etd->original_set_rate = psmouse->set_rate; in elantech_setup_ps2()
2044 psmouse->set_rate = elantech_set_rate_restore_reg_07; in elantech_setup_ps2()
2052 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()
2061 if (info->has_trackpoint) { in elantech_setup_ps2()
2065 error = -ENOMEM; in elantech_setup_ps2()
2069 etd->tp_dev = tp_dev; in elantech_setup_ps2()
2070 snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", in elantech_setup_ps2()
2071 psmouse->ps2dev.serio->phys); in elantech_setup_ps2()
2072 tp_dev->phys = etd->tp_phys; in elantech_setup_ps2()
2073 tp_dev->name = "ETPS/2 Elantech TrackPoint"; in elantech_setup_ps2()
2074 tp_dev->id.bustype = BUS_I8042; in elantech_setup_ps2()
2075 tp_dev->id.vendor = 0x0002; in elantech_setup_ps2()
2076 tp_dev->id.product = PSMOUSE_ELANTECH; in elantech_setup_ps2()
2077 tp_dev->id.version = 0x0000; in elantech_setup_ps2()
2078 tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; in elantech_setup_ps2()
2079 tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in elantech_setup_ps2()
2080 tp_dev->relbit[BIT_WORD(REL_X)] = in elantech_setup_ps2()
2082 tp_dev->keybit[BIT_WORD(BTN_LEFT)] = in elantech_setup_ps2()
2086 __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); in elantech_setup_ps2()
2087 __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); in elantech_setup_ps2()
2089 error = input_register_device(etd->tp_dev); in elantech_setup_ps2()
2094 psmouse->protocol_handler = elantech_process_byte; in elantech_setup_ps2()
2095 psmouse->disconnect = elantech_disconnect; in elantech_setup_ps2()
2096 psmouse->reconnect = elantech_reconnect; in elantech_setup_ps2()
2097 psmouse->pktsize = info->hw_version > 1 ? 6 : 4; in elantech_setup_ps2()
2103 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in elantech_setup_ps2()