aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/mediatek/MZ_FT5346/tpd_custom_fts.h
blob: 2cbfae913bf14564b721119878a0e698378209f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#ifndef __TOUCHPANEL_H__
#define __TOUCHPANEL_H__

#include <linux/hrtimer.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
//#include <linux/io.h>

#include <linux/init.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/byteorder/generic.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/rtpm_prio.h>

#include <linux/proc_fs.h>
#include <linux/uaccess.h>

#include <mach/mt_pm_ldo.h>
#include <mach/mt_typedefs.h>
#include <mach/mt_boot.h>

#include <cust_eint.h>
#include <linux/jiffies.h>


/**********************Custom define begin**********************************************/


#define TPD_POWER_SOURCE_CUSTOM         MT6328_POWER_LDO_VGP1
//#define IIC_PORT                        1 //MT6572: 0  MT6589:1 , Based on the I2C index you choose for TPM

/*
///// ***** virtual key  definition  ***** /////

Below are the recommend  virtual key definition for different resolution TPM.

HVGA  320x480     2key ( (80,530);(240,530) )           3key  ( (80,530);(160;530);(240,530) )          4key   ( (40,530);(120;530);(200,530);(280,530)  )
WVGA  480x800     2key ( (80,900);(400,900) )           3key  ( (80,900);(240,900);(400,900) )          4key   ( (60,900);(180;900);(300,900);(420,900)  )
FWVGA 480x854     2key ( (80,900);(400,900) )           3key  ( (80,900);(240,900);(400,900) )          4key   ( (60,900);(180;900);(300,900);(420,900)  )
QHD   540x960     2key ( (90,1080);(450,1080) )         3key  ( (90,1080);(270,1080);(450,1080) )       4key   ( (90,1080);(180;1080);(360,1080);(450,1080)  )
HD    1280x720    2key ( (120,1350);(600,1350) )        3key  ( (120,1350);(360,1350);(600,1350) )      4key   ( (120,1080);(240;1080);(480,1080);(600,1080)  )
FHD   1920x1080   2key ( (160,2100);(920,2100) )        3key  ( (160,2100);(540,2100);(920,2100) )      4key   ( (160,2100);(320;1080);(600,1080);(920,2100)  )
*/
#define TPD_HAVE_BUTTON          // if have virtual key,need define the MACRO
#define TPD_BUTTON_HEIGH        (40)
#define TPD_KEY_COUNT           (1)
#define TPD_KEYS                {KEY_HOME}

#define TPD_KEYS_DIM            {{360,2000,120,TPD_BUTTON_HEIGH}}

/*********************Custom Define end*************************************************/

#define TPD_NAME    "ft5x46"

/* Pre-defined definition */
#define TPD_TYPE_CAPACITIVE
#define TPD_TYPE_RESISTIVE
#define TPD_POWER_SOURCE

#define TPD_I2C_NUMBER           		0
#define TPD_WAKEUP_TRIAL         		60
#define TPD_WAKEUP_DELAY         		100

#define VELOCITY_CUSTOM
#define TPD_VELOCITY_CUSTOM_X 			15
#define TPD_VELOCITY_CUSTOM_Y 			20

#define TPD_DELAY                		(2*HZ/100)
//#define TPD_RES_X                		1080
//#define TPD_RES_Y                		1920
#define TPD_CALIBRATION_MATRIX  		{962,0,0,0,1600,0,0,0};

//#define TPD_HAVE_CALIBRATION
//#define TPD_HAVE_TREMBLE_ELIMINATION

/******************************************************************************/
/*Chip Device Type*/
#define IC_FT5X06						0	/*x=2,3,4*/
#define IC_FT5606						1	/*ft5506/FT5606/FT5816*/
#define IC_FT5316						2	/*ft5x16*/
#define IC_FT6208						3  	/*ft6208*/
#define IC_FT6x06     					4	/*ft6206/FT6306*/
#define IC_FT5x06i     					5	/*ft5306i*/
#define IC_FT5x36     					6	/*ft5336/ft5436/FT5436i*/
#define IC_FT5x46     					7	/*ft5346/ft5446*/

