hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/input/rmi4/rmi_f11.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2011-2015 Synaptics Incorporated
34 * Copyright (c) 2011 Unixphere
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
85 */
96
107 #include <linux/kernel.h>
....@@ -415,6 +412,10 @@
415412
416413 /* Defs for Ctrl0. */
417414 #define RMI_F11_REPORT_MODE_MASK 0x07
415
+#define RMI_F11_REPORT_MODE_CONTINUOUS (0 << 0)
416
+#define RMI_F11_REPORT_MODE_REDUCED (1 << 0)
417
+#define RMI_F11_REPORT_MODE_FS_CHANGE (2 << 0)
418
+#define RMI_F11_REPORT_MODE_FP_CHANGE (3 << 0)
418419 #define RMI_F11_ABS_POS_FILT (1 << 3)
419420 #define RMI_F11_REL_POS_FILT (1 << 4)
420421 #define RMI_F11_REL_BALLISTICS (1 << 5)
....@@ -513,7 +514,6 @@
513514 struct rmi_2d_sensor_platform_data sensor_pdata;
514515 unsigned long *abs_mask;
515516 unsigned long *rel_mask;
516
- unsigned long *result_bits;
517517 };
518518
519519 enum f11_finger_state {
....@@ -1060,7 +1060,7 @@
10601060 /*
10611061 ** init instance data, fill in values and create any sysfs files
10621062 */
1063
- f11 = devm_kzalloc(&fn->dev, sizeof(struct f11_data) + mask_size * 3,
1063
+ f11 = devm_kzalloc(&fn->dev, sizeof(struct f11_data) + mask_size * 2,
10641064 GFP_KERNEL);
10651065 if (!f11)
10661066 return -ENOMEM;
....@@ -1079,8 +1079,6 @@
10791079 + sizeof(struct f11_data));
10801080 f11->rel_mask = (unsigned long *)((char *)f11
10811081 + sizeof(struct f11_data) + mask_size);
1082
- f11->result_bits = (unsigned long *)((char *)f11
1083
- + sizeof(struct f11_data) + mask_size * 2);
10841082
10851083 set_bit(fn->irq_pos, f11->abs_mask);
10861084 set_bit(fn->irq_pos + 1, f11->rel_mask);
....@@ -1201,6 +1199,16 @@
12011199 ctrl->ctrl0_11[RMI_F11_DELTA_Y_THRESHOLD] =
12021200 sensor->axis_align.delta_y_threshold;
12031201
1202
+ /*
1203
+ * If distance threshold values are set, switch to reduced reporting
1204
+ * mode so they actually get used by the controller.
1205
+ */
1206
+ if (sensor->axis_align.delta_x_threshold ||
1207
+ sensor->axis_align.delta_y_threshold) {
1208
+ ctrl->ctrl0_11[0] &= ~RMI_F11_REPORT_MODE_MASK;
1209
+ ctrl->ctrl0_11[0] |= RMI_F11_REPORT_MODE_REDUCED;
1210
+ }
1211
+
12041212 if (f11->sens_query.has_dribble) {
12051213 switch (sensor->dribble) {
12061214 case RMI_REG_STATE_OFF: