public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Input: imx6ul_tsc - set glitch threshold by dts property
@ 2025-09-15 19:53 Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 3/6] dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property Dario Binacchi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dario Binacchi @ 2025-09-15 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Frank Li, linux-amarula, Dario Binacchi, Conor Dooley,
	Dmitry Torokhov, Fabio Estevam, Haibo Chen, Javier Carrasco,
	Jeff LaBundy, Krzysztof Kozlowski, Michael Trimarchi,
	Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
	devicetree, imx, linux-arm-kernel, linux-input

The series allows setting the glitch threshold for the detected signal
from a DTS property instead of a hardcoded value.
In addition, I applied a patch that replaces opencoded masking and
shifting, with BIT(), GENMASK(), FIELD_GET() and FIELD_PREP() macros.

Changes in v3:
- Remove the final part of the description that refers to
  implementation details in fsl,imx6ul-tsc.yaml.

Changes in v2:
- Replace patch ("dt-bindings: input: touchscreen: fsl,imx6ul-tsc: add
  fsl,glitch-threshold") with ("dt-bindings: touchscreen: add
  touchscreen-glitch-threshold-ns property"), making the previous property
  general by moving it to touchscreen.yaml.
- Rework "Input: imx6ul_tsc - set glitch threshold by DTS property" patch
  to match changes made to the DTS property.
- Move "Input: imx6ul_tsc - use BIT, FIELD_{GET,PREP} and GENMASK macros"
  patch right after the patch fixing the typo.

Dario Binacchi (5):
  Input: imx6ul_tsc - use BIT, FIELD_{GET,PREP} and GENMASK macros
  dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property
  dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold
  ARM: dts: imx6ull-engicam-microgea-bmm: set touchscreen glitch
    threshold
  Input: imx6ul_tsc - set glitch threshold by DTS property

Michael Trimarchi (1):
  Input: imx6ul_tsc - fix typo in register name

 .../input/touchscreen/fsl,imx6ul-tsc.yaml     |  12 ++
 .../input/touchscreen/touchscreen.yaml        |   4 +
 .../nxp/imx/imx6ull-engicam-microgea-bmm.dts  |   1 +
 drivers/input/touchscreen/imx6ul_tsc.c        | 122 +++++++++++-------
 4 files changed, 95 insertions(+), 44 deletions(-)

-- 
2.43.0

base-commit: f83ec76bf285bea5727f478a68b894f5543ca76e
branch: tsc_de_glitch

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

* [PATCH v3 3/6] dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property
  2025-09-15 19:53 [PATCH v3 0/6] Input: imx6ul_tsc - set glitch threshold by dts property Dario Binacchi
@ 2025-09-15 19:53 ` Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 5/6] ARM: dts: imx6ull-engicam-microgea-bmm: set touchscreen glitch threshold Dario Binacchi
  2 siblings, 0 replies; 7+ messages in thread
From: Dario Binacchi @ 2025-09-15 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Frank Li, linux-amarula, Dario Binacchi, Conor Dooley,
	Dmitry Torokhov, Javier Carrasco, Jeff LaBundy,
	Krzysztof Kozlowski, Rob Herring, devicetree, linux-input

Add support for glitch threshold configuration. A detected signal is valid
only if it lasts longer than the set threshold; otherwise, it is regarded
as a glitch.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

(no changes since v2)

Changes in v2:
- Added in v2.

 .../devicetree/bindings/input/touchscreen/touchscreen.yaml    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
index 3e3572aa483a..a60b4d08620d 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
@@ -206,6 +206,10 @@ properties:
 
         unevaluatedProperties: false
 
+  touchscreen-glitch-threshold-ns:
+    description: Minimum duration in nanoseconds a signal must remain stable
+      to be considered valid.
+
 dependencies:
   touchscreen-size-x: [ touchscreen-size-y ]
   touchscreen-size-y: [ touchscreen-size-x ]
-- 
2.43.0


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

* [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold
  2025-09-15 19:53 [PATCH v3 0/6] Input: imx6ul_tsc - set glitch threshold by dts property Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 3/6] dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property Dario Binacchi
@ 2025-09-15 19:53 ` Dario Binacchi
  2025-09-16 15:55   ` Frank Li
  2025-09-15 19:53 ` [PATCH v3 5/6] ARM: dts: imx6ull-engicam-microgea-bmm: set touchscreen glitch threshold Dario Binacchi
  2 siblings, 1 reply; 7+ messages in thread
From: Dario Binacchi @ 2025-09-15 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Frank Li, linux-amarula, Dario Binacchi, Conor Dooley,
	Dmitry Torokhov, Fabio Estevam, Haibo Chen, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
	devicetree, imx, linux-arm-kernel, linux-input

Support the touchscreen-glitch-threshold-ns property. Unlike the
generic description in touchscreen.yaml, this controller maps the
provided value to one of four discrete thresholds internally.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

Changes in v3:
- Remove the final part of the description that refers to
  implementation details.

 .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
index 678756ad0f92..6214d8be5a99 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
@@ -62,6 +62,18 @@ properties:
     description: Number of data samples which are averaged for each read.
     enum: [ 1, 4, 8, 16, 32 ]
 
+  touchscreen-glitch-threshold-ns:
+    description: |
+      Unlike the generic property defined in touchscreen.yaml, this
+      controller does not allow arbitrary values. Internally the value is
+      converted to IPG clock cycles and mapped to one of four discrete
+      thresholds exposed by the TSC_DEBUG_MODE2 register:
+
+        0: 8191 IPG cycles
+        1: 4095 IPG cycles
+        2: 2047 IPG cycles
+        3: 1023 IPG cycles
+
 required:
   - compatible
   - reg
-- 
2.43.0


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

* [PATCH v3 5/6] ARM: dts: imx6ull-engicam-microgea-bmm: set touchscreen glitch threshold
  2025-09-15 19:53 [PATCH v3 0/6] Input: imx6ul_tsc - set glitch threshold by dts property Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 3/6] dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property Dario Binacchi
  2025-09-15 19:53 ` [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold Dario Binacchi
@ 2025-09-15 19:53 ` Dario Binacchi
  2 siblings, 0 replies; 7+ messages in thread
