linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
@ 2013-09-16 21:17 Matthias Kaehlcke
  2013-09-21 12:25 ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Matthias Kaehlcke @ 2013-09-16 21:17 UTC (permalink / raw)
  To: Jonathan Cameron, Sebastian Andrzej Siewior, Felipe Balbi,
	Pantelis Antoniou
  Cc: linux-iio, linux-kernel

The calculation of the old conversion timeout value was based on the number of
steps used by this driver. This doesn't take into account that other steps
can be used by the touchscreen driver. Select the timeout value based on the
steps used by both drivers

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
 drivers/iio/adc/ti_am335x_adc.c      | 4 ++--
 drivers/mfd/ti_am335x_tscadc.c       | 1 +
 include/linux/mfd/ti_am335x_tscadc.h | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 3ceac3e..75be579 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -145,8 +145,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
 	u32 step = UINT_MAX;
 	bool found = false;
 	u32 step_en;
-	unsigned long timeout = jiffies + usecs_to_jiffies
-				(IDLE_TIMEOUT * adc_dev->channels);
+	unsigned long timeout = jiffies + usecs_to_jiffies(IDLE_TIMEOUT *
+		(adc_dev->channels + adc_dev->mfd_tscadc->tsc_steps));
 	step_en = get_adc_step_mask(adc_dev);
 	am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);
 
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index b003a16..b2e1a1c 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -228,6 +228,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	/* TSC Cell */
 	if (tsc_wires > 0) {
 		tscadc->tsc_cell = tscadc->used_cells;
+		tscadc->tsc_steps = readouts * 2 + 2;
 		cell = &tscadc->cells[tscadc->used_cells++];
 		cell->name = "TI-am335x-tsc";
 		cell->of_compatible = "ti,am3359-tsc";
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index db1791b..7e8d702 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -147,6 +147,7 @@ struct ti_tscadc_dev {
 	struct mfd_cell cells[TSCADC_CELLS];
 	u32 reg_se_cache;
 	spinlock_t reg_lock;
+	int tsc_steps;
 
 	/* tsc device */
 	struct titsc *tsc;
-- 
1.8.4.rc3


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

* Re: [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
  2013-09-16 21:17 [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout Matthias Kaehlcke
@ 2013-09-21 12:25 ` Jonathan Cameron
  2013-09-22 17:51   ` Matthias Kaehlcke
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2013-09-21 12:25 UTC (permalink / raw)
  To: Matthias Kaehlcke, Jonathan Cameron, Sebastian Andrzej Siewior,
	Felipe Balbi, Pantelis Antoniou, linux-iio, linux-kernel

On 09/16/13 22:17, Matthias Kaehlcke wrote:
> The calculation of the old conversion timeout value was based on the number of
> steps used by this driver. This doesn't take into account that other steps
> can be used by the touchscreen driver. Select the timeout value based on the
> steps used by both drivers
> 
> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Looks fine to me but I'd like an Ack from someone more familiar with the device
if possible.

Also, I'm assuming this is a fix we want to push out asap but that isn't
clear in your patch title.  Perhaps something like:

iio: ti_am335x_adc: Fix conversion timeout to allow for touch screen steps.
?

> ---
>  drivers/iio/adc/ti_am335x_adc.c      | 4 ++--
>  drivers/mfd/ti_am335x_tscadc.c       | 1 +
>  include/linux/mfd/ti_am335x_tscadc.h | 1 +
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 3ceac3e..75be579 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -145,8 +145,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
>  	u32 step = UINT_MAX;
>  	bool found = false;
>  	u32 step_en;
> -	unsigned long timeout = jiffies + usecs_to_jiffies
> -				(IDLE_TIMEOUT * adc_dev->channels);
> +	unsigned long timeout = jiffies + usecs_to_jiffies(IDLE_TIMEOUT *
> +		(adc_dev->channels + adc_dev->mfd_tscadc->tsc_steps));
>  	step_en = get_adc_step_mask(adc_dev);
>  	am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);
>  
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index b003a16..b2e1a1c 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -228,6 +228,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  	/* TSC Cell */
>  	if (tsc_wires > 0) {
>  		tscadc->tsc_cell = tscadc->used_cells;
> +		tscadc->tsc_steps = readouts * 2 + 2;
>  		cell = &tscadc->cells[tscadc->used_cells++];
>  		cell->name = "TI-am335x-tsc";
>  		cell->of_compatible = "ti,am3359-tsc";
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index db1791b..7e8d702 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -147,6 +147,7 @@ struct ti_tscadc_dev {
>  	struct mfd_cell cells[TSCADC_CELLS];
>  	u32 reg_se_cache;
>  	spinlock_t reg_lock;
> +	int tsc_steps;
>  
>  	/* tsc device */
>  	struct titsc *tsc;
> 

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

* Re: [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
  2013-09-21 12:25 ` Jonathan Cameron
@ 2013-09-22 17:51   ` Matthias Kaehlcke
  2013-09-23  8:57     ` Arun Joseph
  0 siblings, 1 reply; 5+ messages in thread
From: Matthias Kaehlcke @ 2013-09-22 17:51 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Sebastian Andrzej Siewior, Felipe Balbi,
	Pantelis Antoniou, linux-iio, linux-kernel, Arun Joseph

Hi,

El Sat, Sep 21, 2013 at 01:25:42PM +0100 Jonathan Cameron ha dit:

> On 09/16/13 22:17, Matthias Kaehlcke wrote:
> > The calculation of the old conversion timeout value was based on the number of
> > steps used by this driver. This doesn't take into account that other steps
> > can be used by the touchscreen driver. Select the timeout value based on the
> > steps used by both drivers
> > 
> > Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> Looks fine to me but I'd like an Ack from someone more familiar with the device
> if possible.

Arun, do you feel entitled to Ack or can you suggest someone from TI
who is?

> Also, I'm assuming this is a fix we want to push out asap but that isn't
> clear in your patch title.  Perhaps something like:
> 
> iio: ti_am335x_adc: Fix conversion timeout to allow for touch screen steps.
> ?

it's not as critical as it seems as in practice the timeout has the
granularity of a jiffy. If you prefer I still can resend the patch
with the subject you suggest

best regards

-- 
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam

             If God had not intended for us to eat animals,
                  how come He made them out of meat?
                           (Sarah Palin)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

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

* Re: [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
  2013-09-22 17:51   ` Matthias Kaehlcke
@ 2013-09-23  8:57     ` Arun Joseph
  2013-09-23  9:36       ` Sekhar Nori
  0 siblings, 1 reply; 5+ messages in thread
From: Arun Joseph @ 2013-09-23  8:57 UTC (permalink / raw)
  To: Matthias Kaehlcke, Jonathan Cameron, Jonathan Cameron,
	Sebastian Andrzej Siewior, Felipe Balbi, Pantelis Antoniou,
	linux-iio, linux-kernel, Nori, Sekhar


On Sunday 22 September 2013 11:21 PM, Matthias Kaehlcke wrote:
> Hi,
>
> El Sat, Sep 21, 2013 at 01:25:42PM +0100 Jonathan Cameron ha dit:
>
>> On 09/16/13 22:17, Matthias Kaehlcke wrote:
>>> The calculation of the old conversion timeout value was based on the number of
>>> steps used by this driver. This doesn't take into account that other steps
>>> can be used by the touchscreen driver. Select the timeout value based on the
>>> steps used by both drivers
>>>
>>> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
>> Looks fine to me but I'd like an Ack from someone more familiar with the device
>> if possible.
> Arun, do you feel entitled to Ack or can you suggest someone from TI
> who is?
>
Adding Sekhar Nori
>> Also, I'm assuming this is a fix we want to push out asap but that isn't
>> clear in your patch title.  Perhaps something like:
>>
>> iio: ti_am335x_adc: Fix conversion timeout to allow for touch screen steps.
>> ?
> it's not as critical as it seems as in practice the timeout has the
> granularity of a jiffy. If you prefer I still can resend the patch
> with the subject you suggest
>
> best regards
>


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

* Re: [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
  2013-09-23  8:57     ` Arun Joseph
@ 2013-09-23  9:36       ` Sekhar Nori
  0 siblings, 0 replies; 5+ messages in thread
From: Sekhar Nori @ 2013-09-23  9:36 UTC (permalink / raw)
  To: Arun Joseph
  Cc: Matthias Kaehlcke, Jonathan Cameron, Jonathan Cameron,
	Sebastian Andrzej Siewior, Felipe Balbi, Pantelis Antoniou,
	linux-iio, linux-kernel

On Monday 23 September 2013 02:27 PM, Arun Joseph wrote:
> 
> On Sunday 22 September 2013 11:21 PM, Matthias Kaehlcke wrote:
>> Hi,
>>
>> El Sat, Sep 21, 2013 at 01:25:42PM +0100 Jonathan Cameron ha dit:
>>
>>> On 09/16/13 22:17, Matthias Kaehlcke wrote:
>>>> The calculation of the old conversion timeout value was based on the
>>>> number of
>>>> steps used by this driver. This doesn't take into account that other
>>>> steps
>>>> can be used by the touchscreen driver. Select the timeout value
>>>> based on the
>>>> steps used by both drivers
>>>>
>>>> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
>>> Looks fine to me but I'd like an Ack from someone more familiar with
>>> the device
>>> if possible.
>> Arun, do you feel entitled to Ack or can you suggest someone from TI
>> who is?
>>
> Adding Sekhar Nori

I have not really worked on this driver. It should be Sebastian who
should ack once he is back from his vacation. It looks like this is
v3.13 material so hopefully it can wait for him to be back.

Thanks,
Sekhar


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

end of thread, other threads:[~2013-09-23  9:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-16 21:17 [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout Matthias Kaehlcke
2013-09-21 12:25 ` Jonathan Cameron
2013-09-22 17:51   ` Matthias Kaehlcke
2013-09-23  8:57     ` Arun Joseph
2013-09-23  9:36       ` Sekhar Nori

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).