S3C: Backported openmoko's touchscreen filters
[linux-2.6/mini2440.git] / drivers / input / touchscreen / ts_filter.h
blob3746e45bccc6503ac973f5557cd1947e48066c55
1 #ifndef __TS_FILTER_H__
2 #define __TS_FILTER_H__
4 /*
5 * Touchscreen filter.
7 * (c) 2008 Andy Green <andy@openmoko.com>
8 */
10 #include <linux/platform_device.h>
12 #define MAX_TS_FILTER_CHAIN 8 /* Max. filters we can chain up. */
13 #define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */
15 struct ts_filter;
17 /* Operations that a filter can perform. */
19 struct ts_filter_api {
20 struct ts_filter * (*create)(struct platform_device *pdev, void *config,
21 int count_coords);
22 void (*destroy)(struct platform_device *pdev, struct ts_filter *filter);
23 void (*clear)(struct ts_filter *filter);
24 int (*process)(struct ts_filter *filter, int *coords);
25 void (*scale)(struct ts_filter *filter, int *coords);
29 * This is the common part of all filters.
30 * We use this type as an otherwise opaque handle on to
31 * the actual filter. Therefore you need one of these
32 * at the start of your actual filter struct.
35 struct ts_filter {
36 struct ts_filter *next; /* Next in chain. */
37 struct ts_filter_api *api; /* Operations to use for this object. */
38 int count_coords;
39 int coords[MAX_TS_FILTER_COORDS];
43 * Helper to create a filter chain from an array of API pointers and
44 * array of config ints. Leaves pointers to created filters in arr
45 * array and fills in ->next pointers to create the chain.
48 #ifdef CONFIG_TOUCHSCREEN_FILTER
49 extern int ts_filter_create_chain(struct platform_device *pdev,
50 struct ts_filter_api **api, void **config,
51 struct ts_filter **arr, int count_coords);
53 /* Helper to destroy a whole chain from the list of filter pointers. */
55 extern void ts_filter_destroy_chain(struct platform_device *pdev,
56 struct ts_filter **arr);
57 #else
58 #define ts_filter_create_chain(pdev, api, config, arr, count_coords) (0)
59 #define ts_filter_destroy_chain(pdev, arr) do { } while (0)
60 #endif
62 #endif