summaryrefslogtreecommitdiff
path: root/Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen
blob: 1e6a23fdf2fcd7be5a6595c87207bc24e0fa429b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
README on the ADC/Touchscreen Controller
========================================

The LH79524 and LH7A404 include a built-in Analog to Digital
controller (ADC) that is used to process input from a touchscreen.
The driver only implements a four-wire touch panel protocol.

The touchscreen driver is maintenance free except for the pen-down or
touch threshold.  Some resistive displays and board combinations may
require tuning of this threshold.  The driver exposes some of it's
internal state in the sys filesystem.  If the kernel is configured
with it, CONFIG_SYSFS, and sysfs is mounted at /sys, there will be a
directory

  /sys/devices/platform/adc-lh7.0

containing these files.

  -r--r--r--    1 root     root         4096 Jan  1 00:00 samples
  -rw-r--r--    1 root     root         4096 Jan  1 00:00 threshold
  -r--r--r--    1 root     root         4096 Jan  1 00:00 threshold_range

The threshold is the current touch threshold.  It defaults to 750 on
most targets.

  # cat threshold
 750

The threshold_range contains the range of valid values for the
threshold.  Values outside of this range will be silently ignored.

  # cat threshold_range
  0 1023

To change the threshold, write a value to the threshold file.

  # echo 500 > threshold
  # cat threshold
  500

The samples file contains the most recently sampled values from the
ADC.  There are 12.  Below are typical of the last sampled values when
the pen has been released.  The first two and last two samples are for
detecting whether or not the pen is down.  The third through sixth are
X coordinate samples.  The seventh through tenth are Y coordinate
samples.

  # cat samples
  1023 1023 0 0 0 0 530 529 530 529 1023 1023

To determine a reasonable threshold, press on the touch panel with an
appropriate stylus and read the values from samples.

  # cat samples
  1023 676 92 103 101 102 855 919 922 922 1023 679

The first and eleventh samples are discarded.  Thus, the important
values are the second and twelfth which are used to determine if the
pen is down.  When both are below the threshold, the driver registers
that the pen is down.  When either is above the threshold, it
registers then pen is up.