Lines Matching +full:tuning +full:- +full:start +full:- +full:tap
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2011-2015 Synaptics Incorporated
66 * @rezero - writing this to the F11 command register will cause the sensor to
183 * @nr_fingers - describes the maximum number of fingers the 2-D sensor
185 * @has_rel - the sensor supports relative motion reporting.
186 * @has_abs - the sensor supports absolute poition reporting.
187 * @has_gestures - the sensor supports gesture reporting.
188 * @has_sensitivity_adjust - the sensor supports a global sensitivity
190 * @configurable - the sensor supports various configuration options.
191 * @num_of_x_electrodes - the maximum number of electrodes the 2-D sensor
193 * @num_of_y_electrodes - the maximum number of electrodes the 2-D sensor
195 * @max_electrodes - the total number of X and Y electrodes that may be
200 * @abs_data_size - describes the format of data reported by the absolute
203 * @has_anchored_finger - then the sensor supports the high-precision second
206 * @has_adjust_hyst - the difference between the finger release threshold and
208 * @has_dribble - the sensor supports the generation of dribble interrupts,
210 * @has_bending_correction - Bending related data registers 28 and 36, and
212 * @has_large_object_suppression - control register 58 and data register 28
214 * @has_jitter_filter - query 13 and control 73..76 exist.
218 * @has_single_tap - a basic single-tap gesture is supported.
219 * @has_tap_n_hold - tap-and-hold gesture is supported.
220 * @has_double_tap - double-tap gesture is supported.
221 * @has_early_tap - early tap is supported and reported as soon as the finger
222 * lifts for any tap event that could be interpreted as either a single tap
223 * or as the first tap of a double-tap or tap-and-hold gesture.
224 * @has_flick - flick detection is supported.
225 * @has_press - press gesture reporting is supported.
226 * @has_pinch - pinch gesture detection is supported.
227 * @has_palm_det - the 2-D sensor notifies the host whenever a large conductive
228 * object such as a palm or a cheek touches the 2-D sensor.
229 * @has_rotate - rotation gesture detection is supported.
230 * @has_touch_shapes - TouchShapes are supported. A TouchShape is a fixed
232 * @has_scroll_zones - scrolling areas near the sensor edges are supported.
233 * @has_individual_scroll_zones - if 1, then 4 scroll zones are supported;
235 * @has_mf_scroll - the multifinger_scrolling bit will be set when
241 * @query7_nonzero - true if none of the query 7 bits are set
242 * @query8_nonzero - true if none of the query 8 bits are set
246 * @has_pen - detection of a stylus is supported and registers F11_2D_Ctrl20
248 * @has_proximity - detection of fingers near the sensor is supported and
250 * @has_palm_det_sensitivity - the sensor supports the palm detect sensitivity
252 * @has_two_pen_thresholds - is has_pen is also set, then F11_2D_Ctrl35 exists.
253 * @has_contact_geometry - the sensor supports the use of contact geometry to
259 * @nr_touch_shapes - the total number of touch shapes supported.
263 * @has_z_tuning - if set, the sensor supports Z tuning and registers
265 * @has_algorithm_selection - controls choice of noise suppression algorithm
266 * @has_w_tuning - the sensor supports Wx and Wy scaling and registers
268 * @has_pitch_info - the X and Y pitches of the sensor electrodes can be
270 * @has_finger_size - the default finger width settings for the
273 * @has_segmentation_aggressiveness - the sensor’s ability to distinguish
276 * @has_XY_clip - the inactive outside borders of the sensor can be
278 * @has_drumming_filter - the sensor can be configured to distinguish
284 * @has_gapless_finger - control registers relating to gapless finger are
286 * @has_gapless_finger_tuning - additional control and data registers relating
288 * @has_8bit_w - larger W value reporting is supported.
289 * @has_adjustable_mapping - TBD
290 * @has_info2 - the general info query14 is present
291 * @has_physical_props - additional queries describing the physical properties
293 * @has_finger_limit - indicates that F11 Ctrl 80 exists.
294 * @has_linear_coeff - indicates that F11 Ctrl 81 exists.
297 * @jitter_window_size - used by Design Studio 4.
298 * @jitter_filter_type - used by Design Studio 4.
302 * @light_control - Indicates what light/led control features are present, if
304 * @is_clear - if set, this is a clear sensor (indicating direct pointing
306 * @clickpad_props - specifies if this is a clickpad, and if so what sort of
308 * @mouse_buttons - specifies the number of mouse buttons present (if any).
309 * @has_advanced_gestures - advanced driver gestures are supported.
408 /* Query 15 - 18 */
464 * @f_state - start of finger state registers.
465 * @abs_pos - start of absolute position registers (if present).
466 * @rel_pos - start of relative data registers (if present).
467 * @gest_1 - gesture flags (if present).
468 * @gest_2 - gesture flags & finger count (if present).
469 * @pinch - pinch motion register (if present).
470 * @flick - flick distance X & Y, flick time (if present).
471 * @rotate - rotate motion and finger separation.
472 * @multi_scroll - chiral deltas for X and Y (if present).
473 * @scroll_zones - scroll deltas for 4 regions (if present).
489 /** Data pertaining to F11 in general. For per-sensor data, see struct
492 * @dev_query - F11 device specific query registers.
493 * @dev_controls - F11 device specific control registers.
494 * @dev_controls_mutex - lock for the control registers.
495 * @rezero_wait_ms - if nonzero, upon resume we will wait this many
499 * @sensors - per sensor data structures.
528 struct rmi_2d_sensor *sensor = &f11->sensor; in rmi_f11_rel_pos_report()
529 struct f11_2d_data *data = &f11->data; in rmi_f11_rel_pos_report()
532 x = data->rel_pos[n_finger * RMI_F11_REL_BYTES]; in rmi_f11_rel_pos_report()
533 y = data->rel_pos[n_finger * RMI_F11_REL_BYTES + 1]; in rmi_f11_rel_pos_report()
544 struct f11_2d_data *data = &f11->data; in rmi_f11_abs_pos_process()
545 u8 *pos_data = &data->abs_pos[n_finger * RMI_F11_ABS_BYTES]; in rmi_f11_abs_pos_process()
550 obj->type = RMI_2D_OBJECT_FINGER; in rmi_f11_abs_pos_process()
553 obj->type = RMI_2D_OBJECT_NONE; in rmi_f11_abs_pos_process()
556 obj->mt_tool = tool_type; in rmi_f11_abs_pos_process()
557 obj->x = (pos_data[0] << 4) | (pos_data[2] & 0x0F); in rmi_f11_abs_pos_process()
558 obj->y = (pos_data[1] << 4) | (pos_data[2] >> 4); in rmi_f11_abs_pos_process()
559 obj->z = pos_data[4]; in rmi_f11_abs_pos_process()
560 obj->wx = pos_data[3] & 0x0f; in rmi_f11_abs_pos_process()
561 obj->wy = pos_data[3] >> 4; in rmi_f11_abs_pos_process()
575 const u8 *f_state = f11->data.f_state; in rmi_f11_finger_handler()
580 int abs_size = sensor->nbr_fingers * RMI_F11_ABS_BYTES; in rmi_f11_finger_handler()
582 if (sensor->report_abs) { in rmi_f11_finger_handler()
586 abs_fingers = sensor->nbr_fingers; in rmi_f11_finger_handler()
597 rmi_f11_abs_pos_process(f11, sensor, &sensor->objs[i], in rmi_f11_finger_handler()
605 if (sensor->kernel_tracking) in rmi_f11_finger_handler()
606 input_mt_assign_slots(sensor->input, in rmi_f11_finger_handler()
607 sensor->tracking_slots, in rmi_f11_finger_handler()
608 sensor->tracking_pos, in rmi_f11_finger_handler()
609 sensor->nbr_fingers, in rmi_f11_finger_handler()
610 sensor->dmax); in rmi_f11_finger_handler()
618 rmi_2d_sensor_abs_report(sensor, &sensor->objs[i], i); in rmi_f11_finger_handler()
621 input_mt_sync_frame(sensor->input); in rmi_f11_finger_handler()
622 } else if (sensor->report_rel) { in rmi_f11_finger_handler()
623 if ((abs_size + sensor->nbr_fingers * RMI_F11_REL_BYTES) > size) in rmi_f11_finger_handler()
624 rel_fingers = (size - abs_size) / RMI_F11_REL_BYTES; in rmi_f11_finger_handler()
626 rel_fingers = sensor->nbr_fingers; in rmi_f11_finger_handler()
636 struct rmi_2d_sensor *sensor = &f11->sensor; in f11_2d_construct_data()
637 struct f11_2d_sensor_queries *query = &f11->sens_query; in f11_2d_construct_data()
638 struct f11_2d_data *data = &f11->data; in f11_2d_construct_data()
641 sensor->nbr_fingers = (query->nr_fingers == 5 ? 10 : in f11_2d_construct_data()
642 query->nr_fingers + 1); in f11_2d_construct_data()
644 sensor->pkt_size = DIV_ROUND_UP(sensor->nbr_fingers, 4); in f11_2d_construct_data()
646 if (query->has_abs) { in f11_2d_construct_data()
647 sensor->pkt_size += (sensor->nbr_fingers * 5); in f11_2d_construct_data()
648 sensor->attn_size = sensor->pkt_size; in f11_2d_construct_data()
651 if (query->has_rel) in f11_2d_construct_data()
652 sensor->pkt_size += (sensor->nbr_fingers * 2); in f11_2d_construct_data()
654 /* Check if F11_2D_Query7 is non-zero */ in f11_2d_construct_data()
655 if (query->query7_nonzero) in f11_2d_construct_data()
656 sensor->pkt_size += sizeof(u8); in f11_2d_construct_data()
658 /* Check if F11_2D_Query7 or F11_2D_Query8 is non-zero */ in f11_2d_construct_data()
659 if (query->query7_nonzero || query->query8_nonzero) in f11_2d_construct_data()
660 sensor->pkt_size += sizeof(u8); in f11_2d_construct_data()
662 if (query->has_pinch || query->has_flick || query->has_rotate) { in f11_2d_construct_data()
663 sensor->pkt_size += 3; in f11_2d_construct_data()
664 if (!query->has_flick) in f11_2d_construct_data()
665 sensor->pkt_size--; in f11_2d_construct_data()
666 if (!query->has_rotate) in f11_2d_construct_data()
667 sensor->pkt_size--; in f11_2d_construct_data()
670 if (query->has_touch_shapes) in f11_2d_construct_data()
671 sensor->pkt_size += in f11_2d_construct_data()
672 DIV_ROUND_UP(query->nr_touch_shapes + 1, 8); in f11_2d_construct_data()
674 sensor->data_pkt = devm_kzalloc(&sensor->fn->dev, sensor->pkt_size, in f11_2d_construct_data()
676 if (!sensor->data_pkt) in f11_2d_construct_data()
677 return -ENOMEM; in f11_2d_construct_data()
679 data->f_state = sensor->data_pkt; in f11_2d_construct_data()
680 i = DIV_ROUND_UP(sensor->nbr_fingers, 4); in f11_2d_construct_data()
682 if (query->has_abs) { in f11_2d_construct_data()
683 data->abs_pos = &sensor->data_pkt[i]; in f11_2d_construct_data()
684 i += (sensor->nbr_fingers * RMI_F11_ABS_BYTES); in f11_2d_construct_data()
687 if (query->has_rel) { in f11_2d_construct_data()
688 data->rel_pos = &sensor->data_pkt[i]; in f11_2d_construct_data()
689 i += (sensor->nbr_fingers * RMI_F11_REL_BYTES); in f11_2d_construct_data()
692 if (query->query7_nonzero) { in f11_2d_construct_data()
693 data->gest_1 = &sensor->data_pkt[i]; in f11_2d_construct_data()
697 if (query->query7_nonzero || query->query8_nonzero) { in f11_2d_construct_data()
698 data->gest_2 = &sensor->data_pkt[i]; in f11_2d_construct_data()
702 if (query->has_pinch) { in f11_2d_construct_data()
703 data->pinch = &sensor->data_pkt[i]; in f11_2d_construct_data()
707 if (query->has_flick) { in f11_2d_construct_data()
708 if (query->has_pinch) { in f11_2d_construct_data()
709 data->flick = data->pinch; in f11_2d_construct_data()
712 data->flick = &sensor->data_pkt[i]; in f11_2d_construct_data()
717 if (query->has_rotate) { in f11_2d_construct_data()
718 if (query->has_flick) { in f11_2d_construct_data()
719 data->rotate = data->flick + 1; in f11_2d_construct_data()
721 data->rotate = &sensor->data_pkt[i]; in f11_2d_construct_data()
726 if (query->has_touch_shapes) in f11_2d_construct_data()
727 data->shapes = &sensor->data_pkt[i]; in f11_2d_construct_data()
734 struct rmi_device *rmi_dev = fn->rmi_dev; in f11_read_control_regs()
737 ctrl->ctrl0_11_address = ctrl_base_addr; in f11_read_control_regs()
738 error = rmi_read_block(rmi_dev, ctrl_base_addr, ctrl->ctrl0_11, in f11_read_control_regs()
741 dev_err(&fn->dev, "Failed to read ctrl0, code: %d.\n", error); in f11_read_control_regs()
753 struct rmi_device *rmi_dev = fn->rmi_dev; in f11_write_control_regs()
756 error = rmi_write_block(rmi_dev, ctrl_base_addr, ctrl->ctrl0_11, in f11_write_control_regs()
779 sensor_query->nr_fingers = query_buf[0] & RMI_F11_NR_FINGERS_MASK; in rmi_f11_get_query_parameters()
780 sensor_query->has_rel = !!(query_buf[0] & RMI_F11_HAS_REL); in rmi_f11_get_query_parameters()
781 sensor_query->has_abs = !!(query_buf[0] & RMI_F11_HAS_ABS); in rmi_f11_get_query_parameters()
782 sensor_query->has_gestures = !!(query_buf[0] & RMI_F11_HAS_GESTURES); in rmi_f11_get_query_parameters()
783 sensor_query->has_sensitivity_adjust = in rmi_f11_get_query_parameters()
785 sensor_query->configurable = !!(query_buf[0] & RMI_F11_CONFIGURABLE); in rmi_f11_get_query_parameters()
787 sensor_query->nr_x_electrodes = in rmi_f11_get_query_parameters()
789 sensor_query->nr_y_electrodes = in rmi_f11_get_query_parameters()
791 sensor_query->max_electrodes = in rmi_f11_get_query_parameters()
796 if (sensor_query->has_abs) { in rmi_f11_get_query_parameters()
801 sensor_query->abs_data_size = in rmi_f11_get_query_parameters()
803 sensor_query->has_anchored_finger = in rmi_f11_get_query_parameters()
805 sensor_query->has_adj_hyst = in rmi_f11_get_query_parameters()
807 sensor_query->has_dribble = in rmi_f11_get_query_parameters()
809 sensor_query->has_bending_correction = in rmi_f11_get_query_parameters()
811 sensor_query->has_large_object_suppression = in rmi_f11_get_query_parameters()
813 sensor_query->has_jitter_filter = in rmi_f11_get_query_parameters()
818 if (sensor_query->has_rel) { in rmi_f11_get_query_parameters()
820 &sensor_query->f11_2d_query6); in rmi_f11_get_query_parameters()
826 if (sensor_query->has_gestures) { in rmi_f11_get_query_parameters()
832 sensor_query->has_single_tap = in rmi_f11_get_query_parameters()
834 sensor_query->has_tap_n_hold = in rmi_f11_get_query_parameters()
836 sensor_query->has_double_tap = in rmi_f11_get_query_parameters()
838 sensor_query->has_early_tap = in rmi_f11_get_query_parameters()
840 sensor_query->has_flick = in rmi_f11_get_query_parameters()
842 sensor_query->has_press = in rmi_f11_get_query_parameters()
844 sensor_query->has_pinch = in rmi_f11_get_query_parameters()
846 sensor_query->has_chiral = in rmi_f11_get_query_parameters()
850 sensor_query->has_palm_det = in rmi_f11_get_query_parameters()
852 sensor_query->has_rotate = in rmi_f11_get_query_parameters()
854 sensor_query->has_touch_shapes = in rmi_f11_get_query_parameters()
856 sensor_query->has_scroll_zones = in rmi_f11_get_query_parameters()
858 sensor_query->has_individual_scroll_zones = in rmi_f11_get_query_parameters()
860 sensor_query->has_mf_scroll = in rmi_f11_get_query_parameters()
862 sensor_query->has_mf_edge_motion = in rmi_f11_get_query_parameters()
864 sensor_query->has_mf_scroll_inertia = in rmi_f11_get_query_parameters()
867 sensor_query->query7_nonzero = !!(query_buf[0]); in rmi_f11_get_query_parameters()
868 sensor_query->query8_nonzero = !!(query_buf[1]); in rmi_f11_get_query_parameters()
873 if (f11->has_query9) { in rmi_f11_get_query_parameters()
878 sensor_query->has_pen = in rmi_f11_get_query_parameters()
880 sensor_query->has_proximity = in rmi_f11_get_query_parameters()
882 sensor_query->has_palm_det_sensitivity = in rmi_f11_get_query_parameters()
884 sensor_query->has_suppress_on_palm_detect = in rmi_f11_get_query_parameters()
886 sensor_query->has_two_pen_thresholds = in rmi_f11_get_query_parameters()
888 sensor_query->has_contact_geometry = in rmi_f11_get_query_parameters()
890 sensor_query->has_pen_hover_discrimination = in rmi_f11_get_query_parameters()
892 sensor_query->has_pen_filters = in rmi_f11_get_query_parameters()
898 if (sensor_query->has_touch_shapes) { in rmi_f11_get_query_parameters()
903 sensor_query->nr_touch_shapes = query_buf[0] & in rmi_f11_get_query_parameters()
909 if (f11->has_query11) { in rmi_f11_get_query_parameters()
914 sensor_query->has_z_tuning = in rmi_f11_get_query_parameters()
916 sensor_query->has_algorithm_selection = in rmi_f11_get_query_parameters()
918 sensor_query->has_w_tuning = in rmi_f11_get_query_parameters()
920 sensor_query->has_pitch_info = in rmi_f11_get_query_parameters()
922 sensor_query->has_finger_size = in rmi_f11_get_query_parameters()
924 sensor_query->has_segmentation_aggressiveness = in rmi_f11_get_query_parameters()
927 sensor_query->has_XY_clip = in rmi_f11_get_query_parameters()
929 sensor_query->has_drumming_filter = in rmi_f11_get_query_parameters()
935 if (f11->has_query12) { in rmi_f11_get_query_parameters()
940 sensor_query->has_gapless_finger = in rmi_f11_get_query_parameters()
942 sensor_query->has_gapless_finger_tuning = in rmi_f11_get_query_parameters()
944 sensor_query->has_8bit_w = in rmi_f11_get_query_parameters()
946 sensor_query->has_adjustable_mapping = in rmi_f11_get_query_parameters()
948 sensor_query->has_info2 = in rmi_f11_get_query_parameters()
950 sensor_query->has_physical_props = in rmi_f11_get_query_parameters()
952 sensor_query->has_finger_limit = in rmi_f11_get_query_parameters()
954 sensor_query->has_linear_coeff_2 = in rmi_f11_get_query_parameters()
960 if (sensor_query->has_jitter_filter) { in rmi_f11_get_query_parameters()
965 sensor_query->jitter_window_size = query_buf[0] & in rmi_f11_get_query_parameters()
967 sensor_query->jitter_filter_type = (query_buf[0] & in rmi_f11_get_query_parameters()
974 if (sensor_query->has_info2) { in rmi_f11_get_query_parameters()
979 sensor_query->light_control = in rmi_f11_get_query_parameters()
981 sensor_query->is_clear = in rmi_f11_get_query_parameters()
983 sensor_query->clickpad_props = in rmi_f11_get_query_parameters()
986 sensor_query->mouse_buttons = in rmi_f11_get_query_parameters()
989 sensor_query->has_advanced_gestures = in rmi_f11_get_query_parameters()
995 if (sensor_query->has_physical_props) { in rmi_f11_get_query_parameters()
1001 sensor_query->x_sensor_size_mm = in rmi_f11_get_query_parameters()
1003 sensor_query->y_sensor_size_mm = in rmi_f11_get_query_parameters()
1007 * query 15 - 18 contain the size of the sensor in rmi_f11_get_query_parameters()
1008 * and query 19 - 26 contain bezel dimensions in rmi_f11_get_query_parameters()
1013 if (f11->has_query27) in rmi_f11_get_query_parameters()
1016 if (f11->has_query28) { in rmi_f11_get_query_parameters()
1033 f11->has_acm = true; in rmi_f11_get_query_parameters()
1041 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_f11_initialize()
1051 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); in rmi_f11_initialize()
1056 rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Initializing F11 values.\n"); in rmi_f11_initialize()
1058 mask_size = BITS_TO_LONGS(drvdata->irq_count) * sizeof(unsigned long); in rmi_f11_initialize()
1063 f11 = devm_kzalloc(&fn->dev, sizeof(struct f11_data) + mask_size * 2, in rmi_f11_initialize()
1066 return -ENOMEM; in rmi_f11_initialize()
1068 if (fn->dev.of_node) { in rmi_f11_initialize()
1069 rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata); in rmi_f11_initialize()
1073 f11->sensor_pdata = pdata->sensor_pdata; in rmi_f11_initialize()
1076 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait; in rmi_f11_initialize()
1078 f11->abs_mask = (unsigned long *)((char *)f11 in rmi_f11_initialize()
1080 f11->rel_mask = (unsigned long *)((char *)f11 in rmi_f11_initialize()
1083 set_bit(fn->irq_pos, f11->abs_mask); in rmi_f11_initialize()
1084 set_bit(fn->irq_pos + 1, f11->rel_mask); in rmi_f11_initialize()
1086 query_base_addr = fn->fd.query_base_addr; in rmi_f11_initialize()
1087 control_base_addr = fn->fd.control_base_addr; in rmi_f11_initialize()
1093 f11->has_query9 = !!(buf & RMI_F11_HAS_QUERY9); in rmi_f11_initialize()
1094 f11->has_query11 = !!(buf & RMI_F11_HAS_QUERY11); in rmi_f11_initialize()
1095 f11->has_query12 = !!(buf & RMI_F11_HAS_QUERY12); in rmi_f11_initialize()
1096 f11->has_query27 = !!(buf & RMI_F11_HAS_QUERY27); in rmi_f11_initialize()
1097 f11->has_query28 = !!(buf & RMI_F11_HAS_QUERY28); in rmi_f11_initialize()
1100 sensor = &f11->sensor; in rmi_f11_initialize()
1101 sensor->fn = fn; in rmi_f11_initialize()
1104 &f11->sens_query, query_offset); in rmi_f11_initialize()
1109 rc = f11_read_control_regs(fn, &f11->dev_controls, in rmi_f11_initialize()
1112 dev_err(&fn->dev, in rmi_f11_initialize()
1117 if (f11->sens_query.has_info2) { in rmi_f11_initialize()
1118 if (f11->sens_query.is_clear) in rmi_f11_initialize()
1119 f11->sensor.sensor_type = rmi_sensor_touchscreen; in rmi_f11_initialize()
1121 f11->sensor.sensor_type = rmi_sensor_touchpad; in rmi_f11_initialize()
1124 sensor->report_abs = f11->sens_query.has_abs; in rmi_f11_initialize()
1126 sensor->axis_align = in rmi_f11_initialize()
1127 f11->sensor_pdata.axis_align; in rmi_f11_initialize()
1129 sensor->topbuttonpad = f11->sensor_pdata.topbuttonpad; in rmi_f11_initialize()
1130 sensor->kernel_tracking = f11->sensor_pdata.kernel_tracking; in rmi_f11_initialize()
1131 sensor->dmax = f11->sensor_pdata.dmax; in rmi_f11_initialize()
1132 sensor->dribble = f11->sensor_pdata.dribble; in rmi_f11_initialize()
1133 sensor->palm_detect = f11->sensor_pdata.palm_detect; in rmi_f11_initialize()
1135 if (f11->sens_query.has_physical_props) { in rmi_f11_initialize()
1136 sensor->x_mm = f11->sens_query.x_sensor_size_mm; in rmi_f11_initialize()
1137 sensor->y_mm = f11->sens_query.y_sensor_size_mm; in rmi_f11_initialize()
1139 sensor->x_mm = f11->sensor_pdata.x_mm; in rmi_f11_initialize()
1140 sensor->y_mm = f11->sensor_pdata.y_mm; in rmi_f11_initialize()
1143 if (sensor->sensor_type == rmi_sensor_default) in rmi_f11_initialize()
1144 sensor->sensor_type = in rmi_f11_initialize()
1145 f11->sensor_pdata.sensor_type; in rmi_f11_initialize()
1147 sensor->report_abs = sensor->report_abs in rmi_f11_initialize()
1148 && !(f11->sensor_pdata.disable_report_mask in rmi_f11_initialize()
1151 if (!sensor->report_abs) in rmi_f11_initialize()
1156 sensor->report_rel = f11->sens_query.has_rel; in rmi_f11_initialize()
1170 sensor->max_x = max_x_pos; in rmi_f11_initialize()
1171 sensor->max_y = max_y_pos; in rmi_f11_initialize()
1177 if (f11->has_acm) in rmi_f11_initialize()
1178 f11->sensor.attn_size += f11->sensor.nbr_fingers * 2; in rmi_f11_initialize()
1180 /* allocate the in-kernel tracking buffers */ in rmi_f11_initialize()
1181 sensor->tracking_pos = devm_kcalloc(&fn->dev, in rmi_f11_initialize()
1182 sensor->nbr_fingers, sizeof(struct input_mt_pos), in rmi_f11_initialize()
1184 sensor->tracking_slots = devm_kcalloc(&fn->dev, in rmi_f11_initialize()
1185 sensor->nbr_fingers, sizeof(int), GFP_KERNEL); in rmi_f11_initialize()
1186 sensor->objs = devm_kcalloc(&fn->dev, in rmi_f11_initialize()
1187 sensor->nbr_fingers, in rmi_f11_initialize()
1190 if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) in rmi_f11_initialize()
1191 return -ENOMEM; in rmi_f11_initialize()
1193 ctrl = &f11->dev_controls; in rmi_f11_initialize()
1194 if (sensor->axis_align.delta_x_threshold) in rmi_f11_initialize()
1195 ctrl->ctrl0_11[RMI_F11_DELTA_X_THRESHOLD] = in rmi_f11_initialize()
1196 sensor->axis_align.delta_x_threshold; in rmi_f11_initialize()
1198 if (sensor->axis_align.delta_y_threshold) in rmi_f11_initialize()
1199 ctrl->ctrl0_11[RMI_F11_DELTA_Y_THRESHOLD] = in rmi_f11_initialize()
1200 sensor->axis_align.delta_y_threshold; in rmi_f11_initialize()
1206 if (sensor->axis_align.delta_x_threshold || in rmi_f11_initialize()
1207 sensor->axis_align.delta_y_threshold) { in rmi_f11_initialize()
1208 ctrl->ctrl0_11[0] &= ~RMI_F11_REPORT_MODE_MASK; in rmi_f11_initialize()
1209 ctrl->ctrl0_11[0] |= RMI_F11_REPORT_MODE_REDUCED; in rmi_f11_initialize()
1212 if (f11->sens_query.has_dribble) { in rmi_f11_initialize()
1213 switch (sensor->dribble) { in rmi_f11_initialize()
1215 ctrl->ctrl0_11[0] &= ~BIT(6); in rmi_f11_initialize()
1218 ctrl->ctrl0_11[0] |= BIT(6); in rmi_f11_initialize()
1226 if (f11->sens_query.has_palm_det) { in rmi_f11_initialize()
1227 switch (sensor->palm_detect) { in rmi_f11_initialize()
1229 ctrl->ctrl0_11[11] &= ~BIT(0); in rmi_f11_initialize()
1232 ctrl->ctrl0_11[11] |= BIT(0); in rmi_f11_initialize()
1240 rc = f11_write_control_regs(fn, &f11->sens_query, in rmi_f11_initialize()
1241 &f11->dev_controls, fn->fd.control_base_addr); in rmi_f11_initialize()
1243 dev_warn(&fn->dev, "Failed to write control registers\n"); in rmi_f11_initialize()
1245 mutex_init(&f11->dev_controls_mutex); in rmi_f11_initialize()
1247 dev_set_drvdata(&fn->dev, f11); in rmi_f11_initialize()
1254 struct f11_data *f11 = dev_get_drvdata(&fn->dev); in rmi_f11_config()
1255 struct rmi_driver *drv = fn->rmi_dev->driver; in rmi_f11_config()
1256 struct rmi_2d_sensor *sensor = &f11->sensor; in rmi_f11_config()
1259 if (!sensor->report_abs) in rmi_f11_config()
1260 drv->clear_irq_bits(fn->rmi_dev, f11->abs_mask); in rmi_f11_config()
1262 drv->set_irq_bits(fn->rmi_dev, f11->abs_mask); in rmi_f11_config()
1264 if (!sensor->report_rel) in rmi_f11_config()
1265 drv->clear_irq_bits(fn->rmi_dev, f11->rel_mask); in rmi_f11_config()
1267 drv->set_irq_bits(fn->rmi_dev, f11->rel_mask); in rmi_f11_config()
1269 rc = f11_write_control_regs(fn, &f11->sens_query, in rmi_f11_config()
1270 &f11->dev_controls, fn->fd.query_base_addr); in rmi_f11_config()
1280 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_f11_attention()
1281 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); in rmi_f11_attention()
1282 struct f11_data *f11 = dev_get_drvdata(&fn->dev); in rmi_f11_attention()
1283 u16 data_base_addr = fn->fd.data_base_addr; in rmi_f11_attention()
1285 int valid_bytes = f11->sensor.pkt_size; in rmi_f11_attention()
1287 if (drvdata->attn_data.data) { in rmi_f11_attention()
1292 if (f11->sensor.attn_size > drvdata->attn_data.size) in rmi_f11_attention()
1293 valid_bytes = drvdata->attn_data.size; in rmi_f11_attention()
1295 valid_bytes = f11->sensor.attn_size; in rmi_f11_attention()
1296 memcpy(f11->sensor.data_pkt, drvdata->attn_data.data, in rmi_f11_attention()
1298 drvdata->attn_data.data += valid_bytes; in rmi_f11_attention()
1299 drvdata->attn_data.size -= valid_bytes; in rmi_f11_attention()
1302 data_base_addr, f11->sensor.data_pkt, in rmi_f11_attention()
1303 f11->sensor.pkt_size); in rmi_f11_attention()
1308 rmi_f11_finger_handler(f11, &f11->sensor, valid_bytes); in rmi_f11_attention()
1315 struct f11_data *f11 = dev_get_drvdata(&fn->dev); in rmi_f11_resume()
1318 rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Resuming...\n"); in rmi_f11_resume()
1319 if (!f11->rezero_wait_ms) in rmi_f11_resume()
1322 mdelay(f11->rezero_wait_ms); in rmi_f11_resume()
1324 error = rmi_write(fn->rmi_dev, fn->fd.command_base_addr, in rmi_f11_resume()
1327 dev_err(&fn->dev, in rmi_f11_resume()
1345 f11 = dev_get_drvdata(&fn->dev); in rmi_f11_probe()
1346 error = rmi_2d_sensor_configure_input(fn, &f11->sensor); in rmi_f11_probe()