blob: 1a5eaef3b7f2727e317cb11833b1f98a34c0bbd8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Brownellffa458c2006-01-08 13:34:21 -08002/* linux/spi/ads7846.h */
3
4/* Touchscreen characteristics vary between boards and models. The
David Brownell2e5a7bd2006-01-08 13:34:25 -08005 * platform_data for the device's "struct device" holds this information.
David Brownellffa458c2006-01-08 13:34:21 -08006 *
7 * It's OK if the min/max values are zero.
8 */
Imre Deakda970e62007-01-18 00:44:41 -05009enum ads7846_filter {
10 ADS7846_FILTER_OK,
11 ADS7846_FILTER_REPEAT,
12 ADS7846_FILTER_IGNORE,
13};
14
David Brownellffa458c2006-01-08 13:34:21 -080015struct ads7846_platform_data {
Michael Hennerich06a09122010-03-09 20:38:45 -080016 u16 model; /* 7843, 7845, 7846, 7873. */
David Brownellffa458c2006-01-08 13:34:21 -080017 u16 vref_delay_usecs; /* 0 for external vref; etc */
Alexander Steinebcaaad2011-05-11 16:24:08 -070018 u16 vref_mv; /* external vref value, milliVolts
19 * ads7846: if 0, use internal vref */
David Brownell7c6d0ee2008-04-02 00:43:01 -040020 bool keep_vref_on; /* set to keep vref on for differential
Imre Deakde2defd2007-01-18 00:45:21 -050021 * measurements as well */
Michael Roth86579a42009-05-18 16:04:44 -070022 bool swap_xy; /* swap x and y axes */
Semih Hazare4f48862007-07-18 00:35:56 -040023
24 /* Settling time of the analog signals; a function of Vcc and the
25 * capacitance on the X/Y drivers. If set to non-zero, two samples
26 * are taken with settle_delay us apart, and the second one is used.
27 * ~150 uSec with 0.01uF caps.
28 */
29 u16 settle_delay_usecs;
30
Semih Hazar1d258912007-07-18 00:36:04 -040031 /* If set to non-zero, after samples are taken this delay is applied
32 * and penirq is rechecked, to help avoid false events. This value
33 * is affected by the material used to build the touch layer.
34 */
35 u16 penirq_recheck_delay_usecs;
36
David Brownellffa458c2006-01-08 13:34:21 -080037 u16 x_plate_ohms;
38 u16 y_plate_ohms;
39
40 u16 x_min, x_max;
41 u16 y_min, y_max;
42 u16 pressure_min, pressure_max;
Imre Deak0b7018a2006-04-11 23:42:03 -040043
Imre Deakd5b415c2006-04-26 00:13:18 -040044 u16 debounce_max; /* max number of additional readings
45 * per sample */
Imre Deak0b7018a2006-04-11 23:42:03 -040046 u16 debounce_tol; /* tolerance used for filtering */
Imre Deakd5b415c2006-04-26 00:13:18 -040047 u16 debounce_rep; /* additional consecutive good readings
48 * required after the first two */
Eric Miao6ae19b02008-09-10 12:06:15 -040049 int gpio_pendown; /* the GPIO used to decide the pendown
Igor Grinbergc4f49252012-11-20 23:00:10 -080050 * state if get_pendown_state == NULL */
51 int gpio_pendown_debounce; /* platform specific debounce time for
52 * the gpio_pendown */
Imre Deakc9e617a2006-04-11 23:44:05 -040053 int (*get_pendown_state)(void);
Dmitry Torokhov0f622bf2010-07-01 09:01:50 -070054 int (*filter_init) (const struct ads7846_platform_data *pdata,
Imre Deakda970e62007-01-18 00:44:41 -050055 void **filter_data);
56 int (*filter) (void *filter_data, int data_idx, int *val);
57 void (*filter_cleanup)(void *filter_data);
Eric Miaofd746d52009-04-11 16:54:59 -070058 void (*wait_for_sync)(void);
Ranjith Lohithakshanfdba2bb2010-03-10 23:41:22 -080059 bool wakeup;
Anatolij Gustschin78043022010-06-28 01:25:19 -070060 unsigned long irq_flags;
David Brownellffa458c2006-01-08 13:34:21 -080061};
62