diff mbox

input: ti_am335x_tsc: Add open delay parameter

Message ID 1439318705-18601-1-git-send-email-mwelling@ieee.org
State Under Review, archived
Headers show

Commit Message

Michael Welling Aug. 11, 2015, 6:45 p.m. UTC
Adds a device tree parameter to set the open delay on the touchscreen
conversion steps. Increasing this parameter helps the touch accuracy on
some screens.

Signed-off-by: Michael Welling <mwelling@ieee.org>
---
 .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
 drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

Comments

Vignesh Raghavendra Aug. 12, 2015, 6:26 a.m. UTC | #1
Hi Michael,

+ Dmitry

On 08/12/2015 12:15 AM, Michael Welling wrote:
> Adds a device tree parameter to set the open delay on the touchscreen
> conversion steps. Increasing this parameter helps the touch accuracy on
> some screens.
> 
> Signed-off-by: Michael Welling <mwelling@ieee.org>
> ---
>  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
>  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
>  2 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> index b1163bf..cb11fda 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> @@ -41,6 +41,11 @@ Optional properties:
>  			 charge step, so this does in fact function as a
>  			 hardware knob for adjusting the amount of "settling
>  			 time".
> +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
> +			The value corresponds to the number of ADC clock
> +			cycles to wait after applying the step configuration
> +			registers and before sending the start of ADC
> +			conversion. Maximum value is 0x3FFFF.
>  

Since open-delay is per step, is it not better to allow specifying
open-delay per step like ti,chan-step-opendelay of adc? This will help
control open-delay for all the four wires.

>  - child "adc"
>  	ti,chan-step-opendelay: List of open delays for each channel of
> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> index 191a1b8..37a9729 100644
> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> @@ -54,6 +54,7 @@ struct titsc {
>  	u32			inp_xp, inp_xn, inp_yp, inp_yn;
>  	u32			step_mask;
>  	u32			charge_delay;
> +	u32			open_delay;
>  };
>  
>  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
> @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev)
>  	end_step = first_step + tsc_steps;
>  	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), ts_dev->open_delay);
>  	}
>  
>  	config = 0;
> @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev)
>  	end_step = first_step + ts_dev->coordinate_readouts;
>  	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), ts_dev->open_delay);
>  	}
>  
>  	/* Make CHARGECONFIG same as IDLECONFIG */
> @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev)
>  			STEPCONFIG_INP(ts_dev->inp_xp);
>  	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
>  	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
> -			STEPCONFIG_OPENDLY);
> +			ts_dev->open_delay);
>  
>  	end_step++;
>  	config |= 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);
> +			ts_dev->open_delay);
>  
>  	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
>  	stepenable = 1;
> @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev,
>  		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
>  	}
>  
> +	err = of_property_read_u32(node, "ti,open-delay",
> +				   &ts_dev->open_delay);
> +	/*
> +	 * If ti,open-delay value is not specified, then use
> +	 * STEPCONFIG_OPENDLY as the default value.
> +	 */
> +	if (err < 0)
> +		ts_dev->open_delay = STEPCONFIG_OPENDLY;
> +
>  	return of_property_read_u32_array(node, "ti,wire-config",
>  			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
>  }
>
Michael Welling Aug. 12, 2015, 6:44 p.m. UTC | #2
On Wed, Aug 12, 2015 at 11:56:36AM +0530, Vignesh R wrote:
> Hi Michael,
> 
> + Dmitry
> 
> On 08/12/2015 12:15 AM, Michael Welling wrote:
> > Adds a device tree parameter to set the open delay on the touchscreen
> > conversion steps. Increasing this parameter helps the touch accuracy on
> > some screens.
> > 
> > Signed-off-by: Michael Welling <mwelling@ieee.org>
> > ---
> >  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
> >  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
> >  2 files changed, 19 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > index b1163bf..cb11fda 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > @@ -41,6 +41,11 @@ Optional properties:
> >  			 charge step, so this does in fact function as a
> >  			 hardware knob for adjusting the amount of "settling
> >  			 time".
> > +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
> > +			The value corresponds to the number of ADC clock
> > +			cycles to wait after applying the step configuration
> > +			registers and before sending the start of ADC
> > +			conversion. Maximum value is 0x3FFFF.
> >  
> 
> Since open-delay is per step, is it not better to allow specifying
> open-delay per step like ti,chan-step-opendelay of adc? This will help
> control open-delay for all the four wires.

