From: Matthias Kaehlcke <matthias.list@kaehlcke.net>
To: Jonathan Cameron <jic23@cam.ac.uk>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Felipe Balbi <balbi@ti.com>,
Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout
Date: Mon, 16 Sep 2013 23:17:49 +0200 [thread overview]
Message-ID: <20130916211749.GG24058@raspi> (raw)
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
next reply other threads:[~2013-09-16 21:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 21:17 Matthias Kaehlcke [this message]
2013-09-21 12:25 ` [PATCH v2] iio: ti_am335x_adc: Take touchscreen steps into account for conversion timeout Jonathan Cameron
2013-09-22 17:51 ` Matthias Kaehlcke
2013-09-23 8:57 ` Arun Joseph
2013-09-23 9:36 ` Sekhar Nori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130916211749.GG24058@raspi \
--to=matthias.list@kaehlcke.net \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=panto@antoniou-consulting.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).