From c0be5ad97fb0f722b8afded74256742c008991d9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 24 Oct 2009 16:06:05 +0200 Subject: ts-filter: Move include files to include/linux/input/touchscreen --- drivers/input/touchscreen/s3c2410_ts.c | 2 +- drivers/input/touchscreen/ts_filter.h | 74 ---------------------- drivers/input/touchscreen/ts_filter_chain.c | 4 +- drivers/input/touchscreen/ts_filter_chain.h | 58 ----------------- drivers/input/touchscreen/ts_filter_group.c | 2 +- drivers/input/touchscreen/ts_filter_group.h | 36 ----------- drivers/input/touchscreen/ts_filter_linear.c | 2 +- drivers/input/touchscreen/ts_filter_linear.h | 31 --------- drivers/input/touchscreen/ts_filter_mean.c | 2 +- drivers/input/touchscreen/ts_filter_mean.h | 28 -------- drivers/input/touchscreen/ts_filter_median.c | 2 +- drivers/input/touchscreen/ts_filter_median.h | 32 ---------- include/linux/input/touchscreen/ts_filter.h | 74 ++++++++++++++++++++++ include/linux/input/touchscreen/ts_filter_chain.h | 58 +++++++++++++++++ include/linux/input/touchscreen/ts_filter_group.h | 36 +++++++++++ include/linux/input/touchscreen/ts_filter_linear.h | 31 +++++++++ include/linux/input/touchscreen/ts_filter_mean.h | 28 ++++++++ include/linux/input/touchscreen/ts_filter_median.h | 32 ++++++++++ 18 files changed, 266 insertions(+), 266 deletions(-) delete mode 100644 drivers/input/touchscreen/ts_filter.h delete mode 100644 drivers/input/touchscreen/ts_filter_chain.h delete mode 100644 drivers/input/touchscreen/ts_filter_group.h delete mode 100644 drivers/input/touchscreen/ts_filter_linear.h delete mode 100644 drivers/input/touchscreen/ts_filter_mean.h delete mode 100644 drivers/input/touchscreen/ts_filter_median.h create mode 100644 include/linux/input/touchscreen/ts_filter.h create mode 100644 include/linux/input/touchscreen/ts_filter_chain.h create mode 100644 include/linux/input/touchscreen/ts_filter_group.h create mode 100644 include/linux/input/touchscreen/ts_filter_linear.h create mode 100644 include/linux/input/touchscreen/ts_filter_mean.h create mode 100644 include/linux/input/touchscreen/ts_filter_median.h diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index caccc83cd12..db083a16284 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c @@ -72,7 +72,7 @@ #include #include -#include "ts_filter_chain.h" +#include /* For ts.dev.id.version */ #define S3C2410TSVERSION 0x0101 diff --git a/drivers/input/touchscreen/ts_filter.h b/drivers/input/touchscreen/ts_filter.h deleted file mode 100644 index 632e5fb3f4e..00000000000 --- a/drivers/input/touchscreen/ts_filter.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __TS_FILTER_H__ -#define __TS_FILTER_H__ - -/* - * Touchscreen filter. - * - * (c) 2008,2009 Andy Green - */ - -#include - -#define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ - -struct ts_filter; -struct ts_filter_configuration; - -/* Operations that a filter can perform. */ - -struct ts_filter_api { - /* Create the filter - mandatory. */ - struct ts_filter * (*create)( - struct platform_device *pdev, - const struct ts_filter_configuration *config, - int count_coords); - /* Destroy the filter - mandatory. */ - void (*destroy)(struct ts_filter *filter); - /* Clear the filter - optional. */ - void (*clear)(struct ts_filter *filter); - - - /* - * The next three API functions only make sense if all of them are - * set for a filter. If a filter has the next three methods then - * it can propagate coordinates in the chain. - */ - - /* - * Process the filter. - * It returns non-zero if the filter reaches an error. - */ - int (*process)(struct ts_filter *filter, int *coords); - /* - * Is the filter ready to return a point? - * Please do not code side effects in this function. - */ - int (*haspoint)(struct ts_filter *filter); - /* - * Get a point. - * Do not call unless the filter actually has a point to deliver. - */ - void (*getpoint)(struct ts_filter *filter, int *coords); - - /* - * Scale the points - optional. - * A filter could only scale coordinates. - */ - void (*scale)(struct ts_filter *filter, int *coords); -}; - -/* - * Generic filter configuration. Actual configurations have this structure - * as a member. - */ -struct ts_filter_configuration { -}; - -struct ts_filter { - /* Operations for this filter. */ - const struct ts_filter_api *api; - /* Number of coordinates to process. */ - int count_coords; -}; - -#endif diff --git a/drivers/input/touchscreen/ts_filter_chain.c b/drivers/input/touchscreen/ts_filter_chain.c index 17793ace144..054ffc16d35 100644 --- a/drivers/input/touchscreen/ts_filter_chain.c +++ b/drivers/input/touchscreen/ts_filter_chain.c @@ -19,8 +19,8 @@ #include #include -#include "ts_filter_chain.h" -#include "ts_filter.h" +#include +#include /* * Tux, would you like the following function in /lib? diff --git a/drivers/input/touchscreen/ts_filter_chain.h b/drivers/input/touchscreen/ts_filter_chain.h deleted file mode 100644 index 065a6a026d2..00000000000 --- a/drivers/input/touchscreen/ts_filter_chain.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __TS_FILTER_CHAIN_H__ -#define __TS_FILTER_CHAIN_H__ - -/* - * Touchscreen filter chains. - * - * (c) 2008,2009 Andy Green - */ - -#include "ts_filter.h" - -#include - -struct ts_filter_chain_configuration { - /* API to use. */ - const struct ts_filter_api *api; - /* Generic filter configuration. Different for each filter. */ - const struct ts_filter_configuration *config; -}; - -struct ts_filter_chain; - -#ifdef CONFIG_TOUCHSCREEN_FILTER - -/* - * Create a filter chain. It will allocate an array of - * null-terminated pointers to filters. On error it will return - * an error you can check with IS_ERR. - */ -extern struct ts_filter_chain *ts_filter_chain_create( - struct platform_device *pdev, - const struct ts_filter_chain_configuration conf[], - int count_coords); - -/* Destroy the chain. */ -extern void ts_filter_chain_destroy(struct ts_filter_chain *c); - -/* Clear the filter chain. */ -extern void ts_filter_chain_clear(struct ts_filter_chain *c); - -/* - * Try to get one point. Returns 0 if no points are available. - * coords will be used as temporal space, thus you supply a point - * using coords but you shouldn't rely on its value on return unless - * it returns a nonzero value that is not -1. - * If one of the filters find an error then this function will - * return -1. - */ -int ts_filter_chain_feed(struct ts_filter_chain *c, int *coords); - -#else /* !CONFIG_TOUCHSCREEN_FILTER */ -#define ts_filter_chain_create(pdev, config, count_coords) (NULL) -#define ts_filter_chain_destroy(c) do { } while (0) -#define ts_filter_chain_clear(c) do { } while (0) -#define ts_filter_chain_feed(c, coords) (1) -#endif - -#endif diff --git a/drivers/input/touchscreen/ts_filter_group.c b/drivers/input/touchscreen/ts_filter_group.c index 722e8dfbdae..9e344c5f19f 100644 --- a/drivers/input/touchscreen/ts_filter_group.c +++ b/drivers/input/touchscreen/ts_filter_group.c @@ -45,7 +45,7 @@ #include #include -#include "ts_filter_group.h" +#include struct coord_range { int min; /* Minimum value of the range. */ diff --git a/drivers/input/touchscreen/ts_filter_group.h b/drivers/input/touchscreen/ts_filter_group.h deleted file mode 100644 index d1e3590e936..00000000000 --- a/drivers/input/touchscreen/ts_filter_group.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __TS_FILTER_GROUP_H__ -#define __TS_FILTER_GROUP_H__ - -#include "ts_filter.h" - -/* - * Touchscreen group filter. - * - * Copyright (C) 2008,2009 by Openmoko, Inc. - * Author: Nelson Castillo - * - */ - -struct ts_filter_group_configuration { - /* Size of the filter. */ - int length; - /* - * If two points are separated by this distance or less they - * are considered to be members of the same group. - */ - int close_enough; - /* Minimum allowed size for the biggest group in the sample set. */ - int threshold; - /* - * Number of times we try to get a group of points with at least - * threshold points. - */ - int attempts; - - /* Generic filter configuration. */ - struct ts_filter_configuration config; -}; - -extern const struct ts_filter_api ts_filter_group_api; - -#endif diff --git a/drivers/input/touchscreen/ts_filter_linear.c b/drivers/input/touchscreen/ts_filter_linear.c index 7718bbc6e6d..8b496591eec 100644 --- a/drivers/input/touchscreen/ts_filter_linear.c +++ b/drivers/input/touchscreen/ts_filter_linear.c @@ -28,7 +28,7 @@ #include #include -#include "ts_filter_linear.h" +#include struct ts_filter_linear; diff --git a/drivers/input/touchscreen/ts_filter_linear.h b/drivers/input/touchscreen/ts_filter_linear.h deleted file mode 100644 index 82df3d25b50..00000000000 --- a/drivers/input/touchscreen/ts_filter_linear.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __TS_FILTER_LINEAR_H__ -#define __TS_FILTER_LINEAR_H__ - -#include "ts_filter.h" -#include - -/* - * Touchscreen linear filter. - * - * Copyright (C) 2008,2009 by Openmoko, Inc. - * Author: Nelson Castillo - * - */ - -#define TS_FILTER_LINEAR_NCONSTANTS 7 - -struct ts_filter_linear_configuration { - /* Calibration constants. */ - int constants[TS_FILTER_LINEAR_NCONSTANTS]; - /* First coordinate. */ - int coord0; - /* Second coordinate. */ - int coord1; - - /* Generic filter configuration. */ - struct ts_filter_configuration config; -}; - -extern const struct ts_filter_api ts_filter_linear_api; - -#endif diff --git a/drivers/input/touchscreen/ts_filter_mean.c b/drivers/input/touchscreen/ts_filter_mean.c index 0c604321713..ad4e9c1207c 100644 --- a/drivers/input/touchscreen/ts_filter_mean.c +++ b/drivers/input/touchscreen/ts_filter_mean.c @@ -25,7 +25,7 @@ #include #include -#include "ts_filter_mean.h" +#include struct ts_filter_mean { /* Copy of the private filter configuration. */ diff --git a/drivers/input/touchscreen/ts_filter_mean.h b/drivers/input/touchscreen/ts_filter_mean.h deleted file mode 100644 index 80f9b215dff..00000000000 --- a/drivers/input/touchscreen/ts_filter_mean.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __TS_FILTER_MEAN_H__ -#define __TS_FILTER_MEAN_H__ - -#include "ts_filter.h" - -/* - * Touchscreen filter. - * - * mean - * - * (c) 2008,2009 - * Andy Green - * Nelson Castillo - */ - -/* Configuration for this filter. */ -struct ts_filter_mean_configuration { - /* Number of points for the mean. */ - int length; - - /* Generic filter configuration. */ - struct ts_filter_configuration config; -}; - -/* API functions for the mean filter */ -extern const struct ts_filter_api ts_filter_mean_api; - -#endif /* __TS_FILTER_MEAN_H__ */ diff --git a/drivers/input/touchscreen/ts_filter_median.c b/drivers/input/touchscreen/ts_filter_median.c index 6f8aae5941d..c608f7a9794 100644 --- a/drivers/input/touchscreen/ts_filter_median.c +++ b/drivers/input/touchscreen/ts_filter_median.c @@ -32,7 +32,7 @@ #include #include #include -#include "ts_filter_median.h" +#include struct ts_filter_median { /* Private configuration. */ diff --git a/drivers/input/touchscreen/ts_filter_median.h b/drivers/input/touchscreen/ts_filter_median.h deleted file mode 100644 index b13f361bb6a..00000000000 --- a/drivers/input/touchscreen/ts_filter_median.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __TS_FILTER_MEDIAN_H__ -#define __TS_FILTER_MEDIAN_H__ - -#include "ts_filter.h" - -/* - * Touchscreen filter. - * - * median - * - * (c) 2008 Andy Green - */ - -struct ts_filter_median_configuration { - /* Size of the filter. */ - int extent; - /* Precomputed midpoint. */ - int midpoint; - /* A reference value for us to check if we are going fast or slow. */ - int decimation_threshold; - /* How many points to replace if we're going fast. */ - int decimation_above; - /* How many points to replace if we're going slow. */ - int decimation_below; - - /* Generic configuration. */ - struct ts_filter_configuration config; -}; - -extern const struct ts_filter_api ts_filter_median_api; - -#endif diff --git a/include/linux/input/touchscreen/ts_filter.h b/include/linux/input/touchscreen/ts_filter.h new file mode 100644 index 00000000000..632e5fb3f4e --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter.h @@ -0,0 +1,74 @@ +#ifndef __TS_FILTER_H__ +#define __TS_FILTER_H__ + +/* + * Touchscreen filter. + * + * (c) 2008,2009 Andy Green + */ + +#include + +#define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ + +struct ts_filter; +struct ts_filter_configuration; + +/* Operations that a filter can perform. */ + +struct ts_filter_api { + /* Create the filter - mandatory. */ + struct ts_filter * (*create)( + struct platform_device *pdev, + const struct ts_filter_configuration *config, + int count_coords); + /* Destroy the filter - mandatory. */ + void (*destroy)(struct ts_filter *filter); + /* Clear the filter - optional. */ + void (*clear)(struct ts_filter *filter); + + + /* + * The next three API functions only make sense if all of them are + * set for a filter. If a filter has the next three methods then + * it can propagate coordinates in the chain. + */ + + /* + * Process the filter. + * It returns non-zero if the filter reaches an error. + */ + int (*process)(struct ts_filter *filter, int *coords); + /* + * Is the filter ready to return a point? + * Please do not code side effects in this function. + */ + int (*haspoint)(struct ts_filter *filter); + /* + * Get a point. + * Do not call unless the filter actually has a point to deliver. + */ + void (*getpoint)(struct ts_filter *filter, int *coords); + + /* + * Scale the points - optional. + * A filter could only scale coordinates. + */ + void (*scale)(struct ts_filter *filter, int *coords); +}; + +/* + * Generic filter configuration. Actual configurations have this structure + * as a member. + */ +struct ts_filter_configuration { +}; + +struct ts_filter { + /* Operations for this filter. */ + const struct ts_filter_api *api; + /* Number of coordinates to process. */ + int count_coords; +}; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_chain.h b/include/linux/input/touchscreen/ts_filter_chain.h new file mode 100644 index 00000000000..a021ba25bd4 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_chain.h @@ -0,0 +1,58 @@ +#ifndef __TS_FILTER_CHAIN_H__ +#define __TS_FILTER_CHAIN_H__ + +/* + * Touchscreen filter chains. + * + * (c) 2008,2009 Andy Green + */ + +#include + +#include + +struct ts_filter_chain_configuration { + /* API to use. */ + const struct ts_filter_api *api; + /* Generic filter configuration. Different for each filter. */ + const struct ts_filter_configuration *config; +}; + +struct ts_filter_chain; + +#ifdef CONFIG_TOUCHSCREEN_FILTER + +/* + * Create a filter chain. It will allocate an array of + * null-terminated pointers to filters. On error it will return + * an error you can check with IS_ERR. + */ +extern struct ts_filter_chain *ts_filter_chain_create( + struct platform_device *pdev, + const struct ts_filter_chain_configuration conf[], + int count_coords); + +/* Destroy the chain. */ +extern void ts_filter_chain_destroy(struct ts_filter_chain *c); + +/* Clear the filter chain. */ +extern void ts_filter_chain_clear(struct ts_filter_chain *c); + +/* + * Try to get one point. Returns 0 if no points are available. + * coords will be used as temporal space, thus you supply a point + * using coords but you shouldn't rely on its value on return unless + * it returns a nonzero value that is not -1. + * If one of the filters find an error then this function will + * return -1. + */ +int ts_filter_chain_feed(struct ts_filter_chain *c, int *coords); + +#else /* !CONFIG_TOUCHSCREEN_FILTER */ +#define ts_filter_chain_create(pdev, config, count_coords) (NULL) +#define ts_filter_chain_destroy(c) do { } while (0) +#define ts_filter_chain_clear(c) do { } while (0) +#define ts_filter_chain_feed(c, coords) (1) +#endif + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_group.h b/include/linux/input/touchscreen/ts_filter_group.h new file mode 100644 index 00000000000..2d727f30086 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_group.h @@ -0,0 +1,36 @@ +#ifndef __TS_FILTER_GROUP_H__ +#define __TS_FILTER_GROUP_H__ + +#include + +/* + * Touchscreen group filter. + * + * Copyright (C) 2008,2009 by Openmoko, Inc. + * Author: Nelson Castillo + * + */ + +struct ts_filter_group_configuration { + /* Size of the filter. */ + int length; + /* + * If two points are separated by this distance or less they + * are considered to be members of the same group. + */ + int close_enough; + /* Minimum allowed size for the biggest group in the sample set. */ + int threshold; + /* + * Number of times we try to get a group of points with at least + * threshold points. + */ + int attempts; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_group_api; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_linear.h b/include/linux/input/touchscreen/ts_filter_linear.h new file mode 100644 index 00000000000..6f5e8307456 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_linear.h @@ -0,0 +1,31 @@ +#ifndef __TS_FILTER_LINEAR_H__ +#define __TS_FILTER_LINEAR_H__ + +#include +#include + +/* + * Touchscreen linear filter. + * + * Copyright (C) 2008,2009 by Openmoko, Inc. + * Author: Nelson Castillo + * + */ + +#define TS_FILTER_LINEAR_NCONSTANTS 7 + +struct ts_filter_linear_configuration { + /* Calibration constants. */ + int constants[TS_FILTER_LINEAR_NCONSTANTS]; + /* First coordinate. */ + int coord0; + /* Second coordinate. */ + int coord1; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_linear_api; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_mean.h b/include/linux/input/touchscreen/ts_filter_mean.h new file mode 100644 index 00000000000..d4870413987 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_mean.h @@ -0,0 +1,28 @@ +#ifndef __TS_FILTER_MEAN_H__ +#define __TS_FILTER_MEAN_H__ + +#include + +/* + * Touchscreen filter. + * + * mean + * + * (c) 2008,2009 + * Andy Green + * Nelson Castillo + */ + +/* Configuration for this filter. */ +struct ts_filter_mean_configuration { + /* Number of points for the mean. */ + int length; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +/* API functions for the mean filter */ +extern const struct ts_filter_api ts_filter_mean_api; + +#endif /* __TS_FILTER_MEAN_H__ */ diff --git a/include/linux/input/touchscreen/ts_filter_median.h b/include/linux/input/touchscreen/ts_filter_median.h new file mode 100644 index 00000000000..08051619531 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_median.h @@ -0,0 +1,32 @@ +#ifndef __TS_FILTER_MEDIAN_H__ +#define __TS_FILTER_MEDIAN_H__ + +#include + +/* + * Touchscreen filter. + * + * median + * + * (c) 2008 Andy Green + */ + +struct ts_filter_median_configuration { + /* Size of the filter. */ + int extent; + /* Precomputed midpoint. */ + int midpoint; + /* A reference value for us to check if we are going fast or slow. */ + int decimation_threshold; + /* How many points to replace if we're going fast. */ + int decimation_above; + /* How many points to replace if we're going slow. */ + int decimation_below; + + /* Generic configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_median_api; + +#endif -- cgit v1.2.3