Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: st1232 - add touch-overlay handling

Use touch-overlay to support overlay objects such as buttons and a
resized frame defined in the device tree.

A key event will be generated if the coordinates of a touch event are
within the area defined by the button properties.

Reviewed-by: Jeff LaBundy <jeff@labundy.com>
Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Link: https://lore.kernel.org/r/20241016-feature-ts_virtobj_patch-v11-4-b292a1bbb0a1@wolfvision.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
1c44b818 88fb51ea

+27 -8
+27 -8
drivers/input/touchscreen/st1232.c
··· 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" ··· 58 57 struct dev_pm_qos_request low_latency_req; 59 58 struct gpio_desc *reset_gpio; 60 59 const struct st_chip_info *chip_info; 60 + struct list_head touch_overlay_list; 61 61 int read_buf_len; 62 62 u8 *read_buf; 63 63 }; ··· 158 156 159 157 input_mt_assign_slots(input, slots, pos, n_contacts, 0); 160 158 for (i = 0; i < n_contacts; i++) { 159 + if (touch_overlay_process_contact(&ts->touch_overlay_list, 160 + input, &pos[i], slots[i])) 161 + continue; 162 + 161 163 input_mt_slot(input, slots[i]); 162 164 input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 163 165 input_report_abs(input, ABS_MT_POSITION_X, pos[i].x); ··· 170 164 input_report_abs(input, ABS_MT_TOUCH_MAJOR, z[i]); 171 165 } 172 166 167 + touch_overlay_sync_frame(&ts->touch_overlay_list, input); 173 168 input_mt_sync_frame(input); 174 169 input_sync(input); 175 170 ··· 299 292 if (error) 300 293 return error; 301 294 302 - /* Read resolution from the chip */ 303 - error = st1232_ts_read_resolution(ts, &max_x, &max_y); 304 - if (error) { 305 - dev_err(&client->dev, 306 - "Failed to read resolution: %d\n", error); 307 - return error; 308 - } 309 - 310 295 if (ts->chip_info->have_z) 311 296 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 312 297 ts->chip_info->max_area, 0, 0); 298 + 299 + /* map overlay objects if defined in the device tree */ 300 + INIT_LIST_HEAD(&ts->touch_overlay_list); 301 + error = touch_overlay_map(&ts->touch_overlay_list, input_dev); 302 + if (error) 303 + return error; 304 + 305 + if (touch_overlay_mapped_touchscreen(&ts->touch_overlay_list)) { 306 + /* Read resolution from the overlay touchscreen if defined */ 307 + touch_overlay_get_touchscreen_abs(&ts->touch_overlay_list, 308 + &max_x, &max_y); 309 + } else { 310 + /* Read resolution from the chip */ 311 + error = st1232_ts_read_resolution(ts, &max_x, &max_y); 312 + if (error) { 313 + dev_err(&client->dev, 314 + "Failed to read resolution: %d\n", error); 315 + return error; 316 + } 317 + } 313 318 314 319 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 315 320 0, max_x, 0, 0);