[v4,4/6] dt-bindings: touchscreen: fsl,imx6ul-tsc: support glitch thresold

Message ID 20250917080534.1772202-5-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • Input: imx6ul_tsc - set glitch threshold by dts property
Related show

Commit Message

Dario Binacchi Sept. 17, 2025, 8:05 a.m. UTC
Support the touchscreen-glitch-threshold-ns property.

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

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

---

Changes in v4:
- Adjust property description following the suggestions of
  Conor Dooley and Frank Li.
- Update the commit description.

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

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

Comments

Frank Li Sept. 17, 2025, 4:07 p.m. UTC | #1
On Wed, Sep 17, 2025 at 10:05:09AM +0200, Dario Binacchi wrote:
> Support the touchscreen-glitch-threshold-ns property.
>
> Drivers must convert this value to IPG clock cycles and map it to one of

binding descript hardware, not drivers. So below sentence should be better.

"TSC only supports the four discrete thresholds, counted by IPG clock cycles.
See SC_DEBUG_MODE2 register."

> 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
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>
> ---
>
> Changes in v4:
> - Adjust property description following the suggestions of
>   Conor Dooley and Frank Li.
> - Update the commit description.
>
> Changes in v3:
> - Remove the final part of the description that refers to
>   implementation details.
>
>  .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml | 14 ++++++++++++++
>  1 file changed, 14 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..1975f741cf3d 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> @@ -62,6 +62,20 @@ properties:
>      description: Number of data samples which are averaged for each read.
>      enum: [ 1, 4, 8, 16, 32 ]
>
> +  touchscreen-glitch-threshold-ns:
> +    description: |
> +      Minimum duration in nanoseconds a signal must remain stable
> +      to be considered valid.
> +
> +      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:

same as commit messsage, talk about hardware.

> +
> +        0: 8191 IPG cycles
> +        1: 4095 IPG cycles
> +        2: 2047 IPG cycles
> +        3: 1023 IPG cycles
> +

This case genenerally need enum 4 values, but it relates IPG frequency.
I have not idea how to restrict it base on clk frequency. May DT mainatainer
have idea.

Frank

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

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
'Krzysztof Kozlowski' via Amarula Linux Sept. 17, 2025, 7:26 p.m. UTC | #2
On Wed, Sep 17, 2025 at 12:07:44PM -0400, Frank Li wrote:
> On Wed, Sep 17, 2025 at 10:05:09AM +0200, Dario Binacchi wrote:
> > Support the touchscreen-glitch-threshold-ns property.
> >
> > Drivers must convert this value to IPG clock cycles and map it to one of
> 
> binding descript hardware, not drivers. So below sentence should be better.
> 
> "TSC only supports the four discrete thresholds, counted by IPG clock cycles.
> See SC_DEBUG_MODE2 register."
> 
> > 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
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >
> > ---
> >
> > Changes in v4:
> > - Adjust property description following the suggestions of
> >   Conor Dooley and Frank Li.
> > - Update the commit description.
> >
> > Changes in v3:
> > - Remove the final part of the description that refers to
> >   implementation details.
> >
> >  .../bindings/input/touchscreen/fsl,imx6ul-tsc.yaml | 14 ++++++++++++++
> >  1 file changed, 14 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..1975f741cf3d 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
> > @@ -62,6 +62,20 @@ properties:
> >      description: Number of data samples which are averaged for each read.
> >      enum: [ 1, 4, 8, 16, 32 ]
> >
> > +  touchscreen-glitch-threshold-ns:
> > +    description: |
> > +      Minimum duration in nanoseconds a signal must remain stable
> > +      to be considered valid.
> > +
> > +      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:
> 
> same as commit messsage, talk about hardware.

This is fine. It's a generic comment about what must be done with the
property by software that helps people understand how to populate it.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>


> > +        0: 8191 IPG cycles
> > +        1: 4095 IPG cycles
> > +        2: 2047 IPG cycles
> > +        3: 1023 IPG cycles
> > +
> 
> This case genenerally need enum 4 values, but it relates IPG frequency.
> I have not idea how to restrict it base on clk frequency. May DT mainatainer
> have idea.

I don't see how you really can restrict it based on the frequency of a
clock that can probably be varied at runtime.

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
index 678756ad0f92..1975f741cf3d 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/fsl,imx6ul-tsc.yaml
@@ -62,6 +62,20 @@  properties:
     description: Number of data samples which are averaged for each read.
     enum: [ 1, 4, 8, 16, 32 ]
 
+  touchscreen-glitch-threshold-ns:
+    description: |
+      Minimum duration in nanoseconds a signal must remain stable
+      to be considered valid.
+
+      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
+
 required:
   - compatible
   - reg