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: zforce_ts - accept standard touchscreen properties

Only driver-specific properties were accepted, change it
to use the now-available standard properties.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/20231223221213.774868-4-andreas@kemnade.info
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Andreas Kemnade and committed by
Dmitry Torokhov
435e84ec cc040e42

+16 -18
+16 -18
drivers/input/touchscreen/zforce_ts.c
··· 20 20 #include <linux/device.h> 21 21 #include <linux/sysfs.h> 22 22 #include <linux/input/mt.h> 23 + #include <linux/input/touchscreen.h> 23 24 #include <linux/platform_data/zforce_ts.h> 24 25 #include <linux/regulator/consumer.h> 25 26 #include <linux/of.h> ··· 107 106 struct zforce_ts { 108 107 struct i2c_client *client; 109 108 struct input_dev *input; 109 + struct touchscreen_properties prop; 110 110 const struct zforce_ts_platdata *pdata; 111 111 char phys[32]; 112 112 ··· 268 266 static int zforce_start(struct zforce_ts *ts) 269 267 { 270 268 struct i2c_client *client = ts->client; 271 - const struct zforce_ts_platdata *pdata = ts->pdata; 272 269 int ret; 273 270 274 271 dev_dbg(&client->dev, "starting device\n"); ··· 278 277 return ret; 279 278 } 280 279 281 - ret = zforce_resolution(ts, pdata->x_max, pdata->y_max); 280 + ret = zforce_resolution(ts, ts->prop.max_x, ts->prop.max_y); 282 281 if (ret) { 283 282 dev_err(&client->dev, "Unable to set resolution, %d\n", ret); 284 283 goto error; ··· 338 337 static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) 339 338 { 340 339 struct i2c_client *client = ts->client; 341 - const struct zforce_ts_platdata *pdata = ts->pdata; 342 340 struct zforce_point point; 343 341 int count, i, num = 0; 344 342 ··· 355 355 point.coord_y = 356 356 payload[9 * i + 4] << 8 | payload[9 * i + 3]; 357 357 358 - if (point.coord_x > pdata->x_max || 359 - point.coord_y > pdata->y_max) { 358 + if (point.coord_x > ts->prop.max_x || 359 + point.coord_y > ts->prop.max_y) { 360 360 dev_warn(&client->dev, "coordinates (%d,%d) invalid\n", 361 361 point.coord_x, point.coord_y); 362 362 point.coord_x = point.coord_y = 0; ··· 390 390 point.state != STATE_UP); 391 391 392 392 if (point.state != STATE_UP) { 393 - input_report_abs(ts->input, ABS_MT_POSITION_X, 394 - point.coord_x); 395 - input_report_abs(ts->input, ABS_MT_POSITION_Y, 396 - point.coord_y); 393 + touchscreen_report_pos(ts->input, &ts->prop, 394 + point.coord_x, point.coord_y, 395 + true); 397 396 input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, 398 397 point.area_major); 399 398 input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, ··· 718 719 return ERR_PTR(-ENOMEM); 719 720 } 720 721 721 - if (of_property_read_u32(np, "x-size", &pdata->x_max)) { 722 - dev_err(dev, "failed to get x-size property\n"); 723 - return ERR_PTR(-EINVAL); 724 - } 725 - 726 - if (of_property_read_u32(np, "y-size", &pdata->y_max)) { 727 - dev_err(dev, "failed to get y-size property\n"); 728 - return ERR_PTR(-EINVAL); 729 - } 722 + of_property_read_u32(np, "x-size", &pdata->x_max); 723 + of_property_read_u32(np, "y-size", &pdata->y_max); 730 724 731 725 return pdata; 732 726 } ··· 847 855 pdata->x_max, 0, 0); 848 856 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 849 857 pdata->y_max, 0, 0); 858 + 859 + touchscreen_parse_properties(input_dev, true, &ts->prop); 860 + if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { 861 + dev_err(&client->dev, "no size specified\n"); 862 + return -EINVAL; 863 + } 850 864 851 865 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 852 866 ZFORCE_MAX_AREA, 0, 0);