diff options
author | Sven Van Asbroeck <thesven73@gmail.com> | 2019-11-13 00:40:48 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-11-13 00:53:32 +0100 |
commit | b32fbeaec52d387004dd7fa15877b8adf7b396c3 (patch) | |
tree | 32f55c16e4a2a1b6318acf9fdf94c9ab4b2f69f9 /drivers/input | |
parent | Input: ili210x - do not retrieve/print chip firmware version (diff) | |
download | linux-b32fbeaec52d387004dd7fa15877b8adf7b396c3.tar.xz linux-b32fbeaec52d387004dd7fa15877b8adf7b396c3.zip |
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>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/ili210x.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index a6feae5ce887..6861ac4355b2 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -8,6 +8,7 @@ #include <linux/interrupt.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/sizes.h> #include <linux/slab.h> #include <asm/unaligned.h> @@ -31,6 +32,7 @@ struct ili2xxx_chip { unsigned int *x, unsigned int *y); bool (*continue_polling)(const u8 *data, bool touch); unsigned int max_touches; + unsigned int resolution; }; struct ili210x { @@ -160,6 +162,7 @@ static const struct ili2xxx_chip ili211x_chip = { .parse_touch_data = ili211x_touchdata_to_coords, .continue_polling = ili211x_decline_polling, .max_touches = 10, + .resolution = 2048, }; static int ili251x_read_reg(struct i2c_client *client, @@ -336,6 +339,7 @@ static int ili210x_i2c_probe(struct i2c_client *client, struct gpio_desc *reset_gpio; struct input_dev *input; int error; + unsigned int max_xy; dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver"); @@ -386,8 +390,9 @@ static int ili210x_i2c_probe(struct i2c_client *client, input->id.bustype = BUS_I2C; /* Multi touch */ - input_set_abs_params(input, ABS_MT_POSITION_X, 0, 0xffff, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 0xffff, 0, 0); + max_xy = (chip->resolution ?: SZ_64K) - 1; + input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_xy, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_xy, 0, 0); touchscreen_parse_properties(input, true, &priv->prop); error = input_mt_init_slots(input, priv->chip->max_touches, |