Commit 1a54b7da authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Lee Jones

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: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent ecf67ac3
...@@ -125,13 +125,18 @@ ...@@ -125,13 +125,18 @@
#define TOTAL_CHANNELS 8 #define TOTAL_CHANNELS 8
/* /*
* ADC runs at 3MHz, and it takes * time in us for processing a single channel, calculated as follows:
* 15 cycles to latch one data output. *
* Hence the idle time for ADC to * num cycles = open delay + (sample delay + conv time) * averaging
* process one sample data would be *
* around 5 micro seconds. * num cycles: 152 + (1 + 13) * 16 = 376
*/ *
#define IDLE_TIMEOUT 5 /* microsec */ * 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 #define TSCADC_CELLS 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment