[PATCH] fix-last_issued-ts_filter_median.patch

Nelson Castillo nelsoneci at gmail.com
Fri Nov 28 22:42:46 CET 2008


- Decimation_below was not being used in the median filter. Fixed.

- Decimation_below should be small. There's no need to change many
  points in the median filter if we're moving slow. In this way we
  will filter more noise.

- Now we deliver 2X input events -- 1 each 5 milliseconds.
  (side effect of the previous two changes)

- We should omit the last point before the UP event but I think this
  belongs to user-space.  I'm programming a tslib filter ("skip") and
  if it doesn't work will I'll send a patch later to skip the last
  point in the driver.

Signed-off-by: Nelson Castillo <nelsoneci at gmail.com>
---

 arch/arm/mach-s3c2440/mach-gta02.c           |    4 ++--
 drivers/input/touchscreen/ts_filter_median.c |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 5d0cd96..f3fabf9 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -958,9 +958,9 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {
 
 static struct ts_filter_median_configuration gta02_ts_median_config = {
 	.extent = 31,
-	.decimation_below = 28,
+	.decimation_below = 5,
 	.decimation_threshold = 8 * 3,
-	.decimation_above = 12,
+	.decimation_above = 10,
 };
 
 static struct ts_filter_mean_configuration gta02_ts_mean_config = {
diff --git a/drivers/input/touchscreen/ts_filter_median.c b/drivers/input/touchscreen/ts_filter_median.c
index 47970da..d60c431 100644
--- a/drivers/input/touchscreen/ts_filter_median.c
+++ b/drivers/input/touchscreen/ts_filter_median.c
@@ -190,7 +190,8 @@ static int ts_filter_median_process(struct ts_filter *tsf, int *coords)
 	else
 		tsfm->decimation_count = tsfm->config->decimation_below;
 
-	memcpy(&tsfm->last_issued, coords, tsfm->tsf.count_coords);
+	memcpy(&tsfm->last_issued[0], coords,
+	       tsfm->tsf.count_coords * sizeof(int));
 
 	if (tsf->next) /* chain */
 		return (tsf->next->api->process)(tsf->next, coords);




More information about the openmoko-kernel mailing list