Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | /* Copyright Statement:\r |
2 | *\r | |
3 | * This software/firmware and related documentation ("MediaTek Software") are\r | |
4 | * protected under relevant copyright laws. The information contained herein\r | |
5 | * is confidential and proprietary to MediaTek Inc. and/or its licensors.\r | |
6 | * Without the prior written permission of MediaTek inc. and/or its licensors,\r | |
7 | * any reproduction, modification, use or disclosure of MediaTek Software,\r | |
8 | * and information contained herein, in whole or in part, shall be strictly prohibited.\r | |
9 | */\r | |
10 | /* MediaTek Inc. (C) 2010. All rights reserved.\r | |
11 | *\r | |
12 | * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES\r | |
13 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")\r | |
14 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON\r | |
15 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,\r | |
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF\r | |
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.\r | |
18 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE\r | |
19 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR\r | |
20 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH\r | |
21 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES\r | |
22 | * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES\r | |
23 | * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK\r | |
24 | * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR\r | |
25 | * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND\r | |
26 | * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,\r | |
27 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,\r | |
28 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO\r | |
29 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.\r | |
30 | *\r | |
31 | * The following software/firmware and/or related documentation ("MediaTek Software")\r | |
32 | * have been modified by MediaTek Inc. All revisions are subject to any receiver's\r | |
33 | * applicable license agreements with MediaTek Inc.\r | |
34 | */\r | |
35 | \r | |
36 | #ifndef TPD_CUSTOM_GT9XX_H__\r | |
37 | #define TPD_CUSTOM_GT9XX_H__\r | |
38 | \r | |
39 | #include <linux/hrtimer.h>\r | |
40 | #include <linux/string.h>\r | |
41 | #include <linux/vmalloc.h>\r | |
42 | //#include <linux/io.h>\r | |
43 | \r | |
44 | #include <linux/init.h>\r | |
45 | #include <linux/module.h>\r | |
46 | #include <linux/delay.h>\r | |
47 | #include <linux/i2c.h>\r | |
48 | #include <linux/input.h>\r | |
49 | #include <linux/slab.h>\r | |
50 | #include <linux/gpio.h>\r | |
51 | #include <linux/sched.h>\r | |
52 | #include <linux/kthread.h>\r | |
53 | #include <linux/bitops.h>\r | |
54 | #include <linux/kernel.h>\r | |
55 | #include <linux/delay.h>\r | |
56 | #include <linux/byteorder/generic.h>\r | |
57 | #ifdef CONFIG_HAS_EARLYSUSPEND\r | |
58 | #include <linux/earlysuspend.h>\r | |
59 | #endif\r | |
60 | #include <linux/interrupt.h>\r | |
61 | #include <linux/time.h>\r | |
62 | #include <linux/rtpm_prio.h>\r | |
63 | \r | |
64 | #include <linux/proc_fs.h>\r | |
65 | #include <asm/uaccess.h>\r | |
66 | #ifdef MT6575\r | |
67 | #include <mach/mt6575_pm_ldo.h>\r | |
68 | #include <mach/mt6575_typedefs.h>\r | |
69 | #include <mach/mt6575_boot.h>\r | |
70 | #endif\r | |
71 | #ifdef MT6577\r | |
72 | #include <mach/mt6577_pm_ldo.h>\r | |
73 | #include <mach/mt6577_typedefs.h>\r | |
74 | #include <mach/mt6577_boot.h>\r | |
75 | #endif\r | |
76 | #include <mach/mt_pm_ldo.h>\r | |
77 | #include <mach/mt_typedefs.h>\r | |
78 | #include <mach/mt_boot.h>\r | |
79 | \r | |
80 | #include <cust_eint.h>\r | |
81 | #include <linux/jiffies.h>\r | |
82 | \r | |
83 | /* Pre-defined definition */\r | |
84 | \r | |
85 | #define TPD_KEY_COUNT 4\r | |
86 | #define key_1 60,850 //auto define\r | |
87 | #define key_2 180,850\r | |
88 | #define key_3 300,850\r | |
89 | #define key_4 420,850\r | |
90 | \r | |
91 | #define TPD_KEYS {KEY_BACK, KEY_HOME, KEY_MENU, KEY_SEARCH}\r | |
92 | #define TPD_KEYS_DIM {{key_1,50,30},{key_2,50,30},{key_3,50,30},{key_4,50,30}}\r | |
93 | \r | |
94 | extern u16 show_len;\r | |
95 | extern u16 total_len;\r | |
96 | extern u8 gtp_rawdiff_mode;\r | |
97 | \r | |
98 | extern int tpd_halt;\r | |
99 | extern s32 gtp_send_cfg(struct i2c_client *client);\r | |
100 | extern void gtp_reset_guitar(struct i2c_client *client, s32 ms);\r | |
101 | extern void gtp_int_sync(s32 ms);\r | |
102 | extern u8 gup_init_update_proc(struct i2c_client *client);\r | |
103 | extern u8 gup_init_fw_proc(struct i2c_client *client);\r | |
104 | extern void mt_eint_unmask(unsigned int line);\r | |
105 | extern void mt_eint_mask(unsigned int line);\r | |
106 | extern s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len);\r | |
107 | extern s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len);\r | |
108 | extern int i2c_write_bytes(struct i2c_client *client, u16 addr, u8 *txbuf, int len);\r | |
109 | extern int i2c_read_bytes(struct i2c_client *client, u16 addr, u8 *rxbuf, int len);\r | |
110 | extern s32 i2c_read_dbl_check(struct i2c_client *client, u16 addr, u8 *rxbuf, int len);\r | |
111 | extern s32 gtp_i2c_read_dbl_check(struct i2c_client *client, u16 addr, u8 *rxbuf, int len);\r | |
112 | \r | |
113 | //***************************PART1:ON/OFF define*******************************\r | |
114 | #define GTP_CUSTOM_CFG 0\r | |
115 | #define GTP_DRIVER_SEND_CFG 1 // driver send config to TP in intilization\r | |
116 | #define GTP_HAVE_TOUCH_KEY 0\r | |
117 | #define GTP_POWER_CTRL_SLEEP 0 // turn off/on power on suspend/resume\r | |
118 | \r | |
119 | #define GTP_AUTO_UPDATE 0 // auto updated fw by .bin file\r | |
120 | #define GTP_HEADER_FW_UPDATE 0 // auto updated fw by gtp_default_FW in gt9xx_firmware.h, function together with GTP_AUTO_UDPATE\r | |
121 | #define GTP_AUTO_UPDATE_CFG 0 // auto update config by .cfg file, function together with GTP_AUTO_UPDATE\r | |
122 | \r | |
123 | #define GTP_SUPPORT_I2C_DMA 0 // if gt9xxf, better enable it if hardware platform supported\r | |
124 | #define GTP_COMPATIBLE_MODE 1 // compatible with GT9XXF\r | |
125 | #define GTP_FL_LITTLE_SYSTEM 0 // power off/on on suspend/resume, gt9xxf with an interim firwmare for it,\r | |
126 | // function together with GTP_COMATIBLE_MODE & GTP_POWER_CTRL_SLEEP\r | |
127 | #define GTP_CREATE_WR_NODE 1\r | |
128 | #define GTP_ESD_PROTECT 1 // esd protection with a cycle of 2 seconds\r | |
129 | #define GTP_CHARGER_SWITCH 0 // charger plugin & plugout detect\r | |
130 | \r | |
131 | #define GTP_WITH_PEN 0\r | |
132 | #define GTP_PEN_HAVE_BUTTON 0 // active pen has buttons, functions together with GTP_WITH_PEN\r | |
133 | \r | |
134 | #define GTP_GESTURE_WAKEUP 1\r | |
135 | \r | |
136 | //#define TPD_PROXIMITY\r | |
137 | //#define TPD_HAVE_BUTTON // report key as coordinate,Vibration feedback\r | |
138 | //#define TPD_WARP_X // mirrored x coordinate\r | |
139 | //#define TPD_WARP_Y // mirrored y coordinate\r | |
140 | #define GTP_DEBUG_ON 1\r | |
141 | #define GTP_DEBUG_ARRAY_ON 0\r | |
142 | #define GTP_DEBUG_FUNC_ON 0\r | |
143 | \r | |
144 | //***************************PART2:TODO define**********************************\r | |
145 | //STEP_1(REQUIRED):Change config table.\r | |
146 | // Sensor_ID Map:\r | |
147 | /* sensor_opt1 sensor_opt2 Sensor_ID\r | |
148 | GND GND 0\r | |
149 | VDDIO GND 1\r | |
150 | NC GND 2\r | |
151 | GND NC/300K 3\r | |
152 | VDDIO NC/300K 4\r | |
153 | NC NC/300K 5\r | |
154 | */\r | |
155 | // TODO: define your own default or for Sensor_ID == 0 config here.\r | |
156 | // The predefined one is just a sample config, which is not suitable for your tp in most cases.\r | |
157 | #define CTP_CFG_GROUP1 {\\r | |
158 | }\r | |
159 | // TODO: define your config for Sensor_ID == 1 here, if needed\r | |
160 | #define CTP_CFG_GROUP2 {\\r | |
161 | }\r | |
162 | // TODO: define your config for Sensor_ID == 2 here, if needed\r | |
163 | #define CTP_CFG_GROUP3 {\\r | |
164 | }\r | |
165 | \r | |
166 | // TODO: define your config for Sensor_ID == 3 here, if needed\r | |
167 | #define CTP_CFG_GROUP4 {\\r | |
4b9e9796 S |
168 | 0x45,0x20,0x03,0x00,0x05,0x0A,0x34,0x02,0x01,0x08,0x19,0x0A,0x50,0x41,0x03,0x05,\ |
169 | 0x00,0x00,0x00,0x00,0x33,0x12,0x04,0x14,0x16,0x1A,0x14,0x8C,0x2E,0x0E,0x3F,0x41,\ | |
170 | 0xD3,0x07,0x00,0x00,0x00,0xBA,0x02,0x11,0x00,0x01,0x00,0x18,0x00,0x00,0x00,0x00,\ | |
171 | 0x00,0x00,0x00,0x1C,0x6C,0x94,0xC5,0x02,0x00,0x00,0x00,0x04,0xE3,0x20,0x00,0xB2,\ | |
172 | 0x2A,0x00,0x8E,0x37,0x00,0x73,0x48,0x00,0x60,0x5F,0x00,0x5F,0x00,0x00,0x00,0x00,\ | |
173 | 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x33,0x11,0x03,0x08,0x08,0x0F,0x1F,0x00,\ | |
174 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x0F,0x0A,0x00,0x00,0x00,0x00,\ | |
175 | 0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x00,0x00,\ | |
176 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x13,\ | |
177 | 0x12,0x10,0x0F,0x0C,0x0A,0x08,0x06,0x04,0x02,0x00,0x16,0x18,0x1C,0x1D,0x1E,0x1F,\ | |
178 | 0x20,0x21,0x22,0x24,0x26,0x28,0x29,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
179 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
180 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
181 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
182 | 0x00,0x00,0x0F,0x01\ | |
183 | } | |
6fa3eb70 S |
184 | \r |
185 | // TODO: define your config for Sensor_ID == 4 here, if needed\r | |
186 | #define CTP_CFG_GROUP5 {\\r | |
187 | }\r | |
188 | \r | |
189 | // TODO: define your config for Sensor_ID == 5 here, if needed\r | |
4b9e9796 S |
190 | #define CTP_CFG_GROUP6 {\ |
191 | 0x49,0x20,0x03,0x00,0x05,0x0A,0x34,0x02,0x01,0x09,0x19,0x0C,0x64,0x3C,0x03,0x05,\ | |
192 | 0x00,0x00,0x00,0x00,0x33,0x12,0x04,0x14,0x16,0x1A,0x14,0x8C,0x2E,0x0E,0x2F,0x31,\ | |
193 | 0xD3,0x07,0x00,0x00,0x01,0xBA,0x02,0x11,0x00,0x09,0x00,0x1F,0x00,0x00,0x00,0x00,\ | |
194 | 0x00,0x00,0x00,0x1C,0x4B,0x94,0xD5,0x03,0x06,0x00,0x00,0x04,0xE7,0x1F,0x00,0xC7,\ | |
195 | 0x25,0x00,0xA6,0x2E,0x00,0x8E,0x38,0x00,0x76,0x44,0x00,0x76,0x00,0x00,0x00,0x00,\ | |
196 | 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x33,0x11,0x03,0x08,0x08,0x0F,0x1F,0x00,\ | |
197 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x0F,0x0A,0x00,0x00,0x00,0x00,\ | |
198 | 0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x00,0x00,\ | |
199 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x13,\ | |
200 | 0x12,0x10,0x0F,0x0C,0x0A,0x08,0x06,0x04,0x02,0x00,0x16,0x18,0x1C,0x1D,0x1E,0x1F,\ | |
201 | 0x20,0x21,0x22,0x24,0x26,0x28,0x29,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
202 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
203 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
204 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ | |
205 | 0x00,0x00,0xD4,0x01\ | |
206 | } | |
6fa3eb70 S |
207 | \r |
208 | // STEP_2(REQUIRED): Customize your I/O ports & I/O operations here\r | |
209 | #define TPD_POWER_SOURCE_CUSTOM MT6323_POWER_LDO_VGP2// define your power source for tp if needed\r | |
210 | #define GTP_RST_PORT GPIO_CTP_RST_PIN\r | |
211 | #define GTP_INT_PORT GPIO_CTP_EINT_PIN\r | |
212 | \r | |
213 | #define GTP_GPIO_AS_INPUT(pin) do{\\r | |
214 | if(pin == GPIO_CTP_EINT_PIN)\\r | |
215 | mt_set_gpio_mode(pin, GPIO_CTP_EINT_PIN_M_GPIO);\\r | |
216 | else\\r | |
217 | mt_set_gpio_mode(pin, GPIO_CTP_RST_PIN_M_GPIO);\\r | |
218 | mt_set_gpio_dir(pin, GPIO_DIR_IN);\\r | |
219 | mt_set_gpio_pull_enable(pin, GPIO_PULL_DISABLE);\\r | |
220 | }while(0)\r | |
221 | #define GTP_GPIO_AS_INT(pin) do{\\r | |
222 | mt_set_gpio_mode(pin, GPIO_CTP_EINT_PIN_M_EINT);\\r | |
223 | mt_set_gpio_dir(pin, GPIO_DIR_IN);\\r | |
224 | mt_set_gpio_pull_enable(pin, GPIO_PULL_DISABLE);\\r | |
225 | }while(0)\r | |
226 | #define GTP_GPIO_GET_VALUE(pin) mt_get_gpio_in(pin)\r | |
227 | #define GTP_GPIO_OUTPUT(pin,level) do{\\r | |
228 | if(pin == GPIO_CTP_EINT_PIN)\\r | |
229 | mt_set_gpio_mode(pin, GPIO_CTP_EINT_PIN_M_GPIO);\\r | |
230 | else\\r | |
231 | mt_set_gpio_mode(pin, GPIO_CTP_RST_PIN_M_GPIO);\\r | |
232 | mt_set_gpio_dir(pin, GPIO_DIR_OUT);\\r | |
233 | mt_set_gpio_out(pin, level);\\r | |
234 | }while(0)\r | |
235 | #define GTP_GPIO_REQUEST(pin, label) gpio_request(pin, label)\r | |
236 | #define GTP_GPIO_FREE(pin) gpio_free(pin)\r | |
237 | #define GTP_IRQ_TAB {IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH}\r | |
238 | \r | |
239 | // STEP_3(optional):Custom set some config by themself,if need.\r | |
240 | #if GTP_CUSTOM_CFG\r | |
241 | #define GTP_MAX_HEIGHT 800\r | |
242 | #define GTP_MAX_WIDTH 480\r | |
243 | #define GTP_INT_TRIGGER 0 //0:Rising 1:Falling\r | |
244 | #else\r | |
245 | #define GTP_MAX_HEIGHT 1280\r | |
246 | #define GTP_MAX_WIDTH 800\r | |
247 | #define GTP_INT_TRIGGER 1\r | |
248 | #endif\r | |
249 | #define GTP_MAX_TOUCH 5\r | |
250 | #define VELOCITY_CUSTOM\r | |
251 | #define TPD_VELOCITY_CUSTOM_X 15\r | |
252 | #define TPD_VELOCITY_CUSTOM_Y 15\r | |
253 | \r | |
254 | //STEP_4(optional):If this project have touch key,Set touch key config.\r | |
255 | #if GTP_HAVE_TOUCH_KEY\r | |
256 | #define GTP_KEY_TAB {KEY_MENU, KEY_HOME, KEY_BACK, KEY_SEND}\r | |
257 | #endif\r | |
258 | \r | |
259 | //***************************PART3:OTHER define*********************************\r | |
260 | #define GTP_DRIVER_VERSION "V2.2.7<2014/12/26>"\r | |
261 | #define GTP_I2C_NAME "Goodix-TS"\r | |
262 | #define GT91XX_CONFIG_PROC_FILE "gt9xx_config"\r | |
263 | #define GTP_POLL_TIME 10\r | |
264 | #define GTP_ADDR_LENGTH 2\r | |
265 | #define GTP_CONFIG_MIN_LENGTH 186\r | |
266 | #define GTP_CONFIG_MAX_LENGTH 240\r | |
267 | #define FAIL 0\r | |
268 | #define SUCCESS 1\r | |
269 | #define SWITCH_OFF 0\r | |
270 | #define SWITCH_ON 1\r | |
271 | \r | |
272 | #define CFG_GROUP_LEN(p_cfg_grp) (sizeof(p_cfg_grp) / sizeof(p_cfg_grp[0]))\r | |
273 | \r | |
274 | //******************** For GT9XXF Start **********************//\r | |
275 | #if GTP_COMPATIBLE_MODE\r | |
276 | typedef enum\r | |
277 | {\r | |
278 | CHIP_TYPE_GT9 = 0,\r | |
279 | CHIP_TYPE_GT9F = 1,\r | |
280 | } CHIP_TYPE_T;\r | |
281 | #endif\r | |
282 | \r | |
283 | // buffer\r | |
284 | #define GTP_REG_BUFFER 0xB026\r | |
285 | \r | |
286 | #define GTP_REG_SS51_SEG_B 0xC000\r | |
287 | #define GTP_REG_CHECKINFO 0xBF00\r | |
288 | \r | |
289 | // State1\r | |
290 | #define GTP_REG_STATE1 0xBF08\r | |
291 | #define BUFFER_FULL 0x01\r | |
292 | #define CHECK_COMPLETE 0x02\r | |
293 | #define CHECK_ERROR 0x03\r | |
294 | #define WAIT_CHECK 0x04 // others: invalid\r | |
295 | \r | |
296 | // State2\r | |
297 | #define GTP_REG_STATE2 0xBF07\r | |
298 | #define IS_A_SEG 0x01\r | |
299 | #define IS_B_SEG_FIRST 0x02\r | |
300 | #define IS_B_SEG_OTHER 0x03\r | |
301 | #define IS_B_SEG_LAST 0x04 // others: invalid\r | |
302 | \r | |
303 | #define GTP_REG_MATRIX_DRVNUM 0x8069\r | |
304 | #define GTP_REG_MATRIX_SENNUM 0x806A\r | |
305 | #define GTP_REG_RQST 0x8043\r | |
306 | #define GTP_REG_BAK_REF 0x99D0\r | |
307 | #define GTP_REG_MAIN_CLK 0x8020\r | |
308 | #define GTP_REG_CHIP_TYPE 0x8000\r | |
309 | #define GTP_REG_HAVE_KEY 0x804E\r | |
310 | \r | |
311 | #define GTP_FL_FW_BURN 0x00\r | |
312 | #define GTP_FL_ESD_RECOVERY 0x01\r | |
313 | #define GTP_FL_READ_REPAIR 0x02\r | |
314 | #define GTP_FL_PWR_RESUME_BURN 0x03\r | |
315 | \r | |
316 | #define GTP_BAK_REF_SEND 0\r | |
317 | #define GTP_BAK_REF_STORE 1\r | |
318 | #define GTP_HOPPING_SEND 0\r | |
319 | #define GTP_HOPPING_STORE 1\r | |
320 | #define CFG_LOC_DRVA_NUM 29\r | |
321 | #define CFG_LOC_DRVB_NUM 30\r | |
322 | #define CFG_LOC_SENS_NUM 31\r | |
323 | \r | |
324 | #define GTP_CHK_FW_MAX 1000\r | |
325 | #define GTP_CHK_FS_MNT_MAX 300\r | |
979dc3df S |
326 | #define GTP_BAK_REF_PATH "/cache/gtp_ref.bin"\r |
327 | #define GTP_MAIN_CLK_PATH "/cache/gtp_clk.bin"\r | |
6fa3eb70 S |
328 | #define GTP_RQST_CONFIG 0x01\r |
329 | #define GTP_RQST_BAK_REF 0x02\r | |
330 | #define GTP_RQST_RESET 0x03\r | |
331 | #define GTP_RQST_MAIN_CLOCK 0x04\r | |
332 | #define GTP_RQST_STORE_HOPPING 0x05\r | |
333 | #define GTP_RQST_STORE_BAK_REF 0x06\r | |
334 | #define GTP_RQST_RESPONDED 0x00\r | |
335 | #define GTP_RQST_IDLE 0xFF\r | |
336 | \r | |
337 | //******************** For GT9XXF End **********************//\r | |
338 | \r | |
339 | //Register define\r | |
340 | #define GTP_READ_COOR_ADDR 0x814E\r | |
341 | #define GTP_REG_SLEEP 0x8040\r | |
342 | #define GTP_REG_SENSOR_ID 0x814A\r | |
343 | #define GTP_REG_CONFIG_DATA 0x8047\r | |
344 | #define GTP_REG_VERSION 0x8140\r | |
345 | #define GTP_REG_HW_INFO 0x4220\r | |
346 | \r | |
347 | #define RESOLUTION_LOC 3\r | |
348 | #define TRIGGER_LOC 8\r | |
349 | \r | |
350 | #define I2C_MASTER_CLOCK 300\r | |
351 | #define I2C_BUS_NUMBER 0 // I2C Bus for TP, mt6572\r | |
352 | #define GTP_DMA_MAX_TRANSACTION_LENGTH 255 // for DMA mode\r | |
353 | #define GTP_DMA_MAX_I2C_TRANSFER_SIZE (GTP_DMA_MAX_TRANSACTION_LENGTH - GTP_ADDR_LENGTH)\r | |
354 | #define MAX_TRANSACTION_LENGTH 8\r | |
355 | #define MAX_I2C_TRANSFER_SIZE (MAX_TRANSACTION_LENGTH - GTP_ADDR_LENGTH)\r | |
356 | #define TPD_MAX_RESET_COUNT 3\r | |
357 | #define TPD_CALIBRATION_MATRIX {962,0,0,0,1600,0,0,0};\r | |
358 | \r | |
359 | \r | |
360 | #define TPD_RESET_ISSUE_WORKAROUND\r | |
361 | #define TPD_HAVE_CALIBRATION\r | |
362 | #define TPD_NO_GPIO\r | |
363 | #define TPD_RESET_ISSUE_WORKAROUND\r | |
364 | \r | |
365 | #ifdef TPD_WARP_X\r | |
366 | #undef TPD_WARP_X\r | |
367 | #define TPD_WARP_X(x_max, x) ( x_max - 1 - x )\r | |
368 | #else\r | |
369 | #define TPD_WARP_X(x_max, x) x\r | |
370 | #endif\r | |
371 | \r | |
372 | #ifdef TPD_WARP_Y\r | |
373 | #undef TPD_WARP_Y\r | |
374 | #define TPD_WARP_Y(y_max, y) ( y_max - 1 - y )\r | |
375 | #else\r | |
376 | #define TPD_WARP_Y(y_max, y) y\r | |
377 | #endif\r | |
378 | \r | |
379 | //Log define\r | |
380 | #define GTP_INFO(fmt,arg...) printk("<<-GTP-INFO->> "fmt"\n",##arg)\r | |
381 | #define GTP_ERROR(fmt,arg...) printk("<<-GTP-ERROR->> "fmt"\n",##arg)\r | |
382 | #define GTP_DEBUG(fmt,arg...) do{\\r | |
383 | if(GTP_DEBUG_ON)\\r | |
384 | printk("<<-GTP-DEBUG->> [%d]"fmt"\n",__LINE__, ##arg);\\r | |
385 | }while(0)\r | |
386 | #define GTP_DEBUG_ARRAY(array, num) do{\\r | |
387 | s32 i;\\r | |
388 | u8* a = array;\\r | |
389 | if(GTP_DEBUG_ARRAY_ON)\\r | |
390 | {\\r | |
391 | printk("<<-GTP-DEBUG-ARRAY->>\n");\\r | |
392 | for (i = 0; i < (num); i++)\\r | |
393 | {\\r | |
394 | printk("%02x ", (a)[i]);\\r | |
395 | if ((i + 1 ) %10 == 0)\\r | |
396 | {\\r | |
397 | printk("\n");\\r | |
398 | }\\r | |
399 | }\\r | |
400 | printk("\n");\\r | |
401 | }\\r | |
402 | }while(0)\r | |
403 | #define GTP_DEBUG_FUNC() do{\\r | |
404 | if(GTP_DEBUG_FUNC_ON)\\r | |
405 | printk("<<-GTP-FUNC->> Func:%s@Line:%d\n",__func__,__LINE__);\\r | |
406 | }while(0)\r | |
407 | #define GTP_SWAP(x, y) do{\\r | |
408 | typeof(x) z = x;\\r | |
409 | x = y;\\r | |
410 | y = z;\\r | |
411 | }while (0)\r | |
412 | \r | |
413 | \r | |
414 | //*****************************End of Part III********************************\r | |
415 | \r | |
416 | #endif /* TPD_CUSTOM_GT9XX_H__ */\r |