blob: 05eab2f11e6323b9817e24a53b9f2c7180184106 [file] [log] [blame]
David Brownellffa458c2006-01-08 13:34:21 -08001/* linux/spi/ads7846.h */
2
3/* Touchscreen characteristics vary between boards and models. The
David Brownell2e5a7bd2006-01-08 13:34:25 -08004 * platform_data for the device's "struct device" holds this information.
David Brownellffa458c2006-01-08 13:34:21 -08005 *
6 * It's OK if the min/max values are zero.
7 */
Imre Deakda970e62007-01-18 00:44:41 -05008enum ads7846_filter {
9 ADS7846_FILTER_OK,
10 ADS7846_FILTER_REPEAT,
11 ADS7846_FILTER_IGNORE,
12};
13
David Brownellffa458c2006-01-08 13:34:21 -080014struct ads7846_platform_data {
15 u16 model; /* 7843, 7845, 7846. */
16 u16 vref_delay_usecs; /* 0 for external vref; etc */
David Brownell7c6d0ee2008-04-02 00:43:01 -040017 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential
Imre Deakde2defd2007-01-18 00:45:21 -050019 * measurements as well */
Semih Hazare4f48862007-07-18 00:35:56 -040020
21 /* Settling time of the analog signals; a function of Vcc and the
22 * capacitance on the X/Y drivers. If set to non-zero, two samples
23 * are taken with settle_delay us apart, and the second one is used.
24 * ~150 uSec with 0.01uF caps.
25 */
26 u16 settle_delay_usecs;
27
Semih Hazar1d258912007-07-18 00:36:04 -040028 /* If set to non-zero, after samples are taken this delay is applied
29 * and penirq is rechecked, to help avoid false events. This value
30 * is affected by the material used to build the touch layer.
31 */
32 u16 penirq_recheck_delay_usecs;
33
David Brownellffa458c2006-01-08 13:34:21 -080034 u16 x_plate_ohms;
35 u16 y_plate_ohms;
36
37 u16 x_min, x_max;
38 u16 y_min, y_max;
39 u16 pressure_min, pressure_max;
Imre Deak0b7018a2006-04-11 23:42:03 -040040
Imre Deakd5b415c2006-04-26 00:13:18 -040041 u16 debounce_max; /* max number of additional readings
42 * per sample */
Imre Deak0b7018a2006-04-11 23:42:03 -040043 u16 debounce_tol; /* tolerance used for filtering */
Imre Deakd5b415c2006-04-26 00:13:18 -040044 u16 debounce_rep; /* additional consecutive good readings
45 * required after the first two */
Eric Miao6ae19b02008-09-10 12:06:15 -040046 int gpio_pendown; /* the GPIO used to decide the pendown
47 * state if get_pendown_state == NULL
48 */
Imre Deakc9e617a2006-04-11 23:44:05 -040049 int (*get_pendown_state)(void);
Imre Deakda970e62007-01-18 00:44:41 -050050 int (*filter_init) (struct ads7846_platform_data *pdata,
51 void **filter_data);
52 int (*filter) (void *filter_data, int data_idx, int *val);
53 void (*filter_cleanup)(void *filter_data);
David Brownellffa458c2006-01-08 13:34:21 -080054};
55