Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 2 | /* linux/spi/ads7846.h */ |
| 3 | |
| 4 | /* Touchscreen characteristics vary between boards and models. The |
David Brownell | 2e5a7bd | 2006-01-08 13:34:25 -0800 | [diff] [blame] | 5 | * platform_data for the device's "struct device" holds this information. |
David Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 6 | * |
| 7 | * It's OK if the min/max values are zero. |
| 8 | */ |
Imre Deak | da970e6 | 2007-01-18 00:44:41 -0500 | [diff] [blame] | 9 | enum ads7846_filter { |
| 10 | ADS7846_FILTER_OK, |
| 11 | ADS7846_FILTER_REPEAT, |
| 12 | ADS7846_FILTER_IGNORE, |
| 13 | }; |
| 14 | |
David Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 15 | struct ads7846_platform_data { |
Michael Hennerich | 06a0912 | 2010-03-09 20:38:45 -0800 | [diff] [blame] | 16 | u16 model; /* 7843, 7845, 7846, 7873. */ |
David Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 17 | u16 vref_delay_usecs; /* 0 for external vref; etc */ |
Alexander Stein | ebcaaad | 2011-05-11 16:24:08 -0700 | [diff] [blame] | 18 | u16 vref_mv; /* external vref value, milliVolts |
| 19 | * ads7846: if 0, use internal vref */ |
David Brownell | 7c6d0ee | 2008-04-02 00:43:01 -0400 | [diff] [blame] | 20 | bool keep_vref_on; /* set to keep vref on for differential |
Imre Deak | de2defd | 2007-01-18 00:45:21 -0500 | [diff] [blame] | 21 | * measurements as well */ |
Michael Roth | 86579a4 | 2009-05-18 16:04:44 -0700 | [diff] [blame] | 22 | bool swap_xy; /* swap x and y axes */ |
Semih Hazar | e4f4886 | 2007-07-18 00:35:56 -0400 | [diff] [blame] | 23 | |
| 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 Hazar | 1d25891 | 2007-07-18 00:36:04 -0400 | [diff] [blame] | 31 | /* 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 Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 37 | 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 Deak | 0b7018a | 2006-04-11 23:42:03 -0400 | [diff] [blame] | 43 | |
Imre Deak | d5b415c | 2006-04-26 00:13:18 -0400 | [diff] [blame] | 44 | u16 debounce_max; /* max number of additional readings |
| 45 | * per sample */ |
Imre Deak | 0b7018a | 2006-04-11 23:42:03 -0400 | [diff] [blame] | 46 | u16 debounce_tol; /* tolerance used for filtering */ |
Imre Deak | d5b415c | 2006-04-26 00:13:18 -0400 | [diff] [blame] | 47 | u16 debounce_rep; /* additional consecutive good readings |
| 48 | * required after the first two */ |
Eric Miao | 6ae19b0 | 2008-09-10 12:06:15 -0400 | [diff] [blame] | 49 | int gpio_pendown; /* the GPIO used to decide the pendown |
Igor Grinberg | c4f4925 | 2012-11-20 23:00:10 -0800 | [diff] [blame] | 50 | * state if get_pendown_state == NULL */ |
| 51 | int gpio_pendown_debounce; /* platform specific debounce time for |
| 52 | * the gpio_pendown */ |
Imre Deak | c9e617a | 2006-04-11 23:44:05 -0400 | [diff] [blame] | 53 | int (*get_pendown_state)(void); |
Dmitry Torokhov | 0f622bf | 2010-07-01 09:01:50 -0700 | [diff] [blame] | 54 | int (*filter_init) (const struct ads7846_platform_data *pdata, |
Imre Deak | da970e6 | 2007-01-18 00:44:41 -0500 | [diff] [blame] | 55 | void **filter_data); |
| 56 | int (*filter) (void *filter_data, int data_idx, int *val); |
| 57 | void (*filter_cleanup)(void *filter_data); |
Eric Miao | fd746d5 | 2009-04-11 16:54:59 -0700 | [diff] [blame] | 58 | void (*wait_for_sync)(void); |
Ranjith Lohithakshan | fdba2bb | 2010-03-10 23:41:22 -0800 | [diff] [blame] | 59 | bool wakeup; |
Anatolij Gustschin | 7804302 | 2010-06-28 01:25:19 -0700 | [diff] [blame] | 60 | unsigned long irq_flags; |
David Brownell | ffa458c | 2006-01-08 13:34:21 -0800 | [diff] [blame] | 61 | }; |
| 62 | |