Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] HID: kye: fix unresponsive keyboard
From: Jiri Kosina @ 2013-11-21  9:30 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Benjamin Tissoires, Adam Kulagowski, linux-input, linux-kernel
In-Reply-To: <1384958982-23099-2-git-send-email-benjamin.tissoires@redhat.com>

On Wed, 20 Nov 2013, Benjamin Tissoires wrote:

> The manticore keyboard requires that all usb EP are opened at least
> once to be fully functional. The third EP forwards to the user space
> some vendor specific information about the keyboard state, but are useless
> currently for the kernel.
> 
> Opening them and closing them makes the keyboard responsive again.
> 
> Reported-and-tested-by: Adam Kulagowski <fidor@fidor.org>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
> 
> Hi Jiri,
> 
> well, this one was a long shot as I do not have the hardware to actually
> spot the exact call which enables the keyboard. Adam told me that just
> opening and closing once all the /dev/hidrawX attached to the keyboard makes
> the keyboard functional, so, here is the kernel version of this.
> Anyway, it just works, so I think we can take this one as well.

Man, this is ugly :)

What can we do anyway. Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH 3/3] Input: Added thumb detection in BCM5974 multitouch driver
From: Henrik Rydberg @ 2013-11-21  9:20 UTC (permalink / raw)
  To: Dmitry Torokhov, Friedrich Schöller; +Cc: linux-input, linux-kernel
In-Reply-To: <20131121050549.GC4702@core.coreip.homeip.net>

> On Wed, Nov 20, 2013 at 11:54:12PM +0100, Friedrich Schöller wrote:
>> Trackpads with integrated buttons are hard to use when the driver responds to
>> movements of the thumb that is resting or clicking on the surface of the
>> trackpad. This patch adds rudimentary support to filter out these touch events.
>>
>> The feature can be turned on via sysfs:
>> 	/sys/class/input/input[0-9]+/thumb_ignore:
>> 		Enables thumb detection
>> 		Values: 0/1
>> 	/sys/class/input/input[0-9]+/thumb_ratio_on:
>> 		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
>> 		times 100 is smaller than this value the touch qualifies
>> 		as a thumb.
>> 	/sys/class/input/input[0-9]+/thumb_ratio_off:
>> 		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
>> 		times 100 is bigger than this value the touch no longer
>> 		qualifies as a thumb.
>> 	/sys/class/input/input[0-9]+/thumb_y_on:
>> 		When ABS_MT_POSITION_Y is bigger than this value the touch
>> 		qualifies as a thumb.
>> 	/sys/class/input/input[0-9]+/thumb_y_off:
>> 		When ABS_MT_POSITION_Y is smaller than this value the touch
>> 		no longer qualifies as a thumb.
> 
> I'd rather this been implemented in userspace (synaptics and/or evdev X
> drivers).

And it has been in userland since at least 2008. It can be found in
input-synaptics, input-multitouch, input-mtrack, possibly more places.

Thanks,
Henrik

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/3] Input: Fixed pressure and tool width calculation in BCM5974 multitouch driver
From: Henrik Rydberg @ 2013-11-21  9:17 UTC (permalink / raw)
  To: Friedrich Schöller, Dmitry Torokhov, linux-input; +Cc: linux-kernel
In-Reply-To: <1384988052-31898-2-git-send-email-linux@schoeller.se>

Hi Friedrich,

> Previously ABS_PRESSURE and ABS_TOOL_WIDTH were calculated by looking at the
> size of the first touch in the list reported by the trackpad. This is not
> necessarily the same touch as the one used to perform pointer emulation in the
> input multitouch library (input-mt). By using the sum of the sizes of all
> touches as a basis for this calculation we get more coherent values.
> ---
>  drivers/input/mouse/bcm5974.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)

The input-mt core can be used to output the correct pointer-emulated pressure
based on the individual pressures. Devices capable of measuring pressure should
rather use that method. However, this particular device does not actually
support pressure, and is therefore not applicable.

The legacy pressure code was added a long time ago in order to work with the
only userland option at the time (synaptics X driver). Since then, userland has
matured considerably, with drivers such as input-multitouch, input-evdev,
input-mtrack at your disposal. The only reason the pointer pressure and width
are still in the driver is to remain compatible with old userland.

Thanks,
Henrik


^ permalink raw reply

* Re: [PATCH 1/3] Input: Fixed ABS_MT_TOUCH_MINOR scale factor in BCM5974 multitouch driver
From: Henrik Rydberg @ 2013-11-21  9:05 UTC (permalink / raw)
  To: Friedrich Schöller, Dmitry Torokhov, linux-input; +Cc: linux-kernel
In-Reply-To: <1384988052-31898-1-git-send-email-linux@schoeller.se>

Hi Friedrich,

> On wellspring3 devices ABS_MT_TOUCH_MINOR was sometimes reported bigger than
> ABS_MT_TOUCH_MAJOR. This is fixed by rescaling ABS_MT_TOUCH_MINOR by a factor of
> 0.85 instead of 2. Excessive tapping on the trackpad shows this to be the right
> value. Circular touches should now lead to values for ABS_MT_TOUCH_MAJOR and
> ABS_MT_TOUCH_MINOR that are similar, with ABS_MT_TOUCH_MINOR never greater than
> ABS_MT_TOUCH_MAJOR.
> ---
>  drivers/input/mouse/bcm5974.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)

The major/minor scales are following the aspect ratio of the device, and as such
it could happen that minor > major. Most userland drivers do not use the finger
width limits, which are estimates, but only the device axes limit, which are
accurate.

Also, we cannot have floats in the kernel.

I would consider a patch which tries to make the finger widths more accurate,
but all in all, I think this problem is best solved in userland.

Thanks,
Henrik


^ permalink raw reply

* Re: [appleir] BUG: unable to handle kernel NULL pointer dereference
From: Jiri Kosina @ 2013-11-21  8:59 UTC (permalink / raw)
  To: James Henstridge
  Cc: Benjamin Tissoires, Luis Henriques, linux-kernel, linux-input,
	Fabien André, Bastien Nocera
In-Reply-To: <CALcaVOmCAV8XeURJ5UpWfaFXoj+bz6DZ1NgAt7Xiv5pfEynRFQ@mail.gmail.com>

On Thu, 21 Nov 2013, James Henstridge wrote:

> Sorry for the delays in testing out the patch.  I have tried a kernel
> with the patch applied, and can no longer reproduce the oops.  The
> hid-appleir driver appears to be working correctly, generating key
> press events in response to the remote, and LIRC functions correctly
> via hiddev.
> 
> Thanks for the everyone's help with this.

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCHv9][ 3/3] ARM: dts: cpuimx35 Add touchscreen support.
From: Eric Bénard @ 2013-11-21  8:05 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Denis Carikli, Dmitry Torokhov, linux-input, Tomi Valkeinen,
	linux-fbdev, Shawn Guo, Sascha Hauer, devicetree, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Grant Likely, linux-arm-kernel, Lothar Wa??mann
In-Reply-To: <20131121050922.GF18477@ns203013.ovh.net>

Le Thu, 21 Nov 2013 06:09:22 +0100,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a écrit :
> > +	tsc2007: tsc2007@48 {
> > +		compatible = "ti,tsc2007";
> > +		reg = <0x48>;
> > +		interrupt-parent = <&gpio3>;
> > +		interrupts = <0x2 0x8>;
> > +		gpios = <&gpio3 2 1>;
> as explain on the binding drop this gpios this is an IRQ not a gpio
> 
> NACK
> 
please read the tsc2007's code, in the patch there is :

+static int tsc2007_get_pendown_state_dt(struct tsc2007 *ts)
+{
+       return !gpio_get_value(ts->gpio);
+}
+

http://www.mail-archive.com/linux-input@vger.kernel.org/msg06765.html

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCHv9][ 1/3] Input: tsc2007: Add device tree support.
From: Eric Bénard @ 2013-11-21  8:03 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Denis Carikli, Dmitry Torokhov, linux-input, Tomi Valkeinen,
	linux-fbdev, Shawn Guo, Sascha Hauer, devicetree, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Grant Likely, linux-arm-kernel, Lothar Wa??mann
In-Reply-To: <20131121050544.GE18477@ns203013.ovh.net>

Hi Jean Christophe,

Le Thu, 21 Nov 2013 06:05:44 +0100,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a écrit :
> > +Optional properties:
> > +- gpios: the interrupt gpio the chip is connected to (trough the penirq pin).
> nack use interrupt property this a non-sense that we do today to pass irq via
> gpio property the should NEVER known it's a gpio just an irq

