22
22
#include <linux/pm_qos.h>
23
23
#include <linux/slab.h>
24
24
#include <linux/types.h>
25
+ #include <linux/input/touch-overlay.h>
25
26
26
27
#define ST1232_TS_NAME "st1232-ts"
27
28
#define ST1633_TS_NAME "st1633-ts"
@@ -57,6 +58,7 @@ struct st1232_ts_data {
57
58
struct dev_pm_qos_request low_latency_req ;
58
59
struct gpio_desc * reset_gpio ;
59
60
const struct st_chip_info * chip_info ;
61
+ struct list_head touch_overlay_list ;
60
62
int read_buf_len ;
61
63
u8 * read_buf ;
62
64
};
@@ -156,6 +158,10 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts)
156
158
157
159
input_mt_assign_slots (input , slots , pos , n_contacts , 0 );
158
160
for (i = 0 ; i < n_contacts ; i ++ ) {
161
+ if (touch_overlay_process_contact (& ts -> touch_overlay_list ,
162
+ input , & pos [i ], slots [i ]))
163
+ continue ;
164
+
159
165
input_mt_slot (input , slots [i ]);
160
166
input_mt_report_slot_state (input , MT_TOOL_FINGER , true);
161
167
input_report_abs (input , ABS_MT_POSITION_X , pos [i ].x );
@@ -164,6 +170,7 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts)
164
170
input_report_abs (input , ABS_MT_TOUCH_MAJOR , z [i ]);
165
171
}
166
172
173
+ touch_overlay_sync_frame (& ts -> touch_overlay_list , input );
167
174
input_mt_sync_frame (input );
168
175
input_sync (input );
169
176
@@ -292,18 +299,30 @@ static int st1232_ts_probe(struct i2c_client *client)
292
299
if (error )
293
300
return error ;
294
301
295
- /* Read resolution from the chip */
296
- error = st1232_ts_read_resolution (ts , & max_x , & max_y );
297
- if (error ) {
298
- dev_err (& client -> dev ,
299
- "Failed to read resolution: %d\n" , error );
300
- return error ;
301
- }
302
-
303
302
if (ts -> chip_info -> have_z )
304
303
input_set_abs_params (input_dev , ABS_MT_TOUCH_MAJOR , 0 ,
305
304
ts -> chip_info -> max_area , 0 , 0 );
306
305
306
+ /* map overlay objects if defined in the device tree */
307
+ INIT_LIST_HEAD (& ts -> touch_overlay_list );
308
+ error = touch_overlay_map (& ts -> touch_overlay_list , input_dev );
309
+ if (error )
310
+ return error ;
311
+
312
+ if (touch_overlay_mapped_touchscreen (& ts -> touch_overlay_list )) {
313
+ /* Read resolution from the overlay touchscreen if defined */
314
+ touch_overlay_get_touchscreen_abs (& ts -> touch_overlay_list ,
315
+ & max_x , & max_y );
316
+ } else {
317
+ /* Read resolution from the chip */
318
+ error = st1232_ts_read_resolution (ts , & max_x , & max_y );
319
+ if (error ) {
320
+ dev_err (& client -> dev ,
321
+ "Failed to read resolution: %d\n" , error );
322
+ return error ;
323
+ }
324
+ }
325
+
307
326
input_set_abs_params (input_dev , ABS_MT_POSITION_X ,
308
327
0 , max_x , 0 , 0 );
309
328
input_set_abs_params (input_dev , ABS_MT_POSITION_Y ,
0 commit comments