Skip to content

Commit 1a54b7d

Browse files
Matthias KaehlckeLee Jones
authored andcommitted
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>
1 parent ecf67ac commit 1a54b7d

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎include/linux/mfd/ti_am335x_tscadc.h‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,18 @@
125125
#define TOTAL_CHANNELS 8
126126

127127
/*
128-
* ADC runs at 3MHz, and it takes
129-
* 15 cycles to latch one data output.
130-
* Hence the idle time for ADC to
131-
* process one sample data would be
132-
* around 5 micro seconds.
133-
*/
134-
#define IDLE_TIMEOUT 5 /* microsec */
128+
* time in us for processing a single channel, calculated as follows:
129+
*
130+
* num cycles = open delay + (sample delay + conv time) * averaging
131+
*
132+
* num cycles: 152 + (1 + 13) * 16 = 376
133+
*
134+
* clock frequency: 26MHz / 8 = 3.25MHz
135+
* clock period: 1 / 3.25MHz = 308ns
136+
*
137+
* processing time: 376 * 308ns = 116us
138+
*/
139+
#define IDLE_TIMEOUT 116 /* microsec */
135140

136141
#define TSCADC_CELLS 2
137142

0 commit comments

Comments
 (0)