Merge branch 'develop-3.0' of ssh://192.168.1.29/rk/kernel into develop-3.0
[firefly-linux-kernel-4.4.55.git] / drivers / input / touchscreen / gt818_ts.h
1 /* drivers/input/touchscreen/gt818_ts.h
2  *
3  * Copyright (C) 2011 Rockcip, Inc.
4  * 
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * Author: hhb@rock-chips.com
15  * Date: 2011.06.20
16  */
17
18 #ifndef         _LINUX_GOODIX_TOUCH_H
19 #define         _LINUX_GOODIX_TOUCH_H
20
21 #include <linux/earlysuspend.h>
22 #include <linux/hrtimer.h>
23 #include <linux/i2c.h>
24 #include <linux/input.h>
25
26
27 //*************************TouchScreen Work Part*****************************
28 #define GOODIX_I2C_NAME "gt818_ts"
29 #define GT801_PLUS
30 #define GT801_NUVOTON
31 #define GUITAR_UPDATE_STATE 0x02
32 #define GT818_I2C_SCL 400*1000
33
34 //define resolution of the touchscreen
35 #define TOUCH_MAX_HEIGHT        7168
36 #define TOUCH_MAX_WIDTH         5120
37
38 //define resolution of the LCD
39 #define SCREEN_MAX_HEIGHT       800                             
40 #define SCREEN_MAX_WIDTH        480
41
42
43
44 #define SHUTDOWN_PORT   pdata->gpio_reset                       //SHUTDOWN¹Ü½ÅºÅ
45 #define INT_PORT                pdata->gpio_pendown
46
47 #ifdef INT_PORT
48         #define TS_INT          gpio_to_irq(INT_PORT)                   //Interrupt Number
49 #else
50         #define TS_INT  0
51 #endif  
52
53 #define HAVE_TOUCH_KEY
54
55
56 #define FLAG_UP         0
57 #define FLAG_DOWN       1
58 //set GT801 PLUS trigger mode,Ö»ÄÜÉèÖÃ0»ò1 
59 #define INT_TRIGGER             1
60 #define POLL_TIME               10      //actual query spacing interval:POLL_TIME+6
61
62 #define GOODIX_MULTI_TOUCH
63 #ifdef GOODIX_MULTI_TOUCH
64         #define MAX_FINGER_NUM  2
65 #else
66         #define MAX_FINGER_NUM  1       
67 #endif
68
69 #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
70
71 #define READ_TOUCH_ADDR_H       0x07
72 #define READ_TOUCH_ADDR_L       0x12
73 #define READ_KEY_ADDR_H         0x07
74 #define READ_KEY_ADDR_L         0x21
75 #define READ_COOR_ADDR_H        0x07
76 #define READ_COOR_ADDR_L        0x22
77 #define READ_ID_ADDR_H          0x00
78 #define READ_ID_ADDR_L          0xff
79
80
81 #define IOMUX_NAME_SIZE 48
82 struct gt818_platform_data {
83
84         u16             model;                  /* 818. */
85         bool    swap_xy;                /* swap x and y axes */
86         u16             x_min, x_max;
87         u16             y_min, y_max;
88     int         gpio_reset;
89     int     gpio_reset_active_low;
90         int             gpio_pendown;           /* the GPIO used to decide the pendown */
91
92         char    pendown_iomux_name[IOMUX_NAME_SIZE];
93         char    resetpin_iomux_name[IOMUX_NAME_SIZE];
94         int             pendown_iomux_mode;
95         int             resetpin_iomux_mode;
96
97         int         (*get_pendown_state)(void);
98 };
99
100
101 struct gt818_ts_data {
102
103
104         u16 addr;
105         u8 bad_data;
106         struct i2c_client *client;
107         struct input_dev *input_dev;
108         int use_reset;          //use RESET flag
109         int use_irq;            //use EINT flag
110         int read_mode;          //read moudle mode,20110221 by andrew
111         struct hrtimer timer;
112         struct work_struct  work;
113         char phys[32];
114         char name[32];
115         int retry;
116         struct early_suspend early_suspend;
117         int (*power)(struct gt818_ts_data * ts, int on);
118 };
119
120
121
122 #endif /* _LINUX_GOODIX_TOUCH_H */