read previous email and you will see the GPIO is used to get the signal
level on the pin and not the IRQ.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCHv9][ 3/3] ARM: dts: cpuimx35 Add touchscreen support.
From: Lothar Waßmann @ 2013-11-21  8:00 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Denis Carikli, Dmitry Torokhov, linux-input, Tomi Valkeinen,
	linux-fbdev, Shawn Guo, Sascha Hauer, devicetree, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Grant Likely, linux-arm-kernel, Eric B??nard
In-Reply-To: <20131121050922.GF18477@ns203013.ovh.net>

Hi,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 14:17 Fri 08 Nov     , Denis Carikli wrote:
> > Cc: Rob Herring <rob.herring@calxeda.com>
> > Cc: Pawel Moll <pawel.moll@arm.com>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Stephen Warren <swarren@wwwdotorg.org>
> > Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> > Cc: Grant Likely <grant.likely@linaro.org>
> > Cc: devicetree@vger.kernel.org
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: linux-input@vger.kernel.org
> > Cc: Sascha Hauer <kernel@pengutronix.de>
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: Lothar Waßmann <LW@KARO-electronics.de>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Eric Bénard <eric@eukrea.com>
> > Signed-off-by: Denis Carikli <denis@eukrea.com>
> > ---
> > ChangeLog v8->v9:
> > - Added Grant Likely in the cc list.
> > - Adapted to the removal of the pinctrl properties in the tsc2007 documentation.
> > - Fixed the gpios property (before, it was set to active high by error).
> > 
> > ChangeLog v7->v8:
> > - Added Shawn Guo in the cc list.
> > ---
> >  arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi |   21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> > index b9cb5a5..f25a40f 100644
> > --- a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> > +++ b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> > @@ -36,6 +36,27 @@
> >  		compatible = "nxp,pcf8563";
> >  		reg = <0x51>;
> >  	};
> > +
> > +	tsc2007: tsc2007@48 {
> > +		compatible = "ti,tsc2007";
> > +		reg = <0x48>;
> > +		interrupt-parent = <&gpio3>;
> > +		interrupts = <0x2 0x8>;
> > +		gpios = <&gpio3 2 1>;
> as explain on the binding drop this gpios this is an IRQ not a gpio
> 
> NACK
The driver needs an interrupt to get notified about pendown events and
needs to poll the pendown signal to find out when the pen has been
lifted. Both the interrupt and the pendown signal happen to be
signalled on the same pin. Thus, IMO it is perfectly well to have the
interrupt property as well as the gpios property here.

How would you tell the driver which pin to poll for detecting the pen
up event?

Having a platform callback with hardcoded GPIO numbers is not an option.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] Input: tsc2007 - convert to use devres-managed resources
From: Dmitry Torokhov @ 2013-11-21  5:14 UTC (permalink / raw)
  To: linux-input; +Cc: Bill Pemberton, Mark Brown, Denis Carikli, linux-kernel

This simplifies error handling path and allows us get rid of
tsc2007_remove().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007.c | 79 +++++++++++++++++++------------------
 1 file changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 48a165a..bd51eee 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -366,6 +366,14 @@ static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts,
 	return 0;
 }
 
+static void tsc2007_call_exit_platform_hw(void *data)
+{
+	struct device *dev = data;
+	const struct tsc2007_platform_data *pdata = dev_get_platdata(dev);
+
+	pdata->exit_platform_hw();
+}
+
 static int tsc2007_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -389,11 +397,9 @@ static int tsc2007_probe(struct i2c_client *client,
 	if (err)
 		return err;
 
-	input_dev = input_allocate_device();
-	if (!input_dev) {
-		err = -ENOMEM;
-		goto err_free_input;
-	};
+	input_dev = devm_input_allocate_device(&client->dev);
+	if (!input_dev)
+		return -ENOMEM;
 
 	i2c_set_clientdata(client, ts);
 
@@ -422,45 +428,41 @@ static int tsc2007_probe(struct i2c_client *client,
 	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
 			     ts->fuzzz, 0);
 
-	if (pdata && pdata->init_platform_hw)
-		pdata->init_platform_hw();
+	if (pdata) {
+		if (pdata->exit_platform_hw) {
+			err = devm_add_action(&client->dev,
+					      tsc2007_call_exit_platform_hw,
+					      &client->dev);
+			if (err) {
+				dev_err(&client->dev,
+					"Failed to register exit_platform_hw action, %d\n",
+					err);
+				return err;
+			}
+		}
+
+		if (pdata->init_platform_hw)
+			pdata->init_platform_hw();
+	}
 
-	err = request_threaded_irq(ts->irq, tsc2007_hard_irq, tsc2007_soft_irq,
-				   IRQF_ONESHOT, client->dev.driver->name, ts);
-	if (err < 0) {
-		dev_err(&client->dev, "irq %d busy?\n", ts->irq);
-		goto err_free_input;
+	err = devm_request_threaded_irq(&client->dev, ts->irq,
+					tsc2007_hard_irq, tsc2007_soft_irq,
+					IRQF_ONESHOT,
+					client->dev.driver->name, ts);
+	if (err) {
+		dev_err(&client->dev, "Failed to request irq %d: %d\n",
+			ts->irq, err);
+		return err;
 	}
 
 	tsc2007_stop(ts);
 
 	err = input_register_device(input_dev);
-	if (err)
-		goto err_free_irq;
-
-	return 0;
-
- err_free_irq:
-	free_irq(ts->irq, ts);
-	if (pdata && pdata->exit_platform_hw)
-		pdata->exit_platform_hw();
- err_free_input:
-	input_free_device(input_dev);
-	return err;
-}
-
-static int tsc2007_remove(struct i2c_client *client)
-{
-	const struct tsc2007_platform_data *pdata = dev_get_platdata(&client->dev);
-	struct tsc2007 *ts = i2c_get_clientdata(client);
-
-	free_irq(ts->irq, ts);
-
-	if (pdata && pdata->exit_platform_hw)
-		pdata->exit_platform_hw();
-
-	input_unregister_device(ts->input);
-	kfree(ts);
+	if (err) {
+		dev_err(&client->dev,
+			"Failed to register input device: %d\n", err);
+		return err;
+	}
 
 	return 0;
 }
@@ -488,7 +490,6 @@ static struct i2c_driver tsc2007_driver = {
 	},
 	.id_table	= tsc2007_idtable,
 	.probe		= tsc2007_probe,
-	.remove		= tsc2007_remove,
 };
 
 module_i2c_driver(tsc2007_driver);
-- 
1.8.3.1


-- 
Dmitry

^ permalink raw reply related

* [PATCH] Input: tsc2007 - remove unused poll_delay from platform data
From: Dmitry Torokhov @ 2013-11-21  5:13 UTC (permalink / raw)
  To: linux-input; +Cc: Bill Pemberton, Mark Brown, Denis Carikli, linux-kernel

