On Fri, Jan 16, 2009 at 8:18 PM, Werner Almesberger <[email protected]> wrote: > Nelson wrote: >> This patch just moves the touchscreen filter header files >> around, with no modifications. The kernel will not compile >> after this patch and another patch will be needed to modify >> the actual #includes. I read it's better not to modify files >> when you move them around. > > Yes, but change sets that need more changes before things compile > again are generally frowned upon because they break git-bisect. > > We're currently living in relatively calm times in the Openmoko kernel > tree, so Andy may let you get away with this, but better don't make it > a habit.
I'm sending a patch that does both things. I think this one should be used instead. I misread this http://kerneltrap.org/node/11765 . I missed "perhaps with just _trivial_ changes to make it compile". Thanks for pointing it out. > I haven't been following what kind of welcome the filter architecture > got from upstream. Seems that it was friendly ? Congratulations ! Well, nothing from linux-input. In LKML Andrew Morton just told us to fix a few things. I think it is a good thing that nobody has told us that we suck, not yet :-) We need to submit code that actually uses the filters before they accept the patches upstream. Right now s3c2410_ts.c and mach-gta02.c come to my mind (I am not aware of the dependencies).
Move touchscreen filter includes From: Nelson Castillo <[email protected]> This patch just moves the touchscreen filter header files around. It also updates the #includes so that things compile again. Tested in a GTA02. Signed-off-by: Nelson Castillo <[email protected]> --- arch/arm/mach-s3c2410/include/mach/ts.h | 2 - arch/arm/mach-s3c2440/mach-gta02.c | 8 ++- drivers/input/touchscreen/s3c2410_ts.c | 2 - drivers/input/touchscreen/ts_filter.c | 2 - drivers/input/touchscreen/ts_filter.h | 57 +++++++++++++++++++++++ drivers/input/touchscreen/ts_filter_group.c | 2 - drivers/input/touchscreen/ts_filter_group.h | 39 ++++++++++++++++ drivers/input/touchscreen/ts_filter_linear.c | 2 - drivers/input/touchscreen/ts_filter_linear.h | 64 ++++++++++++++++++++++++++ drivers/input/touchscreen/ts_filter_mean.c | 2 - drivers/input/touchscreen/ts_filter_mean.h | 34 ++++++++++++++ drivers/input/touchscreen/ts_filter_median.c | 2 - drivers/input/touchscreen/ts_filter_median.h | 36 +++++++++++++++ include/linux/ts_filter.h | 57 ----------------------- include/linux/ts_filter_group.h | 39 ---------------- include/linux/ts_filter_linear.h | 64 -------------------------- include/linux/ts_filter_mean.h | 34 -------------- include/linux/ts_filter_median.h | 36 --------------- 18 files changed, 241 insertions(+), 241 deletions(-) create mode 100644 drivers/input/touchscreen/ts_filter.h create mode 100644 drivers/input/touchscreen/ts_filter_group.h create mode 100644 drivers/input/touchscreen/ts_filter_linear.h create mode 100644 drivers/input/touchscreen/ts_filter_mean.h create mode 100644 drivers/input/touchscreen/ts_filter_median.h delete mode 100644 include/linux/ts_filter.h delete mode 100644 include/linux/ts_filter_group.h delete mode 100644 include/linux/ts_filter_linear.h delete mode 100644 include/linux/ts_filter_mean.h delete mode 100644 include/linux/ts_filter_median.h diff --git a/arch/arm/mach-s3c2410/include/mach/ts.h b/arch/arm/mach-s3c2410/include/mach/ts.h index ab4433f..1b451ea 100644 --- a/arch/arm/mach-s3c2410/include/mach/ts.h +++ b/arch/arm/mach-s3c2410/include/mach/ts.h @@ -16,7 +16,7 @@ #ifndef __ASM_ARM_TS_H #define __ASM_ARM_TS_H -#include <linux/ts_filter.h> +#include <../drivers/input/touchscreen/ts_filter.h> struct s3c2410_ts_mach_info { int delay; diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index 4520d7b..cff7aff 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -103,10 +103,10 @@ #include "../plat-s3c24xx/neo1973_pm_gps.h" -#include <linux/ts_filter_linear.h> -#include <linux/ts_filter_mean.h> -#include <linux/ts_filter_median.h> -#include <linux/ts_filter_group.h> +#include <../drivers/input/touchscreen/ts_filter_linear.h> +#include <../drivers/input/touchscreen/ts_filter_mean.h> +#include <../drivers/input/touchscreen/ts_filter_median.h> +#include <../drivers/input/touchscreen/ts_filter_group.h> /* arbitrates which sensor IRQ owns the shared SPI bus */ static spinlock_t motion_irq_lock; diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 46a33df..1a930a2 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c @@ -65,7 +65,7 @@ #include <plat/regs-adc.h> -#include <linux/ts_filter.h> +#include "ts_filter.h" /* For ts.dev.id.version */ #define S3C2410TSVERSION 0x0101 diff --git a/drivers/input/touchscreen/ts_filter.c b/drivers/input/touchscreen/ts_filter.c index d936e45..832844d 100644 --- a/drivers/input/touchscreen/ts_filter.c +++ b/drivers/input/touchscreen/ts_filter.c @@ -18,7 +18,7 @@ #include <linux/kernel.h> #include <linux/device.h> -#include <linux/ts_filter.h> +#include "ts_filter.h" static DEFINE_MUTEX(chain_mutex); diff --git a/drivers/input/touchscreen/ts_filter.h b/drivers/input/touchscreen/ts_filter.h new file mode 100644 index 0000000..5578e93 --- /dev/null +++ b/drivers/input/touchscreen/ts_filter.h @@ -0,0 +1,57 @@ +#ifndef __TS_FILTER_H__ +#define __TS_FILTER_H__ + +/* + * Touchscreen filter. + * + * (c) 2008 Andy Green <[email protected]> + */ + +#include <linux/platform_device.h> + +#define MAX_TS_FILTER_CHAIN 8 /* Max. filters we can chain up. */ +#define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ + +struct ts_filter; + +/* Operations that a filter can perform. */ + +struct ts_filter_api { + struct ts_filter * (*create)(struct platform_device *pdev, void *config, + int count_coords); + void (*destroy)(struct platform_device *pdev, struct ts_filter *filter); + void (*clear)(struct ts_filter *filter); + int (*process)(struct ts_filter *filter, int *coords); + void (*scale)(struct ts_filter *filter, int *coords); +}; + +/* + * This is the common part of all filters. + * We use this type as an otherwise opaque handle on to + * the actual filter. Therefore you need one of these + * at the start of your actual filter struct. + */ + +struct ts_filter { + struct ts_filter *next; /* Next in chain. */ + struct ts_filter_api *api; /* Operations to use for this object. */ + int count_coords; + int coords[MAX_TS_FILTER_COORDS]; +}; + +/* + * Helper to create a filter chain from an array of API pointers and + * array of config ints. Leaves pointers to created filters in arr + * array and fills in ->next pointers to create the chain. + */ + +extern int ts_filter_create_chain(struct platform_device *pdev, + struct ts_filter_api **api, void **config, + struct ts_filter **arr, int count_coords); + +/* Helper to destroy a whole chain from the list of filter pointers. */ + +extern void ts_filter_destroy_chain(struct platform_device *pdev, + struct ts_filter **arr); + +#endif diff --git a/drivers/input/touchscreen/ts_filter_group.c b/drivers/input/touchscreen/ts_filter_group.c index 73e3625..f2ecd92 100644 --- a/drivers/input/touchscreen/ts_filter_group.c +++ b/drivers/input/touchscreen/ts_filter_group.c @@ -40,7 +40,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/sort.h> -#include <linux/ts_filter_group.h> +#include "ts_filter_group.h" static void ts_filter_group_clear_internal(struct ts_filter_group *tsfg, int attempts) diff --git a/drivers/input/touchscreen/ts_filter_group.h b/drivers/input/touchscreen/ts_filter_group.h new file mode 100644 index 0000000..c411080 --- /dev/null +++ b/drivers/input/touchscreen/ts_filter_group.h @@ -0,0 +1,39 @@ +#ifndef __TS_FILTER_GROUP_H__ +#define __TS_FILTER_GROUP_H__ + +#include "ts_filter.h" + +/* + * Touchscreen group filter. + * + * Copyright (C) 2008 by Openmoko, Inc. + * Author: Nelson Castillo <[email protected]> + * + */ + +struct ts_filter_group_configuration { + int extent; + int close_enough; + int threshold; + int attempts; +}; + +struct ts_filter_group { + struct ts_filter tsf; + struct ts_filter_group_configuration *config; + + int N; /* How many samples we have */ + int *samples[MAX_TS_FILTER_COORDS]; /* the samples, our input */ + + int *group_size; /* used for temporal computations */ + int *sorted_samples; /* used for temporal computations */ + + int range_max[MAX_TS_FILTER_COORDS]; /* max computed ranges */ + int range_min[MAX_TS_FILTER_COORDS]; /* min computed ranges */ + + int tries_left; /* We finish if we don't get enough samples */ +}; + +extern 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 3322c69..c336252 100644 --- a/drivers/input/touchscreen/ts_filter_linear.c +++ b/drivers/input/touchscreen/ts_filter_linear.c @@ -24,7 +24,7 @@ * */ -#include <linux/ts_filter_linear.h> +#include "ts_filter_linear.h" #include <linux/kernel.h> #include <linux/slab.h> #include <linux/string.h> diff --git a/drivers/input/touchscreen/ts_filter_linear.h b/drivers/input/touchscreen/ts_filter_linear.h new file mode 100644 index 0000000..fc27cf7 --- /dev/null +++ b/drivers/input/touchscreen/ts_filter_linear.h @@ -0,0 +1,64 @@ +#ifndef __TS_FILTER_LINEAR_H__ +#define __TS_FILTER_LINEAR_H__ + +#include "ts_filter.h" +#include <linux/kobject.h> + +/* + * Touchscreen linear filter. + * + * Copyright (C) 2008 by Openmoko, Inc. + * Author: Nelson Castillo <[email protected]> + * + */ + +#define TS_FILTER_LINEAR_NCONSTANTS 7 + +/* sysfs */ + +struct ts_filter_linear; + +struct const_obj { + struct ts_filter_linear *tsfl; + struct kobject kobj; +}; + +#define to_const_obj(x) container_of(x, struct const_obj, kobj) + +struct const_attribute { + struct attribute attr; + ssize_t (*show)(struct const_obj *const, struct const_attribute *attr, + char *buf); + ssize_t (*store)(struct const_obj *const, struct const_attribute *attr, + const char *buf, size_t count); +}; + +#define to_const_attr(x) container_of(x, struct const_attribute, attr) + +/* filter configuration */ + +struct ts_filter_linear_configuration { + int constants[TS_FILTER_LINEAR_NCONSTANTS]; + int coord0; + int coord1; +}; + +/* the filter */ + +struct ts_filter_linear { + struct ts_filter tsf; + struct ts_filter_linear_configuration *config; + + int constants[TS_FILTER_LINEAR_NCONSTANTS]; + + /* sysfs */ + struct const_obj c_obj; + struct kobj_type const_ktype; + struct const_attribute kattrs[TS_FILTER_LINEAR_NCONSTANTS]; + struct attribute *attrs[TS_FILTER_LINEAR_NCONSTANTS + 1]; + char attr_names[TS_FILTER_LINEAR_NCONSTANTS][2]; +}; + +extern 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 409ccc7..e4e0f2a 100644 --- a/drivers/input/touchscreen/ts_filter_mean.c +++ b/drivers/input/touchscreen/ts_filter_mean.c @@ -34,7 +34,7 @@ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/slab.h> -#include <linux/ts_filter_mean.h> +#include "ts_filter_mean.h" static void ts_filter_mean_clear_internal(struct ts_filter *tsf) { diff --git a/drivers/input/touchscreen/ts_filter_mean.h b/drivers/input/touchscreen/ts_filter_mean.h new file mode 100644 index 0000000..44c506c --- /dev/null +++ b/drivers/input/touchscreen/ts_filter_mean.h @@ -0,0 +1,34 @@ +#ifndef __TS_FILTER_MEAN_H__ +#define __TS_FILTER_MEAN_H__ + +#include "ts_filter.h" + +/* + * Touchscreen filter. + * + * mean + * + * (c) 2008 Andy Green <[email protected]> + */ + +struct ts_filter_mean_configuration { + int bits_filter_length; + int averaging_threshold; + + int extent; +}; + +struct ts_filter_mean { + struct ts_filter tsf; + struct ts_filter_mean_configuration *config; + + int reported[MAX_TS_FILTER_COORDS]; + int lowpass[MAX_TS_FILTER_COORDS]; + int *fifo[MAX_TS_FILTER_COORDS]; + int fhead[MAX_TS_FILTER_COORDS]; + int ftail[MAX_TS_FILTER_COORDS]; +}; + +extern struct ts_filter_api ts_filter_mean_api; + +#endif diff --git a/drivers/input/touchscreen/ts_filter_median.c b/drivers/input/touchscreen/ts_filter_median.c index a033716..b3b6a9c 100644 --- a/drivers/input/touchscreen/ts_filter_median.c +++ b/drivers/input/touchscreen/ts_filter_median.c @@ -32,7 +32,7 @@ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/slab.h> -#include <linux/ts_filter_median.h> +#include "ts_filter_median.h" static void ts_filter_median_insert(int *p, int sample, int count) { diff --git a/drivers/input/touchscreen/ts_filter_median.h b/drivers/input/touchscreen/ts_filter_median.h new file mode 100644 index 0000000..8f25e27 --- /dev/null +++ b/drivers/input/touchscreen/ts_filter_median.h @@ -0,0 +1,36 @@ +#ifndef __TS_FILTER_MEDIAN_H__ +#define __TS_FILTER_MEDIAN_H__ + +#include "ts_filter.h" + +/* + * Touchscreen filter. + * + * median + * + * (c) 2008 Andy Green <[email protected]> + */ + +struct ts_filter_median_configuration { + int extent; + int midpoint; + int decimation_threshold; + int decimation_above; + int decimation_below; +}; + +struct ts_filter_median { + struct ts_filter tsf; + struct ts_filter_median_configuration *config; + + int decimation_count; + int last_issued[MAX_TS_FILTER_COORDS]; + int valid; /* how many samples in the sort buffer are valid */ + int *sort[MAX_TS_FILTER_COORDS]; /* samples taken for median */ + int *fifo[MAX_TS_FILTER_COORDS]; /* samples taken for median */ + int pos; /* where we are in the fifo sample memory */ +}; + +extern struct ts_filter_api ts_filter_median_api; + +#endif diff --git a/include/linux/ts_filter.h b/include/linux/ts_filter.h deleted file mode 100644 index 5578e93..0000000 --- a/include/linux/ts_filter.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __TS_FILTER_H__ -#define __TS_FILTER_H__ - -/* - * Touchscreen filter. - * - * (c) 2008 Andy Green <[email protected]> - */ - -#include <linux/platform_device.h> - -#define MAX_TS_FILTER_CHAIN 8 /* Max. filters we can chain up. */ -#define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ - -struct ts_filter; - -/* Operations that a filter can perform. */ - -struct ts_filter_api { - struct ts_filter * (*create)(struct platform_device *pdev, void *config, - int count_coords); - void (*destroy)(struct platform_device *pdev, struct ts_filter *filter); - void (*clear)(struct ts_filter *filter); - int (*process)(struct ts_filter *filter, int *coords); - void (*scale)(struct ts_filter *filter, int *coords); -}; - -/* - * This is the common part of all filters. - * We use this type as an otherwise opaque handle on to - * the actual filter. Therefore you need one of these - * at the start of your actual filter struct. - */ - -struct ts_filter { - struct ts_filter *next; /* Next in chain. */ - struct ts_filter_api *api; /* Operations to use for this object. */ - int count_coords; - int coords[MAX_TS_FILTER_COORDS]; -}; - -/* - * Helper to create a filter chain from an array of API pointers and - * array of config ints. Leaves pointers to created filters in arr - * array and fills in ->next pointers to create the chain. - */ - -extern int ts_filter_create_chain(struct platform_device *pdev, - struct ts_filter_api **api, void **config, - struct ts_filter **arr, int count_coords); - -/* Helper to destroy a whole chain from the list of filter pointers. */ - -extern void ts_filter_destroy_chain(struct platform_device *pdev, - struct ts_filter **arr); - -#endif diff --git a/include/linux/ts_filter_group.h b/include/linux/ts_filter_group.h deleted file mode 100644 index 1e74c8d..0000000 --- a/include/linux/ts_filter_group.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __TS_FILTER_GROUP_H__ -#define __TS_FILTER_GROUP_H__ - -#include <linux/ts_filter.h> - -/* - * Touchscreen group filter. - * - * Copyright (C) 2008 by Openmoko, Inc. - * Author: Nelson Castillo <[email protected]> - * - */ - -struct ts_filter_group_configuration { - int extent; - int close_enough; - int threshold; - int attempts; -}; - -struct ts_filter_group { - struct ts_filter tsf; - struct ts_filter_group_configuration *config; - - int N; /* How many samples we have */ - int *samples[MAX_TS_FILTER_COORDS]; /* the samples, our input */ - - int *group_size; /* used for temporal computations */ - int *sorted_samples; /* used for temporal computations */ - - int range_max[MAX_TS_FILTER_COORDS]; /* max computed ranges */ - int range_min[MAX_TS_FILTER_COORDS]; /* min computed ranges */ - - int tries_left; /* We finish if we don't get enough samples */ -}; - -extern struct ts_filter_api ts_filter_group_api; - -#endif diff --git a/include/linux/ts_filter_linear.h b/include/linux/ts_filter_linear.h deleted file mode 100644 index b4dd8e4..0000000 --- a/include/linux/ts_filter_linear.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __TS_FILTER_LINEAR_H__ -#define __TS_FILTER_LINEAR_H__ - -#include <linux/ts_filter.h> -#include <linux/kobject.h> - -/* - * Touchscreen linear filter. - * - * Copyright (C) 2008 by Openmoko, Inc. - * Author: Nelson Castillo <[email protected]> - * - */ - -#define TS_FILTER_LINEAR_NCONSTANTS 7 - -/* sysfs */ - -struct ts_filter_linear; - -struct const_obj { - struct ts_filter_linear *tsfl; - struct kobject kobj; -}; - -#define to_const_obj(x) container_of(x, struct const_obj, kobj) - -struct const_attribute { - struct attribute attr; - ssize_t (*show)(struct const_obj *const, struct const_attribute *attr, - char *buf); - ssize_t (*store)(struct const_obj *const, struct const_attribute *attr, - const char *buf, size_t count); -}; - -#define to_const_attr(x) container_of(x, struct const_attribute, attr) - -/* filter configuration */ - -struct ts_filter_linear_configuration { - int constants[TS_FILTER_LINEAR_NCONSTANTS]; - int coord0; - int coord1; -}; - -/* the filter */ - -struct ts_filter_linear { - struct ts_filter tsf; - struct ts_filter_linear_configuration *config; - - int constants[TS_FILTER_LINEAR_NCONSTANTS]; - - /* sysfs */ - struct const_obj c_obj; - struct kobj_type const_ktype; - struct const_attribute kattrs[TS_FILTER_LINEAR_NCONSTANTS]; - struct attribute *attrs[TS_FILTER_LINEAR_NCONSTANTS + 1]; - char attr_names[TS_FILTER_LINEAR_NCONSTANTS][2]; -}; - -extern struct ts_filter_api ts_filter_linear_api; - -#endif diff --git a/include/linux/ts_filter_mean.h b/include/linux/ts_filter_mean.h deleted file mode 100644 index 7bf7df6..0000000 --- a/include/linux/ts_filter_mean.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __TS_FILTER_MEAN_H__ -#define __TS_FILTER_MEAN_H__ - -#include <linux/ts_filter.h> - -/* - * Touchscreen filter. - * - * mean - * - * (c) 2008 Andy Green <[email protected]> - */ - -struct ts_filter_mean_configuration { - int bits_filter_length; - int averaging_threshold; - - int extent; -}; - -struct ts_filter_mean { - struct ts_filter tsf; - struct ts_filter_mean_configuration *config; - - int reported[MAX_TS_FILTER_COORDS]; - int lowpass[MAX_TS_FILTER_COORDS]; - int *fifo[MAX_TS_FILTER_COORDS]; - int fhead[MAX_TS_FILTER_COORDS]; - int ftail[MAX_TS_FILTER_COORDS]; -}; - -extern struct ts_filter_api ts_filter_mean_api; - -#endif diff --git a/include/linux/ts_filter_median.h b/include/linux/ts_filter_median.h deleted file mode 100644 index eb56eaa..0000000 --- a/include/linux/ts_filter_median.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __TS_FILTER_MEDIAN_H__ -#define __TS_FILTER_MEDIAN_H__ - -#include <linux/ts_filter.h> - -/* - * Touchscreen filter. - * - * median - * - * (c) 2008 Andy Green <[email protected]> - */ - -struct ts_filter_median_configuration { - int extent; - int midpoint; - int decimation_threshold; - int decimation_above; - int decimation_below; -}; - -struct ts_filter_median { - struct ts_filter tsf; - struct ts_filter_median_configuration *config; - - int decimation_count; - int last_issued[MAX_TS_FILTER_COORDS]; - int valid; /* how many samples in the sort buffer are valid */ - int *sort[MAX_TS_FILTER_COORDS]; /* samples taken for median */ - int *fifo[MAX_TS_FILTER_COORDS]; /* samples taken for median */ - int pos; /* where we are in the fifo sample memory */ -}; - -extern struct ts_filter_api ts_filter_median_api; - -#endif