Do you see any reason why you would want a different delay for each step of
the conversion on the same touchscreen?

The user would need to know the number of steps what each of the steps do.

> 
> >  - child "adc"
> >  	ti,chan-step-opendelay: List of open delays for each channel of
> > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> > index 191a1b8..37a9729 100644
> > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > @@ -54,6 +54,7 @@ struct titsc {
> >  	u32			inp_xp, inp_xn, inp_yp, inp_yn;
> >  	u32			step_mask;
> >  	u32			charge_delay;
> > +	u32			open_delay;
> >  };
> >  
> >  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
> > @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> >  	end_step = first_step + tsc_steps;
> >  	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), ts_dev->open_delay);
> >  	}
> >  
> >  	config = 0;
> > @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> >  	end_step = first_step + ts_dev->coordinate_readouts;
> >  	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), ts_dev->open_delay);
> >  	}
> >  
> >  	/* Make CHARGECONFIG same as IDLECONFIG */
> > @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev)
> >  			STEPCONFIG_INP(ts_dev->inp_xp);
> >  	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
> >  	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
> > -			STEPCONFIG_OPENDLY);
> > +			ts_dev->open_delay);
> >  
> >  	end_step++;
> >  	config |= 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);
> > +			ts_dev->open_delay);
> >  
> >  	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
> >  	stepenable = 1;
> > @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev,
> >  		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
> >  	}
> >  
> > +	err = of_property_read_u32(node, "ti,open-delay",
> > +				   &ts_dev->open_delay);
> > +	/*
> > +	 * If ti,open-delay value is not specified, then use
> > +	 * STEPCONFIG_OPENDLY as the default value.
> > +	 */
> > +	if (err < 0)
> > +		ts_dev->open_delay = STEPCONFIG_OPENDLY;
> > +
> >  	return of_property_read_u32_array(node, "ti,wire-config",
> >  			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
> >  }
> > 
> 
> -- 
> Regards
> Vignesh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Welling Aug. 19, 2015, 6:08 p.m. UTC | #3
On Wed, Aug 12, 2015 at 01:44:22PM -0500, Michael Welling wrote:
> On Wed, Aug 12, 2015 at 11:56:36AM +0530, Vignesh R wrote:
> > Hi Michael,
> > 
> > + Dmitry
> > 
> > On 08/12/2015 12:15 AM, Michael Welling wrote:
> > > Adds a device tree parameter to set the open delay on the touchscreen
> > > conversion steps. Increasing this parameter helps the touch accuracy on
> > > some screens.
> > > 
> > > Signed-off-by: Michael Welling <mwelling@ieee.org>
> > > ---
> > >  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
> > >  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
> > >  2 files changed, 19 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > > index b1163bf..cb11fda 100644
> > > --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > > +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> > > @@ -41,6 +41,11 @@ Optional properties:
> > >  			 charge step, so this does in fact function as a
> > >  			 hardware knob for adjusting the amount of "settling
> > >  			 time".
> > > +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
> > > +			The value corresponds to the number of ADC clock
> > > +			cycles to wait after applying the step configuration
> > > +			registers and before sending the start of ADC
> > > +			conversion. Maximum value is 0x3FFFF.
> > >  
> > 
> > Since open-delay is per step, is it not better to allow specifying
> > open-delay per step like ti,chan-step-opendelay of adc? This will help
> > control open-delay for all the four wires.
> 
> Do you see any reason why you would want a different delay for each step of
> the conversion on the same touchscreen?
> 
> The user would need to know the number of steps what each of the steps do.
> 

Comments?

Any other concerns?

