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