/*register address*/
#define FT_REG_CHIP_ID				0xA3    //chip ID 
#define FT_REG_FW_VER				0xA6    //FW version 
#define FT_REG_VENDOR_ID			0xA8    //TP vendor ID 
#define FT_REG_LCM_ID			    0xAB    //lcm ID 

#define FT_APP_INFO_ADDR	        0xd7f8
#define FT_VENDOR_ID_ADDR	        0xd784
#define FT_LCM_ID_ADDR	            0xd786

/*max point*/
#define TPD_MAX_POINTS_2            2
#define TPD_MAX_POINTS_5            5
#define TPD_MAX_POINTS_10           10

#define FTS_MAX_TOUCH TPD_MAX_POINTS_10

/*calibration option*/
#define AUTO_CLB_NEED               1
#define AUTO_CLB_NONEED             0

/*debug fuction*/
#define TPD_SYSFS_DEBUG
#ifndef USER_BUILD_KERNEL
#define FTS_CTL_IIC
#define FTS_APK_DEBUG
#define FTS_DEBUG
#endif

/*tp power down when suspend*/
//#define TPD_CLOSE_POWER_IN_SLEEP

// include ft5x46 self test interface
#define FTS_MCAP_TEST

/*download*/
// #define TPD_AUTO_DOWNLOAD				// if need download CTP FW when POWER ON,pls enable this MACRO

/*apgrade*/
#define TPD_AUTO_UPGRADE				// if need upgrade CTP FW when POWER ON,pls enable this MACRO
//#define TPD_HW_REST

/*proximity*/
//#define TPD_PROXIMITY					// if need the PS funtion,enable this MACRO

/*gesture*/
#define FTS_GESTURE                     // if need gesture funtion,enable this MARCO
#ifdef FTS_GESTURE
#undef TPD_CLOSE_POWER_IN_SLEEP
#define FTS_GESTURE_DBG                 // if define it,open gesture in suspend every time
#define FTS_ESD_CHECKER		// enable esd checker

#define MZ_UNKNOWN	0
#define MZ_HAND_MODE	1
#define MZ_GESTURE_MODE	2
#define MZ_COVER_MODE	3
#define MZ_SLEEP_MODE	4

#define MZ_NO_ACTION	0
#define MZ_FAILED	1
#define MZ_SUCCESS	2

#define GESTURE_SWITCH_OPEN          0x50
#define GESTURE_SWITCH_CLOSE         0x51
#endif //FTS_GESTURE

/*glove*/
//#define FTS_GLOVE
#ifdef FTS_GLOVE
#define GLOVE_SWITCH_OPEN            0x53
#define GLOVE_SWITCH_CLOSE           0x54
#endif

#define MZ_HALL_MODE

/*trace*/
#define pr_fmt(fmt) "[FTS]" fmt

#ifdef FTS_DEBUG
#define FTS_DBG		pr_debug
#else
#define FTS_DBG(fmt, args...)				do{}while(0)
#endif

/*current chip information for upgrade*/
struct Upgrade_Info
{
	u8  CHIP_ID;
	u8  FTS_NAME[20];
	u8  TPD_MAX_POINTS;
	u8  AUTO_CLB;
	u16 delay_aa;		    /*delay of write FT_UPGRADE_AA */
	u16 delay_55;		    /*delay of write FT_UPGRADE_55 */
#ifdef TPD_AUTO_DOWNLOAD
	u8  download_id_1;	    /*download id 1 */
	u8  download_id_2;	    /*download id 2 */
#endif
	u8  upgrade_id_1;	    /*upgrade id 1 */
	u8  upgrade_id_2;	    /*upgrade id 2 */
	u16 delay_readid;	    /*delay of read id */
	u16 delay_earse_flash;  /*delay of earse flash*/
};

#endif /* TOUCHPANEL_H__ */