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

Input: ili210x - add resolution to chip operations structure

Optionally allow the touch screen resolution to be set by adding
it to the chip operations structure. If it is omitted (left zero),
the resolution defaults to 64K. Which is the previously hard-coded
value.

Set the ili2117 resolution to 2048, as indicated in its datasheet.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Link: https://lore.kernel.org/r/20191112210148.3535-1-TheSven73@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sven Van Asbroeck and committed by
Dmitry Torokhov
b32fbeae c7dded5b

+7 -2
+7 -2
drivers/input/touchscreen/ili210x.c
··· 8 8 #include <linux/interrupt.h> 9 9 #include <linux/module.h> 10 10 #include <linux/of_device.h> 11 + #include <linux/sizes.h> 11 12 #include <linux/slab.h> 12 13 #include <asm/unaligned.h> 13 14 ··· 32 31 unsigned int *x, unsigned int *y); 33 32 bool (*continue_polling)(const u8 *data, bool touch); 34 33 unsigned int max_touches; 34 + unsigned int resolution; 35 35 }; 36 36 37 37 struct ili210x { ··· 162 160 .parse_touch_data = ili211x_touchdata_to_coords, 163 161 .continue_polling = ili211x_decline_polling, 164 162 .max_touches = 10, 163 + .resolution = 2048, 165 164 }; 166 165 167 166 static int ili251x_read_reg(struct i2c_client *client, ··· 339 336 struct gpio_desc *reset_gpio; 340 337 struct input_dev *input; 341 338 int error; 339 + unsigned int max_xy; 342 340 343 341 dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver"); 344 342 ··· 390 386 input->id.bustype = BUS_I2C; 391 387 392 388 /* Multi touch */ 393 - input_set_abs_params(input, ABS_MT_POSITION_X, 0, 0xffff, 0, 0); 394 - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 0xffff, 0, 0); 389 + max_xy = (chip->resolution ?: SZ_64K) - 1; 390 + input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_xy, 0, 0); 391 + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_xy, 0, 0); 395 392 touchscreen_parse_properties(input, true, &priv->prop); 396 393 397 394 error = input_mt_init_slots(input, priv->chip->max_touches,