diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:52 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:52 +0000 |
commit | 06978a2e455de33d8222fce251780437a8589bab (patch) | |
tree | 054dc204963f33f2e5c4ca4c681d2dc9090ed893 /arch/arm | |
parent | f66212923fd6424f06c274184ad6eb2e67f45d2f (diff) |
touchscreen-meddling.patch
Touchscreen on GTA01-02 experiences noise on the channel that serves the
"tall axis" of the LCM. The sample quality of the other axis is good.
The bad samples have a characteristic of one shot excursions that can
reach +/- 20% or more of the sample average.
Previously, we had a simple averaging scheme going in the touchscreen
driver that summed up 32 x and ys and then divided it by 32. This patch
first tidies up the existing code for style, then adds a new "running
average" concept with a FIFO. The running average is separate from the
summing average mentioned above, and is accurate for the last n samples
sample-by-sample, where n is set by 1 << excursion_filter_len_bits in the
machine / platform stuff.
The heuristic the patch implements for the filtering is to accept all
samples, but tag the *previous* sample with a flag if it differed from
the running average by more than reject_threshold_vs_avg in either
axis. The next sample time, a beauty contest is held if the flag was
set to decide if we think the previous sample was a one-shot excursion
(detected by the new sample being closer to the average than to the
flagged previous sample), or if we believe we are moving (detected by
the new sample being closer to the flagged previous sample than the
average. In the case that we believe the previous sample was an
excursion, we simply overwrite it with the new data and adjust the
summing average to use the new data instead of the excursion data.
I only tested this by eyeballing the output of ts_print_raw, but it
seemed to be quite a bit better. Gross movement appeared to be
tracked fine too. If folks want to try different heuristics on top
of this patch, be my guest; either way feedback on what it looks like
with a graphical app would be good.
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s3c2440/mach-gta02.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index c32bb2a9851..afe8039f0ff 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -897,10 +897,18 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = { static struct s3c2410_ts_mach_info gta02_ts_cfg = { .delay = 10000, - .presc = 65, + .presc = 50000000 / 1000000, /* 50 MHz PCLK / 1MHz */ + /* simple averaging, 2^n samples */ .oversampling_shift = 5, + /* averaging filter length, 2^n */ + .excursion_filter_len_bits = 5, + /* flagged for beauty contest on next sample if differs from + * average more than this + */ + .reject_threshold_vs_avg = 2, }; + /* SPI: LCM control interface attached to Glamo3362 */ static void gta02_jbt6k74_reset(int devidx, int level) |