Merge tag 'lsk-v3.10-android-14.11'
[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 READ_TOUCH_ADDR_H       0x07
70 #define READ_TOUCH_ADDR_L       0x12
71 #define READ_KEY_ADDR_H         0x07
72 #define READ_KEY_ADDR_L         0x21
73 #define READ_COOR_ADDR_H        0x07
74 #define READ_COOR_ADDR_L        0x22
75 #define READ_ID_ADDR_H          0x00
76 #define READ_ID_ADDR_L          0xff
77
78
79 #define IOMUX_NAME_SIZE 48
80 struct gt818_platform_data {
81
82         u16             model;                  /* 818. */
83         bool    swap_xy;                /* swap x and y axes */
84         u16             x_min, x_max;
85         u16             y_min, y_max;
86     int         gpio_reset;
87     int     gpio_reset_active_low;
88         int             gpio_pendown;           /* the GPIO used to decide the pendown */
89
90         char    pendown_iomux_name[IOMUX_NAME_SIZE];
91         char    resetpin_iomux_name[IOMUX_NAME_SIZE];
92         int             pendown_iomux_mode;
93         int             resetpin_iomux_mode;
94
95         int         (*get_pendown_state)(void);
96 };
97
98
99 struct gt818_ts_data {
100
101
102         u16 addr;
103         u8 bad_data;
104         struct i2c_client *client;
105         struct input_dev *input_dev;
106         int use_reset;          //use RESET flag
107         int use_irq;            //use EINT flag
108         int read_mode;          //read moudle mode,20110221 by andrew
109         struct hrtimer timer;
110         struct work_struct  work;
111         char phys[32];
112         char name[32];
113         int retry;
114         struct early_suspend early_suspend;
115         int (*power)(struct gt818_ts_data * ts, int on);
116 };
117
118
119
120 #endif /* _LINUX_GOODIX_TOUCH_H */