> > 
> > >  - child "adc"
> > >  	ti,chan-step-opendelay: List of open delays for each channel of
> > > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > index 191a1b8..37a9729 100644
> > > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > @@ -54,6 +54,7 @@ struct titsc {
> > >  	u32			inp_xp, inp_xn, inp_yp, inp_yn;
> > >  	u32			step_mask;
> > >  	u32			charge_delay;
> > > +	u32			open_delay;
> > >  };
> > >  
> > >  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
> > > @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> > >  	end_step = first_step + tsc_steps;
> > >  	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), ts_dev->open_delay);
> > >  	}
> > >  
> > >  	config = 0;
> > > @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> > >  	end_step = first_step + ts_dev->coordinate_readouts;
> > >  	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), ts_dev->open_delay);
> > >  	}
> > >  
> > >  	/* Make CHARGECONFIG same as IDLECONFIG */
> > > @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev)
> > >  			STEPCONFIG_INP(ts_dev->inp_xp);
> > >  	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
> > >  	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
> > > -			STEPCONFIG_OPENDLY);
> > > +			ts_dev->open_delay);
> > >  
> > >  	end_step++;
> > >  	config |= 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);
> > > +			ts_dev->open_delay);
> > >  
> > >  	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
> > >  	stepenable = 1;
> > > @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev,
> > >  		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
> > >  	}
> > >  
> > > +	err = of_property_read_u32(node, "ti,open-delay",
> > > +				   &ts_dev->open_delay);
> > > +	/*
> > > +	 * If ti,open-delay value is not specified, then use
> > > +	 * STEPCONFIG_OPENDLY as the default value.
> > > +	 */
> > > +	if (err < 0)
> > > +		ts_dev->open_delay = STEPCONFIG_OPENDLY;
> > > +
> > >  	return of_property_read_u32_array(node, "ti,wire-config",
> > >  			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
> > >  }
> > > 
> > 
> > -- 
> > Regards
> > Vignesh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vignesh Raghavendra Aug. 20, 2015, 12:11 p.m. UTC | #4
On 08/19/2015 11:38 PM, Michael Welling wrote:
> On Wed, Aug 12, 2015 at 01:44:22PM -0500, Michael Welling wrote:
>> On Wed, Aug 12, 2015 at 11:56:36AM +0530, Vignesh R wrote:
>>> Hi Michael,
>>>
>>> + Dmitry
>>>
>>> On 08/12/2015 12:15 AM, Michael Welling wrote:
>>>> Adds a device tree parameter to set the open delay on the touchscreen
>>>> conversion steps. Increasing this parameter helps the touch accuracy on
>>>> some screens.
>>>>
>>>> Signed-off-by: Michael Welling <mwelling@ieee.org>
>>>> ---
>>>>  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
>>>>  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
>>>>  2 files changed, 19 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>> index b1163bf..cb11fda 100644
>>>> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>> @@ -41,6 +41,11 @@ Optional properties:
>>>>  			 charge step, so this does in fact function as a
>>>>  			 hardware knob for adjusting the amount of "settling
>>>>  			 time".
>>>> +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
>>>> +			The value corresponds to the number of ADC clock
>>>> +			cycles to wait after applying the step configuration
>>>> +			registers and before sending the start of ADC
>>>> +			conversion. Maximum value is 0x3FFFF.
>>>>  
>>>
>>> Since open-delay is per step, is it not better to allow specifying
>>> open-delay per step like ti,chan-step-opendelay of adc? This will help
>>> control open-delay for all the four wires.
>>
>> Do you see any reason why you would want a different delay for each step of
>> the conversion on the same touchscreen?


Sorry for the delay,

I haven't seen different delays being used for different channels on
4-wire TSC ( not sure of 5-wire or 8 wire designs). Since this is DT
change, I just wanted to make sure more flexibility is provided.

>>
>> The user would need to know the number of steps what each of the steps do.
>>


What I was thinking was making open-delay configurable per channel (one
entry for X+, X-, Y+, Y-).

For example, for a 4-wire TSC:
ti,chan-open-delay = <0x30 0x100 0x20 0x10>; /* for X+, X-, Y+, Y- */


