linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements
@ 2021-11-07 11:22 Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 1/6] input: ti_am335x_tsc: set ADCREFM for X configuration Dario Binacchi
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi, Rob Herring, devicetree


This series grew out of a touchscreen validation activity on a custom
board. Oscilloscope measurements and driver source analysis led to these
patches.

Added Rob Herring 'Acked-by' tag to commit "dt-bindings: input:
ti-tsc-adc: fix tsc node example".



Dario Binacchi (6):
  input: ti_am335x_tsc: set ADCREFM for X configuration
  input: ti_am335x_tsc: fix STEPCONFIG setup for Z2
  input: ti_am335x_tsc: lower the X and Y sampling time
  dt-bindings: input: ti-tsc-adc: fix tsc node example
  mfd: ti_am335x_tscadc: fix reading a tsc property from DT
  mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro

 .../bindings/input/touchscreen/ti-tsc-adc.txt  |  2 +-
 drivers/input/touchscreen/ti_am335x_tsc.c      | 18 +++++++++++++-----
 drivers/mfd/ti_am335x_tscadc.c                 |  7 ++++++-
 include/linux/mfd/ti_am335x_tscadc.h           |  1 -
 4 files changed, 20 insertions(+), 8 deletions(-)

-- 
2.17.1


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

* [RESEND PATCH 1/6] input: ti_am335x_tsc: set ADCREFM for X configuration
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 2/6] input: ti_am335x_tsc: fix STEPCONFIG setup for Z2 Dario Binacchi
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi

As reported by the STEPCONFIG[1-16] registered field descriptions of the
TI reference manual, for the ADC "in single ended, SEL_INM_SWC_3_0 must
be 1xxx".

Unlike the Y and Z coordinates, this bit has not been set for the step
configuration registers used to sample the X coordinate.

Fixes: 1b8be32e691 ("Input: add support for TI Touchscreen controller")
Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/input/touchscreen/ti_am335x_tsc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 83e685557a19..fd3ffdd23470 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -131,7 +131,8 @@ static void titsc_step_config(struct titsc *ts_dev)
 	u32 stepenable;
 
 	config = STEPCONFIG_MODE_HWSYNC |
-			STEPCONFIG_AVG_16 | ts_dev->bit_xp;
+			STEPCONFIG_AVG_16 | ts_dev->bit_xp |
+			STEPCONFIG_INM_ADCREFM;
 	switch (ts_dev->wires) {
 	case 4:
 		config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn;
-- 
2.17.1


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

* [RESEND PATCH 2/6] input: ti_am335x_tsc: fix STEPCONFIG setup for Z2
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 1/6] input: ti_am335x_tsc: set ADCREFM for X configuration Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 3/6] input: ti_am335x_tsc: lower the X and Y sampling time Dario Binacchi
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi

The Z2 step configuration doesn't erase the SEL_INP_SWC_3_0 bit-field
before setting the ADC channel. This way its value could be corrupted by
the ADC channel selected for the Z1 coordinate.

Fixes: 8c896308fea ("input: ti_am335x_adc: use only FIFO0 and clean up a little")
Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/input/touchscreen/ti_am335x_tsc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index fd3ffdd23470..cfc943423241 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -196,7 +196,10 @@ static void titsc_step_config(struct titsc *ts_dev)
 			STEPCONFIG_OPENDLY);
 
 	end_step++;
-	config |= STEPCONFIG_INP(ts_dev->inp_yn);
+	config = STEPCONFIG_MODE_HWSYNC |
+			STEPCONFIG_AVG_16 | ts_dev->bit_yp |
+			ts_dev->bit_xn | STEPCONFIG_INM_ADCREFM |
+			STEPCONFIG_INP(ts_dev->inp_yn);
 	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
 	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
 			STEPCONFIG_OPENDLY);
-- 
2.17.1


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

* [RESEND PATCH 3/6] input: ti_am335x_tsc: lower the X and Y sampling time
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 1/6] input: ti_am335x_tsc: set ADCREFM for X configuration Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 2/6] input: ti_am335x_tsc: fix STEPCONFIG setup for Z2 Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 4/6] dt-bindings: input: ti-tsc-adc: fix tsc node example Dario Binacchi
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi

