]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mfd: ti_am335x_tscadc: Fix idle timeout value
authorMatthias Kaehlcke <matthias.list@kaehlcke.net>
Tue, 10 Sep 2013 21:02:18 +0000 (23:02 +0200)
committerLee Jones <lee.jones@linaro.org>
Wed, 23 Oct 2013 15:20:46 +0000 (16:20 +0100)
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>
include/linux/mfd/ti_am335x_tscadc.h

index 25f2c611ab013db8e3a4135a00c129b3d556e7d5..4befdb85dd9ca0837b778250b2e58cd92f906e74 100644 (file)
 #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