>>>
>>>>  - child "adc"
>>>>  	ti,chan-step-opendelay: List of open delays for each channel of
>>>> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
>>>> index 191a1b8..37a9729 100644
>>>> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
>>>> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
>>>> @@ -54,6 +54,7 @@ struct titsc {
>>>>  	u32			inp_xp, inp_xn, inp_yp, inp_yn;
>>>>  	u32			step_mask;
>>>>  	u32			charge_delay;
>>>> +	u32			open_delay;
>>>>  };
>>>>  
>>>>  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
>>>> @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev)
>>>>  	end_step = first_step + tsc_steps;
>>>>  	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), ts_dev->open_delay);
>>>>  	}
>>>>  
>>>>  	config = 0;
>>>> @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev)
>>>>  	end_step = first_step + ts_dev->coordinate_readouts;
>>>>  	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), ts_dev->open_delay);
>>>>  	}
>>>>  
>>>>  	/* Make CHARGECONFIG same as IDLECONFIG */
>>>> @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev)
>>>>  			STEPCONFIG_INP(ts_dev->inp_xp);
>>>>  	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
>>>>  	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
>>>> -			STEPCONFIG_OPENDLY);
>>>> +			ts_dev->open_delay);
>>>>  
>>>>  	end_step++;
>>>>  	config |= 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);
>>>> +			ts_dev->open_delay);
>>>>  
>>>>  	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
>>>>  	stepenable = 1;
>>>> @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev,
>>>>  		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
>>>>  	}
>>>>  
>>>> +	err = of_property_read_u32(node, "ti,open-delay",
>>>> +				   &ts_dev->open_delay);
>>>> +	/*
>>>> +	 * If ti,open-delay value is not specified, then use
>>>> +	 * STEPCONFIG_OPENDLY as the default value.
>>>> +	 */
>>>> +	if (err < 0)
>>>> +		ts_dev->open_delay = STEPCONFIG_OPENDLY;
>>>> +
>>>>  	return of_property_read_u32_array(node, "ti,wire-config",
>>>>  			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
>>>>  }
>>>>
>>>
>>> -- 
>>> Regards
>>> Vignesh
Michael Welling Aug. 20, 2015, 10:17 p.m. UTC | #5
On Thu, Aug 20, 2015 at 05:41:30PM +0530, Vignesh R wrote:
> 
> 
> On 08/19/2015 11:38 PM, Michael Welling wrote:
> > On Wed, Aug 12, 2015 at 01:44:22PM -0500, Michael Welling wrote:
> >> On Wed, Aug 12, 2015 at 11:56:36AM +0530, Vignesh R wrote:
> >>> Hi Michael,
> >>>
> >>> + Dmitry
> >>>
> >>> On 08/12/2015 12:15 AM, Michael Welling wrote:
> >>>> Adds a device tree parameter to set the open delay on the touchscreen
> >>>> conversion steps. Increasing this parameter helps the touch accuracy on
> >>>> some screens.
> >>>>
> >>>> Signed-off-by: Michael Welling <mwelling@ieee.org>
> >>>> ---
> >>>>  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
> >>>>  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
> >>>>  2 files changed, 19 insertions(+), 4 deletions(-)
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> >>>> index b1163bf..cb11fda 100644
> >>>> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> >>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> >>>> @@ -41,6 +41,11 @@ Optional properties:
> >>>>  			 charge step, so this does in fact function as a
> >>>>  			 hardware knob for adjusting the amount of "settling
> >>>>  			 time".
> >>>> +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
> >>>> +			The value corresponds to the number of ADC clock
> >>>> +			cycles to wait after applying the step configuration
> >>>> +			registers and before sending the start of ADC
> >>>> +			conversion. Maximum value is 0x3FFFF.
> >>>>  
> >>>
> >>> Since open-delay is per step, is it not better to allow specifying
> >>> open-delay per step like ti,chan-step-opendelay of adc? This will help
> >>> control open-delay for all the four wires.
> >>
> >> Do you see any reason why you would want a different delay for each step of
> >> the conversion on the same touchscreen?
> 
> 
> Sorry for the delay,
> 
> I haven't seen different delays being used for different channels on
> 4-wire TSC ( not sure of 5-wire or 8 wire designs). Since this is DT
> change, I just wanted to make sure more flexibility is provided.
> 
> >>
> >> The user would need to know the number of steps what each of the steps do.
> >>
> 
> 
> What I was thinking was making open-delay configurable per channel (one
> entry for X+, X-, Y+, Y-).
> 
> For example, for a 4-wire TSC:
> ti,chan-open-delay = <0x30 0x100 0x20 0x10>; /* for X+, X-, Y+, Y- */
>

