Merge tag 'v4.4-rc6'
[firefly-linux-kernel-4.4.55.git] / drivers / input / touchscreen / xpt2046_tslib_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
19 #define IOMUX_NAME_SIZE 20
20
21 enum xpt2046_filter {
22         XPT2046_FILTER_OK,
23         XPT2046_FILTER_REPEAT,
24         XPT2046_FILTER_IGNORE,
25 };
26
27 struct xpt2046_platform_data {
28         u16     model;                  /* 2046. */
29         bool    keep_vref_on;           /* set to keep vref on for differential
30                                          * measurements as well */
31         bool    swap_xy;                /* swap x and y axes */
32
33         /* If set to non-zero, after samples are taken this delay is applied
34          * and penirq is rechecked, to help avoid false events.  This value
35          * is affected by the material used to build the touch layer.
36          */
37         u16     penirq_recheck_delay_usecs;
38
39         u16     x_min, x_max;
40         u16     y_min, y_max;
41
42         u16     debounce_max;           /* max number of additional readings
43                                          * per sample */
44         u16     debounce_tol;           /* tolerance used for filtering */
45         u16     debounce_rep;           /* additional consecutive good readings
46                                          * required after the first two */
47         int     gpio_pendown;           /* the GPIO used to decide the pendown
48                                          * state if get_pendown_state == NULL
49                                          */
50         char    pendown_iomux_name[IOMUX_NAME_SIZE];    
51         int             pendown_iomux_mode;     
52         int     touch_ad_top;
53         int     touch_ad_bottom;
54         int     touch_ad_left;
55         int     touch_ad_right;
56         int             touch_virtualkey_length;
57         int     (*get_pendown_state)(void);
58         int     (*filter_init)  (struct xpt2046_platform_data *pdata,
59                                  void **filter_data);
60         int     (*filter)       (void *filter_data, int data_idx, int *val);
61         void    (*filter_cleanup)(void *filter_data);
62         void    (*wait_for_sync)(void);
63         int (* io_init)(void);
64         int (* io_deinit)(void);
65 };
66 #endif