linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: Marek Vasut <marex@denx.de>, Adam Ford <aford173@gmail.com>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH v1 2/3] Input: ili210x - add resolution to chip operations structure
Date: Tue, 12 Nov 2019 11:42:20 -0800	[thread overview]
Message-ID: <20191112194220.GD13374@dtor-ws> (raw)
In-Reply-To: <20191112164429.11225-2-TheSven73@gmail.com>

On Tue, Nov 12, 2019 at 11:44:28AM -0500, Sven Van Asbroeck wrote:
> 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.
> 
> Link: https://lore.kernel.org/lkml/20191111181657.GA57214@dtor-ws/
> Cc: Marek Vasut <marex@denx.de>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: <linux-kernel@vger.kernel.org>
> Cc: linux-input@vger.kernel.org
> Tree: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/?h=next
> Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
> ---
>  drivers/input/touchscreen/ili210x.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> index a6feae5ce887..4321f0d676cc 100644
> --- a/drivers/input/touchscreen/ili210x.c
> +++ b/drivers/input/touchscreen/ili210x.c
> @@ -31,6 +31,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 +161,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 +338,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 +389,12 @@ 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);
> +	if (chip->resolution)
> +		max_xy = chip->resolution - 1;
> +	else
> +		max_xy = 0xffff;

	max_xy = (chip->resolution ?: 65536) - 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,
> -- 
> 2.17.1
> 

-- 
Dmitry

  reply	other threads:[~2019-11-12 19:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 16:44 [PATCH v1 1/3] Input: ili210x - do not retrieve/print chip firmware version Sven Van Asbroeck
2019-11-12 16:44 ` [PATCH v1 2/3] Input: ili210x - add resolution to chip operations structure Sven Van Asbroeck
2019-11-12 19:42   ` Dmitry Torokhov [this message]
2019-11-12 16:44 ` [PATCH v1 3/3] Input: ili210x - optionally hide calibrate sysfs attribute Sven Van Asbroeck
2019-11-12 19:38   ` Dmitry Torokhov
2019-11-12 23:34 ` [PATCH v1 1/3] Input: ili210x - do not retrieve/print chip firmware version Sebastian Reichel
2019-11-13  0:06   ` Dmitry Torokhov
2019-11-12 23:53 ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191112194220.GD13374@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aford173@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=thesven73@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).