What about the readings for the pressure?
 
> 
> >>>
> >>>>  - child "adc"
> >>>>  	ti,chan-step-opendelay: List of open delays for each channel of
> >>>> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> >>>> index 191a1b8..37a9729 100644
> >>>> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> >>>> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> >>>> @@ -54,6 +54,7 @@ struct titsc {
> >>>>  	u32			inp_xp, inp_xn, inp_yp, inp_yn;
> >>>>  	u32			step_mask;
> >>>>  	u32			charge_delay;
> >>>> +	u32			open_delay;
> >>>>  };
> >>>>  
> >>>>  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
> >>>> @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> >>>>  	end_step = first_step + tsc_steps;
> >>>>  	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), ts_dev->open_delay);
> >>>>  	}
> >>>>  
> >>>>  	config = 0;
> >>>> @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev)
> >>>>  	end_step = first_step + ts_dev->coordinate_readouts;
> >>>>  	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), ts_dev->open_delay);
> >>>>  	}
> >>>>  
> >>>>  	/* Make CHARGECONFIG same as IDLECONFIG */
> >>>> @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev)
> >>>>  			STEPCONFIG_INP(ts_dev->inp_xp);
> >>>>  	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
> >>>>  	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
> >>>> -			STEPCONFIG_OPENDLY);
> >>>> +			ts_dev->open_delay);
> >>>>  
> >>>>  	end_step++;
> >>>>  	config |= 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);
> >>>> +			ts_dev->open_delay);
> >>>>  
> >>>>  	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
> >>>>  	stepenable = 1;
> >>>> @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev,
> >>>>  		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
> >>>>  	}
> >>>>  
> >>>> +	err = of_property_read_u32(node, "ti,open-delay",
> >>>> +				   &ts_dev->open_delay);
> >>>> +	/*
> >>>> +	 * If ti,open-delay value is not specified, then use
> >>>> +	 * STEPCONFIG_OPENDLY as the default value.
> >>>> +	 */
> >>>> +	if (err < 0)
> >>>> +		ts_dev->open_delay = STEPCONFIG_OPENDLY;
> >>>> +
> >>>>  	return of_property_read_u32_array(node, "ti,wire-config",
> >>>>  			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
> >>>>  }
> >>>>
> >>>
> >>> -- 
> >>> Regards
> >>> Vignesh
> 
> -- 
> Regards
> Vignesh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vignesh Raghavendra Aug. 21, 2015, 12:11 p.m. UTC | #6
On 08/21/2015 03:47 AM, Michael Welling wrote:
> On Thu, Aug 20, 2015 at 05:41:30PM +0530, Vignesh R wrote:
>>
>>
>> On 08/19/2015 11:38 PM, Michael Welling wrote:
>>> On Wed, Aug 12, 2015 at 01:44:22PM -0500, Michael Welling wrote:
>>>> On Wed, Aug 12, 2015 at 11:56:36AM +0530, Vignesh R wrote:
>>>>> Hi Michael,
>>>>>
>>>>> + Dmitry
>>>>>
>>>>> On 08/12/2015 12:15 AM, Michael Welling wrote:
>>>>>> Adds a device tree parameter to set the open delay on the touchscreen
>>>>>> conversion steps. Increasing this parameter helps the touch accuracy on
>>>>>> some screens.
>>>>>>
>>>>>> Signed-off-by: Michael Welling <mwelling@ieee.org>
>>>>>> ---
>>>>>>  .../bindings/input/touchscreen/ti-tsc-adc.txt          |  5 +++++
>>>>>>  drivers/input/touchscreen/ti_am335x_tsc.c              | 18 ++++++++++++++----
>>>>>>  2 files changed, 19 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>>>> index b1163bf..cb11fda 100644
>>>>>> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
>>>>>> @@ -41,6 +41,11 @@ Optional properties:
>>>>>>  			 charge step, so this does in fact function as a
>>>>>>  			 hardware knob for adjusting the amount of "settling
>>>>>>  			 time".
>>>>>> +	ti,open-delay: Open delay applied to all touchscreen conversion steps.
>>>>>> +			The value corresponds to the number of ADC clock
>>>>>> +			cycles to wait after applying the step configuration
>>>>>> +			registers and before sending the start of ADC
>>>>>> +			conversion. Maximum value is 0x3FFFF.
>>>>>>  
>>>>>
>>>>> Since open-delay is per step, is it not better to allow specifying
>>>>> open-delay per step like ti,chan-step-opendelay of adc? This will help
>>>>> control open-delay for all the four wires.
>>>>
>>>> Do you see any reason why you would want a different delay for each step of
>>>> the conversion on the same touchscreen?
>>
>>
>> Sorry for the delay,
>>
>> I haven't seen different delays being used for different channels on
>> 4-wire TSC ( not sure of 5-wire or 8 wire designs). Since this is DT
>> change, I just wanted to make sure more flexibility is provided.
>>
>>>>
>>>> The user would need to know the number of steps what each of the steps do.
>>>>
>>
>>
>> What I was thinking was making open-delay configurable per channel (one
>> entry for X+, X-, Y+, Y-).
>>
>> For example, for a 4-wire TSC:
>> ti,chan-open-delay = <0x30 0x100 0x20 0x10>; /* for X+, X-, Y+, Y- */
>>
> 
> What about the readings for the pressure?

