From: Matthias Kaehlcke <matthias.list@kaehlcke.net>
To: Samuel Ortiz <sameo@linux.intel.com>, Lee Jones <lee.jones@linaro.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] mfd: ti_am335x_tscadc: Fix idle timeout value
Date: Tue, 10 Sep 2013 23:02:18 +0200 [thread overview]
Message-ID: <20130910210218.GB30481@raspi> (raw)
The old timeout value was based on the assumption that the minimum values are
used for the open and sample delay and no averaging is done. In fact the ADC
and touchscreen driver both use an open delay of 152 cycles and averaging over
16 samples. This patch adjusts the timeout value accordingly
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
include/linux/mfd/ti_am335x_tscadc.h | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index db1791b..9e6a775 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -126,13 +126,18 @@
#define TOTAL_CHANNELS 8
/*
-* ADC runs at 3MHz, and it takes
-* 15 cycles to latch one data output.
-* Hence the idle time for ADC to
-* process one sample data would be
-* around 5 micro seconds.
-*/
-#define IDLE_TIMEOUT 5 /* microsec */
+ * time in us for processing a single channel, calculated as follows:
+ *
+ * num cycles = open delay + (sample delay + conv time) * averaging
+ *
+ * num cycles: 152 + (1 + 13) * 16 = 376
+ *
+ * clock frequency: 26MHz / 8 = 3.25MHz
+ * clock period: 1 / 3.25MHz = 308ns
+ *
+ * processing time: 376 * 308ns = 116us
+ */
+#define IDLE_TIMEOUT 116 /* microsec */
#define TSCADC_CELLS 2
--
1.8.4.rc3
next reply other threads:[~2013-09-10 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 21:02 Matthias Kaehlcke [this message]
2013-09-11 7:00 ` [PATCH 1/2] mfd: ti_am335x_tscadc: Fix idle timeout value Lee Jones
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=20130910210218.GB30481@raspi \
--to=matthias.list@kaehlcke.net \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.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