Merge tag 'mips_fixes_5.3_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips...
[linux-2.6-block.git] / include / linux / spi / ads7846.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
ffa458c1
DB
2/* linux/spi/ads7846.h */
3
4/* Touchscreen characteristics vary between boards and models. The
2e5a7bd9 5 * platform_data for the device's "struct device" holds this information.
ffa458c1
DB
6 *
7 * It's OK if the min/max values are zero.
8 */
da970e69
ID
9enum ads7846_filter {
10 ADS7846_FILTER_OK,
11 ADS7846_FILTER_REPEAT,
12 ADS7846_FILTER_IGNORE,
13};
14
ffa458c1 15struct ads7846_platform_data {
06a09124 16 u16 model; /* 7843, 7845, 7846, 7873. */
ffa458c1 17 u16 vref_delay_usecs; /* 0 for external vref; etc */
ebcaaad9
AS
18 u16 vref_mv; /* external vref value, milliVolts
19 * ads7846: if 0, use internal vref */
7c6d0ee1 20 bool keep_vref_on; /* set to keep vref on for differential
de2defd9 21 * measurements as well */
86579a4c 22 bool swap_xy; /* swap x and y axes */
e4f48861
SH
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
1d25891f
SH
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
ffa458c1
DB
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;
0b7018aa 43
d5b415c9
ID
44 u16 debounce_max; /* max number of additional readings
45 * per sample */
0b7018aa 46 u16 debounce_tol; /* tolerance used for filtering */
d5b415c9
ID
47 u16 debounce_rep; /* additional consecutive good readings
48 * required after the first two */
6ae19b04 49 int gpio_pendown; /* the GPIO used to decide the pendown
c4f49254
IG
50 * state if get_pendown_state == NULL */
51 int gpio_pendown_debounce; /* platform specific debounce time for
52 * the gpio_pendown */
c9e617a5 53 int (*get_pendown_state)(void);
0f622bf4 54 int (*filter_init) (const struct ads7846_platform_data *pdata,
da970e69
ID
55 void **filter_data);
56 int (*filter) (void *filter_data, int data_idx, int *val);
57 void (*filter_cleanup)(void *filter_data);
fd746d54 58 void (*wait_for_sync)(void);
fdba2bb1 59 bool wakeup;
7804302b 60 unsigned long irq_flags;
ffa458c1
DB
61};
62