linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: linux-input@vger.kernel.org, iiro.valkonen@atmel.com,
	kyungmin.park@samsung.com
Subject: Re: [PATCH v2] Input: atmel_mxt_ts - Support 12bit resolution
Date: Mon, 11 Apr 2011 23:57:46 -0700	[thread overview]
Message-ID: <20110412065746.GC9566@core.coreip.homeip.net> (raw)
In-Reply-To: <1302241446-29201-1-git-send-email-jy0922.shim@samsung.com>

On Fri, Apr 08, 2011 at 02:44:06PM +0900, Joonyoung Shim wrote:
> Atmel touchscreen chip can support 12bit resolution and this patch
> modifies to get maximum x and y size from platform data.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>

Iiro, can I have your Acked-by for this please?

> ---
> v2: Fix absinfo->maximum value of x and y
> 
>  drivers/input/touchscreen/atmel_mxt_ts.c |   53 ++++++++++++++++++++++--------
>  1 files changed, 39 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 4012436..a97905a 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -196,9 +196,12 @@
>  #define MXT_PRESS		(1 << 6)
>  #define MXT_DETECT		(1 << 7)
>  
> +/* Touch orient bits */
> +#define MXT_XY_SWITCH		(1 << 0)
> +#define MXT_X_INVERT		(1 << 1)
> +#define MXT_Y_INVERT		(1 << 2)
> +
>  /* Touchscreen absolute values */
> -#define MXT_MAX_XC		0x3ff
> -#define MXT_MAX_YC		0x3ff
>  #define MXT_MAX_AREA		0xff
>  
>  #define MXT_MAX_FINGER		10
> @@ -246,6 +249,8 @@ struct mxt_data {
>  	struct mxt_info info;
>  	struct mxt_finger finger[MXT_MAX_FINGER];
>  	unsigned int irq;
> +	unsigned int max_x;
> +	unsigned int max_y;
>  };
>  
>  static bool mxt_object_readable(unsigned int type)
> @@ -549,8 +554,13 @@ static void mxt_input_touchevent(struct mxt_data *data,
>  	if (!(status & (MXT_PRESS | MXT_MOVE)))
>  		return;
>  
> -	x = (message->message[1] << 2) | ((message->message[3] & ~0x3f) >> 6);
> -	y = (message->message[2] << 2) | ((message->message[3] & ~0xf3) >> 2);
> +	x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf);
> +	y = (message->message[2] << 4) | ((message->message[3] & 0xf));
> +	if (data->max_x < 1024)
> +		x = x >> 2;
> +	if (data->max_y < 1024)
> +		y = y >> 2;
> +
>  	area = message->message[4];
>  
>  	dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
> @@ -845,6 +855,20 @@ static int mxt_initialize(struct mxt_data *data)
>  	return 0;
>  }
>  
> +static void mxt_calc_resolution(struct mxt_data *data)
> +{
> +	unsigned int max_x = data->pdata->x_size - 1;
> +	unsigned int max_y = data->pdata->y_size - 1;
> +
> +	if (data->pdata->orient & MXT_XY_SWITCH) {
> +		data->max_x = max_y;
> +		data->max_y = max_x;
> +	} else {
> +		data->max_x = max_x;
> +		data->max_y = max_y;
> +	}
> +}
> +
>  static ssize_t mxt_object_show(struct device *dev,
>  				    struct device_attribute *attr, char *buf)
>  {
> @@ -1052,31 +1076,32 @@ static int __devinit mxt_probe(struct i2c_client *client,
>  	input_dev->open = mxt_input_open;
>  	input_dev->close = mxt_input_close;
>  
> +	data->client = client;
> +	data->input_dev = input_dev;
> +	data->pdata = pdata;
> +	data->irq = client->irq;
> +
> +	mxt_calc_resolution(data);
> +
>  	__set_bit(EV_ABS, input_dev->evbit);
>  	__set_bit(EV_KEY, input_dev->evbit);
>  	__set_bit(BTN_TOUCH, input_dev->keybit);
>  
>  	/* For single touch */
>  	input_set_abs_params(input_dev, ABS_X,
> -			     0, MXT_MAX_XC, 0, 0);
> +			     0, data->max_x, 0, 0);
>  	input_set_abs_params(input_dev, ABS_Y,
> -			     0, MXT_MAX_YC, 0, 0);
> +			     0, data->max_y, 0, 0);
>  
>  	/* For multi touch */
>  	input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
>  			     0, MXT_MAX_AREA, 0, 0);
>  	input_set_abs_params(input_dev, ABS_MT_POSITION_X,
> -			     0, MXT_MAX_XC, 0, 0);
> +			     0, data->max_x, 0, 0);
>  	input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
> -			     0, MXT_MAX_YC, 0, 0);
> +			     0, data->max_y, 0, 0);
>  
>  	input_set_drvdata(input_dev, data);
> -
> -	data->client = client;
> -	data->input_dev = input_dev;
> -	data->pdata = pdata;
> -	data->irq = client->irq;
> -
>  	i2c_set_clientdata(client, data);
>  
>  	error = mxt_initialize(data);
> -- 
> 1.7.0.4
> 

-- 
Dmitry

  reply	other threads:[~2011-04-12  6:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08  5:44 [PATCH v2] Input: atmel_mxt_ts - Support 12bit resolution Joonyoung Shim
2011-04-12  6:57 ` Dmitry Torokhov [this message]
2011-04-12 14:54 ` Valkonen, Iiro

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=20110412065746.GC9566@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=iiro.valkonen@atmel.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-input@vger.kernel.org \
    /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).