Lines Matching +full:max +full:- +full:fingers
1 // SPDX-License-Identifier: GPL-2.0-only
6 * Added support for pass-through port. Special thanks to Peter Berg Larsen
13 * start merging tpconfig and gpm code to a xfree-input module
17 * Copyright (c) 1998-2000 Bruce Kalk <kall@compass.com>
18 * code for the special synaptics commands (from the tpconfig-source)
61 * value which are actually negative values truncated to the 13-bit
63 * than 8184 (i.e. -8), so we treat all values greater than 8176 as
84 error = ps2_sliced_command(&psmouse->ps2dev, mode); in synaptics_mode_cmd()
89 error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE); in synaptics_mode_cmd()
98 struct ps2dev *ps2dev = &psmouse->ps2dev; in synaptics_detect()
108 return -ENODEV; in synaptics_detect()
111 psmouse->vendor = "Synaptics"; in synaptics_detect()
112 psmouse->name = "TouchPad"; in synaptics_detect()
175 "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */
181 "LEN0097", /* X280 -> ALPS trackpoint */
194 "SYN3221", /* HP 15-ay000 */
195 "SYN323d", /* HP Spectre X360 13-w013dx */
196 "SYN3257", /* HP Envy 13-ad105ng */
213 error = ps2_sliced_command(&psmouse->ps2dev, cmd); in synaptics_send_cmd()
217 error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO); in synaptics_send_cmd()
249 error = synaptics_query_int(psmouse, SYN_QUE_IDENTIFY, &info->identity); in synaptics_identify()
253 return SYN_ID_IS_SYNAPTICS(info->identity) ? 0 : -ENXIO; in synaptics_identify()
257 * Read the model-id bytes from the touchpad
263 return synaptics_query_int(psmouse, SYN_QUE_MODEL, &info->model_id); in synaptics_model_id()
273 &info->firmware_id); in synaptics_firmware_id()
287 if (SYN_ID_FULL(info->identity) < 0x705) in synaptics_query_modes()
294 info->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; in synaptics_query_modes()
298 &info->ext_cap_10); in synaptics_query_modes()
304 * Read the capability-bits from the touchpad
313 &info->capabilities); in synaptics_capability()
317 info->ext_cap = info->ext_cap_0c = 0; in synaptics_capability()
322 if (SYN_ID_FULL(info->identity) < 0x705 && in synaptics_capability()
323 SYN_CAP_SUBMODEL_ID(info->capabilities) != 0x47) { in synaptics_capability()
324 return -ENXIO; in synaptics_capability()
330 if (!SYN_CAP_EXTENDED(info->capabilities)) in synaptics_capability()
331 info->capabilities = 0; in synaptics_capability()
333 if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 1) { in synaptics_capability()
335 &info->ext_cap); in synaptics_capability()
344 if (SYN_CAP_MULTI_BUTTON_NO(info->ext_cap) > 8) in synaptics_capability()
345 info->ext_cap &= ~SYN_CAP_MB_MASK; in synaptics_capability()
349 if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 4) { in synaptics_capability()
351 &info->ext_cap_0c); in synaptics_capability()
370 if (SYN_ID_MAJOR(info->identity) < 4) in synaptics_resolution()
376 info->x_res = resp[0]; /* x resolution in units/mm */ in synaptics_resolution()
377 info->y_res = resp[2]; /* y resolution in units/mm */ in synaptics_resolution()
381 if (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 5 && in synaptics_resolution()
382 SYN_CAP_MAX_DIMENSIONS(info->ext_cap_0c)) { in synaptics_resolution()
387 "device claims to have max coordinates query, but I'm not able to read it.\n"); in synaptics_resolution()
389 info->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); in synaptics_resolution()
390 info->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); in synaptics_resolution()
392 "queried max coordinates: x [..%d], y [..%d]\n", in synaptics_resolution()
393 info->x_max, info->y_max); in synaptics_resolution()
397 if (SYN_CAP_MIN_DIMENSIONS(info->ext_cap_0c) && in synaptics_resolution()
398 (SYN_EXT_CAP_REQUESTS(info->capabilities) >= 7 || in synaptics_resolution()
404 SYN_ID_FULL(info->identity) == 0x801)) { in synaptics_resolution()
411 info->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); in synaptics_resolution()
412 info->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); in synaptics_resolution()
415 info->x_min, info->y_min); in synaptics_resolution()
466 u32 min, max; member
523 return YMAX_NOMINAL + YMIN_NOMINAL - y; in synaptics_invert_y()
540 info->board_id < min_max_pnpid_table[i].board_id.min) in synaptics_apply_quirks()
543 if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID && in synaptics_apply_quirks()
544 info->board_id > min_max_pnpid_table[i].board_id.max) in synaptics_apply_quirks()
547 info->x_min = min_max_pnpid_table[i].x_min; in synaptics_apply_quirks()
548 info->x_max = min_max_pnpid_table[i].x_max; in synaptics_apply_quirks()
549 info->y_min = min_max_pnpid_table[i].y_min; in synaptics_apply_quirks()
550 info->y_max = min_max_pnpid_table[i].y_max; in synaptics_apply_quirks()
552 "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n", in synaptics_apply_quirks()
553 info->x_min, info->x_max, in synaptics_apply_quirks()
554 info->y_min, info->y_max); in synaptics_apply_quirks()
561 return (SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) || in synaptics_has_agm()
562 SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)); in synaptics_has_agm()
570 error = ps2_sliced_command(&psmouse->ps2dev, SYN_QUE_MODEL); in synaptics_set_advanced_gesture_mode()
574 error = ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE); in synaptics_set_advanced_gesture_mode()
583 struct synaptics_data *priv = psmouse->private; in synaptics_set_mode()
586 priv->mode = 0; in synaptics_set_mode()
587 if (priv->absolute_mode) in synaptics_set_mode()
588 priv->mode |= SYN_BIT_ABSOLUTE_MODE; in synaptics_set_mode()
589 if (priv->disable_gesture) in synaptics_set_mode()
590 priv->mode |= SYN_BIT_DISABLE_GESTURE; in synaptics_set_mode()
591 if (psmouse->rate >= 80) in synaptics_set_mode()
592 priv->mode |= SYN_BIT_HIGH_RATE; in synaptics_set_mode()
593 if (SYN_CAP_EXTENDED(priv->info.capabilities)) in synaptics_set_mode()
594 priv->mode |= SYN_BIT_W_MODE; in synaptics_set_mode()
596 error = synaptics_mode_cmd(psmouse, priv->mode); in synaptics_set_mode()
600 if (priv->absolute_mode && synaptics_has_agm(priv)) { in synaptics_set_mode()
615 struct synaptics_data *priv = psmouse->private; in synaptics_set_rate()
618 priv->mode |= SYN_BIT_HIGH_RATE; in synaptics_set_rate()
619 psmouse->rate = 80; in synaptics_set_rate()
621 priv->mode &= ~SYN_BIT_HIGH_RATE; in synaptics_set_rate()
622 psmouse->rate = 40; in synaptics_set_rate()
625 synaptics_mode_cmd(psmouse, priv->mode); in synaptics_set_rate()
629 * Synaptics pass-through PS/2 port support
633 struct psmouse *parent = psmouse_from_serio(serio->parent); in synaptics_pt_write()
634 u8 rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ in synaptics_pt_write()
637 error = ps2_sliced_command(&parent->ps2dev, c); in synaptics_pt_write()
641 error = ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE); in synaptics_pt_write()
650 struct psmouse *parent = psmouse_from_serio(serio->parent); in synaptics_pt_start()
651 struct synaptics_data *priv = parent->private; in synaptics_pt_start()
653 serio_pause_rx(parent->ps2dev.serio); in synaptics_pt_start()
654 priv->pt_port = serio; in synaptics_pt_start()
655 serio_continue_rx(parent->ps2dev.serio); in synaptics_pt_start()
662 struct psmouse *parent = psmouse_from_serio(serio->parent); in synaptics_pt_stop()
663 struct synaptics_data *priv = parent->private; in synaptics_pt_stop()
665 serio_pause_rx(parent->ps2dev.serio); in synaptics_pt_stop()
666 priv->pt_port = NULL; in synaptics_pt_stop()
667 serio_continue_rx(parent->ps2dev.serio); in synaptics_pt_stop()
679 if (child && child->state == PSMOUSE_ACTIVATED) { in synaptics_pass_pt_packet()
683 if (child->pktsize == 4) in synaptics_pass_pt_packet()
692 struct synaptics_data *priv = psmouse->private; in synaptics_pt_activate()
693 struct psmouse *child = psmouse_from_serio(priv->pt_port); in synaptics_pt_activate()
697 if (child->pktsize == 4) in synaptics_pt_activate()
698 priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; in synaptics_pt_activate()
700 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; in synaptics_pt_activate()
702 if (synaptics_mode_cmd(psmouse, priv->mode)) in synaptics_pt_activate()
715 "not enough memory for pass-through port\n"); in synaptics_pt_create()
719 serio->id.type = SERIO_PS_PSTHRU; in synaptics_pt_create()
720 strscpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); in synaptics_pt_create()
721 strscpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->phys)); in synaptics_pt_create()
722 serio->write = synaptics_pt_write; in synaptics_pt_create()
723 serio->start = synaptics_pt_start; in synaptics_pt_create()
724 serio->stop = synaptics_pt_stop; in synaptics_pt_create()
725 serio->parent = psmouse->ps2dev.serio; in synaptics_pt_create()
727 psmouse->pt_activate = synaptics_pt_activate; in synaptics_pt_create()
730 serio->name, psmouse->phys); in synaptics_pt_create()
742 struct synaptics_hw_state *agm = &priv->agm; in synaptics_parse_agm()
749 agm->w = hw->w; in synaptics_parse_agm()
750 agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1; in synaptics_parse_agm()
751 agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1; in synaptics_parse_agm()
752 agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1; in synaptics_parse_agm()
756 /* AGM-CONTACT packet: we are only interested in the count */ in synaptics_parse_agm()
757 priv->agm_count = buf[1]; in synaptics_parse_agm()
770 (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) + 1) >> 1; in synaptics_parse_ext_buttons()
771 unsigned int ext_mask = GENMASK(ext_bits - 1, 0); in synaptics_parse_ext_buttons()
773 hw->ext_buttons = buf[4] & ext_mask; in synaptics_parse_ext_buttons()
774 hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits; in synaptics_parse_ext_buttons()
783 if (SYN_MODEL_NEWABS(priv->info.model_id)) { in synaptics_parse_hw_state()
784 hw->w = (((buf[0] & 0x30) >> 2) | in synaptics_parse_hw_state()
788 if (synaptics_has_agm(priv) && hw->w == 2) { in synaptics_parse_hw_state()
793 hw->x = (((buf[3] & 0x10) << 8) | in synaptics_parse_hw_state()
796 hw->y = (((buf[3] & 0x20) << 7) | in synaptics_parse_hw_state()
799 hw->z = buf[2]; in synaptics_parse_hw_state()
801 hw->left = (buf[0] & 0x01) ? 1 : 0; in synaptics_parse_hw_state()
802 hw->right = (buf[0] & 0x02) ? 1 : 0; in synaptics_parse_hw_state()
804 if (priv->is_forcepad) { in synaptics_parse_hw_state()
812 * out multi-finger gestures. in synaptics_parse_hw_state()
814 if (hw->z == 0) { in synaptics_parse_hw_state()
816 priv->press = priv->report_press = false; in synaptics_parse_hw_state()
817 } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { in synaptics_parse_hw_state()
819 * Single-finger touch with pressure above in synaptics_parse_hw_state()
826 if (!priv->press) { in synaptics_parse_hw_state()
827 priv->press_start = jiffies; in synaptics_parse_hw_state()
828 priv->press = true; in synaptics_parse_hw_state()
830 priv->press_start + in synaptics_parse_hw_state()
832 priv->report_press = true; in synaptics_parse_hw_state()
835 priv->press = false; in synaptics_parse_hw_state()
838 hw->left = priv->report_press; in synaptics_parse_hw_state()
840 } else if (SYN_CAP_CLICKPAD(priv->info.ext_cap_0c)) { in synaptics_parse_hw_state()
846 hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; in synaptics_parse_hw_state()
848 } else if (SYN_CAP_MIDDLE_BUTTON(priv->info.capabilities)) { in synaptics_parse_hw_state()
849 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; in synaptics_parse_hw_state()
850 if (hw->w == 2) in synaptics_parse_hw_state()
851 hw->scroll = (s8)buf[1]; in synaptics_parse_hw_state()
854 if (SYN_CAP_FOUR_BUTTON(priv->info.capabilities)) { in synaptics_parse_hw_state()
855 hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; in synaptics_parse_hw_state()
856 hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; in synaptics_parse_hw_state()
859 if (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) > 0 && in synaptics_parse_hw_state()
864 hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); in synaptics_parse_hw_state()
865 hw->y = (((buf[4] & 0x1f) << 8) | buf[5]); in synaptics_parse_hw_state()
867 hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F)); in synaptics_parse_hw_state()
868 hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1)); in synaptics_parse_hw_state()
870 hw->left = (buf[0] & 0x01) ? 1 : 0; in synaptics_parse_hw_state()
871 hw->right = (buf[0] & 0x02) ? 1 : 0; in synaptics_parse_hw_state()
875 * Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE in synaptics_parse_hw_state()
880 if (hw->x > X_MAX_POSITIVE) in synaptics_parse_hw_state()
881 hw->x -= 1 << ABS_POS_BITS; in synaptics_parse_hw_state()
882 else if (hw->x == X_MAX_POSITIVE) in synaptics_parse_hw_state()
883 hw->x = XMAX; in synaptics_parse_hw_state()
885 if (hw->y > Y_MAX_POSITIVE) in synaptics_parse_hw_state()
886 hw->y -= 1 << ABS_POS_BITS; in synaptics_parse_hw_state()
887 else if (hw->y == Y_MAX_POSITIVE) in synaptics_parse_hw_state()
888 hw->y = YMAX; in synaptics_parse_hw_state()
910 synaptics_report_semi_mt_slot(dev, 0, true, min(a->x, b->x), in synaptics_report_semi_mt_data()
911 min(a->y, b->y)); in synaptics_report_semi_mt_data()
912 synaptics_report_semi_mt_slot(dev, 1, true, max(a->x, b->x), in synaptics_report_semi_mt_data()
913 max(a->y, b->y)); in synaptics_report_semi_mt_data()
915 synaptics_report_semi_mt_slot(dev, 0, true, a->x, a->y); in synaptics_report_semi_mt_data()
926 struct input_dev *dev = psmouse->dev; in synaptics_report_ext_buttons()
927 struct synaptics_data *priv = psmouse->private; in synaptics_report_ext_buttons()
928 int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap) + 1) >> 1; in synaptics_report_ext_buttons()
931 if (!SYN_CAP_MULTI_BUTTON_NO(priv->info.ext_cap)) in synaptics_report_ext_buttons()
935 if ((SYN_ID_FULL(priv->info.identity) == 0x801 || in synaptics_report_ext_buttons()
936 SYN_ID_FULL(priv->info.identity) == 0x802) && in synaptics_report_ext_buttons()
937 !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02)) in synaptics_report_ext_buttons()
940 if (!SYN_CAP_EXT_BUTTONS_STICK(priv->info.ext_cap_10)) { in synaptics_report_ext_buttons()
943 hw->ext_buttons & BIT(i)); in synaptics_report_ext_buttons()
945 hw->ext_buttons & BIT(i + ext_bits)); in synaptics_report_ext_buttons()
952 * physically wired to the touchpad. Re-route them through in synaptics_report_ext_buttons()
953 * the pass-through interface. in synaptics_report_ext_buttons()
955 if (priv->pt_port) { in synaptics_report_ext_buttons()
959 pt_buttons = SYN_EXT_BUTTON_STICK_L(hw->ext_buttons) | in synaptics_report_ext_buttons()
960 SYN_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | in synaptics_report_ext_buttons()
961 SYN_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; in synaptics_report_ext_buttons()
963 serio_interrupt(priv->pt_port, in synaptics_report_ext_buttons()
965 serio_interrupt(priv->pt_port, pt_buttons, SERIO_OOB_DATA); in synaptics_report_ext_buttons()
972 struct input_dev *dev = psmouse->dev; in synaptics_report_buttons()
973 struct synaptics_data *priv = psmouse->private; in synaptics_report_buttons()
975 input_report_key(dev, BTN_LEFT, hw->left); in synaptics_report_buttons()
976 input_report_key(dev, BTN_RIGHT, hw->right); in synaptics_report_buttons()
978 if (SYN_CAP_MIDDLE_BUTTON(priv->info.capabilities)) in synaptics_report_buttons()
979 input_report_key(dev, BTN_MIDDLE, hw->middle); in synaptics_report_buttons()
981 if (SYN_CAP_FOUR_BUTTON(priv->info.capabilities)) { in synaptics_report_buttons()
982 input_report_key(dev, BTN_FORWARD, hw->up); in synaptics_report_buttons()
983 input_report_key(dev, BTN_BACK, hw->down); in synaptics_report_buttons()
993 struct input_dev *dev = psmouse->dev; in synaptics_report_mt_data()
994 struct synaptics_data *priv = psmouse->private; in synaptics_report_mt_data()
995 const struct synaptics_hw_state *hw[2] = { sgm, &priv->agm }; in synaptics_report_mt_data()
1002 pos[i].x = hw[i]->x; in synaptics_report_mt_data()
1003 pos[i].y = synaptics_invert_y(hw[i]->y); in synaptics_report_mt_data()
1006 input_mt_assign_slots(dev, slot, pos, nsemi, DMAX * priv->info.x_res); in synaptics_report_mt_data()
1013 input_report_abs(dev, ABS_MT_PRESSURE, hw[i]->z); in synaptics_report_mt_data()
1021 /* Send the number of fingers reported by touchpad itself. */ in synaptics_report_mt_data()
1032 struct synaptics_data *priv = psmouse->private; in synaptics_image_sensor_process()
1038 if (sgm->z == 0) in synaptics_image_sensor_process()
1040 else if (sgm->w >= 4) in synaptics_image_sensor_process()
1042 else if (sgm->w == 0) in synaptics_image_sensor_process()
1044 else if (sgm->w == 1) in synaptics_image_sensor_process()
1045 num_fingers = priv->agm_count ? priv->agm_count : 3; in synaptics_image_sensor_process()
1055 if (SYN_CAP_MULTIFINGER(priv->info.capabilities)) in synaptics_has_multifinger()
1067 struct input_dev *dev = psmouse->dev; in synaptics_process_packet()
1068 struct synaptics_data *priv = psmouse->private; in synaptics_process_packet()
1069 struct synaptics_device_info *info = &priv->info; in synaptics_process_packet()
1074 if (synaptics_parse_hw_state(psmouse->packet, priv, &hw)) in synaptics_process_packet()
1077 if (SYN_CAP_IMAGE_SENSOR(info->ext_cap_0c)) { in synaptics_process_packet()
1083 priv->scroll += hw.scroll; in synaptics_process_packet()
1085 while (priv->scroll >= 4) { in synaptics_process_packet()
1090 priv->scroll -= 4; in synaptics_process_packet()
1092 while (priv->scroll <= -4) { in synaptics_process_packet()
1097 priv->scroll += 4; in synaptics_process_packet()
1105 if (SYN_CAP_EXTENDED(info->capabilities)) { in synaptics_process_packet()
1113 * SYN_MODEL_PEN(info->model_id): even if in synaptics_process_packet()
1119 if (SYN_CAP_PALMDETECT(info->capabilities)) in synaptics_process_packet()
1134 if (SYN_CAP_ADV_GESTURE(info->ext_cap_0c)) in synaptics_process_packet()
1135 synaptics_report_semi_mt_data(dev, &hw, &priv->agm, in synaptics_process_packet()
1140 * absolute -> relative conversion in synaptics_process_packet()
1151 if (SYN_CAP_PALMDETECT(info->capabilities)) in synaptics_process_packet()
1173 const u8 *packet = psmouse->packet; in synaptics_validate_byte()
1213 struct synaptics_data *priv = psmouse->private; in synaptics_process_byte()
1215 if (psmouse->pktcnt >= 6) { /* Full packet received */ in synaptics_process_byte()
1216 if (unlikely(priv->pkt_type == SYN_NEWABS)) in synaptics_process_byte()
1217 priv->pkt_type = synaptics_detect_pkt_type(psmouse); in synaptics_process_byte()
1219 if (SYN_CAP_PASS_THROUGH(priv->info.capabilities) && in synaptics_process_byte()
1220 synaptics_is_pt_packet(psmouse->packet)) { in synaptics_process_byte()
1221 if (priv->pt_port) in synaptics_process_byte()
1222 synaptics_pass_pt_packet(priv->pt_port, in synaptics_process_byte()
1223 psmouse->packet); in synaptics_process_byte()
1230 return synaptics_validate_byte(psmouse, psmouse->pktcnt - 1, priv->pkt_type) ? in synaptics_process_byte()
1241 int x_min = info->x_min ?: XMIN_NOMINAL; in set_abs_position_params()
1242 int x_max = info->x_max ?: XMAX_NOMINAL; in set_abs_position_params()
1243 int y_min = info->y_min ?: YMIN_NOMINAL; in set_abs_position_params()
1244 int y_max = info->y_max ?: YMAX_NOMINAL; in set_abs_position_params()
1245 int fuzz = SYN_CAP_REDUCED_FILTERING(info->ext_cap_0c) ? in set_abs_position_params()
1250 input_abs_set_res(dev, x_code, info->x_res); in set_abs_position_params()
1251 input_abs_set_res(dev, y_code, info->y_res); in set_abs_position_params()
1257 struct input_dev *dev = psmouse->dev; in set_input_params()
1258 struct synaptics_device_info *info = &priv->info; in set_input_params()
1263 __clear_bit(EV_REL, dev->evbit); in set_input_params()
1264 bitmap_zero(dev->relbit, REL_CNT); in set_input_params()
1265 bitmap_zero(dev->keybit, KEY_CNT); in set_input_params()
1268 __set_bit(INPUT_PROP_POINTER, dev->propbit); in set_input_params()
1273 if (!SYN_CAP_CLICKPAD(info->ext_cap_0c)) { in set_input_params()
1275 if (SYN_CAP_MIDDLE_BUTTON(info->capabilities)) in set_input_params()
1279 if (!priv->absolute_mode) { in set_input_params()
1287 set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y); in set_input_params()
1293 if (SYN_CAP_IMAGE_SENSOR(info->ext_cap_0c)) { in set_input_params()
1296 /* Image sensors can report per-contact pressure */ in set_input_params()
1307 } else if (SYN_CAP_ADV_GESTURE(info->ext_cap_0c)) { in set_input_params()
1311 * Profile sensor in CR-48 tracks contacts reasonably well, in set_input_params()
1312 * other non-image sensors with AGM use semi-mt. in set_input_params()
1323 * For semi-mt devices we send ABS_X/Y ourselves instead of in set_input_params()
1327 * position. Let's re-initialize ABS_X/Y here. in set_input_params()
1330 set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y); in set_input_params()
1333 if (SYN_CAP_PALMDETECT(info->capabilities)) in set_input_params()
1344 if (SYN_CAP_FOUR_BUTTON(info->capabilities) || in set_input_params()
1345 SYN_CAP_MIDDLE_BUTTON(info->capabilities)) { in set_input_params()
1350 if (!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10)) in set_input_params()
1351 for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(info->ext_cap); i++) in set_input_params()
1354 if (SYN_CAP_CLICKPAD(info->ext_cap_0c)) { in set_input_params()
1355 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); in set_input_params()
1357 !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10)) in set_input_params()
1358 __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); in set_input_params()
1367 struct synaptics_data *priv = psmouse->private; in synaptics_show_disable_gesture()
1369 return sprintf(buf, "%c\n", priv->disable_gesture ? '1' : '0'); in synaptics_show_disable_gesture()
1376 struct synaptics_data *priv = psmouse->private; in synaptics_set_disable_gesture()
1385 return -EINVAL; in synaptics_set_disable_gesture()
1387 if (value == priv->disable_gesture) in synaptics_set_disable_gesture()
1390 priv->disable_gesture = value; in synaptics_set_disable_gesture()
1392 priv->mode |= SYN_BIT_DISABLE_GESTURE; in synaptics_set_disable_gesture()
1394 priv->mode &= ~SYN_BIT_DISABLE_GESTURE; in synaptics_set_disable_gesture()
1396 if (synaptics_mode_cmd(psmouse, priv->mode)) in synaptics_set_disable_gesture()
1397 return -EIO; in synaptics_set_disable_gesture()
1408 struct synaptics_data *priv = psmouse->private; in synaptics_disconnect()
1416 if (!priv->absolute_mode && in synaptics_disconnect()
1417 SYN_ID_DISGEST_SUPPORTED(priv->info.identity)) in synaptics_disconnect()
1418 device_remove_file(&psmouse->ps2dev.serio->dev, in synaptics_disconnect()
1423 psmouse->private = NULL; in synaptics_disconnect()
1428 struct synaptics_data *priv = psmouse->private; in synaptics_reconnect()
1441 * to Synaptics-specific queries, so let's wait a in synaptics_reconnect()
1446 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID); in synaptics_reconnect()
1468 if (info.identity != priv->info.identity || in synaptics_reconnect()
1469 info.model_id != priv->info.model_id || in synaptics_reconnect()
1470 info.capabilities != priv->info.capabilities || in synaptics_reconnect()
1471 info.ext_cap != priv->info.ext_cap) { in synaptics_reconnect()
1473 "hardware appears to be different: id(%u-%u), model(%u-%u), caps(%x-%x), ext(%x-%x).\n", in synaptics_reconnect()
1474 priv->info.identity, info.identity, in synaptics_reconnect()
1475 priv->info.model_id, info.model_id, in synaptics_reconnect()
1476 priv->info.capabilities, info.capabilities, in synaptics_reconnect()
1477 priv->info.ext_cap, info.ext_cap); in synaptics_reconnect()
1478 return -ENXIO; in synaptics_reconnect()
1528 /* OLPC XO-1 or XO-1.5 */
1541 /* Cr-48 Chromebook (Codename Mario) */
1567 psmouse->private = priv = kzalloc(sizeof(*priv), GFP_KERNEL); in synaptics_init_ps2()
1569 return -ENOMEM; in synaptics_init_ps2()
1571 priv->info = *info; in synaptics_init_ps2()
1572 priv->absolute_mode = absolute_mode; in synaptics_init_ps2()
1573 if (SYN_ID_DISGEST_SUPPORTED(info->identity)) in synaptics_init_ps2()
1574 priv->disable_gesture = true; in synaptics_init_ps2()
1580 priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids); in synaptics_init_ps2()
1588 priv->pkt_type = SYN_MODEL_NEWABS(info->model_id) ? in synaptics_init_ps2()
1593 SYN_ID_MODEL(info->identity), in synaptics_init_ps2()
1594 SYN_ID_MAJOR(info->identity), SYN_ID_MINOR(info->identity), in synaptics_init_ps2()
1595 info->model_id, in synaptics_init_ps2()
1596 info->capabilities, info->ext_cap, info->ext_cap_0c, in synaptics_init_ps2()
1597 info->ext_cap_10, info->board_id, info->firmware_id); in synaptics_init_ps2()
1608 * input device->id.version and be visible to userspace. in synaptics_init_ps2()
1613 psmouse->model = ((info->model_id & 0x00ff0000) >> 8) | in synaptics_init_ps2()
1614 (info->model_id & 0x000000ff); in synaptics_init_ps2()
1617 psmouse->protocol_handler = synaptics_process_byte; in synaptics_init_ps2()
1618 psmouse->pktsize = 6; in synaptics_init_ps2()
1621 psmouse->protocol_handler = psmouse_process_byte; in synaptics_init_ps2()
1622 psmouse->pktsize = 3; in synaptics_init_ps2()
1625 psmouse->set_rate = synaptics_set_rate; in synaptics_init_ps2()
1626 psmouse->disconnect = synaptics_disconnect; in synaptics_init_ps2()
1627 psmouse->reconnect = synaptics_reconnect; in synaptics_init_ps2()
1628 psmouse->fast_reconnect = NULL; in synaptics_init_ps2()
1629 psmouse->cleanup = synaptics_reset; in synaptics_init_ps2()
1631 psmouse->resync_time = 0; in synaptics_init_ps2()
1633 if (SYN_CAP_PASS_THROUGH(info->capabilities)) in synaptics_init_ps2()
1641 if (psmouse->rate >= 80 && impaired_toshiba_kbc) { in synaptics_init_ps2()
1645 psmouse->rate = 40; in synaptics_init_ps2()
1648 if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(info->identity)) { in synaptics_init_ps2()
1649 err = device_create_file(&psmouse->ps2dev.serio->dev, in synaptics_init_ps2()
1727 return -ENOSYS; in synaptics_setup_ps2()
1740 SYNAPTICS_INTERTOUCH_NOT_SET = -1,
1756 !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10); in synaptics_create_intertouch()
1766 .buttonpad = SYN_CAP_CLICKPAD(info->ext_cap_0c), in synaptics_create_intertouch()
1768 !!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10), in synaptics_create_intertouch()
1782 * synaptics_setup_intertouch - called once the PS/2 devices are enumerated
1792 return -ENXIO; in synaptics_setup_intertouch()
1801 …"If i2c-hid and hid-rmi are not used, you might want to try setting psmouse.synaptics_intertouch t… in synaptics_setup_intertouch()
1802 psmouse->ps2dev.serio->firmware_id); in synaptics_setup_intertouch()
1804 return -ENXIO; in synaptics_setup_intertouch()
1812 if (error == -EAGAIN) in synaptics_setup_intertouch()
1837 return -ENXIO; in synaptics_init_smbus()
1849 return -ENOSYS; in synaptics_setup_intertouch()
1854 return -ENOSYS; in synaptics_init_smbus()
1907 return -ENOSYS; in synaptics_init()