****
Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:7/7=100%,commit_signer:2/2=100%)
Bill Pemberton <wfp5p@virginia.edu> (commit_signer:3/7=43%)
Mark Brown <broonie@opensource.wolfsonmicro.com> (commit_signer:2/7=29%)
Javier Martinez Canillas <javier@dowhile0.org> (commit_signer:1/7=14%)
Russell King <rmk+kernel@arm.linux.org.uk> (commit_signer:1/7=14%)
linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
linux-kernel@vger.kernel.org (open list)
****
Authors
drivers/input/touchscreen/tsc2007.c: Kwangwoo Lee <kwangwoo.lee@gmail.com>
include/linux/i2c/tsc2007.h: Kwangwoo Lee <kwangwoo.lee@gmail.com>
****
The driver does not use poll_delay parameter, so let's remove it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007.c | 2 --
 include/linux/i2c/tsc2007.h         | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 390148c..48a165a 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -75,7 +75,6 @@ struct tsc2007 {
 	u16			model;
 	u16			x_plate_ohms;
 	u16			max_rt;
-	unsigned long		poll_delay;
 	unsigned long		poll_period;
 	int			fuzzx;
 	int			fuzzy;
@@ -352,7 +351,6 @@ static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts,
 	ts->model             = pdata->model;
 	ts->x_plate_ohms      = pdata->x_plate_ohms;
 	ts->max_rt            = pdata->max_rt ? : MAX_12BIT;
-	ts->poll_delay        = pdata->poll_delay ? : 1;
 	ts->poll_period       = pdata->poll_period ? : 1;
 	ts->get_pendown_state = pdata->get_pendown_state;
 	ts->clear_penirq      = pdata->clear_penirq;
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
index 041c8e8..4f35b6a 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/i2c/tsc2007.h
@@ -7,8 +7,6 @@ struct tsc2007_platform_data {
 	u16	model;				/* 2007. */
 	u16	x_plate_ohms;	/* must be non-zero value */
 	u16	max_rt; /* max. resistance above which samples are ignored */
-	unsigned long poll_delay; /* delay (in ms) after pen-down event
-				     before polling starts */
 	unsigned long poll_period; /* time (in ms) between samples */
 	int	fuzzx; /* fuzz factor for X, Y and pressure axes */
 	int	fuzzy;
-- 
1.8.3.1


-- 
Dmitry

^ permalink raw reply related

* Re: [PATCHv9][ 2/3] ARM: dts: cpuimx51 Add touchscreen support.
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-21  5:10 UTC (permalink / raw)
  To: Denis Carikli
  Cc: Mark Rutland, devicetree, linux-fbdev, Eric B??nard, Pawel Moll,
	Stephen Warren, Dmitry Torokhov, Rob Herring, Grant Likely,
	Tomi Valkeinen, Sascha Hauer, linux-input, Ian Campbell,
	Shawn Guo, linux-arm-kernel, Lothar Wa??mann
In-Reply-To: <1383916659-9988-2-git-send-email-denis@eukrea.com>

On 14:17 Fri 08 Nov     , Denis Carikli wrote:
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: devicetree@vger.kernel.org
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Eric Bénard <eric@eukrea.com>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v8->v9:
> - Added Grant Likely in the Cc list.
> - Adapted to the removal of the pinctrl properties in the tsc2007 documentation.
> - Fixed the gpios property (before, it was set to active high by error).
> 
> ChangeLog v7->v8:
> - Added Shawn Guo in the cc list.
> ---
>  arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi b/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi
> index b22841a..b04c65b 100644
> --- a/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi
> +++ b/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi
> @@ -42,11 +42,23 @@
>  		compatible = "nxp,pcf8563";
>  		reg = <0x51>;
>  	};
> +
> +	tsc2007: tsc2007@49 {
> +		compatible = "ti,tsc2007";
> +		reg = <0x49>;
> +		interrupt-parent = <&gpio4>;
> +		interrupts = <0x0 0x8>;
> +		gpios = <&gpio4 0 1>;
> +		ti,x-plate-ohms = <180>;
as explain on the binding drop this gpios this is an IRQ not a gpio

NACK

Best Regards,
J.
> +	};
>  };
>  
>  &iomuxc {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_hog>;
> +
>  	imx51-eukrea {
> -		pinctrl_tsc2007_1: tsc2007grp-1 {
> +		pinctrl_hog: hoggrp {
>  			fsl,pins = <
>  				MX51_PAD_GPIO_NAND__GPIO_NAND 0x1f5
>  				MX51_PAD_NANDF_D8__GPIO4_0 0x1f5
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* Re: [PATCHv9][ 3/3] ARM: dts: cpuimx35 Add touchscreen support.
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-21  5:09 UTC (permalink / raw)
  To: Denis Carikli
  Cc: Mark Rutland, devicetree, linux-fbdev, Eric B??nard, Pawel Moll,
	Stephen Warren, Dmitry Torokhov, Rob Herring, Grant Likely,
	Tomi Valkeinen, Sascha Hauer, linux-input, Ian Campbell,
	Shawn Guo, linux-arm-kernel, Lothar Wa??mann
In-Reply-To: <1383916659-9988-3-git-send-email-denis@eukrea.com>

On 14:17 Fri 08 Nov     , Denis Carikli wrote:
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: devicetree@vger.kernel.org
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Eric Bénard <eric@eukrea.com>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v8->v9:
> - Added Grant Likely in the cc list.
> - Adapted to the removal of the pinctrl properties in the tsc2007 documentation.
> - Fixed the gpios property (before, it was set to active high by error).
> 
> ChangeLog v7->v8:
> - Added Shawn Guo in the cc list.
> ---
>  arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> index b9cb5a5..f25a40f 100644
> --- a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> +++ b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
> @@ -36,6 +36,27 @@
>  		compatible = "nxp,pcf8563";
>  		reg = <0x51>;
>  	};
> +
> +	tsc2007: tsc2007@48 {
> +		compatible = "ti,tsc2007";
> +		reg = <0x48>;
> +		interrupt-parent = <&gpio3>;
> +		interrupts = <0x2 0x8>;
> +		gpios = <&gpio3 2 1>;
as explain on the binding drop this gpios this is an IRQ not a gpio

NACK

Best Regards,
J.
> +		ti,x-plate-ohms = <180>;
> +        };
> +
> +};
> +
> +&iomuxc {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_hog>;
> +
> +	imx35-eukrea {
> +		pinctrl_hog: hoggrp {
> +			fsl,pins = <MX35_PAD_ATA_DA2__GPIO3_2 0x80000000>;
> +		};
> +	};
>  };
>  
>  &nfc {
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* Re: randconfig build error with next-20131120, in drivers/input/touchscreen
From: Dmitry Torokhov @ 2013-11-21  5:07 UTC (permalink / raw)
  To: Jim Davis
  Cc: Stephen Rothwell, linux-next, linux-kernel, rydberg, floe,
	dh.herrmann, linux-input
In-Reply-To: <CA+r1ZhimRvYuw2SAajEM6y-P2TL3KMdAMyX6UQ0BFb-peRMn5A@mail.gmail.com>

Hi Jim,

On Wed, Nov 20, 2013 at 11:23:31AM -0700, Jim Davis wrote:
> Building with the attached random configuration file,
> 
> drivers/built-in.o: In function `sur40_disconnect':
> sur40.c:(.text+0x15c1cc): undefined reference to
> `input_unregister_polled_device'
> sur40.c:(.text+0x15c1d5): undefined reference to `input_free_polled_device'
> drivers/built-in.o: In function `sur40_probe':
> sur40.c:(.text+0x15c47a): undefined reference to `input_allocate_polled_device'
> sur40.c:(.text+0x15c65b): undefined reference to `input_register_polled_device'
> sur40.c:(.text+0x15c68b): undefined reference to `input_free_polled_device'
> make: *** [vmlinux] Error 1

Thanks for the report. I amended the commit to select INPUT_POLLDEV.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 3/3] Input: Added thumb detection in BCM5974 multitouch driver
From: Dmitry Torokhov @ 2013-11-21  5:05 UTC (permalink / raw)
  To: Friedrich Schöller; +Cc: Henrik Rydberg, linux-input, linux-kernel
In-Reply-To: <1384988052-31898-3-git-send-email-linux@schoeller.se>

Hi Friedrich,

On Wed, Nov 20, 2013 at 11:54:12PM +0100, Friedrich Schöller wrote:
> Trackpads with integrated buttons are hard to use when the driver responds to
> movements of the thumb that is resting or clicking on the surface of the
> trackpad. This patch adds rudimentary support to filter out these touch events.
> 
> The feature can be turned on via sysfs:
> 	/sys/class/input/input[0-9]+/thumb_ignore:
> 		Enables thumb detection
> 		Values: 0/1
> 	/sys/class/input/input[0-9]+/thumb_ratio_on:
> 		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
> 		times 100 is smaller than this value the touch qualifies
> 		as a thumb.
> 	/sys/class/input/input[0-9]+/thumb_ratio_off:
> 		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
> 		times 100 is bigger than this value the touch no longer
> 		qualifies as a thumb.
> 	/sys/class/input/input[0-9]+/thumb_y_on:
> 		When ABS_MT_POSITION_Y is bigger than this value the touch
> 		qualifies as a thumb.
> 	/sys/class/input/input[0-9]+/thumb_y_off:
> 		When ABS_MT_POSITION_Y is smaller than this value the touch
> 		no longer qualifies as a thumb.

I'd rather this been implemented in userspace (synaptics and/or evdev X
drivers).

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCHv9][ 1/3] Input: tsc2007: Add device tree support.
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-21  5:05 UTC (permalink / raw)
  To: Denis Carikli
  Cc: Mark Rutland, devicetree, linux-fbdev, Eric B??nard, Pawel Moll,
	Stephen Warren, Dmitry Torokhov, Rob Herring, Grant Likely,
	Tomi Valkeinen, Sascha Hauer, linux-input, Ian Campbell,
	Shawn Guo, linux-arm-kernel, Lothar Wa??mann
In-Reply-To: <1383916659-9988-1-git-send-email-denis@eukrea.com>

On 14:17 Fri 08 Nov     , Denis Carikli wrote:
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: devicetree@vger.kernel.org
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Eric Bénard <eric@eukrea.com>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v8->v9:
> - Added Grant Likely in the Cc list.
> - Removed the mention of the pinctrl properties in the documentation.
> 
> ChangeLog v7->v8:
> - Fixed the lack of x and z fuzz properties.
> - The pendown gpio is better documented.
> - Added Shawn Guo in the cc list.
> ---
>  .../bindings/input/touchscreen/tsc2007.txt         |   41 ++++
>  drivers/input/touchscreen/tsc2007.c                |  204 ++++++++++++++++----
>  2 files changed, 204 insertions(+), 41 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
> new file mode 100644
> index 0000000..028aba66d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
> @@ -0,0 +1,41 @@
> +* Texas Instruments tsc2007 touchscreen controller
> +
> +Required properties:
> +- compatible: must be "ti,tsc2007".
> +- reg: I2C address of the chip.
> +- ti,x-plate-ohms: X-plate resistance in ohms.
> +
> +Optional properties:
> +- gpios: the interrupt gpio the chip is connected to (trough the penirq pin).
nack use interrupt property this a non-sense that we do today to pass irq via
gpio property the should NEVER known it's a gpio just an irq
> +  The penirq pin goes to low when the panel is touched.
> +  (see GPIO binding[1] for more details).
> +- interrupt-parent: the phandle for the gpio controller
> +  (see interrupt binding[0]).
> +- interrupts: (gpio) interrupt to which the chip is connected
> +  (see interrupt binding[0]).
> +- ti,max-rt: maximum pressure.
> +- ti,fuzzx: specifies the absolute input fuzz x value.
> +  If set, it will permit noise in the data up to +- the value given to the fuzz
> +  parameter, that is used to filter noise from the event stream.
> +- ti,fuzzy: specifies the absolute input fuzz y value.
> +- ti,fuzzz: specifies the absolute input fuzz z value.
fuzz{x,y,z} look a weird name
> +- ti,poll-period: how much time to wait(in millisecond) before reading again the
> +  values from the tsc2007.
so put -ms in the binding to de clear and does not requiere to read the doc

Best Regards,
J.
> +
> +[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> +[1]: Documentation/devicetree/bindings/gpio/gpio.txt
> +
> +Example:
> +	&i2c1 {
> +		/* ... */
> +		tsc2007@49 {
> +			compatible = "ti,tsc2007";
> +			reg = <0x49>;
> +			interrupt-parent = <&gpio4>;
> +			interrupts = <0x0 0x8>;
> +			gpios = <&gpio4 0 0>;
> +			ti,x-plate-ohms = <180>;
> +		};
> +
> +		/* ... */
> +	};
> diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
> index 0b67ba4..3168a99 100644
> --- a/drivers/input/touchscreen/tsc2007.c
> +++ b/drivers/input/touchscreen/tsc2007.c
> @@ -26,6 +26,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/i2c.h>
>  #include <linux/i2c/tsc2007.h>
> +#include <linux/of_device.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
>  
>  #define TSC2007_MEASURE_TEMP0		(0x0 << 4)
>  #define TSC2007_MEASURE_AUX		(0x2 << 4)
> @@ -74,7 +77,12 @@ struct tsc2007 {
>  	u16			max_rt;
>  	unsigned long		poll_delay;
>  	unsigned long		poll_period;
> +	int			fuzzx;
> +	int			fuzzy;
> +	int			fuzzz;
> +	char			of;
>  
> +	unsigned		gpio;
>  	int			irq;
>  
>  	wait_queue_head_t	wait;
> @@ -84,6 +92,11 @@ struct tsc2007 {
>  	void			(*clear_penirq)(void);
>  };
>  
> +static int tsc2007_get_pendown_state_dt(struct tsc2007 *ts)
> +{
> +	return !gpio_get_value(ts->gpio);
> +}
> +
>  static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd)
>  {
>  	s32 data;
> @@ -142,6 +155,14 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
>  	return rt;
>  }
>  
> +static bool tsc2007_is_pen_down_valid(struct tsc2007 *ts)
> +{
> +	if (ts->of)
> +		return gpio_is_valid(ts->gpio);
> +	else
> +		return ts->get_pendown_state ? true : false;
> +}
> +
>  static bool tsc2007_is_pen_down(struct tsc2007 *ts)
>  {
>  	/*
> @@ -158,10 +179,13 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts)
>  	 * to fall back on the pressure reading.
>  	 */
>  
> -	if (!ts->get_pendown_state)
> +	if (!tsc2007_is_pen_down_valid(ts))
>  		return true;
>  
> -	return ts->get_pendown_state();
> +	if (ts->of)
> +		return tsc2007_get_pendown_state_dt(ts);
> +	else
> +		return ts->get_pendown_state();
>  }
>  
>  static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
> @@ -178,7 +202,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>  
>  		rt = tsc2007_calculate_pressure(ts, &tc);
>  
> -		if (rt == 0 && !ts->get_pendown_state) {
> +		if (!rt && !tsc2007_is_pen_down_valid(ts)) {
>  			/*
>  			 * If pressure reported is 0 and we don't have
>  			 * callback to check pendown state, we have to
> @@ -228,7 +252,7 @@ static irqreturn_t tsc2007_hard_irq(int irq, void *handle)
>  {
>  	struct tsc2007 *ts = handle;
>  
> -	if (!ts->get_pendown_state || likely(ts->get_pendown_state()))
> +	if (tsc2007_is_pen_down(ts))
>  		return IRQ_WAKE_THREAD;
>  
>  	if (ts->clear_penirq)
> @@ -273,34 +297,71 @@ static void tsc2007_close(struct input_dev *input_dev)
>  	tsc2007_stop(ts);
>  }
>  
> -static int tsc2007_probe(struct i2c_client *client,
> -				   const struct i2c_device_id *id)
> +#ifdef CONFIG_OF
> +static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts,
> +			    struct device_node *np)
>  {
> -	struct tsc2007 *ts;
> -	struct tsc2007_platform_data *pdata = client->dev.platform_data;
> -	struct input_dev *input_dev;
> -	int err;
> -
> -	if (!pdata) {
> -		dev_err(&client->dev, "platform data is required!\n");
> +	int err = 0;
> +	u32 val32;
> +	u64 val64;
> +
> +	if (!of_property_read_u32(np, "ti,max-rt", &val32))
> +		ts->max_rt = val32;
> +	else
> +		ts->max_rt = MAX_12BIT;
> +
> +	if (!of_property_read_u32(np, "ti,fuzzx", &val32))
> +		ts->fuzzx = val32;
> +
> +	if (!of_property_read_u32(np, "ti,fuzzy", &val32))
> +		ts->fuzzy = val32;
> +
> +	if (!of_property_read_u32(np, "ti,fuzzz", &val32))
> +		ts->fuzzz = val32;
> +
> +	if (!of_property_read_u64(np, "ti,poll-period", &val64))
> +		ts->poll_period = val64;
> +	else
> +		ts->poll_period = 1;
> +
> +	if (!of_property_read_u32(np, "ti,x-plate-ohms", &val32)) {
> +		ts->x_plate_ohms = val32;
> +	} else {
> +		dev_err(&client->dev,
> +			"Error: lacking ti,x-plate-ohms devicetree property. (err %d).",
> +			err);
>  		return -EINVAL;
>  	}
>  
> -	if (!i2c_check_functionality(client->adapter,
> -				     I2C_FUNC_SMBUS_READ_WORD_DATA))
> -		return -EIO;
> +	ts->gpio = of_get_gpio(np, 0);
> +	if (!gpio_is_valid(ts->gpio))
> +		dev_err(&client->dev,
> +			"GPIO not found (of_get_gpio returned %d)\n",
> +			ts->gpio);
>  
> -	ts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL);
> -	input_dev = input_allocate_device();
> -	if (!ts || !input_dev) {
> -		err = -ENOMEM;
> -		goto err_free_mem;
> -	}
> +	/* Used to detect if it is probed trough the device tree,
> +	 * in order to be able to use that information in the IRQ handler.
> +	 */
> +	ts->of = 1;
>  
> -	ts->client = client;
> -	ts->irq = client->irq;
> -	ts->input = input_dev;
> -	init_waitqueue_head(&ts->wait);
> +	return 0;
> +}
> +#else
> +static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts,
> +			    struct device_node *np)
> +{
> +	return -ENODEV;
> +}
> +#endif
> +
> +static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts,
> +			      struct tsc2007_platform_data *pdata,
> +			      const struct i2c_device_id *id)
> +{
> +	if (!pdata) {
> +		dev_err(&client->dev, "platform data is required!\n");
> +		return -EINVAL;
> +	}
>  
>  	ts->model             = pdata->model;
>  	ts->x_plate_ohms      = pdata->x_plate_ohms;
> @@ -309,13 +370,59 @@ static int tsc2007_probe(struct i2c_client *client,
>  	ts->poll_period       = pdata->poll_period ? : 1;
>  	ts->get_pendown_state = pdata->get_pendown_state;
>  	ts->clear_penirq      = pdata->clear_penirq;
> +	ts->fuzzx             = pdata->fuzzx;
> +	ts->fuzzy             = pdata->fuzzy;
> +	ts->fuzzz             = pdata->fuzzz;
>  
>  	if (pdata->x_plate_ohms == 0) {
>  		dev_err(&client->dev, "x_plate_ohms is not set up in platform data");
> -		err = -EINVAL;
> -		goto err_free_mem;
> +		return -EINVAL;
>  	}
>  
> +	/* Used to detect if it is probed trough the device tree,
> +	 * in order to be able to use that information in the IRQ handler.
> +	 */
> +	ts->of = 0;
> +
> +	return 0;
> +}
> +
> +static int tsc2007_probe(struct i2c_client *client,
> +			 const struct i2c_device_id *id)
> +{
> +	struct device_node *np = client->dev.of_node;
> +	struct tsc2007_platform_data *pdata = client->dev.platform_data;
> +	struct tsc2007 *ts;
> +	struct input_dev *input_dev;
> +	int err = 0;
> +
> +	ts = devm_kzalloc(&client->dev, sizeof(struct tsc2007), GFP_KERNEL);
> +	if (!ts)
> +		return -ENOMEM;
> +
> +	if (np)
> +		err = tsc2007_probe_dt(client, ts, np);
> +	else
> +		err = tsc2007_probe_pdev(client, ts, pdata, id);
> +
> +	if (err)
> +		return err;
> +
> +	if (!i2c_check_functionality(client->adapter,
> +				     I2C_FUNC_SMBUS_READ_WORD_DATA))
> +		return -EIO;
> +
> +	input_dev = input_allocate_device();
> +	if (!input_dev) {
> +		err = -ENOMEM;
> +		goto err_free_input;
> +	};
> +
> +	ts->client = client;
> +	ts->irq = client->irq;
> +	ts->input = input_dev;
> +	init_waitqueue_head(&ts->wait);
> +
>  	snprintf(ts->phys, sizeof(ts->phys),
>  		 "%s/input0", dev_name(&client->dev));
>  
> @@ -331,19 +438,21 @@ static int tsc2007_probe(struct i2c_client *client,
>  	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
>  	input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
>  
> -	input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, pdata->fuzzx, 0);
> -	input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, pdata->fuzzy, 0);
> +	input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, ts->fuzzx, 0);
> +	input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, ts->fuzzy, 0);
>  	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
> -			pdata->fuzzz, 0);
> +			     ts->fuzzz, 0);
>  
> -	if (pdata->init_platform_hw)
> -		pdata->init_platform_hw();
> +	if (!np) {
> +		if (pdata->init_platform_hw)
> +			pdata->init_platform_hw();
> +	}
>  
>  	err = request_threaded_irq(ts->irq, tsc2007_hard_irq, tsc2007_soft_irq,
>  				   IRQF_ONESHOT, client->dev.driver->name, ts);
>  	if (err < 0) {
>  		dev_err(&client->dev, "irq %d busy?\n", ts->irq);
> -		goto err_free_mem;
> +		goto err_free_input;
>  	}
>  
>  	tsc2007_stop(ts);
> @@ -358,23 +467,27 @@ static int tsc2007_probe(struct i2c_client *client,
>  
>   err_free_irq:
>  	free_irq(ts->irq, ts);
> -	if (pdata->exit_platform_hw)
> -		pdata->exit_platform_hw();
> - err_free_mem:
> +	if (!np) {
> +		if (pdata->exit_platform_hw)
> +			pdata->exit_platform_hw();
> +	}
> + err_free_input:
>  	input_free_device(input_dev);
> -	kfree(ts);
>  	return err;
>  }
>  
>  static int tsc2007_remove(struct i2c_client *client)
>  {
> +	struct device_node *np = client->dev.of_node;
>  	struct tsc2007	*ts = i2c_get_clientdata(client);
>  	struct tsc2007_platform_data *pdata = client->dev.platform_data;
>  
>  	free_irq(ts->irq, ts);
>  
> -	if (pdata->exit_platform_hw)
> -		pdata->exit_platform_hw();
> +	if (!np) {
> +		if (pdata->exit_platform_hw)
> +			pdata->exit_platform_hw();
> +	}
>  
>  	input_unregister_device(ts->input);
>  	kfree(ts);
> @@ -389,10 +502,19 @@ static const struct i2c_device_id tsc2007_idtable[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, tsc2007_idtable);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id tsc2007_of_match[] = {
> +	{ .compatible = "ti,tsc2007" },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, tsc2007_of_match);
> +#endif
> +
>  static struct i2c_driver tsc2007_driver = {
>  	.driver = {
>  		.owner	= THIS_MODULE,
> -		.name	= "tsc2007"
> +		.name	= "tsc2007",
> +		.of_match_table = of_match_ptr(tsc2007_of_match),
>  	},
>  	.id_table	= tsc2007_idtable,
>  	.probe		= tsc2007_probe,
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* Re: [PATCH 2/3] input: Introduce INPUT_PROP_MT
From: Dmitry Torokhov @ 2013-11-21  4:57 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Benjamin Tissoires, Jiri Kosina, David Herrmann, Henrik Rydberg,
	Antonio Ospite, simon, case, linux-input, linux-kernel
In-Reply-To: <1384983141-31019-3-git-send-email-benjamin.tissoires@redhat.com>

On Wed, Nov 20, 2013 at 04:32:20PM -0500, Benjamin Tissoires wrote:
> There may be a clash with devices presenting a lot of absolute axis
> (like the PS3 Sixaxis) and true multitouch devices. Both those kinds
> of devices may present some ABS_MT_* capabilities, so setting this
> property ensures user-space knows what to do with the input device.
> 

No, let's not use the same ABS_* values to mean different things and
define proper values instead.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 1/3] Only process ABS_MT_SLOT where there are slots available
From: Dmitry Torokhov @ 2013-11-21  4:56 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Benjamin Tissoires, Jiri Kosina, David Herrmann, Henrik Rydberg,
	Antonio Ospite, simon, case, linux-input, linux-kernel
In-Reply-To: <1384983141-31019-2-git-send-email-benjamin.tissoires@redhat.com>

Hi Benjamin, Antonio,

On Wed, Nov 20, 2013 at 04:32:19PM -0500, Benjamin Tissoires wrote:
> From: Antonio Ospite <ospite@studenti.unina.it>
> 
> This fixes the case when a non-multitouch device happens to have a HID
> code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad
> analog control.
> 
> Updated to latest tree by Benjamin Tissoires.

I do not think this is a proper way to address the issue. Generic HID
driver should not encroach onto multitouch ABS range and either stop
mapping absolute axis or map them properly.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [appleir] BUG: unable to handle kernel NULL pointer dereference
From: James Henstridge @ 2013-11-21  3:20 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Benjamin Tissoires, Luis Henriques, linux-kernel, linux-input,
	Fabien André, Bastien Nocera
In-Reply-To: <alpine.LNX.2.00.1311191533200.6657@pobox.suse.cz>

On Tue, Nov 19, 2013 at 10:33 PM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Thu, 7 Nov 2013, Benjamin Tissoires wrote:
>
>> >> [ adding some more CCs ]
>> >>
>> >> Okay, so apparently we didn't register with input, but only hiddev /
>> >> hidraw.
>> >>
>> >> appleir 0003:05AC:8240.0005: hiddev0,hidraw4: USB HID v1.11 Device [Apple Computer, Inc. IR Receiver] on usb-0000:00:1d.3-2/input0
>> >>
>> >> Therefore ->input_configured() callback has never been called, and thus we
>> >> oops due to appleir->input_dev being NULL when the first raw event is
>> >> reported.
>> >>
>> >> Could you please provide report descriptor of the device?
>> >>
>> >> The driver apparently relies on it being registered with hid-input, but
>> >> for some reason that doesn't happen.
>> >
>> > Here is the relevant lsusb output that I think contains what you're
>> > asking for (I had to unbind usbhid for it to include the descriptor):
>> >
>> > Bus 005 Device 003: ID 05ac:8240 Apple, Inc. Built-in IR Receiver
>> > Device Descriptor:
>> >   bLength                18
>> >   bDescriptorType         1
>> >   bcdUSB               2.00
>> > ...
>>
>> Ok, thanks for the report. Could you please test the following patch
>> which should solve your problem (hopefully)?
>
> James,
>
> any reults from testing Benjamin's patch, please?

Sorry for the delays in testing out the patch.  I have tried a kernel
with the patch applied, and can no longer reproduce the oops.  The
hid-appleir driver appears to be working correctly, generating key
press events in response to the remote, and LIRC functions correctly
via hiddev.

Thanks for the everyone's help with this.

James.

^ permalink raw reply

* Re: [PATCH 1/3] Only process ABS_MT_SLOT where there are slots available
From: simon @ 2013-11-21  1:45 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Benjamin Tissoires, Jiri Kosina, Dmitry Torokhov, David Herrmann,
	Henrik Rydberg, Antonio Ospite, simon, case, linux-input,
	linux-kernel
In-Reply-To: <1384983141-31019-2-git-send-email-benjamin.tissoires@redhat.com>

> From: Antonio Ospite <ospite@studenti.unina.it>
>
> This fixes the case when a non-multitouch device happens to have a HID
> code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad
> analog control.
>
> Updated to latest tree by Benjamin Tissoires.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Wow, its been a great week for the DualShock - got rumble and LED control,
and now I can confirm that the 'left D pad' analogue axis works.

Thanks guys,
Simon

tested-by: Simon Wood <simon@mungewell.org>


^ permalink raw reply

* [PATCH 2/3] Input: Fixed pressure and tool width calculation in BCM5974 multitouch driver
From: Friedrich Schöller @ 2013-11-20 22:54 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, linux-input
  Cc: linux-kernel, Friedrich Schöller
In-Reply-To: <1384988052-31898-1-git-send-email-linux@schoeller.se>

Previously ABS_PRESSURE and ABS_TOOL_WIDTH were calculated by looking at the
size of the first touch in the list reported by the trackpad. This is not
necessarily the same touch as the one used to perform pointer emulation in the
input multitouch library (input-mt). By using the sum of the sizes of all
touches as a basis for this calculation we get more coherent values.
---
 drivers/input/mouse/bcm5974.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index af15410..ecbf359 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -539,19 +539,10 @@ static void report_finger_data(struct input_dev *input,
 
 static void report_synaptics_data(struct input_dev *input,
 				  const struct bcm5974_config *cfg,
-				  const struct tp_finger *f, int raw_n)
+				  int p, int w)
 {
-	int abs_p = 0, abs_w = 0;
-
-	if (raw_n) {
-		int p = raw2int(f->touch_major);
-		int w = raw2int(f->tool_major);
-		if (p > 0 && raw2int(f->origin)) {
-			abs_p = clamp_val(256 * p / cfg->p.max, 0, 255);
-			abs_w = clamp_val(16 * w / cfg->w.max, 0, 15);
-		}
-	}
-
+	int abs_p = clamp_val(256 * p / cfg->p.max, 0, 255);
+	int abs_w = clamp_val(16 * w / cfg->w.max, 0, 15);
 	input_report_abs(input, ABS_PRESSURE, abs_p);
 	input_report_abs(input, ABS_TOOL_WIDTH, abs_w);
 }
@@ -562,7 +553,7 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 	const struct bcm5974_config *c = &dev->cfg;
 	const struct tp_finger *f;
 	struct input_dev *input = dev->input;
-	int raw_n, i, n = 0;
+	int raw_n, i, n = 0, p = 0, w = 0;
 
 	if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0)
 		return -EIO;
@@ -577,6 +568,8 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 		dev->pos[n].x = raw2int(f[i].abs_x);
 		dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y);
 		dev->index[n++] = &f[i];
+		p += raw2int(f[i].touch_major);
+		w += raw2int(f[i].tool_major);
 	}
 
 	input_mt_assign_slots(input, dev->slots, dev->pos, n);
@@ -587,7 +580,7 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 
 	input_mt_sync_frame(input);
 
-	report_synaptics_data(input, c, f, raw_n);
+	report_synaptics_data(input, c, p, w);
 
 	/* type 2 reports button events via ibt only */
 	if (c->tp_type == TYPE2) {
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 3/3] Input: Added thumb detection in BCM5974 multitouch driver
From: Friedrich Schöller @ 2013-11-20 22:54 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, linux-input
  Cc: linux-kernel, Friedrich Schöller
In-Reply-To: <1384988052-31898-1-git-send-email-linux@schoeller.se>

Trackpads with integrated buttons are hard to use when the driver responds to
movements of the thumb that is resting or clicking on the surface of the
trackpad. This patch adds rudimentary support to filter out these touch events.

The feature can be turned on via sysfs:
	/sys/class/input/input[0-9]+/thumb_ignore:
		Enables thumb detection
		Values: 0/1
	/sys/class/input/input[0-9]+/thumb_ratio_on:
		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
		times 100 is smaller than this value the touch qualifies
		as a thumb.
	/sys/class/input/input[0-9]+/thumb_ratio_off:
		When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR
		times 100 is bigger than this value the touch no longer
		qualifies as a thumb.
	/sys/class/input/input[0-9]+/thumb_y_on:
		When ABS_MT_POSITION_Y is bigger than this value the touch
		qualifies as a thumb.
	/sys/class/input/input[0-9]+/thumb_y_off:
		When ABS_MT_POSITION_Y is smaller than this value the touch
		no longer qualifies as a thumb.
---
 drivers/input/mouse/bcm5974.c | 150 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index ecbf359..826cdb4 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -259,6 +259,12 @@ struct bcm5974 {
 	const struct tp_finger *index[MAX_FINGERS];	/* finger index data */
 	struct input_mt_pos pos[MAX_FINGERS];		/* position array */
 	int slots[MAX_FINGERS];				/* slot assignments */
+	bool thb_ignore;		/* ignore thumb */
+	unsigned int thb_r_on;		/* ratio to start ignoring thumb */
+	unsigned int thb_r_off;		/* ratio to stop ignoring thumb */
+	int thb_y_on;			/* y coord. to start ignoring thumb */
+	int thb_y_off;			/* y coord. to stop ignoring thumb */
+	bool thb_found;			/* thumb detected */
 };
 
 /* logical signal quality */
@@ -554,6 +560,7 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 	const struct tp_finger *f;
 	struct input_dev *input = dev->input;
 	int raw_n, i, n = 0, p = 0, w = 0;
+	int thb_r = 0, thb_y = 0;
 
 	if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0)
 		return -EIO;
@@ -562,11 +569,30 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 	f = (const struct tp_finger *)(dev->tp_data + c->tp_offset);
 	raw_n = (size - c->tp_offset) / SIZEOF_FINGER;
 
+	if (dev->thb_ignore) {
+		if (dev->thb_found) {
+			thb_r = dev->thb_r_off;
+			thb_y = dev->thb_y_off;
+		} else {
+			thb_r = dev->thb_r_on;
+			thb_y = dev->thb_y_on;
+		}
+		dev->thb_found = false;
+	}
+
 	for (i = 0; i < raw_n; i++) {
 		if (raw2int(f[i].touch_major) == 0)
 			continue;
 		dev->pos[n].x = raw2int(f[i].abs_x);
 		dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y);
+
+		if (dev->thb_ignore && thb_y < dev->pos[n].y &&
+		    thb_r * 2 * raw2int(f[i].touch_major) >
+		    100 * c->touch_minor_f * raw2int(f[i].touch_minor)) {
+			dev->thb_found = true;
+			continue;
+		}
+
 		dev->index[n++] = &f[i];
 		p += raw2int(f[i].touch_major);
 		w += raw2int(f[i].tool_major);
@@ -596,6 +622,118 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 	return 0;
 }
 
+static ssize_t bcm5974_thb_ignore_show(struct device *dev,
+				       struct device_attribute *attr, char *buf)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", bcm5974_dev->thb_ignore);
+}
+
+static ssize_t bcm5974_thb_ignore_store(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t count)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	int val;
+
+	unsigned int error = kstrtoint(buf, 10, &val);
+	if (error)
+		return error;
+
+	bcm5974_dev->thb_ignore = !!val;
+	bcm5974_dev->thb_found = false;
+
+	return count;
+}
+
+static ssize_t bcm5974_thb_r_on_show(struct device *dev,
+				     struct device_attribute *attr, char *buf)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	return scnprintf(buf, PAGE_SIZE, "%d%%\n", bcm5974_dev->thb_r_on);
+}
+
+static ssize_t bcm5974_thb_r_on_store(struct device *dev,
+				      struct device_attribute *attr,
+				      const char *buf, size_t count)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	unsigned int error = kstrtouint(buf, 10, &bcm5974_dev->thb_r_on);
+	return error ? error : count;
+}
+
+static ssize_t bcm5974_thb_r_off_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	return scnprintf(buf, PAGE_SIZE, "%d%%\n", bcm5974_dev->thb_r_off);
+}
+
+static ssize_t bcm5974_thb_r_off_store(struct device *dev,
+				       struct device_attribute *attr,
+				       const char *buf, size_t count)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	unsigned int error = kstrtouint(buf, 10, &bcm5974_dev->thb_r_off);
+	return error ? error : count;
+}
+
+static ssize_t bcm5974_thb_y_on_show(struct device *dev,
+				     struct device_attribute *attr, char *buf)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", bcm5974_dev->thb_y_on);
+}
+
+static ssize_t bcm5974_thb_y_on_store(struct device *dev,
+				      struct device_attribute *attr,
+				      const char *buf, size_t count)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	int error = kstrtoint(buf, 10, &bcm5974_dev->thb_y_on);
+	return error ? error : count;
+}
+
+static ssize_t bcm5974_thb_y_off_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", bcm5974_dev->thb_y_off);
+}
+
+static ssize_t bcm5974_thb_y_off_store(struct device *dev,
+				       struct device_attribute *attr,
+				       const char *buf, size_t count)
+{
+	struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev);
+	int error = kstrtoint(buf, 10, &bcm5974_dev->thb_y_off);
+	return error ? error : count;
+}
+
+static DEVICE_ATTR(thumb_ignore, 0664, bcm5974_thb_ignore_show,
+		   bcm5974_thb_ignore_store);
+static DEVICE_ATTR(thumb_ratio_on, 0664, bcm5974_thb_r_on_show,
+		   bcm5974_thb_r_on_store);
+static DEVICE_ATTR(thumb_ratio_off, 0664, bcm5974_thb_r_off_show,
+		   bcm5974_thb_r_off_store);
+static DEVICE_ATTR(thumb_y_on, 0664, bcm5974_thb_y_on_show,
+		   bcm5974_thb_y_on_store);
+static DEVICE_ATTR(thumb_y_off, 0664, bcm5974_thb_y_off_show,
+		   bcm5974_thb_y_off_store);
+
+static struct attribute *bcm5974_attributes[] = {
+	&dev_attr_thumb_ignore.attr,
+	&dev_attr_thumb_ratio_on.attr,
+	&dev_attr_thumb_ratio_off.attr,
+	&dev_attr_thumb_y_on.attr,
+	&dev_attr_thumb_y_off.attr,
+	NULL
+};
+
+static const struct attribute_group bcm5974_attr_group = {
+	.attrs = bcm5974_attributes,
+};
+
 /* Wellspring initialization constants */
 #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID		1
 #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID	9
@@ -880,6 +1018,11 @@ static int bcm5974_probe(struct usb_interface *iface,
 	dev->cfg = *cfg;
 	mutex_init(&dev->pm_mutex);
 
+	dev->thb_r_on  = 40;
+	dev->thb_r_off = 60;
+	dev->thb_y_on  = (cfg->y.max - cfg->y.min) * 0.75 + cfg->y.min;
+	dev->thb_y_off = (cfg->y.max - cfg->y.min) * 0.73 + cfg->y.min;
+
 	/* setup urbs */
 	if (cfg->tp_type == TYPE1) {
 		dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -941,8 +1084,14 @@ static int bcm5974_probe(struct usb_interface *iface,
 	/* save our data pointer in this interface device */
 	usb_set_intfdata(iface, dev);
 
+	error = sysfs_create_group(&input_dev->dev.kobj, &bcm5974_attr_group);
+	if (error)
+		goto err_unregister_input;
+
 	return 0;
 
+err_unregister_input:
+	input_unregister_device(dev->input);
 err_free_buffer:
 	usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
 		dev->tp_data, dev->tp_urb->transfer_dma);
@@ -967,6 +1116,7 @@ static void bcm5974_disconnect(struct usb_interface *iface)
 
 	usb_set_intfdata(iface, NULL);
 
+	sysfs_remove_group(&dev->input->dev.kobj, &bcm5974_attr_group);
 	input_unregister_device(dev->input);
 	usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
 			  dev->tp_data, dev->tp_urb->transfer_dma);
-- 
1.8.4.2

^ permalink raw reply related

* [PATCH 1/3] Input: Fixed ABS_MT_TOUCH_MINOR scale factor in BCM5974 multitouch driver
From: Friedrich Schöller @ 2013-11-20 22:54 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, linux-input
  Cc: linux-kernel, Friedrich Schöller

On wellspring3 devices ABS_MT_TOUCH_MINOR was sometimes reported bigger than
ABS_MT_TOUCH_MAJOR. This is fixed by rescaling ABS_MT_TOUCH_MINOR by a factor of
0.85 instead of 2. Excessive tapping on the trackpad shows this to be the right
value. Circular touches should now lead to values for ABS_MT_TOUCH_MAJOR and
ABS_MT_TOUCH_MINOR that are similar, with ABS_MT_TOUCH_MINOR never greater than
ABS_MT_TOUCH_MAJOR.
---
 drivers/input/mouse/bcm5974.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index a73f961..af15410 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -235,6 +235,7 @@ struct bcm5974_config {
 	enum tp_type tp_type;	/* type of trackpad interface */
 	int tp_offset;		/* offset to trackpad finger data */
 	int tp_datalen;		/* data length of the trackpad interface */
+	float touch_minor_f;	/* factor for ABS_MT_TOUCH_MINOR */
 	struct bcm5974_param p;	/* finger pressure limits */
 	struct bcm5974_param w;	/* finger width limits */
 	struct bcm5974_param x;	/* horizontal limits */
@@ -275,6 +276,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		0,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 256 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4824, 5342 },
@@ -288,6 +290,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		0,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 256 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4824, 4824 },
@@ -301,6 +304,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		0.85,
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4460, 5166 },
@@ -314,6 +318,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4620, 5140 },
@@ -327,6 +332,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4616, 5112 },
@@ -340,6 +346,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4415, 5050 },
@@ -353,6 +360,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4620, 5140 },
@@ -366,6 +374,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4750, 5280 },
@@ -379,6 +388,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4620, 5140 },
@@ -392,6 +402,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4750, 5280 },
@@ -405,6 +416,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0x84, sizeof(struct bt_data),
 		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4750, 5280 },
@@ -418,6 +430,7 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		HAS_INTEGRATED_BUTTON,
 		0, sizeof(struct bt_data),
 		0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS,
+		2, /* verify me! */
 		{ SN_PRESSURE, 0, 300 },
 		{ SN_WIDTH, 0, 2048 },
 		{ SN_COORD, -4620, 5140 },
@@ -502,7 +515,8 @@ static int report_bt_state(struct bcm5974 *dev, int size)
 	return 0;
 }
 
-static void report_finger_data(struct input_dev *input, int slot,
+static void report_finger_data(struct input_dev *input,
+			       const struct bcm5974_config *cfg, int slot,
 			       const struct input_mt_pos *pos,
 			       const struct tp_finger *f)
 {
@@ -512,7 +526,7 @@ static void report_finger_data(struct input_dev *input, int slot,
 	input_report_abs(input, ABS_MT_TOUCH_MAJOR,
 			 raw2int(f->touch_major) << 1);
 	input_report_abs(input, ABS_MT_TOUCH_MINOR,
-			 raw2int(f->touch_minor) << 1);
+			 raw2int(f->touch_minor) * cfg->touch_minor_f);
 	input_report_abs(input, ABS_MT_WIDTH_MAJOR,
 			 raw2int(f->tool_major) << 1);
 	input_report_abs(input, ABS_MT_WIDTH_MINOR,
@@ -568,7 +582,7 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 	input_mt_assign_slots(input, dev->slots, dev->pos, n);
 
 	for (i = 0; i < n; i++)
-		report_finger_data(input, dev->slots[i],
+		report_finger_data(input, c, dev->slots[i],
 				   &dev->pos[i], dev->index[i]);
 
 	input_mt_sync_frame(input);
-- 
1.8.4.2

^ permalink raw reply related

* [PATCH 3/3] input: reintroduce filtering of mt axis when the device is not multitouch
From: Benjamin Tissoires @ 2013-11-20 21:32 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Dmitry Torokhov, David Herrmann,
	Henrik Rydberg, Antonio Ospite, simon, case, linux-input,
	linux-kernel
In-Reply-To: <1384983141-31019-1-git-send-email-benjamin.tissoires@redhat.com>

Some devices (like the PS3 Sixaxis) have a lot of absolute axis which
are mapped by hid-input on ABS_MISC and beyond. These axis interfere
with the multitouch protocol.
The kernel considers those device to be following the multitouch protocol
A, and removes the filtering of such events.

We can rely on INPUT_PROP_MT to know if the device is multitouch or not,
and then rely on mt to know if the device uses the protocol B.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 Documentation/input/multi-touch-protocol.txt | 3 ++-
 drivers/input/input.c                        | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt
index 420444f..b476845 100644
--- a/Documentation/input/multi-touch-protocol.txt
+++ b/Documentation/input/multi-touch-protocol.txt
@@ -55,7 +55,8 @@ surface. The order in which the packets appear in the event stream is not
 important.  Event filtering and finger tracking is left to user space [3].
 
 Note that type A device are requested to manually set the property
-INPUT_PROP_MT.
+INPUT_PROP_MT. If this property is not set, the absolute multitouch axis
+will be statefull, so this step is now mandatory.
 Type B devices does not need to set INPUT_PROP_MT manually, as this is done
 by calling input_mt_init_slot().
 
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1198785..239639e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -224,7 +224,8 @@ static int input_handle_abs_event(struct input_dev *dev,
 		return INPUT_IGNORE_EVENT;
 	}
 
-	is_mt_event = input_is_mt_value(code);
+	is_mt_event = test_bit(INPUT_PROP_MT, dev->propbit) &&
+			input_is_mt_value(code);
 
 	if (!is_mt_event) {
 		pold = &dev->absinfo[code].value;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 0/3] Fixes for multitouch / generic gamepads interaction
From: Benjamin Tissoires @ 2013-11-20 21:32 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Dmitry Torokhov, David Herrmann,
	Henrik Rydberg, Antonio Ospite, simon, case, linux-input,
	linux-kernel

Hi guys,

I have been reported recently a problem with the Sixaxis controller
(http://www.spinics.net/lists/linux-input/msg28098.html).
The root of the problem comes from hid-input, which maps unknown axis to
ABS_MISC. However, when an event code is already in use, hid-input uses the one
after, leading to uses of ABS_MISC + N, where N is the number of unknown axis.

We are encountering a problem with the multitouch protocol here because if a
device has more than 7 unknown axis (which is the case for the PS3 Sixaxis
controller), then the unknown axis get maps to ABS_MT_SLOT and beyond.

This infers two problems:
- the axis currently mapped on ABS_MT_SLOT is a special case in the kernel,
and it is not updated
- the axis after ABS_MT_SLOT are not filtered anymore, as the kernel things
the device is using a multitouch protocol A.

The patch 0001 solves the first problem, whereas the patches 0002 and 0003
fix the second. Bonus point: the userspace is now correctly notified that one of
the multitouch protocols is in used, so it does not have to rely on bad designed
heuristics.

Cheers,
Benjamin

Antonio Ospite (1):
  Only process ABS_MT_SLOT where there are slots available

Benjamin Tissoires (2):
  input: Introduce INPUT_PROP_MT
  input: reintroduce filtering of mt axis when the device is not
    multitouch

 Documentation/input/event-codes.txt          | 7 +++++++
 Documentation/input/multi-touch-protocol.txt | 6 ++++++
 drivers/hid/hid-ntrig.c                      | 1 +
 drivers/input/input-mt.c                     | 2 ++
 drivers/input/input.c                        | 7 ++++---
 drivers/input/touchscreen/auo-pixcir-ts.c    | 1 +
 drivers/input/touchscreen/bu21013_ts.c       | 1 +
 drivers/input/touchscreen/pixcir_i2c_ts.c    | 1 +
 drivers/input/touchscreen/st1232.c           | 1 +
 include/uapi/linux/input.h                   | 1 +
 10 files changed, 25 insertions(+), 3 deletions(-)

-- 
1.8.3.1


^ permalink raw reply

* [PATCH 2/3] input: Introduce INPUT_PROP_MT
From: Benjamin Tissoires @ 2013-11-20 21:32 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Dmitry Torokhov, David Herrmann,
	Henrik Rydberg, Antonio Ospite, simon, case, linux-input,
	linux-kernel
In-Reply-To: <1384983141-31019-1-git-send-email-benjamin.tissoires@redhat.com>

There may be a clash with devices presenting a lot of absolute axis
(like the PS3 Sixaxis) and true multitouch devices. Both those kinds
of devices may present some ABS_MT_* capabilities, so setting this
property ensures user-space knows what to do with the input device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 Documentation/input/event-codes.txt          | 7 +++++++
 Documentation/input/multi-touch-protocol.txt | 5 +++++
 drivers/hid/hid-ntrig.c                      | 1 +
 drivers/input/input-mt.c                     | 2 ++
 drivers/input/touchscreen/auo-pixcir-ts.c    | 1 +
 drivers/input/touchscreen/bu21013_ts.c       | 1 +
 drivers/input/touchscreen/pixcir_i2c_ts.c    | 1 +
 drivers/input/touchscreen/st1232.c           | 1 +
 include/uapi/linux/input.h                   | 1 +
 9 files changed, 20 insertions(+)

diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt
index f1ea2c6..b54feb3 100644
--- a/Documentation/input/event-codes.txt
+++ b/Documentation/input/event-codes.txt
@@ -281,6 +281,13 @@ gestures can normally be extracted from it.
 If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT
 device.
 
+INPUT_PROP_MT:
+-------------
+There may be a clash with devices presenting a lot of absolute axis (like the
+PS3 Sixaxis) and true multitouch devices. Both those kinds of devices may
+present some ABS_MT_* capabilities, so setting this property ensures user-space
+knows what to do with the input device.
+
 Guidelines:
 ==========
 The guidelines below ensure proper single-touch and multi-finger functionality.
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt
index de139b1..420444f 100644
--- a/Documentation/input/multi-touch-protocol.txt
+++ b/Documentation/input/multi-touch-protocol.txt
@@ -54,6 +54,11 @@ enumeration of the full set of anonymous contacts currently on the
 surface. The order in which the packets appear in the event stream is not
 important.  Event filtering and finger tracking is left to user space [3].
 
+Note that type A device are requested to manually set the property
+INPUT_PROP_MT.
+Type B devices does not need to set INPUT_PROP_MT manually, as this is done
+by calling input_mt_init_slot().
+
 For type B devices, the kernel driver should associate a slot with each
 identified contact, and use that slot to propagate changes for the contact.
 Creation, replacement and destruction of contacts is achieved by modifying
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 600f207..6dedc64 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -879,6 +879,7 @@ static void ntrig_input_configured(struct hid_device *hid,
 		__clear_bit(BTN_TOOL_FINGER, input->keybit);
 		__clear_bit(BTN_0, input->keybit);
 		__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
+		__set_bit(INPUT_PROP_MT, input->propbit);
 		/*
 		 * The physical touchscreen (single touch)
 		 * input has a value for physical, whereas
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index d398f13..f9b70e7 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -58,6 +58,8 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
 	input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
 	input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);
 
+	__set_bit(INPUT_PROP_MT, dev->propbit);
+
 	if (flags & (INPUT_MT_POINTER | INPUT_MT_DIRECT)) {
 		__set_bit(EV_KEY, dev->evbit);
 		__set_bit(BTN_TOUCH, dev->keybit);
diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c
index d3f9f6b..70836cd 100644
--- a/drivers/input/touchscreen/auo-pixcir-ts.c
+++ b/drivers/input/touchscreen/auo-pixcir-ts.c
@@ -594,6 +594,7 @@ static int auo_pixcir_probe(struct i2c_client *client,
 	input_set_abs_params(input_dev, ABS_Y, 0, pdata->y_max, 0, 0);
 
 	/* For multi touch */
+	__set_bit(INPUT_PROP_MT, input_dev->propbit);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0,
 			     pdata->x_max, 0, 0);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0,
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index b9b5dda..4ce6220 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -573,6 +573,7 @@ static int bu21013_probe(struct i2c_client *client,
 	__set_bit(EV_SYN, in_dev->evbit);
 	__set_bit(EV_KEY, in_dev->evbit);
 	__set_bit(EV_ABS, in_dev->evbit);
+	__set_bit(INPUT_PROP_MT, in_dev->propbit);
 
 	input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0,
 						pdata->touch_x_max, 0, 0);
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 6cc6b36..72154e4 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -157,6 +157,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 	__set_bit(EV_KEY, input->evbit);
 	__set_bit(EV_ABS, input->evbit);
 	__set_bit(BTN_TOUCH, input->keybit);
+	__set_bit(INPUT_PROP_MT, input->propbit);
 	input_set_abs_params(input, ABS_X, 0, pdata->x_max, 0, 0);
 	input_set_abs_params(input, ABS_Y, 0, pdata->y_max, 0, 0);
 	input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0);
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 2f03b2f..2f17045 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -205,6 +205,7 @@ static int st1232_ts_probe(struct i2c_client *client,
 	__set_bit(EV_SYN, input_dev->evbit);
 	__set_bit(EV_KEY, input_dev->evbit);
 	__set_bit(EV_ABS, input_dev->evbit);
+	__set_bit(INPUT_PROP_MT, input_dev->propbit);
 
 	input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_X, MIN_X, MAX_X, 0, 0);
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index a372627..b469cae 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -164,6 +164,7 @@ struct input_keymap_entry {
 #define INPUT_PROP_DIRECT		0x01	/* direct input devices */
 #define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
 #define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+#define INPUT_PROP_MT			0x04	/* multitouch devices */
 
 #define INPUT_PROP_MAX			0x1f
 #define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
-- 
1.8.3.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox