adapt all kind of board
[firefly-linux-kernel-4.4.55.git] / drivers / input / touchscreen / xpt2046_ts.h
1 /*
2  * drivers/input/touchscreen/xpt2046_ts.h
3  *
4  * Copyright (C) 2010 ROCKCHIP, Inc.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15
16 #ifndef __DRIVERS_TOUCHSCREEN_XPT2046_TS_H
17 #define __DRIVERS_TOUCHSCREEN_XPT2046_TS_H
18 enum xpt2046_filter {
19         XPT2046_FILTER_OK,
20         XPT2046_FILTER_REPEAT,
21         XPT2046_FILTER_IGNORE,
22 };
23
24 struct xpt2046_platform_data {
25         u16     model;                  /* 2046. */
26         bool    keep_vref_on;           /* set to keep vref on for differential
27                                          * measurements as well */
28         bool    swap_xy;                /* swap x and y axes */
29
30         /* If set to non-zero, after samples are taken this delay is applied
31          * and penirq is rechecked, to help avoid false events.  This value
32          * is affected by the material used to build the touch layer.
33          */
34         u16     penirq_recheck_delay_usecs;
35
36         u16     x_min, x_max;
37         u16     y_min, y_max;
38
39         u16     debounce_max;           /* max number of additional readings
40                                          * per sample */
41         u16     debounce_tol;           /* tolerance used for filtering */
42         u16     debounce_rep;           /* additional consecutive good readings
43                                          * required after the first two */
44         int     gpio_pendown;           /* the GPIO used to decide the pendown
45                                          * state if get_pendown_state == NULL
46                                          */
47         int     (*get_pendown_state)(void);
48         int     (*filter_init)  (struct xpt2046_platform_data *pdata,
49                                  void **filter_data);
50         int     (*filter)       (void *filter_data, int data_idx, int *val);
51         void    (*filter_cleanup)(void *filter_data);
52         void    (*wait_for_sync)(void);
53         int (* io_init)(void);
54         int (* io_deinit)(void);
55 };
56 #endif