summaryrefslogtreecommitdiff
path: root/include/linux/mfd/ti_am335x_tscadc.h
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.list@kaehlcke.net>2013-09-11 01:02:18 +0400
committerLee Jones <lee.jones@linaro.org>2013-10-23 19:20:46 +0400
commit1a54b7dabf8f20df2894aed9683155ff89fc20e8 (patch)
tree971c15a0003ee7b8cb68dc74663896e3d5b5bdf8 /include/linux/mfd/ti_am335x_tscadc.h
parentecf67ac335bba0867ce7c6470ae4a3574e0f2838 (diff)
downloadlinux-1a54b7dabf8f20df2894aed9683155ff89fc20e8.tar.xz
mfd: ti_am335x_tscadc: Fix idle timeout value
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> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd/ti_am335x_tscadc.h')
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c611ab01..4befdb85dd9c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -125,13 +125,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