The open delay time has to be applied only on the first sample of the
X/Y coordinates because on the following samples the ADC channel is not
changed. Removing this time from the samples after the first one,
"ti,coordinate-readouts" greater than 1, decreases the total acquisition
time, allowing to increase the number of acquired coordinates in the time
unit.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/input/touchscreen/ti_am335x_tsc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index cfc943423241..f4ef218bc1b8 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -126,7 +126,7 @@ static int titsc_config_wires(struct titsc *ts_dev)
 static void titsc_step_config(struct titsc *ts_dev)
 {
 	unsigned int	config;
-	int i;
+	int i, n;
 	int end_step, first_step, tsc_steps;
 	u32 stepenable;
 
@@ -151,9 +151,11 @@ static void titsc_step_config(struct titsc *ts_dev)
 	first_step = TOTAL_STEPS - tsc_steps;
 	/* Steps 16 to 16-coordinate_readouts is for X */
 	end_step = first_step + tsc_steps;
+	n = 0;
 	for (i = end_step - ts_dev->coordinate_readouts; i < end_step; i++) {
 		titsc_writel(ts_dev, REG_STEPCONFIG(i), config);
-		titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY);
+		titsc_writel(ts_dev, REG_STEPDELAY(i),
+			     n++ == 0 ? STEPCONFIG_OPENDLY : 0);
 	}
 
 	config = 0;
@@ -175,9 +177,11 @@ static void titsc_step_config(struct titsc *ts_dev)
 
 	/* 1 ... coordinate_readouts is for Y */
 	end_step = first_step + ts_dev->coordinate_readouts;
+	n = 0;
 	for (i = first_step; i < end_step; i++) {
 		titsc_writel(ts_dev, REG_STEPCONFIG(i), config);
-		titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY);
+		titsc_writel(ts_dev, REG_STEPDELAY(i),
+			     n++ == 0 ? STEPCONFIG_OPENDLY : 0);
 	}
 
 	/* Make CHARGECONFIG same as IDLECONFIG */
-- 
2.17.1


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

* [RESEND PATCH 4/6] dt-bindings: input: ti-tsc-adc: fix tsc node example
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
                   ` (2 preceding siblings ...)
  2021-11-07 11:22 ` [RESEND PATCH 3/6] input: ti_am335x_tsc: lower the X and Y sampling time Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 5/6] mfd: ti_am335x_tscadc: fix reading a tsc property from DT Dario Binacchi
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi, Rob Herring, devicetree

