| 1 | #ifndef __TS_FILTER_H__ |
| 2 | #define __TS_FILTER_H__ |
| 3 | |
| 4 | /* |
| 5 | * Touchscreen filter. |
| 6 | * |
| 7 | * (c) 2008,2009 Andy Green <andy@openmoko.com> |
| 8 | */ |
| 9 | |
| 10 | #include <linux/platform_device.h> |
| 11 | |
| 12 | #define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ |
| 13 | |
| 14 | struct ts_filter; |
| 15 | struct ts_filter_configuration; |
| 16 | |
| 17 | /* Operations that a filter can perform. */ |
| 18 | |
| 19 | struct ts_filter_api { |
| 20 | /* Create the filter - mandatory. */ |
| 21 | struct ts_filter * (*create)( |
| 22 | struct platform_device *pdev, |
| 23 | const struct ts_filter_configuration *config, |
| 24 | int count_coords); |
| 25 | /* Destroy the filter - mandatory. */ |
| 26 | void (*destroy)(struct ts_filter *filter); |
| 27 | /* Clear the filter - optional. */ |
| 28 | void (*clear)(struct ts_filter *filter); |
| 29 | |
| 30 | |
| 31 | /* |
| 32 | * The next three API functions only make sense if all of them are |
| 33 | * set for a filter. If a filter has the next three methods then |
| 34 | * it can propagate coordinates in the chain. |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | * Process the filter. |
| 39 | * It returns non-zero if the filter reaches an error. |
| 40 | */ |
| 41 | int (*process)(struct ts_filter *filter, int *coords); |
| 42 | /* |
| 43 | * Is the filter ready to return a point? |
| 44 | * Please do not code side effects in this function. |
| 45 | */ |
| 46 | int (*haspoint)(struct ts_filter *filter); |
| 47 | /* |
| 48 | * Get a point. |
| 49 | * Do not call unless the filter actually has a point to deliver. |
| 50 | */ |
| 51 | void (*getpoint)(struct ts_filter *filter, int *coords); |
| 52 | |
| 53 | /* |
| 54 | * Scale the points - optional. |
| 55 | * A filter could only scale coordinates. |
| 56 | */ |
| 57 | void (*scale)(struct ts_filter *filter, int *coords); |
| 58 | }; |
| 59 | |
| 60 | /* |
| 61 | * Generic filter configuration. Actual configurations have this structure |
| 62 | * as a member. |
| 63 | */ |
| 64 | struct ts_filter_configuration { |
| 65 | }; |
| 66 | |
| 67 | struct ts_filter { |
| 68 | /* Operations for this filter. */ |
| 69 | const struct ts_filter_api *api; |
| 70 | /* Number of coordinates to process. */ |
| 71 | int count_coords; |
| 72 | }; |
| 73 | |
| 74 | #endif |
| 75 | |