Skip to contentSkip to conversation

iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout

PATCH In review Matthias Kaehlcke 4 participants 5 messages Sep 16, 2013 – Sep 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout

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

---
 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(-)
drivers/iio/adc/ti_am335x_adc.c +2 -2
index 3ceac3e..75be579 100644
@@ -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);
 
drivers/mfd/ti_am335x_tscadc.c +1 -0
index b003a16..b2e1a1c 100644
@@ -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";
include/linux/mfd/ti_am335x_tscadc.h +1 -0
index db1791b..7e8d702 100644
@@ -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;
Signature · 1 line
1.8.4.rc3
maintainer
#1 lore raw
Quoted 6 lines · Matthias Kaehlcke

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

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

Quoted 46 lines
---
 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(-)
drivers/iio/adc/ti_am335x_adc.c +2 -2
index 3ceac3e..75be579 100644
@@ -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);
 
drivers/mfd/ti_am335x_tscadc.c +1 -0
index b003a16..b2e1a1c 100644
@@ -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";
include/linux/mfd/ti_am335x_tscadc.h +1 -0
index db1791b..7e8d702 100644
@@ -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;
#2 lore raw

Hi,

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

Quoted 9 lines · Matthias Kaehlcke
Quoted 6 lines

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

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?

Quoted 5 lines

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

Signature · 11 lines
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                  `-
#3 lore raw
Quoted 10 lines · Matthias Kaehlcke

Hi,

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

Quoted 6 lines · Matthias Kaehlcke
Quoted 5 lines

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 11 lines
Quoted 5 lines

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

#4 lore raw
Quoted 15 lines · Arun Joseph
Quoted 13 lines · Matthias Kaehlcke

Hi,

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

Quoted 9 lines · Matthias Kaehlcke
Quoted 8 lines

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

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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