lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 6 Apr 2015 13:30:57 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Javier Martinez Canillas <javier.martinez@...labora.co.uk>
Cc:	Henrik Rydberg <rydberg@...omail.se>,
	Nick Dyer <nick.dyer@...ev.co.uk>,
	Sjoerd Simons <sjoerd.simons@...labora.co.uk>,
	Doug Anderson <dianders@...omium.org>,
	Olof Johansson <olof@...om.net>,
	Yufeng Shen <miletus@...omium.org>,
	Benson Leung <bleung@...omium.org>,
	Chung-yih Wang <cywang@...omium.org>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] Input: atmel_mxt_ts - Split out touchpad
 initialisation logic

On Tue, Mar 17, 2015 at 03:00:46PM +0100, Javier Martinez Canillas wrote:
> From: Sjoerd Simons <sjoerd.simons@...labora.co.uk>
> 
> If the "linux,gpio-keymap" DT property is defined, the T19 keys are configured
> and the device is setup as a touchpad rather than a touchscreen. The logic is
> part of the input device initialization routine but it can be factored out to
> its own function to simplify the former.
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@...labora.co.uk>
> Signed-off-by: Javier Martinez Canillas <javier.martinez@...labora.co.uk>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 48 +++++++++++++++++++-------------
>  1 file changed, 28 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 749371761669..e2e55cf857cb 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1815,15 +1815,40 @@ static int mxt_read_t100_config(struct mxt_data *data)
>  static int mxt_input_open(struct input_dev *dev);
>  static void mxt_input_close(struct input_dev *dev);
>  
> +static bool mxt_initialize_t19(struct input_dev *input_dev,
> +			       struct mxt_data *data)

I renamed it as mxt_set_up_as_touchpad() and made void, otherwise
applied.

Thanks.

> +{
> +	const struct mxt_platform_data *pdata = data->pdata;
> +	int i;
> +
> +	if (pdata->t19_num_keys) {
> +		__set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit);
> +
> +		for (i = 0; i < pdata->t19_num_keys; i++)
> +			if (pdata->t19_keymap[i] != KEY_RESERVED)
> +				input_set_capability(input_dev, EV_KEY,
> +						     pdata->t19_keymap[i]);
> +
> +		input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM);
> +		input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM);
> +		input_abs_set_res(input_dev, ABS_MT_POSITION_X,
> +				  MXT_PIXELS_PER_MM);
> +		input_abs_set_res(input_dev, ABS_MT_POSITION_Y,
> +				  MXT_PIXELS_PER_MM);
> +
> +		input_dev->name = "Atmel maXTouch Touchpad";
> +		return true;
> +	}
> +	return false;
> +}
> +
>  static int mxt_initialize_input_device(struct mxt_data *data)
>  {
>  	struct device *dev = &data->client->dev;
> -	const struct mxt_platform_data *pdata = data->pdata;
>  	struct input_dev *input_dev;
>  	int error;
>  	unsigned int num_mt_slots;
>  	unsigned int mt_flags = 0;
> -	int i;
>  
>  	switch (data->multitouch) {
>  	case MXT_TOUCH_MULTI_T9:
> @@ -1859,26 +1884,9 @@ static int mxt_initialize_input_device(struct mxt_data *data)
>  	set_bit(EV_ABS, input_dev->evbit);
>  	input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
>  
> -	if (pdata->t19_num_keys) {
> -		__set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit);
> -
> -		for (i = 0; i < pdata->t19_num_keys; i++)
> -			if (pdata->t19_keymap[i] != KEY_RESERVED)
> -				input_set_capability(input_dev, EV_KEY,
> -						     pdata->t19_keymap[i]);
> -
> +	if (mxt_initialize_t19(input_dev, data))
>  		mt_flags |= INPUT_MT_POINTER;
>  
> -		input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM);
> -		input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM);
> -		input_abs_set_res(input_dev, ABS_MT_POSITION_X,
> -				  MXT_PIXELS_PER_MM);
> -		input_abs_set_res(input_dev, ABS_MT_POSITION_Y,
> -				  MXT_PIXELS_PER_MM);
> -
> -		input_dev->name = "Atmel maXTouch Touchpad";
> -	}
> -
>  	/* For single touch */
>  	input_set_abs_params(input_dev, ABS_X,
>  			     0, data->max_x, 0, 0);
> -- 
> 2.1.4
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