Sorry, I was confused with channels and co-ordinate readouts.

Each of X, Y and pressure(Z) readouts will correspond to certain tscadc
steps. So, what I have in mind is:

ti,open-delay = <0x30 0x100 0x20>; /* for X, Y, Z */

For Steps that represents X co-ordinate readouts set opendelay = 0x30.
For Steps that correspond to Y co-ordinate readouts set opendelay =
0x100 and similarly for 0x20 for Z.

This is will provide flexibility to configure open-delay independently
for X, Y and Z
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index b1163bf..cb11fda 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -41,6 +41,11 @@  Optional properties:
 			 charge step, so this does in fact function as a
 			 hardware knob for adjusting the amount of "settling
 			 time".
+	ti,open-delay: Open delay applied to all touchscreen conversion steps.
+			The value corresponds to the number of ADC clock
+			cycles to wait after applying the step configuration
+			registers and before sending the start of ADC
+			conversion. Maximum value is 0x3FFFF.
 
 - child "adc"
 	ti,chan-step-opendelay: List of open delays for each channel of
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 191a1b8..37a9729 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -54,6 +54,7 @@  struct titsc {
 	u32			inp_xp, inp_xn, inp_yp, inp_yn;
 	u32			step_mask;
 	u32			charge_delay;
+	u32			open_delay;
 };
 
 static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -148,7 +149,7 @@  static void titsc_step_config(struct titsc *ts_dev)
 	end_step = first_step + tsc_steps;
 	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), ts_dev->open_delay);
 	}
 
 	config = 0;
@@ -172,7 +173,7 @@  static void titsc_step_config(struct titsc *ts_dev)
 	end_step = first_step + ts_dev->coordinate_readouts;
 	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), ts_dev->open_delay);
 	}
 
 	/* Make CHARGECONFIG same as IDLECONFIG */
@@ -188,13 +189,13 @@  static void titsc_step_config(struct titsc *ts_dev)
 			STEPCONFIG_INP(ts_dev->inp_xp);
 	titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
 	titsc_writel(ts_dev, REG_STEPDELAY(end_step),
-			STEPCONFIG_OPENDLY);
+			ts_dev->open_delay);
 
 	end_step++;
 	config |= 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);
+			ts_dev->open_delay);
 
 	/* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */
 	stepenable = 1;
@@ -392,6 +393,15 @@  static int titsc_parse_dt(struct platform_device *pdev,
 		dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
 	}
 
+	err = of_property_read_u32(node, "ti,open-delay",
+				   &ts_dev->open_delay);
+	/*
+	 * If ti,open-delay value is not specified, then use
+	 * STEPCONFIG_OPENDLY as the default value.
+	 */
+	if (err < 0)
+		ts_dev->open_delay = STEPCONFIG_OPENDLY;
+
 	return of_property_read_u32_array(node, "ti,wire-config",
 			ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
 }