| 1 | #ifndef __TS_FILTER_CHAIN_H__ |
| 2 | #define __TS_FILTER_CHAIN_H__ |
| 3 | |
| 4 | /* |
| 5 | * Touchscreen filter chains. |
| 6 | * |
| 7 | * (c) 2008,2009 Andy Green <andy@openmoko.com> |
| 8 | */ |
| 9 | |
| 10 | #include "ts_filter.h" |
| 11 | |
| 12 | #include <linux/err.h> |
| 13 | |
| 14 | struct ts_filter_chain_configuration { |
| 15 | /* API to use. */ |
| 16 | const struct ts_filter_api *api; |
| 17 | /* Generic filter configuration. Different for each filter. */ |
| 18 | const struct ts_filter_configuration *config; |
| 19 | }; |
| 20 | |
| 21 | struct ts_filter_chain; |
| 22 | |
| 23 | #ifdef CONFIG_TOUCHSCREEN_FILTER |
| 24 | |
| 25 | /* |
| 26 | * Create a filter chain. It will allocate an array of |
| 27 | * null-terminated pointers to filters. On error it will return |
| 28 | * an error you can check with IS_ERR. |
| 29 | */ |
| 30 | extern struct ts_filter_chain *ts_filter_chain_create( |
| 31 | struct platform_device *pdev, |
| 32 | const struct ts_filter_chain_configuration conf[], |
| 33 | int count_coords); |
| 34 | |
| 35 | /* Destroy the chain. */ |
| 36 | extern void ts_filter_chain_destroy(struct ts_filter_chain *c); |
| 37 | |
| 38 | /* Clear the filter chain. */ |
| 39 | extern void ts_filter_chain_clear(struct ts_filter_chain *c); |
| 40 | |
| 41 | /* |
| 42 | * Try to get one point. Returns 0 if no points are available. |
| 43 | * coords will be used as temporal space, thus you supply a point |
| 44 | * using coords but you shouldn't rely on its value on return unless |
| 45 | * it returns a nonzero value that is not -1. |
| 46 | * If one of the filters find an error then this function will |
| 47 | * return -1. |
| 48 | */ |
| 49 | int ts_filter_chain_feed(struct ts_filter_chain *c, int *coords); |
| 50 | |
| 51 | #else /* !CONFIG_TOUCHSCREEN_FILTER */ |
| 52 | #define ts_filter_chain_create(pdev, config, count_coords) (NULL) |
| 53 | #define ts_filter_chain_destroy(c) do { } while (0) |
| 54 | #define ts_filter_chain_clear(c) do { } while (0) |
| 55 | #define ts_filter_chain_feed(c, coords) (1) |
| 56 | #endif |
| 57 | |
| 58 | #endif |
| 59 | |