Skip to content

Commit b32fbea

Browse files
Sven Van Asbroeckdtor
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent c7dded5 commit b32fbea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/input/touchscreen/ili210x.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/interrupt.h>
99
#include <linux/module.h>
1010
#include <linux/of_device.h>
11+
#include <linux/sizes.h>
1112
#include <linux/slab.h>
1213
#include <asm/unaligned.h>
1314

@@ -31,6 +32,7 @@ struct ili2xxx_chip {
3132
unsigned int *x, unsigned int *y);
3233
bool (*continue_polling)(const u8 *data, bool touch);
3334
unsigned int max_touches;
35+
unsigned int resolution;
3436
};
3537

3638
struct ili210x {
@@ -160,6 +162,7 @@ static const struct ili2xxx_chip ili211x_chip = {
160162
.parse_touch_data = ili211x_touchdata_to_coords,
161163
.continue_polling = ili211x_decline_polling,
162164
.max_touches = 10,
165+
.resolution = 2048,
163166
};
164167

165168
static int ili251x_read_reg(struct i2c_client *client,
@@ -336,6 +339,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
336339
struct gpio_desc *reset_gpio;
337340
struct input_dev *input;
338341
int error;
342+
unsigned int max_xy;
339343

340344
dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver");
341345

@@ -386,8 +390,9 @@ static int ili210x_i2c_probe(struct i2c_client *client,
386390
input->id.bustype = BUS_I2C;
387391

388392
/* Multi touch */
389-
input_set_abs_params(input, ABS_MT_POSITION_X, 0, 0xffff, 0, 0);
390-
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 0xffff, 0, 0);
393+
max_xy = (chip->resolution ?: SZ_64K) - 1;
394+
input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_xy, 0, 0);
395+
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_xy, 0, 0);
391396
touchscreen_parse_properties(input, true, &priv->prop);
392397

393398
error = input_mt_init_slots(input, priv->chip->max_touches,

0 commit comments

Comments
 (0)