From: Dario Binacchi @ 2025-09-15 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Frank Li, linux-amarula, Dario Binacchi, Conor Dooley,
	Fabio Estevam, Krzysztof Kozlowski, Pengutronix Kernel Team,
	Rob Herring, Sascha Hauer, Shawn Guo, devicetree, imx,
	linux-arm-kernel

This way the detected signal is valid only if it lasts longer than
62 µs, otherwise it is not sampled.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

(no changes since v1)

 arch/arm/boot/dts/nxp/imx/imx6ull-engicam-microgea-bmm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/nxp/imx/imx6ull-engicam-microgea-bmm.dts b/arch/arm/boot/dts/nxp/imx/imx6ull-engicam-microgea-bmm.dts
index 279d46c22cd7..f12084d8f2a0 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6ull-engicam-microgea-bmm.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx6ull-engicam-microgea-bmm.dts
@@ -154,6 +154,7 @@ &tsc {
 	pinctrl-0 = <&pinctrl_tsc>;
 	measure-delay-time = <0x9ffff>;
 	pre-charge-time = <0xfff>;
+	touchscreen-glitch-threshold-ns = <62000>;
 	xnur-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
 	status = "okay";
 };
-- 
2.43.0


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

* Re: [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold
  2025-09-15 19:53 ` [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold Dario Binacchi
@ 2025-09-16 15:55   ` Frank Li
  2025-09-16 19:25     ` Conor Dooley
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2025-09-16 15:55 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: linux-kernel, linux-amarula, Conor Dooley, Dmitry Torokhov,
	Fabio Estevam, Haibo Chen, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
	devicetree, imx, linux-arm-kernel, linux-input

On Mon, Sep 15, 2025 at 09:53:06PM +0200, Dario Binacchi wrote:
> Support the touchscreen-glitch-threshold-ns property. Unlike the
> generic description in touchscreen.yaml, this controller maps the
> provided value to one of four discrete thresholds internally.
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>
> ---
>
> Changes in v3:
> - Remove the final part of the description that refers to
>   implementation details.
>
>  .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml   | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> index 678756ad0f92..6214d8be5a99 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> @@ -62,6 +62,18 @@ properties:
>      description: Number of data samples which are averaged for each read.
>      enum: [ 1, 4, 8, 16, 32 ]
>
> +  touchscreen-glitch-threshold-ns:
> +    description: |
> +      Unlike the generic property defined in touchscreen.yaml, this
> +      controller does not allow arbitrary values. Internally the value is
> +      converted to IPG clock cycles and mapped to one of four discrete
> +      thresholds exposed by the TSC_DEBUG_MODE2 register:
> +
> +        0: 8191 IPG cycles
> +        1: 4095 IPG cycles
> +        2: 2047 IPG cycles
> +        3: 1023 IPG cycles
> +

You have to use ns here. You can caculate in driver to match to closed one.

Frank

>  required:
>    - compatible
>    - reg
> --
> 2.43.0
>

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

* Re: [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold
  2025-09-16 15:55   ` Frank Li
@ 2025-09-16 19:25     ` Conor Dooley
  2025-09-16 19:27       ` Conor Dooley
  0 siblings, 1 reply; 7+ messages in thread
From: Conor Dooley @ 2025-09-16 19:25 UTC (permalink / raw)
  To: Frank Li
  Cc: Dario Binacchi, linux-kernel, linux-amarula, Conor Dooley,
	Dmitry Torokhov, Fabio Estevam, Haibo Chen, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
	devicetree, imx, linux-arm-kernel, linux-input

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

On Tue, Sep 16, 2025 at 11:55:17AM -0400, Frank Li wrote:
> On Mon, Sep 15, 2025 at 09:53:06PM +0200, Dario Binacchi wrote:
> > Support the touchscreen-glitch-threshold-ns property. Unlike the
> > generic description in touchscreen.yaml, this controller maps the
> > provided value to one of four discrete thresholds internally.
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >
> > ---
> >
> > Changes in v3:
> > - Remove the final part of the description that refers to
> >   implementation details.
> >
> >  .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml   | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > index 678756ad0f92..6214d8be5a99 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > @@ -62,6 +62,18 @@ properties:
> >      description: Number of data samples which are averaged for each read.
> >      enum: [ 1, 4, 8, 16, 32 ]
> >
> > +  touchscreen-glitch-threshold-ns:
> > +    description: |
> > +      Unlike the generic property defined in touchscreen.yaml, this
> > +      controller does not allow arbitrary values. Internally the value is
> > +      converted to IPG clock cycles and mapped to one of four discrete
> > +      thresholds exposed by the TSC_DEBUG_MODE2 register:
> > +
> > +        0: 8191 IPG cycles
> > +        1: 4095 IPG cycles
> > +        2: 2047 IPG cycles
> > +        3: 1023 IPG cycles
> > +
> 
> You have to use ns here. You can caculate in driver to match to closed one.

That is what he is saying it is doing - "internally the value is
converted to IPG clock cycles" and so on. Your repeated misunderstanding
of this though points out that maybe the description is still lacking?

Dario, how about:
| The gitch threshold in nanoseconds. Drivers must convert this value to
| IPG clock cycles and map it to one of the four discrete thresholds
| exposed by the TSC_DEBUG_MODE2 register:
| 
|         0: 8191 IPG cycles
|         1: 4095 IPG cycles
|         2: 2047 IPG cycles
|         3: 1023 IPG cycles
? 
I dropped the bit about arbitrary values, due to my comment on the other
version a few mins ago.

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

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

* Re: [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold
  2025-09-16 19:25     ` Conor Dooley
@ 2025-09-16 19:27       ` Conor Dooley
  0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2025-09-16 19:27 UTC (permalink / raw)
  To: Frank Li
  Cc: Dario Binacchi, linux-kernel, linux-amarula, Conor Dooley,
	Dmitry Torokhov, Fabio Estevam, Haibo Chen, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
	devicetree, imx, linux-arm-kernel, linux-input

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

On Tue, Sep 16, 2025 at 08:25:53PM +0100, Conor Dooley wrote:
> On Tue, Sep 16, 2025 at 11:55:17AM -0400, Frank Li wrote:
> > On Mon, Sep 15, 2025 at 09:53:06PM +0200, Dario Binacchi wrote:
> > > Support the touchscreen-glitch-threshold-ns property. Unlike the
> > > generic description in touchscreen.yaml, this controller maps the
> > > provided value to one of four discrete thresholds internally.
> > >
> > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > >
> > > ---
> > >
> > > Changes in v3:
> > > - Remove the final part of the description that refers to
> > >   implementation details.
> > >
> > >  .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml   | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > > index 678756ad0f92..6214d8be5a99 100644
> > > --- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > > @@ -62,6 +62,18 @@ properties:
> > >      description: Number of data samples which are averaged for each read.
> > >      enum: [ 1, 4, 8, 16, 32 ]
> > >
> > > +  touchscreen-glitch-threshold-ns:
> > > +    description: |
> > > +      Unlike the generic property defined in touchscreen.yaml, this
> > > +      controller does not allow arbitrary values. Internally the value is
> > > +      converted to IPG clock cycles and mapped to one of four discrete
> > > +      thresholds exposed by the TSC_DEBUG_MODE2 register:
> > > +
> > > +        0: 8191 IPG cycles
> > > +        1: 4095 IPG cycles
> > > +        2: 2047 IPG cycles
> > > +        3: 1023 IPG cycles
> > > +
> > 
> > You have to use ns here. You can caculate in driver to match to closed one.
> 
> That is what he is saying it is doing - "internally the value is
> converted to IPG clock cycles" and so on. Your repeated misunderstanding
> of this though points out that maybe the description is still lacking?
> 
> Dario, how about:
> | The gitch threshold in nanoseconds. Drivers must convert this value to

Or maybe instead of what I did here for the first sentence, yoink the text
from [3/6] instead and re-use it.

> | IPG clock cycles and map it to one of the four discrete thresholds
> | exposed by the TSC_DEBUG_MODE2 register:
> | 
> |         0: 8191 IPG cycles
> |         1: 4095 IPG cycles
> |         2: 2047 IPG cycles
> |         3: 1023 IPG cycles
> ? 
> I dropped the bit about arbitrary values, due to my comment on the other
> version a few mins ago.



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

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

end of thread, other threads:[~2025-09-16 19:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15 19:53 [PATCH v3 0/6] Input: imx6ul_tsc - set glitch threshold by dts property Dario Binacchi
2025-09-15 19:53 ` [PATCH v3 3/6] dt-bindings: touchscreen: add touchscreen-glitch-threshold-ns property Dario Binacchi
2025-09-15 19:53 ` [PATCH v3 4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold Dario Binacchi
2025-09-16 15:55   ` Frank Li
2025-09-16 19:25     ` Conor Dooley
2025-09-16 19:27       ` Conor Dooley
2025-09-15 19:53 ` [PATCH v3 5/6] ARM: dts: imx6ull-engicam-microgea-bmm: set touchscreen glitch threshold Dario Binacchi

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