All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix tsc2007 to report ABS_PRESSURE correctly
@ 2017-02-20 16:56 H. Nikolaus Schaller
  2017-02-20 16:56 ` [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does H. Nikolaus Schaller
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-20 16:56 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, H. Nikolaus Schaller,
	Jonathan Cameron, sre
  Cc: linux-input, devicetree, linux-kernel, letux-kernel

tsc2007 reports the touch resistance as ABS_PRESSURE, which jumps
to its maximum for light touch and goes down for increasing pressure.
This is not consistent with other touch drivers and not what one would
expect.

Additionally the name of the function tsc2007_calculate_pressure()
is misleading since the formula calculates an estimate for the touch
screen resistance. So it is renamed without changing the function.

While this patch changes the values reported to userspace,
ABS_PRESSURE is used rarely by userspace. Most software only
relies on BTN_TOUCH (boolean), which is not affected by this
patch. Some graphics software makes use of the interface and
does not work correctly with the currently used inverted
behaviour.

Note: this patch series assumes to be merged after

	"Input: tsc2007 - add iio interface to read external ADC input and temperature"

because that one renames tsc2007.c to tsc2007_core.c

H. Nikolaus Schaller (3):
  Input: tsc2007 - rename function tsc2007_calculate_pressure to
    tsc2007_calculate_resistance     because that is what it does
  Input: tsc2007 - correctly report pressure and not resistance to user
    space
  Input: tsc2007 - add a property "ti,report-resistance" to restore the
    old pressure reporting state     if needed.

 .../devicetree/bindings/input/touchscreen/tsc2007.txt      |  2 ++
 drivers/input/touchscreen/tsc2007.h                        |  1 +
 drivers/input/touchscreen/tsc2007_core.c                   | 14 ++++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.7.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does
  2017-02-20 16:56 [PATCH 0/3] Fix tsc2007 to report ABS_PRESSURE correctly H. Nikolaus Schaller
@ 2017-02-20 16:56 ` H. Nikolaus Schaller
  2017-02-23  8:45   ` Dmitry Torokhov
  2017-02-20 16:56   ` H. Nikolaus Schaller
  2017-02-20 16:56 ` [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed H. Nikolaus Schaller
  2 siblings, 1 reply; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-20 16:56 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, H. Nikolaus Schaller,
	Jonathan Cameron, sre
  Cc: linux-input, devicetree, linux-kernel, letux-kernel

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 98dbefc..30b53ca 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -68,7 +68,7 @@ static void tsc2007_read_values(struct tsc2007 *tsc, struct ts_event *tc)
 	tsc2007_xfer(tsc, PWRDOWN);
 }
 
-u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
+u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc)
 {
 	u32 rt = 0;
 
@@ -77,7 +77,7 @@ u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
 		tc->x = 0;
 
 	if (likely(tc->x && tc->z1)) {
-		/* compute touch pressure resistance using equation #1 */
+		/* compute touch resistance using equation #1 */
 		rt = tc->z2 - tc->z1;
 		rt *= tc->x;
 		rt *= tsc->x_plate_ohms;
@@ -125,7 +125,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 		tsc2007_read_values(ts, &tc);
 		mutex_unlock(&ts->mlock);
 
-		rt = tsc2007_calculate_pressure(ts, &tc);
+		rt = tsc2007_calculate_resistance(ts, &tc);
 
 		if (!rt && !ts->get_pendown_state) {
 			/*
@@ -138,7 +138,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 
 		if (rt <= ts->max_rt) {
 			dev_dbg(&ts->client->dev,
-				"DOWN point(%4d,%4d), pressure (%4u)\n",
+				"DOWN point(%4d,%4d), resistance (%4u)\n",
 				tc.x, tc.y, rt);
 
 			input_report_key(input, BTN_TOUCH, 1);
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
@ 2017-02-20 16:56   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-20 16:56 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, H. Nikolaus Schaller,
	Jonathan Cameron, sre
  Cc: linux-input, devicetree, linux-kernel, letux-kernel

previously, tsc2007 will report as ABS_PRESSURE:
0              for no pressure (resistance infinite)
high value     for soft pressure (high resistance)
low value      for firm pressure (lower resistance)

This does not matter for most applications (e.g. GUI, Menu, Scrolling
etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
to detect screen taps.

Only some special graphics applications read the pressure channel and
they will be mixed up by this non-monotonic relation.

So we fix it to become:
0              for no pressure (resistance infinite)
low value      for soft pressure (high resistance)
high value     for firm pressure (lower resistance)

While this patch changes the values reported to userspace,
ABS_PRESSURE is used rarely by userspace. Most software only
relies on BTN_TOUCH (boolean), which is not affected by this
patch. Some graphics software makes use of the interface and
does not work correctly with the currently used inverted
behaviour.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 30b53ca..fc73849 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 				"DOWN point(%4d,%4d), resistance (%4u)\n",
 				tc.x, tc.y, rt);
 
+			rt = ts->max_rt - rt;
+
 			input_report_key(input, BTN_TOUCH, 1);
 			input_report_abs(input, ABS_X, tc.x);
 			input_report_abs(input, ABS_Y, tc.y);
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
@ 2017-02-20 16:56   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-20 16:56 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, H. Nikolaus Schaller,
	Jonathan Cameron, sre-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	letux-kernel-S0jZdbWzriLCfDggNXIi3w

previously, tsc2007 will report as ABS_PRESSURE:
0              for no pressure (resistance infinite)
high value     for soft pressure (high resistance)
low value      for firm pressure (lower resistance)

This does not matter for most applications (e.g. GUI, Menu, Scrolling
etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
to detect screen taps.

Only some special graphics applications read the pressure channel and
they will be mixed up by this non-monotonic relation.

So we fix it to become:
0              for no pressure (resistance infinite)
low value      for soft pressure (high resistance)
high value     for firm pressure (lower resistance)

While this patch changes the values reported to userspace,
ABS_PRESSURE is used rarely by userspace. Most software only
relies on BTN_TOUCH (boolean), which is not affected by this
patch. Some graphics software makes use of the interface and
does not work correctly with the currently used inverted
behaviour.

Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
---
 drivers/input/touchscreen/tsc2007_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 30b53ca..fc73849 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 				"DOWN point(%4d,%4d), resistance (%4u)\n",
 				tc.x, tc.y, rt);
 
+			rt = ts->max_rt - rt;
+
 			input_report_key(input, BTN_TOUCH, 1);
 			input_report_abs(input, ABS_X, tc.x);
 			input_report_abs(input, ABS_Y, tc.y);
-- 
2.7.3

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed.
  2017-02-20 16:56 [PATCH 0/3] Fix tsc2007 to report ABS_PRESSURE correctly H. Nikolaus Schaller
  2017-02-20 16:56 ` [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does H. Nikolaus Schaller
  2017-02-20 16:56   ` H. Nikolaus Schaller
@ 2017-02-20 16:56 ` H. Nikolaus Schaller
  2017-02-21 11:07   ` Pavel Machek
  2 siblings, 1 reply; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-20 16:56 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, H. Nikolaus Schaller,
	Jonathan Cameron, sre
  Cc: linux-input, devicetree, linux-kernel, letux-kernel

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt | 2 ++
 drivers/input/touchscreen/tsc2007.h                             | 1 +
 drivers/input/touchscreen/tsc2007_core.c                        | 6 +++++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
index ec365e1..9b686af 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
@@ -14,6 +14,8 @@ Optional properties:
 - interrupts: (gpio) interrupt to which the chip is connected
   (see interrupt binding[0]).
 - ti,max-rt: maximum pressure.
+- ti,report-resistance: report resistance (no pressure = max_rt) instead
+  of pressure (no pressure = 0).
 - 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.
diff --git a/drivers/input/touchscreen/tsc2007.h b/drivers/input/touchscreen/tsc2007.h
index 474bd29..81baabb 100644
--- a/drivers/input/touchscreen/tsc2007.h
+++ b/drivers/input/touchscreen/tsc2007.h
@@ -66,6 +66,7 @@ struct tsc2007 {
 
 	u16			model;
 	u16			x_plate_ohms;
+	bool			report_resistance;
 	u16			max_rt;
 	unsigned long		poll_period; /* in jiffies */
 	int			fuzzx;
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index fc73849..984710f 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -141,7 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 				"DOWN point(%4d,%4d), resistance (%4u)\n",
 				tc.x, tc.y, rt);
 
-			rt = ts->max_rt - rt;
+			if (!ts->report_resistance)
+				rt = ts->max_rt - rt;
 
 			input_report_key(input, BTN_TOUCH, 1);
 			input_report_abs(input, ABS_X, tc.x);
@@ -248,6 +249,9 @@ static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts)
 	else
 		ts->max_rt = MAX_12BIT;
 
+	ts->report_resistance =
+		of_property_read_bool(np, "ti,report-resistance");
+
 	if (!of_property_read_u32(np, "ti,fuzzx", &val32))
 		ts->fuzzx = val32;
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed.
  2017-02-20 16:56 ` [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed H. Nikolaus Schaller
@ 2017-02-21 11:07   ` Pavel Machek
  2017-02-21 11:43       ` H. Nikolaus Schaller
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2017-02-21 11:07 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Jonathan Cameron,
	sre, linux-input, devicetree, linux-kernel, letux-kernel

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

On Mon 2017-02-20 17:56:36, H. Nikolaus Schaller wrote:
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

No. device tree is for hardware description, not kernel configuration.

									Pavel
									
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed.
  2017-02-21 11:07   ` Pavel Machek
@ 2017-02-21 11:43       ` H. Nikolaus Schaller
  0 siblings, 0 replies; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-21 11:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Jonathan Cameron,
	sre, linux-input, devicetree, linux-kernel, letux-kernel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

Hi Pavel,

> Am 21.02.2017 um 12:07 schrieb Pavel Machek <pavel@ucw.cz>:
> 
> On Mon 2017-02-20 17:56:36, H. Nikolaus Schaller wrote:
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> 
> No. device tree is for hardware description, not kernel configuration.

Yes, I agree. A new Kernel CONFIG would be better in this case.
I just did copy&paste from the old patch set without thinking that far.

Would

CONFIG_TSC2007_REPORT_RAW_RESISTANCE_AS_PRESSURE

be ok?

BR and thanks,
Nikolaus


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed.
@ 2017-02-21 11:43       ` H. Nikolaus Schaller
  0 siblings, 0 replies; 14+ messages in thread
From: H. Nikolaus Schaller @ 2017-02-21 11:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Jonathan Cameron,
	sre-DgEjT+Ai2ygdnm+yROfE0A, linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	letux-kernel-S0jZdbWzriLCfDggNXIi3w

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Hi Pavel,

> Am 21.02.2017 um 12:07 schrieb Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>:
> 
> On Mon 2017-02-20 17:56:36, H. Nikolaus Schaller wrote:
>> Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
> 
> No. device tree is for hardware description, not kernel configuration.

Yes, I agree. A new Kernel CONFIG would be better in this case.
I just did copy&paste from the old patch set without thinking that far.

Would

CONFIG_TSC2007_REPORT_RAW_RESISTANCE_AS_PRESSURE

be ok?

BR and thanks,
Nikolaus


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
@ 2017-02-21 17:13     ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-02-21 17:13 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Jonathan Cameron,
	linux-input, devicetree, linux-kernel, letux-kernel

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

Hi,

On Mon, Feb 20, 2017 at 05:56:35PM +0100, H. Nikolaus Schaller wrote:
> previously, tsc2007 will report as ABS_PRESSURE:
> 0              for no pressure (resistance infinite)
> high value     for soft pressure (high resistance)
> low value      for firm pressure (lower resistance)
> 
> This does not matter for most applications (e.g. GUI, Menu, Scrolling
> etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
> to detect screen taps.
> 
> Only some special graphics applications read the pressure channel and
> they will be mixed up by this non-monotonic relation.
> 
> So we fix it to become:
> 0              for no pressure (resistance infinite)
> low value      for soft pressure (high resistance)
> high value     for firm pressure (lower resistance)
> 
> While this patch changes the values reported to userspace,
> ABS_PRESSURE is used rarely by userspace. Most software only
> relies on BTN_TOUCH (boolean), which is not affected by this
> patch. Some graphics software makes use of the interface and
> does not work correctly with the currently used inverted
> behaviour.
> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/input/touchscreen/tsc2007_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> index 30b53ca..fc73849 100644
> --- a/drivers/input/touchscreen/tsc2007_core.c
> +++ b/drivers/input/touchscreen/tsc2007_core.c
> @@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>  				"DOWN point(%4d,%4d), resistance (%4u)\n",
>  				tc.x, tc.y, rt);
>  
> +			rt = ts->max_rt - rt;
> +
>  			input_report_key(input, BTN_TOUCH, 1);
>  			input_report_abs(input, ABS_X, tc.x);
>  			input_report_abs(input, ABS_Y, tc.y);

Reviewed-By: Sebastian Reichel <sre@kernel.org>

We should add the same to ts200x-core.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
@ 2017-02-21 17:13     ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-02-21 17:13 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Jonathan Cameron,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	letux-kernel-S0jZdbWzriLCfDggNXIi3w

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

Hi,

On Mon, Feb 20, 2017 at 05:56:35PM +0100, H. Nikolaus Schaller wrote:
> previously, tsc2007 will report as ABS_PRESSURE:
> 0              for no pressure (resistance infinite)
> high value     for soft pressure (high resistance)
> low value      for firm pressure (lower resistance)
> 
> This does not matter for most applications (e.g. GUI, Menu, Scrolling
> etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
> to detect screen taps.
> 
> Only some special graphics applications read the pressure channel and
> they will be mixed up by this non-monotonic relation.
> 
> So we fix it to become:
> 0              for no pressure (resistance infinite)
> low value      for soft pressure (high resistance)
> high value     for firm pressure (lower resistance)
> 
> While this patch changes the values reported to userspace,
> ABS_PRESSURE is used rarely by userspace. Most software only
> relies on BTN_TOUCH (boolean), which is not affected by this
> patch. Some graphics software makes use of the interface and
> does not work correctly with the currently used inverted
> behaviour.
> 
> Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
> ---
>  drivers/input/touchscreen/tsc2007_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> index 30b53ca..fc73849 100644
> --- a/drivers/input/touchscreen/tsc2007_core.c
> +++ b/drivers/input/touchscreen/tsc2007_core.c
> @@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>  				"DOWN point(%4d,%4d), resistance (%4u)\n",
>  				tc.x, tc.y, rt);
>  
> +			rt = ts->max_rt - rt;
> +
>  			input_report_key(input, BTN_TOUCH, 1);
>  			input_report_abs(input, ABS_X, tc.x);
>  			input_report_abs(input, ABS_Y, tc.y);

Reviewed-By: Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

We should add the same to ts200x-core.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed.
  2017-02-21 11:43       ` H. Nikolaus Schaller
  (?)
@ 2017-02-21 17:19       ` Sebastian Reichel
  -1 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2017-02-21 17:19 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Pavel Machek, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Jonathan Cameron, linux-input, devicetree, linux-kernel,
	letux-kernel

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Hi,

On Tue, Feb 21, 2017 at 12:43:28PM +0100, H. Nikolaus Schaller wrote:
> > Am 21.02.2017 um 12:07 schrieb Pavel Machek <pavel@ucw.cz>:
> > On Mon 2017-02-20 17:56:36, H. Nikolaus Schaller wrote:
> >> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> > 
> > No. device tree is for hardware description, not kernel configuration.
> 
> Yes, I agree. A new Kernel CONFIG would be better in this case.
> I just did copy&paste from the old patch set without thinking that far.
> 
> Would
> 
> CONFIG_TSC2007_REPORT_RAW_RESISTANCE_AS_PRESSURE
> 
> be ok?

I guess either a CONFIG or a module parameter may be used to provide
the previous (broken) behaviour. I suggest to ignore the problem
until its reported, though. There is a high chance, that nobody will
notice the change at all / nobody needs the compat layer.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does
  2017-02-20 16:56 ` [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does H. Nikolaus Schaller
@ 2017-02-23  8:45   ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2017-02-23  8:45 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Rob Herring, Mark Rutland, Jonathan Cameron, sre, linux-input,
	devicetree, linux-kernel, letux-kernel

On Mon, Feb 20, 2017 at 05:56:34PM +0100, H. Nikolaus Schaller wrote:
>p Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2007_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> index 98dbefc..30b53ca 100644
> --- a/drivers/input/touchscreen/tsc2007_core.c
> +++ b/drivers/input/touchscreen/tsc2007_core.c
> @@ -68,7 +68,7 @@ static void tsc2007_read_values(struct tsc2007 *tsc, struct ts_event *tc)
>  	tsc2007_xfer(tsc, PWRDOWN);
>  }
>  
> -u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
> +u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc)
>  {
>  	u32 rt = 0;
>  
> @@ -77,7 +77,7 @@ u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc)
>  		tc->x = 0;
>  
>  	if (likely(tc->x && tc->z1)) {
> -		/* compute touch pressure resistance using equation #1 */
> +		/* compute touch resistance using equation #1 */
>  		rt = tc->z2 - tc->z1;
>  		rt *= tc->x;
>  		rt *= tsc->x_plate_ohms;
> @@ -125,7 +125,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>  		tsc2007_read_values(ts, &tc);
>  		mutex_unlock(&ts->mlock);
>  
> -		rt = tsc2007_calculate_pressure(ts, &tc);
> +		rt = tsc2007_calculate_resistance(ts, &tc);
>  
>  		if (!rt && !ts->get_pendown_state) {
>  			/*
> @@ -138,7 +138,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
>  
>  		if (rt <= ts->max_rt) {
>  			dev_dbg(&ts->client->dev,
> -				"DOWN point(%4d,%4d), pressure (%4u)\n",
> +				"DOWN point(%4d,%4d), resistance (%4u)\n",
>  				tc.x, tc.y, rt);
>  
>  			input_report_key(input, BTN_TOUCH, 1);
> -- 
> 2.7.3
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
  2017-02-21 17:13     ` Sebastian Reichel
@ 2017-02-23  8:45       ` Dmitry Torokhov
  -1 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2017-02-23  8:45 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: H. Nikolaus Schaller, Rob Herring, Mark Rutland,
	Jonathan Cameron, linux-input, devicetree, linux-kernel,
	letux-kernel

On Tue, Feb 21, 2017 at 06:13:32PM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Feb 20, 2017 at 05:56:35PM +0100, H. Nikolaus Schaller wrote:
> > previously, tsc2007 will report as ABS_PRESSURE:
> > 0              for no pressure (resistance infinite)
> > high value     for soft pressure (high resistance)
> > low value      for firm pressure (lower resistance)
> > 
> > This does not matter for most applications (e.g. GUI, Menu, Scrolling
> > etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
> > to detect screen taps.
> > 
> > Only some special graphics applications read the pressure channel and
> > they will be mixed up by this non-monotonic relation.
> > 
> > So we fix it to become:
> > 0              for no pressure (resistance infinite)
> > low value      for soft pressure (high resistance)
> > high value     for firm pressure (lower resistance)
> > 
> > While this patch changes the values reported to userspace,
> > ABS_PRESSURE is used rarely by userspace. Most software only
> > relies on BTN_TOUCH (boolean), which is not affected by this
> > patch. Some graphics software makes use of the interface and
> > does not work correctly with the currently used inverted
> > behaviour.
> > 
> > Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> > ---
> >  drivers/input/touchscreen/tsc2007_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> > index 30b53ca..fc73849 100644
> > --- a/drivers/input/touchscreen/tsc2007_core.c
> > +++ b/drivers/input/touchscreen/tsc2007_core.c
> > @@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
> >  				"DOWN point(%4d,%4d), resistance (%4u)\n",
> >  				tc.x, tc.y, rt);
> >  
> > +			rt = ts->max_rt - rt;
> > +
> >  			input_report_key(input, BTN_TOUCH, 1);
> >  			input_report_abs(input, ABS_X, tc.x);
> >  			input_report_abs(input, ABS_Y, tc.y);
> 
> Reviewed-By: Sebastian Reichel <sre@kernel.org>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space
@ 2017-02-23  8:45       ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2017-02-23  8:45 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: H. Nikolaus Schaller, Rob Herring, Mark Rutland,
	Jonathan Cameron, linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	letux-kernel-S0jZdbWzriLCfDggNXIi3w

On Tue, Feb 21, 2017 at 06:13:32PM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Feb 20, 2017 at 05:56:35PM +0100, H. Nikolaus Schaller wrote:
> > previously, tsc2007 will report as ABS_PRESSURE:
> > 0              for no pressure (resistance infinite)
> > high value     for soft pressure (high resistance)
> > low value      for firm pressure (lower resistance)
> > 
> > This does not matter for most applications (e.g. GUI, Menu, Scrolling
> > etc.) where the ABS_PRESSURE is ignored and only BTN_TOUCH is processed
> > to detect screen taps.
> > 
> > Only some special graphics applications read the pressure channel and
> > they will be mixed up by this non-monotonic relation.
> > 
> > So we fix it to become:
> > 0              for no pressure (resistance infinite)
> > low value      for soft pressure (high resistance)
> > high value     for firm pressure (lower resistance)
> > 
> > While this patch changes the values reported to userspace,
> > ABS_PRESSURE is used rarely by userspace. Most software only
> > relies on BTN_TOUCH (boolean), which is not affected by this
> > patch. Some graphics software makes use of the interface and
> > does not work correctly with the currently used inverted
> > behaviour.
> > 
> > Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
> > ---
> >  drivers/input/touchscreen/tsc2007_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
> > index 30b53ca..fc73849 100644
> > --- a/drivers/input/touchscreen/tsc2007_core.c
> > +++ b/drivers/input/touchscreen/tsc2007_core.c
> > @@ -141,6 +141,8 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
> >  				"DOWN point(%4d,%4d), resistance (%4u)\n",
> >  				tc.x, tc.y, rt);
> >  
> > +			rt = ts->max_rt - rt;
> > +
> >  			input_report_key(input, BTN_TOUCH, 1);
> >  			input_report_abs(input, ABS_X, tc.x);
> >  			input_report_abs(input, ABS_Y, tc.y);
> 
> Reviewed-By: Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Applied, thank you.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-02-23  8:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 16:56 [PATCH 0/3] Fix tsc2007 to report ABS_PRESSURE correctly H. Nikolaus Schaller
2017-02-20 16:56 ` [PATCH 1/3] Input: tsc2007 - rename function tsc2007_calculate_pressure to tsc2007_calculate_resistance because that is what it does H. Nikolaus Schaller
2017-02-23  8:45   ` Dmitry Torokhov
2017-02-20 16:56 ` [PATCH 2/3] Input: tsc2007 - correctly report pressure and not resistance to user space H. Nikolaus Schaller
2017-02-20 16:56   ` H. Nikolaus Schaller
2017-02-21 17:13   ` Sebastian Reichel
2017-02-21 17:13     ` Sebastian Reichel
2017-02-23  8:45     ` Dmitry Torokhov
2017-02-23  8:45       ` Dmitry Torokhov
2017-02-20 16:56 ` [PATCH 3/3] Input: tsc2007 - add a property "ti,report-resistance" to restore the old pressure reporting state if needed H. Nikolaus Schaller
2017-02-21 11:07   ` Pavel Machek
2017-02-21 11:43     ` H. Nikolaus Schaller
2017-02-21 11:43       ` H. Nikolaus Schaller
2017-02-21 17:19       ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.