The commit c9aeb249bf72e ("Input: ti_am335x_tsc - fix spelling mistake
in TSC/ADC DT binding") didn't fix the typo mistake in the tsc node of
the example.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Acked-by: Rob Herring <robh@kernel.org>
---

 .../devicetree/bindings/input/touchscreen/ti-tsc-adc.txt        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index aad5e34965eb..2013fd7c4a10 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -77,7 +77,7 @@ Example:
 		tsc {
 			ti,wires = <4>;
 			ti,x-plate-resistance = <200>;
-			ti,coordiante-readouts = <5>;
+			ti,coordinate-readouts = <5>;
 			ti,wire-config = <0x00 0x11 0x22 0x33>;
 			ti,charge-delay = <0x400>;
 		};
-- 
2.17.1


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

* [RESEND PATCH 5/6] mfd: ti_am335x_tscadc: fix reading a tsc property from DT
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
                   ` (3 preceding siblings ...)
  2021-11-07 11:22 ` [RESEND PATCH 4/6] dt-bindings: input: ti-tsc-adc: fix tsc node example Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-07 11:22 ` [RESEND PATCH 6/6] mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro Dario Binacchi
  2021-11-24 15:53 ` [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Lee Jones
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi

There was a spelling mistake on TSC/ADC binding where "coordinate" was
spelled as "coordiante".

As done by commit c9aeb249bf72 ("Input: ti_am335x_tsc - fix spelling
mistake in TSC/ADC DT binding"), "the approach taken was to first use
correct spelling and if that fails, fall back to miss-spelled version".

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 drivers/mfd/ti_am335x_tscadc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 55adc379f94b..53b7a8b7f571 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -141,7 +141,12 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 
 	node = of_get_child_by_name(pdev->dev.of_node, "tsc");
 	of_property_read_u32(node, "ti,wires", &tsc_wires);
-	of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
+	/*
+	 * Try with the new binding first. If it fails, try again with
+	 * bogus, miss-spelled version.
+	 */
+	if (of_property_read_u32(node, "ti,coordinate-readouts", &readouts))
+		of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
 
 	node = of_get_child_by_name(pdev->dev.of_node, "adc");
 	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
-- 
2.17.1


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

* [RESEND PATCH 6/6] mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
                   ` (4 preceding siblings ...)
  2021-11-07 11:22 ` [RESEND PATCH 5/6] mfd: ti_am335x_tscadc: fix reading a tsc property from DT Dario Binacchi
@ 2021-11-07 11:22 ` Dario Binacchi
  2021-11-24 15:53 ` [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Lee Jones
  6 siblings, 0 replies; 8+ messages in thread
From: Dario Binacchi @ 2021-11-07 11:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Lee Jones, Rachna Patil, Sebastian Andrzej Siewior,
	Dmitry Torokhov, Dario Binacchi

In TI's reference manual description for the `AFE_Pen_Ctrl' bit-field
of the TSC's CTRL register, there is no mention of 8-wire touchscreens.
Even commit f0933a60d190 ("mfd: ti_am335x_tscadc: Update logic in CTRL
register for 5-wire TS") says that the value of this bit-field must be
the same for 4-wire and 8-wire touchscreens. So let's remove the
CNTRLREG_8WIRE macro to avoid misunderstandings.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---

 include/linux/mfd/ti_am335x_tscadc.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index ffc091b77633..155b2ab13bf8 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -126,7 +126,6 @@
 #define CNTRLREG_AFE_CTRL(val)	((val) << 5)
 #define CNTRLREG_4WIRE		CNTRLREG_AFE_CTRL(1)
 #define CNTRLREG_5WIRE		CNTRLREG_AFE_CTRL(2)
-#define CNTRLREG_8WIRE		CNTRLREG_AFE_CTRL(3)
 #define CNTRLREG_TSCENB		BIT(7)
 
 /* FIFO READ Register */
-- 
2.17.1


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

* Re: [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements
  2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
                   ` (5 preceding siblings ...)
  2021-11-07 11:22 ` [RESEND PATCH 6/6] mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro Dario Binacchi
@ 2021-11-24 15:53 ` Lee Jones
  6 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2021-11-24 15:53 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: linux-kernel, linux-input, Rachna Patil,
	Sebastian Andrzej Siewior, Dmitry Torokhov, Rob Herring,
	devicetree

On Sun, 07 Nov 2021, Dario Binacchi wrote:

> 
> This series grew out of a touchscreen validation activity on a custom
> board. Oscilloscope measurements and driver source analysis led to these
> patches.
> 
> Added Rob Herring 'Acked-by' tag to commit "dt-bindings: input:
> ti-tsc-adc: fix tsc node example".
> 
> 
> 
> Dario Binacchi (6):
>   input: ti_am335x_tsc: set ADCREFM for X configuration
>   input: ti_am335x_tsc: fix STEPCONFIG setup for Z2
>   input: ti_am335x_tsc: lower the X and Y sampling time
>   dt-bindings: input: ti-tsc-adc: fix tsc node example
>   mfd: ti_am335x_tscadc: fix reading a tsc property from DT
>   mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro
> 
>  .../bindings/input/touchscreen/ti-tsc-adc.txt  |  2 +-
>  drivers/input/touchscreen/ti_am335x_tsc.c      | 18 +++++++++++++-----
>  drivers/mfd/ti_am335x_tscadc.c                 |  7 ++++++-
>  include/linux/mfd/ti_am335x_tscadc.h           |  1 -
>  4 files changed, 20 insertions(+), 8 deletions(-)

You're going to need to rebase this set onto v5.16-rc1.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2021-11-24 15:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-07 11:22 [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 1/6] input: ti_am335x_tsc: set ADCREFM for X configuration Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 2/6] input: ti_am335x_tsc: fix STEPCONFIG setup for Z2 Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 3/6] input: ti_am335x_tsc: lower the X and Y sampling time Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 4/6] dt-bindings: input: ti-tsc-adc: fix tsc node example Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 5/6] mfd: ti_am335x_tscadc: fix reading a tsc property from DT Dario Binacchi
2021-11-07 11:22 ` [RESEND PATCH 6/6] mfd: ti_am335x_tscadc: drop the CNTRLREG_8WIRE macro Dario Binacchi
2021-11-24 15:53 ` [RESEND PATCH 0/6] input: touchscreen: am335x: fix and improvements Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).