diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/input/touchscreen/ts_filter.h | 74 | ||||
-rw-r--r-- | include/linux/input/touchscreen/ts_filter_chain.h | 58 | ||||
-rw-r--r-- | include/linux/input/touchscreen/ts_filter_group.h | 36 | ||||
-rw-r--r-- | include/linux/input/touchscreen/ts_filter_linear.h | 31 | ||||
-rw-r--r-- | include/linux/input/touchscreen/ts_filter_mean.h | 28 | ||||
-rw-r--r-- | include/linux/input/touchscreen/ts_filter_median.h | 32 | ||||
-rw-r--r-- | include/linux/mfd/pcf50606/gpo.h | 42 | ||||
-rw-r--r-- | include/linux/mfd/pcf50606/mbc.h | 2 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/backlight.h | 44 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/core.h | 4 |
10 files changed, 308 insertions, 43 deletions
diff --git a/include/linux/input/touchscreen/ts_filter.h b/include/linux/input/touchscreen/ts_filter.h new file mode 100644 index 00000000000..632e5fb3f4e --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter.h @@ -0,0 +1,74 @@ +#ifndef __TS_FILTER_H__ +#define __TS_FILTER_H__ + +/* + * Touchscreen filter. + * + * (c) 2008,2009 Andy Green <andy@warmcat.com> + */ + +#include <linux/platform_device.h> + +#define MAX_TS_FILTER_COORDS 3 /* X, Y and Z (pressure). */ + +struct ts_filter; +struct ts_filter_configuration; + +/* Operations that a filter can perform. */ + +struct ts_filter_api { + /* Create the filter - mandatory. */ + struct ts_filter * (*create)( + struct platform_device *pdev, + const struct ts_filter_configuration *config, + int count_coords); + /* Destroy the filter - mandatory. */ + void (*destroy)(struct ts_filter *filter); + /* Clear the filter - optional. */ + void (*clear)(struct ts_filter *filter); + + + /* + * The next three API functions only make sense if all of them are + * set for a filter. If a filter has the next three methods then + * it can propagate coordinates in the chain. + */ + + /* + * Process the filter. + * It returns non-zero if the filter reaches an error. + */ + int (*process)(struct ts_filter *filter, int *coords); + /* + * Is the filter ready to return a point? + * Please do not code side effects in this function. + */ + int (*haspoint)(struct ts_filter *filter); + /* + * Get a point. + * Do not call unless the filter actually has a point to deliver. + */ + void (*getpoint)(struct ts_filter *filter, int *coords); + + /* + * Scale the points - optional. + * A filter could only scale coordinates. + */ + void (*scale)(struct ts_filter *filter, int *coords); +}; + +/* + * Generic filter configuration. Actual configurations have this structure + * as a member. + */ +struct ts_filter_configuration { +}; + +struct ts_filter { + /* Operations for this filter. */ + const struct ts_filter_api *api; + /* Number of coordinates to process. */ + int count_coords; +}; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_chain.h b/include/linux/input/touchscreen/ts_filter_chain.h new file mode 100644 index 00000000000..a021ba25bd4 --- /dev/null +++ b/include/linux/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 <andy@warmcat.com> + */ + +#include <linux/input/touchscreen/ts_filter.h> + +#include <linux/err.h> + +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 diff --git a/include/linux/input/touchscreen/ts_filter_group.h b/include/linux/input/touchscreen/ts_filter_group.h new file mode 100644 index 00000000000..2d727f30086 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_group.h @@ -0,0 +1,36 @@ +#ifndef __TS_FILTER_GROUP_H__ +#define __TS_FILTER_GROUP_H__ + +#include <linux/input/touchscreen/ts_filter.h> + +/* + * Touchscreen group filter. + * + * Copyright (C) 2008,2009 by Openmoko, Inc. + * Author: Nelson Castillo <arhuaco@freaks-unidos.net> + * + */ + +struct ts_filter_group_configuration { + /* Size of the filter. */ + int length; + /* + * If two points are separated by this distance or less they + * are considered to be members of the same group. + */ + int close_enough; + /* Minimum allowed size for the biggest group in the sample set. */ + int threshold; + /* + * Number of times we try to get a group of points with at least + * threshold points. + */ + int attempts; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_group_api; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_linear.h b/include/linux/input/touchscreen/ts_filter_linear.h new file mode 100644 index 00000000000..6f5e8307456 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_linear.h @@ -0,0 +1,31 @@ +#ifndef __TS_FILTER_LINEAR_H__ +#define __TS_FILTER_LINEAR_H__ + +#include <linux/input/touchscreen/ts_filter.h> +#include <linux/kobject.h> + +/* + * Touchscreen linear filter. + * + * Copyright (C) 2008,2009 by Openmoko, Inc. + * Author: Nelson Castillo <arhuaco@freaks-unidos.net> + * + */ + +#define TS_FILTER_LINEAR_NCONSTANTS 7 + +struct ts_filter_linear_configuration { + /* Calibration constants. */ + int constants[TS_FILTER_LINEAR_NCONSTANTS]; + /* First coordinate. */ + int coord0; + /* Second coordinate. */ + int coord1; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_linear_api; + +#endif diff --git a/include/linux/input/touchscreen/ts_filter_mean.h b/include/linux/input/touchscreen/ts_filter_mean.h new file mode 100644 index 00000000000..d4870413987 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_mean.h @@ -0,0 +1,28 @@ +#ifndef __TS_FILTER_MEAN_H__ +#define __TS_FILTER_MEAN_H__ + +#include <linux/input/touchscreen/ts_filter.h> + +/* + * Touchscreen filter. + * + * mean + * + * (c) 2008,2009 + * Andy Green <andy@warmcat.com> + * Nelson Castillo <arhuaco@freaks-unidos.net> + */ + +/* Configuration for this filter. */ +struct ts_filter_mean_configuration { + /* Number of points for the mean. */ + int length; + + /* Generic filter configuration. */ + struct ts_filter_configuration config; +}; + +/* API functions for the mean filter */ +extern const struct ts_filter_api ts_filter_mean_api; + +#endif /* __TS_FILTER_MEAN_H__ */ diff --git a/include/linux/input/touchscreen/ts_filter_median.h b/include/linux/input/touchscreen/ts_filter_median.h new file mode 100644 index 00000000000..08051619531 --- /dev/null +++ b/include/linux/input/touchscreen/ts_filter_median.h @@ -0,0 +1,32 @@ +#ifndef __TS_FILTER_MEDIAN_H__ +#define __TS_FILTER_MEDIAN_H__ + +#include <linux/input/touchscreen/ts_filter.h> + +/* + * Touchscreen filter. + * + * median + * + * (c) 2008 Andy Green <andy@warmcat.com> + */ + +struct ts_filter_median_configuration { + /* Size of the filter. */ + int extent; + /* Precomputed midpoint. */ + int midpoint; + /* A reference value for us to check if we are going fast or slow. */ + int decimation_threshold; + /* How many points to replace if we're going fast. */ + int decimation_above; + /* How many points to replace if we're going slow. */ + int decimation_below; + + /* Generic configuration. */ + struct ts_filter_configuration config; +}; + +extern const struct ts_filter_api ts_filter_median_api; + +#endif diff --git a/include/linux/mfd/pcf50606/gpo.h b/include/linux/mfd/pcf50606/gpo.h deleted file mode 100644 index 081b127d754..00000000000 --- a/include/linux/mfd/pcf50606/gpo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * gpo.h -- GPO driver for NXP PCF50606 - * - * (C) 2006-2008 by Openmoko, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#ifndef __LINUX_MFD_PCF50606_GPO_H -#define __LINUX_MFD_PCF50606_GPO_H - -#include <linux/mfd/pcf50633/core.h> - -#define PCF50606_REG_GPOC1 0x38 -#define PCF50606_REG_GPOC2 0x39 -#define PCF50606_REG_GPOC3 0x3a -#define PCF50606_REG_GPOC4 0x3b -#define PCF50606_REG_GPOC5 0x3c - -#define PCF50606_GPO1 PCF50606_REG_GPOC1 -#define PCF50606_GPO2 PCF50606_REG_GPOC1 -#define PCF50606_GPOOD1 PCF50606_REG_GPOC2 -#define PCF50606_GPOOD2 PCF50606_REG_GPOC3 -#define PCF50606_GPOOD3 PCF50606_REG_GPOC4 -#define PCF50606_GPOOD4 PCF50606_REG_GPOC5 - -#define PCF50606_GPOCFG_GPOSEL_MASK 0x07 - -void pcf50606_gpo_set_active(struct pcf50606 *pcf, int gpo, int value); -int pcf50606_gpo_get_active(struct pcf50606 *pcf, int gpo); -void pcf50606_gpo_set_standby(struct pcf50606 *pcf, int gpo, int value); -int pcf50606_gpo_get_standby(struct pcf50606 *pcf, int gpo); - -void pcf50606_gpo_invert_set(struct pcf50606 *, int gpo, int invert); -int pcf50606_gpo_invert_get(struct pcf50606 *pcf, int gpo); - -#endif /* __LINUX_MFD_PCF50606_GPIO_H */ - diff --git a/include/linux/mfd/pcf50606/mbc.h b/include/linux/mfd/pcf50606/mbc.h index b793d703a64..23aeb9e3138 100644 --- a/include/linux/mfd/pcf50606/mbc.h +++ b/include/linux/mfd/pcf50606/mbc.h @@ -46,7 +46,7 @@ #define PCF50606_MBC_CHARGER_ONLINE 0x01 #define PCF50606_MBC_CHARGER_ACTIVE 0x02 -void pcf50606_charge_fast(struct pcf50606 *pcf, int on); +int pcf50606_charge_fast(struct pcf50606 *pcf, int on); #endif diff --git a/include/linux/mfd/pcf50633/backlight.h b/include/linux/mfd/pcf50633/backlight.h new file mode 100644 index 00000000000..9d3646af056 --- /dev/null +++ b/include/linux/mfd/pcf50633/backlight.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de> + * PCF50633 backlight device driver + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __LINUX_MFD_PCF50633_BACKLIGHT +#define __LINUX_MFD_PCF50633_BACKLIGHT + +/* +* @default_brightness: Brightness to be used after the driver has been + probed. Valid range 0-63. +* @default_brightness_limit: Brightness limit to be used after the driver has +* been probed. This is usfull when it is not known +* how much power is available for the backlight +* during probe. Valid range 0-63 +* @ramp_time: When changing the backlights brightness the change +* is not instant, instead it fades smooth from one +* state to another. This value specifies how long the +* fade should take. The lower the value the higher +* the fade time. Valid range 0-255 +*/ +struct pcf50633_bl_platform_data { + unsigned int default_brightness; + unsigned int default_brightness_limit; + uint8_t ramp_time; +}; + + +struct pcf50633; + +int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit); + +#endif + diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h index e304238dbc5..42f9af553ed 100644 --- a/include/linux/mfd/pcf50633/core.h +++ b/include/linux/mfd/pcf50633/core.h @@ -18,6 +18,7 @@ #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> #include <linux/power_supply.h> +#include <linux/mfd/pcf50633/backlight.h> struct pcf50633; @@ -38,6 +39,8 @@ struct pcf50633_platform_data { void (*force_shutdown)(struct pcf50633 *); u8 resumers[5]; + + struct pcf50633_bl_platform_data *backlight_data; }; struct pcf50633_irq { @@ -147,6 +150,7 @@ struct pcf50633 { struct platform_device *mbc_pdev; struct platform_device *adc_pdev; struct platform_device *input_pdev; + struct platform_device *bl_pdev; struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS]; }; |