From 675a93c65029c2cda2d00bb73f9d7f0e1c9d42dc Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Tue, 10 Mar 2009 12:04:40 +0000 Subject: Add filter_chain object Filter chains should be completely opaque to the drivers that use it. We fix this with this patch. ~ Make the "filter chain" a new object. ~ We can build with CONFIG_TOUCHSCREEN_FILTER=n with no problems in a cleaner way. ~ Update s3c2410_ts.c to use the filter_chain object. ~ Cleanups. Signed-off-by: Nelson Castillo --- drivers/input/touchscreen/ts_filter_chain.h | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 drivers/input/touchscreen/ts_filter_chain.h (limited to 'drivers/input/touchscreen/ts_filter_chain.h') diff --git a/drivers/input/touchscreen/ts_filter_chain.h b/drivers/input/touchscreen/ts_filter_chain.h new file mode 100644 index 00000000000..806bffe6c99 --- /dev/null +++ b/drivers/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 "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 -- cgit v1.2.3