diff options
author | Iiro Valkonen <iiro.valkonen@atmel.com> | 2011-02-03 02:21:58 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-02-21 04:02:27 -0500 |
commit | 7686b108d8ef5c32f429d5228798636f3a1caf5a (patch) | |
tree | 0adce74109f9779e517dcd1a3b2601358bc37b61 /drivers/input/touchscreen/atmel_mxt_ts.c | |
parent | 964de52147c2842092642512e6f654fc2ab51408 (diff) |
Input: atmel_mxt_ts - get rid of qt602240 prefixes in names
Change prefixes from qt602240 to mxt to reflect that the driver supports
whole line of mXT touchscreens.
Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 929 |
1 files changed, 465 insertions, 464 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 47067789b747..5dca78a00c94 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * AT42QT602240/ATMXT224 Touchscreen driver | 2 | * Atmel maXTouch Touchscreen driver |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | 4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd |
5 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | 5 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> |
@@ -22,300 +22,300 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | /* Version */ | 24 | /* Version */ |
25 | #define QT602240_VER_20 20 | 25 | #define MXT_VER_20 20 |
26 | #define QT602240_VER_21 21 | 26 | #define MXT_VER_21 21 |
27 | #define QT602240_VER_22 22 | 27 | #define MXT_VER_22 22 |
28 | 28 | ||
29 | /* Slave addresses */ | 29 | /* Slave addresses */ |
30 | #define QT602240_APP_LOW 0x4a | 30 | #define MXT_APP_LOW 0x4a |
31 | #define QT602240_APP_HIGH 0x4b | 31 | #define MXT_APP_HIGH 0x4b |
32 | #define QT602240_BOOT_LOW 0x24 | 32 | #define MXT_BOOT_LOW 0x24 |
33 | #define QT602240_BOOT_HIGH 0x25 | 33 | #define MXT_BOOT_HIGH 0x25 |
34 | 34 | ||
35 | /* Firmware */ | 35 | /* Firmware */ |
36 | #define QT602240_FW_NAME "qt602240.fw" | 36 | #define MXT_FW_NAME "maxtouch.fw" |
37 | 37 | ||
38 | /* Registers */ | 38 | /* Registers */ |
39 | #define QT602240_FAMILY_ID 0x00 | 39 | #define MXT_FAMILY_ID 0x00 |
40 | #define QT602240_VARIANT_ID 0x01 | 40 | #define MXT_VARIANT_ID 0x01 |
41 | #define QT602240_VERSION 0x02 | 41 | #define MXT_VERSION 0x02 |
42 | #define QT602240_BUILD 0x03 | 42 | #define MXT_BUILD 0x03 |
43 | #define QT602240_MATRIX_X_SIZE 0x04 | 43 | #define MXT_MATRIX_X_SIZE 0x04 |
44 | #define QT602240_MATRIX_Y_SIZE 0x05 | 44 | #define MXT_MATRIX_Y_SIZE 0x05 |
45 | #define QT602240_OBJECT_NUM 0x06 | 45 | #define MXT_OBJECT_NUM 0x06 |
46 | #define QT602240_OBJECT_START 0x07 | 46 | #define MXT_OBJECT_START 0x07 |
47 | 47 | ||
48 | #define QT602240_OBJECT_SIZE 6 | 48 | #define MXT_OBJECT_SIZE 6 |
49 | 49 | ||
50 | /* Object types */ | 50 | /* Object types */ |
51 | #define QT602240_DEBUG_DIAGNOSTIC 37 | 51 | #define MXT_DEBUG_DIAGNOSTIC 37 |
52 | #define QT602240_GEN_MESSAGE 5 | 52 | #define MXT_GEN_MESSAGE 5 |
53 | #define QT602240_GEN_COMMAND 6 | 53 | #define MXT_GEN_COMMAND 6 |
54 | #define QT602240_GEN_POWER 7 | 54 | #define MXT_GEN_POWER 7 |
55 | #define QT602240_GEN_ACQUIRE 8 | 55 | #define MXT_GEN_ACQUIRE 8 |
56 | #define QT602240_TOUCH_MULTI 9 | 56 | #define MXT_TOUCH_MULTI 9 |
57 | #define QT602240_TOUCH_KEYARRAY 15 | 57 | #define MXT_TOUCH_KEYARRAY 15 |
58 | #define QT602240_TOUCH_PROXIMITY 23 | 58 | #define MXT_TOUCH_PROXIMITY 23 |
59 | #define QT602240_PROCI_GRIPFACE 20 | 59 | #define MXT_PROCI_GRIPFACE 20 |
60 | #define QT602240_PROCG_NOISE 22 | 60 | #define MXT_PROCG_NOISE 22 |
61 | #define QT602240_PROCI_ONETOUCH 24 | 61 | #define MXT_PROCI_ONETOUCH 24 |
62 | #define QT602240_PROCI_TWOTOUCH 27 | 62 | #define MXT_PROCI_TWOTOUCH 27 |
63 | #define QT602240_SPT_COMMSCONFIG 18 /* firmware ver 21 over */ | 63 | #define MXT_SPT_COMMSCONFIG 18 /* firmware ver 21 over */ |
64 | #define QT602240_SPT_GPIOPWM 19 | 64 | #define MXT_SPT_GPIOPWM 19 |
65 | #define QT602240_SPT_SELFTEST 25 | 65 | #define MXT_SPT_SELFTEST 25 |
66 | #define QT602240_SPT_CTECONFIG 28 | 66 | #define MXT_SPT_CTECONFIG 28 |
67 | #define QT602240_SPT_USERDATA 38 /* firmware ver 21 over */ | 67 | #define MXT_SPT_USERDATA 38 /* firmware ver 21 over */ |
68 | 68 | ||
69 | /* QT602240_GEN_COMMAND field */ | 69 | /* MXT_GEN_COMMAND field */ |
70 | #define QT602240_COMMAND_RESET 0 | 70 | #define MXT_COMMAND_RESET 0 |
71 | #define QT602240_COMMAND_BACKUPNV 1 | 71 | #define MXT_COMMAND_BACKUPNV 1 |
72 | #define QT602240_COMMAND_CALIBRATE 2 | 72 | #define MXT_COMMAND_CALIBRATE 2 |
73 | #define QT602240_COMMAND_REPORTALL 3 | 73 | #define MXT_COMMAND_REPORTALL 3 |
74 | #define QT602240_COMMAND_DIAGNOSTIC 5 | 74 | #define MXT_COMMAND_DIAGNOSTIC 5 |
75 | 75 | ||
76 | /* QT602240_GEN_POWER field */ | 76 | /* MXT_GEN_POWER field */ |
77 | #define QT602240_POWER_IDLEACQINT 0 | 77 | #define MXT_POWER_IDLEACQINT 0 |
78 | #define QT602240_POWER_ACTVACQINT 1 | 78 | #define MXT_POWER_ACTVACQINT 1 |
79 | #define QT602240_POWER_ACTV2IDLETO 2 | 79 | #define MXT_POWER_ACTV2IDLETO 2 |
80 | 80 | ||
81 | /* QT602240_GEN_ACQUIRE field */ | 81 | /* MXT_GEN_ACQUIRE field */ |
82 | #define QT602240_ACQUIRE_CHRGTIME 0 | 82 | #define MXT_ACQUIRE_CHRGTIME 0 |
83 | #define QT602240_ACQUIRE_TCHDRIFT 2 | 83 | #define MXT_ACQUIRE_TCHDRIFT 2 |
84 | #define QT602240_ACQUIRE_DRIFTST 3 | 84 | #define MXT_ACQUIRE_DRIFTST 3 |
85 | #define QT602240_ACQUIRE_TCHAUTOCAL 4 | 85 | #define MXT_ACQUIRE_TCHAUTOCAL 4 |
86 | #define QT602240_ACQUIRE_SYNC 5 | 86 | #define MXT_ACQUIRE_SYNC 5 |
87 | #define QT602240_ACQUIRE_ATCHCALST 6 | 87 | #define MXT_ACQUIRE_ATCHCALST 6 |
88 | #define QT602240_ACQUIRE_ATCHCALSTHR 7 | 88 | #define MXT_ACQUIRE_ATCHCALSTHR 7 |
89 | 89 | ||
90 | /* QT602240_TOUCH_MULTI field */ | 90 | /* MXT_TOUCH_MULTI field */ |
91 | #define QT602240_TOUCH_CTRL 0 | 91 | #define MXT_TOUCH_CTRL 0 |
92 | #define QT602240_TOUCH_XORIGIN 1 | 92 | #define MXT_TOUCH_XORIGIN 1 |
93 | #define QT602240_TOUCH_YORIGIN 2 | 93 | #define MXT_TOUCH_YORIGIN 2 |
94 | #define QT602240_TOUCH_XSIZE 3 | 94 | #define MXT_TOUCH_XSIZE 3 |
95 | #define QT602240_TOUCH_YSIZE 4 | 95 | #define MXT_TOUCH_YSIZE 4 |
96 | #define QT602240_TOUCH_BLEN 6 | 96 | #define MXT_TOUCH_BLEN 6 |
97 | #define QT602240_TOUCH_TCHTHR 7 | 97 | #define MXT_TOUCH_TCHTHR 7 |
98 | #define QT602240_TOUCH_TCHDI 8 | 98 | #define MXT_TOUCH_TCHDI 8 |
99 | #define QT602240_TOUCH_ORIENT 9 | 99 | #define MXT_TOUCH_ORIENT 9 |
100 | #define QT602240_TOUCH_MOVHYSTI 11 | 100 | #define MXT_TOUCH_MOVHYSTI 11 |
101 | #define QT602240_TOUCH_MOVHYSTN 12 | 101 | #define MXT_TOUCH_MOVHYSTN 12 |
102 | #define QT602240_TOUCH_NUMTOUCH 14 | 102 | #define MXT_TOUCH_NUMTOUCH 14 |
103 | #define QT602240_TOUCH_MRGHYST 15 | 103 | #define MXT_TOUCH_MRGHYST 15 |
104 | #define QT602240_TOUCH_MRGTHR 16 | 104 | #define MXT_TOUCH_MRGTHR 16 |
105 | #define QT602240_TOUCH_AMPHYST 17 | 105 | #define MXT_TOUCH_AMPHYST 17 |
106 | #define QT602240_TOUCH_XRANGE_LSB 18 | 106 | #define MXT_TOUCH_XRANGE_LSB 18 |
107 | #define QT602240_TOUCH_XRANGE_MSB 19 | 107 | #define MXT_TOUCH_XRANGE_MSB 19 |
108 | #define QT602240_TOUCH_YRANGE_LSB 20 | 108 | #define MXT_TOUCH_YRANGE_LSB 20 |
109 | #define QT602240_TOUCH_YRANGE_MSB 21 | 109 | #define MXT_TOUCH_YRANGE_MSB 21 |
110 | #define QT602240_TOUCH_XLOCLIP 22 | 110 | #define MXT_TOUCH_XLOCLIP 22 |
111 | #define QT602240_TOUCH_XHICLIP 23 | 111 | #define MXT_TOUCH_XHICLIP 23 |
112 | #define QT602240_TOUCH_YLOCLIP 24 | 112 | #define MXT_TOUCH_YLOCLIP 24 |
113 | #define QT602240_TOUCH_YHICLIP 25 | 113 | #define MXT_TOUCH_YHICLIP 25 |
114 | #define QT602240_TOUCH_XEDGECTRL 26 | 114 | #define MXT_TOUCH_XEDGECTRL 26 |
115 | #define QT602240_TOUCH_XEDGEDIST 27 | 115 | #define MXT_TOUCH_XEDGEDIST 27 |
116 | #define QT602240_TOUCH_YEDGECTRL 28 | 116 | #define MXT_TOUCH_YEDGECTRL 28 |
117 | #define QT602240_TOUCH_YEDGEDIST 29 | 117 | #define MXT_TOUCH_YEDGEDIST 29 |
118 | #define QT602240_TOUCH_JUMPLIMIT 30 /* firmware ver 22 over */ | 118 | #define MXT_TOUCH_JUMPLIMIT 30 /* firmware ver 22 over */ |
119 | 119 | ||
120 | /* QT602240_PROCI_GRIPFACE field */ | 120 | /* MXT_PROCI_GRIPFACE field */ |
121 | #define QT602240_GRIPFACE_CTRL 0 | 121 | #define MXT_GRIPFACE_CTRL 0 |
122 | #define QT602240_GRIPFACE_XLOGRIP 1 | 122 | #define MXT_GRIPFACE_XLOGRIP 1 |
123 | #define QT602240_GRIPFACE_XHIGRIP 2 | 123 | #define MXT_GRIPFACE_XHIGRIP 2 |
124 | #define QT602240_GRIPFACE_YLOGRIP 3 | 124 | #define MXT_GRIPFACE_YLOGRIP 3 |
125 | #define QT602240_GRIPFACE_YHIGRIP 4 | 125 | #define MXT_GRIPFACE_YHIGRIP 4 |
126 | #define QT602240_GRIPFACE_MAXTCHS 5 | 126 | #define MXT_GRIPFACE_MAXTCHS 5 |
127 | #define QT602240_GRIPFACE_SZTHR1 7 | 127 | #define MXT_GRIPFACE_SZTHR1 7 |
128 | #define QT602240_GRIPFACE_SZTHR2 8 | 128 | #define MXT_GRIPFACE_SZTHR2 8 |
129 | #define QT602240_GRIPFACE_SHPTHR1 9 | 129 | #define MXT_GRIPFACE_SHPTHR1 9 |
130 | #define QT602240_GRIPFACE_SHPTHR2 10 | 130 | #define MXT_GRIPFACE_SHPTHR2 10 |
131 | #define QT602240_GRIPFACE_SUPEXTTO 11 | 131 | #define MXT_GRIPFACE_SUPEXTTO 11 |
132 | 132 | ||
133 | /* QT602240_PROCI_NOISE field */ | 133 | /* MXT_PROCI_NOISE field */ |
134 | #define QT602240_NOISE_CTRL 0 | 134 | #define MXT_NOISE_CTRL 0 |
135 | #define QT602240_NOISE_OUTFLEN 1 | 135 | #define MXT_NOISE_OUTFLEN 1 |
136 | #define QT602240_NOISE_GCAFUL_LSB 3 | 136 | #define MXT_NOISE_GCAFUL_LSB 3 |
137 | #define QT602240_NOISE_GCAFUL_MSB 4 | 137 | #define MXT_NOISE_GCAFUL_MSB 4 |
138 | #define QT602240_NOISE_GCAFLL_LSB 5 | 138 | #define MXT_NOISE_GCAFLL_LSB 5 |
139 | #define QT602240_NOISE_GCAFLL_MSB 6 | 139 | #define MXT_NOISE_GCAFLL_MSB 6 |
140 | #define QT602240_NOISE_ACTVGCAFVALID 7 | 140 | #define MXT_NOISE_ACTVGCAFVALID 7 |
141 | #define QT602240_NOISE_NOISETHR 8 | 141 | #define MXT_NOISE_NOISETHR 8 |
142 | #define QT602240_NOISE_FREQHOPSCALE 10 | 142 | #define MXT_NOISE_FREQHOPSCALE 10 |
143 | #define QT602240_NOISE_FREQ0 11 | 143 | #define MXT_NOISE_FREQ0 11 |
144 | #define QT602240_NOISE_FREQ1 12 | 144 | #define MXT_NOISE_FREQ1 12 |
145 | #define QT602240_NOISE_FREQ2 13 | 145 | #define MXT_NOISE_FREQ2 13 |
146 | #define QT602240_NOISE_FREQ3 14 | 146 | #define MXT_NOISE_FREQ3 14 |
147 | #define QT602240_NOISE_FREQ4 15 | 147 | #define MXT_NOISE_FREQ4 15 |
148 | #define QT602240_NOISE_IDLEGCAFVALID 16 | 148 | #define MXT_NOISE_IDLEGCAFVALID 16 |
149 | 149 | ||
150 | /* QT602240_SPT_COMMSCONFIG */ | 150 | /* MXT_SPT_COMMSCONFIG */ |
151 | #define QT602240_COMMS_CTRL 0 | 151 | #define MXT_COMMS_CTRL 0 |
152 | #define QT602240_COMMS_CMD 1 | 152 | #define MXT_COMMS_CMD 1 |
153 | 153 | ||
154 | /* QT602240_SPT_CTECONFIG field */ | 154 | /* MXT_SPT_CTECONFIG field */ |
155 | #define QT602240_CTE_CTRL 0 | 155 | #define MXT_CTE_CTRL 0 |
156 | #define QT602240_CTE_CMD 1 | 156 | #define MXT_CTE_CMD 1 |
157 | #define QT602240_CTE_MODE 2 | 157 | #define MXT_CTE_MODE 2 |
158 | #define QT602240_CTE_IDLEGCAFDEPTH 3 | 158 | #define MXT_CTE_IDLEGCAFDEPTH 3 |
159 | #define QT602240_CTE_ACTVGCAFDEPTH 4 | 159 | #define MXT_CTE_ACTVGCAFDEPTH 4 |
160 | #define QT602240_CTE_VOLTAGE 5 /* firmware ver 21 over */ | 160 | #define MXT_CTE_VOLTAGE 5 /* firmware ver 21 over */ |
161 | 161 | ||
162 | #define QT602240_VOLTAGE_DEFAULT 2700000 | 162 | #define MXT_VOLTAGE_DEFAULT 2700000 |
163 | #define QT602240_VOLTAGE_STEP 10000 | 163 | #define MXT_VOLTAGE_STEP 10000 |
164 | 164 | ||
165 | /* Define for QT602240_GEN_COMMAND */ | 165 | /* Define for MXT_GEN_COMMAND */ |
166 | #define QT602240_BOOT_VALUE 0xa5 | 166 | #define MXT_BOOT_VALUE 0xa5 |
167 | #define QT602240_BACKUP_VALUE 0x55 | 167 | #define MXT_BACKUP_VALUE 0x55 |
168 | #define QT602240_BACKUP_TIME 25 /* msec */ | 168 | #define MXT_BACKUP_TIME 25 /* msec */ |
169 | #define QT602240_RESET_TIME 65 /* msec */ | 169 | #define MXT_RESET_TIME 65 /* msec */ |
170 | 170 | ||
171 | #define QT602240_FWRESET_TIME 175 /* msec */ | 171 | #define MXT_FWRESET_TIME 175 /* msec */ |
172 | 172 | ||
173 | /* Command to unlock bootloader */ | 173 | /* Command to unlock bootloader */ |
174 | #define QT602240_UNLOCK_CMD_MSB 0xaa | 174 | #define MXT_UNLOCK_CMD_MSB 0xaa |
175 | #define QT602240_UNLOCK_CMD_LSB 0xdc | 175 | #define MXT_UNLOCK_CMD_LSB 0xdc |
176 | 176 | ||
177 | /* Bootloader mode status */ | 177 | /* Bootloader mode status */ |
178 | #define QT602240_WAITING_BOOTLOAD_CMD 0xc0 /* valid 7 6 bit only */ | 178 | #define MXT_WAITING_BOOTLOAD_CMD 0xc0 /* valid 7 6 bit only */ |
179 | #define QT602240_WAITING_FRAME_DATA 0x80 /* valid 7 6 bit only */ | 179 | #define MXT_WAITING_FRAME_DATA 0x80 /* valid 7 6 bit only */ |
180 | #define QT602240_FRAME_CRC_CHECK 0x02 | 180 | #define MXT_FRAME_CRC_CHECK 0x02 |
181 | #define QT602240_FRAME_CRC_FAIL 0x03 | 181 | #define MXT_FRAME_CRC_FAIL 0x03 |
182 | #define QT602240_FRAME_CRC_PASS 0x04 | 182 | #define MXT_FRAME_CRC_PASS 0x04 |
183 | #define QT602240_APP_CRC_FAIL 0x40 /* valid 7 8 bit only */ | 183 | #define MXT_APP_CRC_FAIL 0x40 /* valid 7 8 bit only */ |
184 | #define QT602240_BOOT_STATUS_MASK 0x3f | 184 | #define MXT_BOOT_STATUS_MASK 0x3f |
185 | 185 | ||
186 | /* Touch status */ | 186 | /* Touch status */ |
187 | #define QT602240_SUPPRESS (1 << 1) | 187 | #define MXT_SUPPRESS (1 << 1) |
188 | #define QT602240_AMP (1 << 2) | 188 | #define MXT_AMP (1 << 2) |
189 | #define QT602240_VECTOR (1 << 3) | 189 | #define MXT_VECTOR (1 << 3) |
190 | #define QT602240_MOVE (1 << 4) | 190 | #define MXT_MOVE (1 << 4) |
191 | #define QT602240_RELEASE (1 << 5) | 191 | #define MXT_RELEASE (1 << 5) |
192 | #define QT602240_PRESS (1 << 6) | 192 | #define MXT_PRESS (1 << 6) |
193 | #define QT602240_DETECT (1 << 7) | 193 | #define MXT_DETECT (1 << 7) |
194 | 194 | ||
195 | /* Touchscreen absolute values */ | 195 | /* Touchscreen absolute values */ |
196 | #define QT602240_MAX_XC 0x3ff | 196 | #define MXT_MAX_XC 0x3ff |
197 | #define QT602240_MAX_YC 0x3ff | 197 | #define MXT_MAX_YC 0x3ff |
198 | #define QT602240_MAX_AREA 0xff | 198 | #define MXT_MAX_AREA 0xff |
199 | 199 | ||
200 | #define QT602240_MAX_FINGER 10 | 200 | #define MXT_MAX_FINGER 10 |
201 | 201 | ||
202 | /* Initial register values recommended from chip vendor */ | 202 | /* Initial register values recommended from chip vendor */ |
203 | static const u8 init_vals_ver_20[] = { | 203 | static const u8 init_vals_ver_20[] = { |
204 | /* QT602240_GEN_COMMAND(6) */ | 204 | /* MXT_GEN_COMMAND(6) */ |
205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
206 | /* QT602240_GEN_POWER(7) */ | 206 | /* MXT_GEN_POWER(7) */ |
207 | 0x20, 0xff, 0x32, | 207 | 0x20, 0xff, 0x32, |
208 | /* QT602240_GEN_ACQUIRE(8) */ | 208 | /* MXT_GEN_ACQUIRE(8) */ |
209 | 0x08, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x14, | 209 | 0x08, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x14, |
210 | /* QT602240_TOUCH_MULTI(9) */ | 210 | /* MXT_TOUCH_MULTI(9) */ |
211 | 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, | 211 | 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, |
212 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | 212 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, |
213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x64, | 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x64, |
214 | /* QT602240_TOUCH_KEYARRAY(15) */ | 214 | /* MXT_TOUCH_KEYARRAY(15) */ |
215 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 215 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
216 | 0x00, | 216 | 0x00, |
217 | /* QT602240_SPT_GPIOPWM(19) */ | 217 | /* MXT_SPT_GPIOPWM(19) */ |
218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
219 | 0x00, 0x00, | 219 | 0x00, 0x00, |
220 | /* QT602240_PROCI_GRIPFACE(20) */ | 220 | /* MXT_PROCI_GRIPFACE(20) */ |
221 | 0x00, 0x64, 0x64, 0x64, 0x64, 0x00, 0x00, 0x1e, 0x14, 0x04, | 221 | 0x00, 0x64, 0x64, 0x64, 0x64, 0x00, 0x00, 0x1e, 0x14, 0x04, |
222 | 0x1e, 0x00, | 222 | 0x1e, 0x00, |
223 | /* QT602240_PROCG_NOISE(22) */ | 223 | /* MXT_PROCG_NOISE(22) */ |
224 | 0x05, 0x00, 0x00, 0x19, 0x00, 0xe7, 0xff, 0x04, 0x32, 0x00, | 224 | 0x05, 0x00, 0x00, 0x19, 0x00, 0xe7, 0xff, 0x04, 0x32, 0x00, |
225 | 0x01, 0x0a, 0x0f, 0x14, 0x00, 0x00, 0xe8, | 225 | 0x01, 0x0a, 0x0f, 0x14, 0x00, 0x00, 0xe8, |
226 | /* QT602240_TOUCH_PROXIMITY(23) */ | 226 | /* MXT_TOUCH_PROXIMITY(23) */ |
227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
228 | 0x00, 0x00, 0x00, | 228 | 0x00, 0x00, 0x00, |
229 | /* QT602240_PROCI_ONETOUCH(24) */ | 229 | /* MXT_PROCI_ONETOUCH(24) */ |
230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
232 | /* QT602240_SPT_SELFTEST(25) */ | 232 | /* MXT_SPT_SELFTEST(25) */ |
233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
234 | 0x00, 0x00, 0x00, 0x00, | 234 | 0x00, 0x00, 0x00, 0x00, |
235 | /* QT602240_PROCI_TWOTOUCH(27) */ | 235 | /* MXT_PROCI_TWOTOUCH(27) */ |
236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
237 | /* QT602240_SPT_CTECONFIG(28) */ | 237 | /* MXT_SPT_CTECONFIG(28) */ |
238 | 0x00, 0x00, 0x00, 0x04, 0x08, | 238 | 0x00, 0x00, 0x00, 0x04, 0x08, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static const u8 init_vals_ver_21[] = { | 241 | static const u8 init_vals_ver_21[] = { |
242 | /* QT602240_GEN_COMMAND(6) */ | 242 | /* MXT_GEN_COMMAND(6) */ |
243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
244 | /* QT602240_GEN_POWER(7) */ | 244 | /* MXT_GEN_POWER(7) */ |
245 | 0x20, 0xff, 0x32, | 245 | 0x20, 0xff, 0x32, |
246 | /* QT602240_GEN_ACQUIRE(8) */ | 246 | /* MXT_GEN_ACQUIRE(8) */ |
247 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, | 247 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, |
248 | /* QT602240_TOUCH_MULTI(9) */ | 248 | /* MXT_TOUCH_MULTI(9) */ |
249 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, | 249 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, |
250 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | 250 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, |
251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
252 | /* QT602240_TOUCH_KEYARRAY(15) */ | 252 | /* MXT_TOUCH_KEYARRAY(15) */ |
253 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 253 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
254 | 0x00, | 254 | 0x00, |
255 | /* QT602240_SPT_GPIOPWM(19) */ | 255 | /* MXT_SPT_GPIOPWM(19) */ |
256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
257 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 257 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
258 | /* QT602240_PROCI_GRIPFACE(20) */ | 258 | /* MXT_PROCI_GRIPFACE(20) */ |
259 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, | 259 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, |
260 | 0x0f, 0x0a, | 260 | 0x0f, 0x0a, |
261 | /* QT602240_PROCG_NOISE(22) */ | 261 | /* MXT_PROCG_NOISE(22) */ |
262 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, | 262 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, |
263 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, | 263 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, |
264 | /* QT602240_TOUCH_PROXIMITY(23) */ | 264 | /* MXT_TOUCH_PROXIMITY(23) */ |
265 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 265 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
266 | 0x00, 0x00, 0x00, | 266 | 0x00, 0x00, 0x00, |
267 | /* QT602240_PROCI_ONETOUCH(24) */ | 267 | /* MXT_PROCI_ONETOUCH(24) */ |
268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
269 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 269 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
270 | /* QT602240_SPT_SELFTEST(25) */ | 270 | /* MXT_SPT_SELFTEST(25) */ |
271 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 271 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
272 | 0x00, 0x00, 0x00, 0x00, | 272 | 0x00, 0x00, 0x00, 0x00, |
273 | /* QT602240_PROCI_TWOTOUCH(27) */ | 273 | /* MXT_PROCI_TWOTOUCH(27) */ |
274 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 274 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
275 | /* QT602240_SPT_CTECONFIG(28) */ | 275 | /* MXT_SPT_CTECONFIG(28) */ |
276 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, | 276 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static const u8 init_vals_ver_22[] = { | 279 | static const u8 init_vals_ver_22[] = { |
280 | /* QT602240_GEN_COMMAND(6) */ | 280 | /* MXT_GEN_COMMAND(6) */ |
281 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 281 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
282 | /* QT602240_GEN_POWER(7) */ | 282 | /* MXT_GEN_POWER(7) */ |
283 | 0x20, 0xff, 0x32, | 283 | 0x20, 0xff, 0x32, |
284 | /* QT602240_GEN_ACQUIRE(8) */ | 284 | /* MXT_GEN_ACQUIRE(8) */ |
285 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, | 285 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, |
286 | /* QT602240_TOUCH_MULTI(9) */ | 286 | /* MXT_TOUCH_MULTI(9) */ |
287 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, | 287 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, |
288 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | 288 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, |
289 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 289 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
290 | 0x00, | 290 | 0x00, |
291 | /* QT602240_TOUCH_KEYARRAY(15) */ | 291 | /* MXT_TOUCH_KEYARRAY(15) */ |
292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
293 | 0x00, | 293 | 0x00, |
294 | /* QT602240_SPT_GPIOPWM(19) */ | 294 | /* MXT_SPT_GPIOPWM(19) */ |
295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
297 | /* QT602240_PROCI_GRIPFACE(20) */ | 297 | /* MXT_PROCI_GRIPFACE(20) */ |
298 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, | 298 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, |
299 | 0x0f, 0x0a, | 299 | 0x0f, 0x0a, |
300 | /* QT602240_PROCG_NOISE(22) */ | 300 | /* MXT_PROCG_NOISE(22) */ |
301 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, | 301 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, |
302 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, | 302 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, |
303 | /* QT602240_TOUCH_PROXIMITY(23) */ | 303 | /* MXT_TOUCH_PROXIMITY(23) */ |
304 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 304 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
305 | 0x00, 0x00, 0x00, 0x00, 0x00, | 305 | 0x00, 0x00, 0x00, 0x00, 0x00, |
306 | /* QT602240_PROCI_ONETOUCH(24) */ | 306 | /* MXT_PROCI_ONETOUCH(24) */ |
307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
308 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 308 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
309 | /* QT602240_SPT_SELFTEST(25) */ | 309 | /* MXT_SPT_SELFTEST(25) */ |
310 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 310 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
311 | 0x00, 0x00, 0x00, 0x00, | 311 | 0x00, 0x00, 0x00, 0x00, |
312 | /* QT602240_PROCI_TWOTOUCH(27) */ | 312 | /* MXT_PROCI_TWOTOUCH(27) */ |
313 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 313 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
314 | /* QT602240_SPT_CTECONFIG(28) */ | 314 | /* MXT_SPT_CTECONFIG(28) */ |
315 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, | 315 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, |
316 | }; | 316 | }; |
317 | 317 | ||
318 | struct qt602240_info { | 318 | struct mxt_info { |
319 | u8 family_id; | 319 | u8 family_id; |
320 | u8 variant_id; | 320 | u8 variant_id; |
321 | u8 version; | 321 | u8 version; |
@@ -325,7 +325,7 @@ struct qt602240_info { | |||
325 | u8 object_num; | 325 | u8 object_num; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | struct qt602240_object { | 328 | struct mxt_object { |
329 | u8 type; | 329 | u8 type; |
330 | u16 start_address; | 330 | u16 start_address; |
331 | u8 size; | 331 | u8 size; |
@@ -336,13 +336,13 @@ struct qt602240_object { | |||
336 | u8 max_reportid; | 336 | u8 max_reportid; |
337 | }; | 337 | }; |
338 | 338 | ||
339 | struct qt602240_message { | 339 | struct mxt_message { |
340 | u8 reportid; | 340 | u8 reportid; |
341 | u8 message[7]; | 341 | u8 message[7]; |
342 | u8 checksum; | 342 | u8 checksum; |
343 | }; | 343 | }; |
344 | 344 | ||
345 | struct qt602240_finger { | 345 | struct mxt_finger { |
346 | int status; | 346 | int status; |
347 | int x; | 347 | int x; |
348 | int y; | 348 | int y; |
@@ -350,65 +350,65 @@ struct qt602240_finger { | |||
350 | }; | 350 | }; |
351 | 351 | ||
352 | /* Each client has this additional data */ | 352 | /* Each client has this additional data */ |
353 | struct qt602240_data { | 353 | struct mxt_data { |
354 | struct i2c_client *client; | 354 | struct i2c_client *client; |
355 | struct input_dev *input_dev; | 355 | struct input_dev *input_dev; |
356 | const struct qt602240_platform_data *pdata; | 356 | const struct mxt_platform_data *pdata; |
357 | struct qt602240_object *object_table; | 357 | struct mxt_object *object_table; |
358 | struct qt602240_info info; | 358 | struct mxt_info info; |
359 | struct qt602240_finger finger[QT602240_MAX_FINGER]; | 359 | struct mxt_finger finger[MXT_MAX_FINGER]; |
360 | unsigned int irq; | 360 | unsigned int irq; |
361 | }; | 361 | }; |
362 | 362 | ||
363 | static bool qt602240_object_readable(unsigned int type) | 363 | static bool mxt_object_readable(unsigned int type) |
364 | { | 364 | { |
365 | switch (type) { | 365 | switch (type) { |
366 | case QT602240_GEN_MESSAGE: | 366 | case MXT_GEN_MESSAGE: |
367 | case QT602240_GEN_COMMAND: | 367 | case MXT_GEN_COMMAND: |
368 | case QT602240_GEN_POWER: | 368 | case MXT_GEN_POWER: |
369 | case QT602240_GEN_ACQUIRE: | 369 | case MXT_GEN_ACQUIRE: |
370 | case QT602240_TOUCH_MULTI: | 370 | case MXT_TOUCH_MULTI: |
371 | case QT602240_TOUCH_KEYARRAY: | 371 | case MXT_TOUCH_KEYARRAY: |
372 | case QT602240_TOUCH_PROXIMITY: | 372 | case MXT_TOUCH_PROXIMITY: |
373 | case QT602240_PROCI_GRIPFACE: | 373 | case MXT_PROCI_GRIPFACE: |
374 | case QT602240_PROCG_NOISE: | 374 | case MXT_PROCG_NOISE: |
375 | case QT602240_PROCI_ONETOUCH: | 375 | case MXT_PROCI_ONETOUCH: |
376 | case QT602240_PROCI_TWOTOUCH: | 376 | case MXT_PROCI_TWOTOUCH: |
377 | case QT602240_SPT_COMMSCONFIG: | 377 | case MXT_SPT_COMMSCONFIG: |
378 | case QT602240_SPT_GPIOPWM: | 378 | case MXT_SPT_GPIOPWM: |
379 | case QT602240_SPT_SELFTEST: | 379 | case MXT_SPT_SELFTEST: |
380 | case QT602240_SPT_CTECONFIG: | 380 | case MXT_SPT_CTECONFIG: |
381 | case QT602240_SPT_USERDATA: | 381 | case MXT_SPT_USERDATA: |
382 | return true; | 382 | return true; |
383 | default: | 383 | default: |
384 | return false; | 384 | return false; |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | static bool qt602240_object_writable(unsigned int type) | 388 | static bool mxt_object_writable(unsigned int type) |
389 | { | 389 | { |
390 | switch (type) { | 390 | switch (type) { |
391 | case QT602240_GEN_COMMAND: | 391 | case MXT_GEN_COMMAND: |
392 | case QT602240_GEN_POWER: | 392 | case MXT_GEN_POWER: |
393 | case QT602240_GEN_ACQUIRE: | 393 | case MXT_GEN_ACQUIRE: |
394 | case QT602240_TOUCH_MULTI: | 394 | case MXT_TOUCH_MULTI: |
395 | case QT602240_TOUCH_KEYARRAY: | 395 | case MXT_TOUCH_KEYARRAY: |
396 | case QT602240_TOUCH_PROXIMITY: | 396 | case MXT_TOUCH_PROXIMITY: |
397 | case QT602240_PROCI_GRIPFACE: | 397 | case MXT_PROCI_GRIPFACE: |
398 | case QT602240_PROCG_NOISE: | 398 | case MXT_PROCG_NOISE: |
399 | case QT602240_PROCI_ONETOUCH: | 399 | case MXT_PROCI_ONETOUCH: |
400 | case QT602240_PROCI_TWOTOUCH: | 400 | case MXT_PROCI_TWOTOUCH: |
401 | case QT602240_SPT_GPIOPWM: | 401 | case MXT_SPT_GPIOPWM: |
402 | case QT602240_SPT_SELFTEST: | 402 | case MXT_SPT_SELFTEST: |
403 | case QT602240_SPT_CTECONFIG: | 403 | case MXT_SPT_CTECONFIG: |
404 | return true; | 404 | return true; |
405 | default: | 405 | default: |
406 | return false; | 406 | return false; |
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | static void qt602240_dump_message(struct device *dev, | 410 | static void mxt_dump_message(struct device *dev, |
411 | struct qt602240_message *message) | 411 | struct mxt_message *message) |
412 | { | 412 | { |
413 | dev_dbg(dev, "reportid:\t0x%x\n", message->reportid); | 413 | dev_dbg(dev, "reportid:\t0x%x\n", message->reportid); |
414 | dev_dbg(dev, "message1:\t0x%x\n", message->message[0]); | 414 | dev_dbg(dev, "message1:\t0x%x\n", message->message[0]); |
@@ -421,7 +421,7 @@ static void qt602240_dump_message(struct device *dev, | |||
421 | dev_dbg(dev, "checksum:\t0x%x\n", message->checksum); | 421 | dev_dbg(dev, "checksum:\t0x%x\n", message->checksum); |
422 | } | 422 | } |
423 | 423 | ||
424 | static int qt602240_check_bootloader(struct i2c_client *client, | 424 | static int mxt_check_bootloader(struct i2c_client *client, |
425 | unsigned int state) | 425 | unsigned int state) |
426 | { | 426 | { |
427 | u8 val; | 427 | u8 val; |
@@ -433,12 +433,12 @@ recheck: | |||
433 | } | 433 | } |
434 | 434 | ||
435 | switch (state) { | 435 | switch (state) { |
436 | case QT602240_WAITING_BOOTLOAD_CMD: | 436 | case MXT_WAITING_BOOTLOAD_CMD: |
437 | case QT602240_WAITING_FRAME_DATA: | 437 | case MXT_WAITING_FRAME_DATA: |
438 | val &= ~QT602240_BOOT_STATUS_MASK; | 438 | val &= ~MXT_BOOT_STATUS_MASK; |
439 | break; | 439 | break; |
440 | case QT602240_FRAME_CRC_PASS: | 440 | case MXT_FRAME_CRC_PASS: |
441 | if (val == QT602240_FRAME_CRC_CHECK) | 441 | if (val == MXT_FRAME_CRC_CHECK) |
442 | goto recheck; | 442 | goto recheck; |
443 | break; | 443 | break; |
444 | default: | 444 | default: |
@@ -453,12 +453,12 @@ recheck: | |||
453 | return 0; | 453 | return 0; |
454 | } | 454 | } |
455 | 455 | ||
456 | static int qt602240_unlock_bootloader(struct i2c_client *client) | 456 | static int mxt_unlock_bootloader(struct i2c_client *client) |
457 | { | 457 | { |
458 | u8 buf[2]; | 458 | u8 buf[2]; |
459 | 459 | ||
460 | buf[0] = QT602240_UNLOCK_CMD_LSB; | 460 | buf[0] = MXT_UNLOCK_CMD_LSB; |
461 | buf[1] = QT602240_UNLOCK_CMD_MSB; | 461 | buf[1] = MXT_UNLOCK_CMD_MSB; |
462 | 462 | ||
463 | if (i2c_master_send(client, buf, 2) != 2) { | 463 | if (i2c_master_send(client, buf, 2) != 2) { |
464 | dev_err(&client->dev, "%s: i2c send failed\n", __func__); | 464 | dev_err(&client->dev, "%s: i2c send failed\n", __func__); |
@@ -468,7 +468,7 @@ static int qt602240_unlock_bootloader(struct i2c_client *client) | |||
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
470 | 470 | ||
471 | static int qt602240_fw_write(struct i2c_client *client, | 471 | static int mxt_fw_write(struct i2c_client *client, |
472 | const u8 *data, unsigned int frame_size) | 472 | const u8 *data, unsigned int frame_size) |
473 | { | 473 | { |
474 | if (i2c_master_send(client, data, frame_size) != frame_size) { | 474 | if (i2c_master_send(client, data, frame_size) != frame_size) { |
@@ -479,7 +479,7 @@ static int qt602240_fw_write(struct i2c_client *client, | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | 481 | ||
482 | static int __qt602240_read_reg(struct i2c_client *client, | 482 | static int __mxt_read_reg(struct i2c_client *client, |
483 | u16 reg, u16 len, void *val) | 483 | u16 reg, u16 len, void *val) |
484 | { | 484 | { |
485 | struct i2c_msg xfer[2]; | 485 | struct i2c_msg xfer[2]; |
@@ -508,12 +508,12 @@ static int __qt602240_read_reg(struct i2c_client *client, | |||
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
510 | 510 | ||
511 | static int qt602240_read_reg(struct i2c_client *client, u16 reg, u8 *val) | 511 | static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) |
512 | { | 512 | { |
513 | return __qt602240_read_reg(client, reg, 1, val); | 513 | return __mxt_read_reg(client, reg, 1, val); |
514 | } | 514 | } |
515 | 515 | ||
516 | static int qt602240_write_reg(struct i2c_client *client, u16 reg, u8 val) | 516 | static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) |
517 | { | 517 | { |
518 | u8 buf[3]; | 518 | u8 buf[3]; |
519 | 519 | ||
@@ -529,17 +529,17 @@ static int qt602240_write_reg(struct i2c_client *client, u16 reg, u8 val) | |||
529 | return 0; | 529 | return 0; |
530 | } | 530 | } |
531 | 531 | ||
532 | static int qt602240_read_object_table(struct i2c_client *client, | 532 | static int mxt_read_object_table(struct i2c_client *client, |
533 | u16 reg, u8 *object_buf) | 533 | u16 reg, u8 *object_buf) |
534 | { | 534 | { |
535 | return __qt602240_read_reg(client, reg, QT602240_OBJECT_SIZE, | 535 | return __mxt_read_reg(client, reg, MXT_OBJECT_SIZE, |
536 | object_buf); | 536 | object_buf); |
537 | } | 537 | } |
538 | 538 | ||
539 | static struct qt602240_object * | 539 | static struct mxt_object * |
540 | qt602240_get_object(struct qt602240_data *data, u8 type) | 540 | mxt_get_object(struct mxt_data *data, u8 type) |
541 | { | 541 | { |
542 | struct qt602240_object *object; | 542 | struct mxt_object *object; |
543 | int i; | 543 | int i; |
544 | 544 | ||
545 | for (i = 0; i < data->info.object_num; i++) { | 545 | for (i = 0; i < data->info.object_num; i++) { |
@@ -552,63 +552,63 @@ qt602240_get_object(struct qt602240_data *data, u8 type) | |||
552 | return NULL; | 552 | return NULL; |
553 | } | 553 | } |
554 | 554 | ||
555 | static int qt602240_read_message(struct qt602240_data *data, | 555 | static int mxt_read_message(struct mxt_data *data, |
556 | struct qt602240_message *message) | 556 | struct mxt_message *message) |
557 | { | 557 | { |
558 | struct qt602240_object *object; | 558 | struct mxt_object *object; |
559 | u16 reg; | 559 | u16 reg; |
560 | 560 | ||
561 | object = qt602240_get_object(data, QT602240_GEN_MESSAGE); | 561 | object = mxt_get_object(data, MXT_GEN_MESSAGE); |
562 | if (!object) | 562 | if (!object) |
563 | return -EINVAL; | 563 | return -EINVAL; |
564 | 564 | ||
565 | reg = object->start_address; | 565 | reg = object->start_address; |
566 | return __qt602240_read_reg(data->client, reg, | 566 | return __mxt_read_reg(data->client, reg, |
567 | sizeof(struct qt602240_message), message); | 567 | sizeof(struct mxt_message), message); |
568 | } | 568 | } |
569 | 569 | ||
570 | static int qt602240_read_object(struct qt602240_data *data, | 570 | static int mxt_read_object(struct mxt_data *data, |
571 | u8 type, u8 offset, u8 *val) | 571 | u8 type, u8 offset, u8 *val) |
572 | { | 572 | { |
573 | struct qt602240_object *object; | 573 | struct mxt_object *object; |
574 | u16 reg; | 574 | u16 reg; |
575 | 575 | ||
576 | object = qt602240_get_object(data, type); | 576 | object = mxt_get_object(data, type); |
577 | if (!object) | 577 | if (!object) |
578 | return -EINVAL; | 578 | return -EINVAL; |
579 | 579 | ||
580 | reg = object->start_address; | 580 | reg = object->start_address; |
581 | return __qt602240_read_reg(data->client, reg + offset, 1, val); | 581 | return __mxt_read_reg(data->client, reg + offset, 1, val); |
582 | } | 582 | } |
583 | 583 | ||
584 | static int qt602240_write_object(struct qt602240_data *data, | 584 | static int mxt_write_object(struct mxt_data *data, |
585 | u8 type, u8 offset, u8 val) | 585 | u8 type, u8 offset, u8 val) |
586 | { | 586 | { |
587 | struct qt602240_object *object; | 587 | struct mxt_object *object; |
588 | u16 reg; | 588 | u16 reg; |
589 | 589 | ||
590 | object = qt602240_get_object(data, type); | 590 | object = mxt_get_object(data, type); |
591 | if (!object) | 591 | if (!object) |
592 | return -EINVAL; | 592 | return -EINVAL; |
593 | 593 | ||
594 | reg = object->start_address; | 594 | reg = object->start_address; |
595 | return qt602240_write_reg(data->client, reg + offset, val); | 595 | return mxt_write_reg(data->client, reg + offset, val); |
596 | } | 596 | } |
597 | 597 | ||
598 | static void qt602240_input_report(struct qt602240_data *data, int single_id) | 598 | static void mxt_input_report(struct mxt_data *data, int single_id) |
599 | { | 599 | { |
600 | struct qt602240_finger *finger = data->finger; | 600 | struct mxt_finger *finger = data->finger; |
601 | struct input_dev *input_dev = data->input_dev; | 601 | struct input_dev *input_dev = data->input_dev; |
602 | int status = finger[single_id].status; | 602 | int status = finger[single_id].status; |
603 | int finger_num = 0; | 603 | int finger_num = 0; |
604 | int id; | 604 | int id; |
605 | 605 | ||
606 | for (id = 0; id < QT602240_MAX_FINGER; id++) { | 606 | for (id = 0; id < MXT_MAX_FINGER; id++) { |
607 | if (!finger[id].status) | 607 | if (!finger[id].status) |
608 | continue; | 608 | continue; |
609 | 609 | ||
610 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, | 610 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, |
611 | finger[id].status != QT602240_RELEASE ? | 611 | finger[id].status != MXT_RELEASE ? |
612 | finger[id].area : 0); | 612 | finger[id].area : 0); |
613 | input_report_abs(input_dev, ABS_MT_POSITION_X, | 613 | input_report_abs(input_dev, ABS_MT_POSITION_X, |
614 | finger[id].x); | 614 | finger[id].x); |
@@ -616,7 +616,7 @@ static void qt602240_input_report(struct qt602240_data *data, int single_id) | |||
616 | finger[id].y); | 616 | finger[id].y); |
617 | input_mt_sync(input_dev); | 617 | input_mt_sync(input_dev); |
618 | 618 | ||
619 | if (finger[id].status == QT602240_RELEASE) | 619 | if (finger[id].status == MXT_RELEASE) |
620 | finger[id].status = 0; | 620 | finger[id].status = 0; |
621 | else | 621 | else |
622 | finger_num++; | 622 | finger_num++; |
@@ -624,7 +624,7 @@ static void qt602240_input_report(struct qt602240_data *data, int single_id) | |||
624 | 624 | ||
625 | input_report_key(input_dev, BTN_TOUCH, finger_num > 0); | 625 | input_report_key(input_dev, BTN_TOUCH, finger_num > 0); |
626 | 626 | ||
627 | if (status != QT602240_RELEASE) { | 627 | if (status != MXT_RELEASE) { |
628 | input_report_abs(input_dev, ABS_X, finger[single_id].x); | 628 | input_report_abs(input_dev, ABS_X, finger[single_id].x); |
629 | input_report_abs(input_dev, ABS_Y, finger[single_id].y); | 629 | input_report_abs(input_dev, ABS_Y, finger[single_id].y); |
630 | } | 630 | } |
@@ -632,10 +632,10 @@ static void qt602240_input_report(struct qt602240_data *data, int single_id) | |||
632 | input_sync(input_dev); | 632 | input_sync(input_dev); |
633 | } | 633 | } |
634 | 634 | ||
635 | static void qt602240_input_touchevent(struct qt602240_data *data, | 635 | static void mxt_input_touchevent(struct mxt_data *data, |
636 | struct qt602240_message *message, int id) | 636 | struct mxt_message *message, int id) |
637 | { | 637 | { |
638 | struct qt602240_finger *finger = data->finger; | 638 | struct mxt_finger *finger = data->finger; |
639 | struct device *dev = &data->client->dev; | 639 | struct device *dev = &data->client->dev; |
640 | u8 status = message->message[0]; | 640 | u8 status = message->message[0]; |
641 | int x; | 641 | int x; |
@@ -643,18 +643,18 @@ static void qt602240_input_touchevent(struct qt602240_data *data, | |||
643 | int area; | 643 | int area; |
644 | 644 | ||
645 | /* Check the touch is present on the screen */ | 645 | /* Check the touch is present on the screen */ |
646 | if (!(status & QT602240_DETECT)) { | 646 | if (!(status & MXT_DETECT)) { |
647 | if (status & QT602240_RELEASE) { | 647 | if (status & MXT_RELEASE) { |
648 | dev_dbg(dev, "[%d] released\n", id); | 648 | dev_dbg(dev, "[%d] released\n", id); |
649 | 649 | ||
650 | finger[id].status = QT602240_RELEASE; | 650 | finger[id].status = MXT_RELEASE; |
651 | qt602240_input_report(data, id); | 651 | mxt_input_report(data, id); |
652 | } | 652 | } |
653 | return; | 653 | return; |
654 | } | 654 | } |
655 | 655 | ||
656 | /* Check only AMP detection */ | 656 | /* Check only AMP detection */ |
657 | if (!(status & (QT602240_PRESS | QT602240_MOVE))) | 657 | if (!(status & (MXT_PRESS | MXT_MOVE))) |
658 | return; | 658 | return; |
659 | 659 | ||
660 | x = (message->message[1] << 2) | ((message->message[3] & ~0x3f) >> 6); | 660 | x = (message->message[1] << 2) | ((message->message[3] & ~0x3f) >> 6); |
@@ -662,23 +662,23 @@ static void qt602240_input_touchevent(struct qt602240_data *data, | |||
662 | area = message->message[4]; | 662 | area = message->message[4]; |
663 | 663 | ||
664 | dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, | 664 | dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, |
665 | status & QT602240_MOVE ? "moved" : "pressed", | 665 | status & MXT_MOVE ? "moved" : "pressed", |
666 | x, y, area); | 666 | x, y, area); |
667 | 667 | ||
668 | finger[id].status = status & QT602240_MOVE ? | 668 | finger[id].status = status & MXT_MOVE ? |
669 | QT602240_MOVE : QT602240_PRESS; | 669 | MXT_MOVE : MXT_PRESS; |
670 | finger[id].x = x; | 670 | finger[id].x = x; |
671 | finger[id].y = y; | 671 | finger[id].y = y; |
672 | finger[id].area = area; | 672 | finger[id].area = area; |
673 | 673 | ||
674 | qt602240_input_report(data, id); | 674 | mxt_input_report(data, id); |
675 | } | 675 | } |
676 | 676 | ||
677 | static irqreturn_t qt602240_interrupt(int irq, void *dev_id) | 677 | static irqreturn_t mxt_interrupt(int irq, void *dev_id) |
678 | { | 678 | { |
679 | struct qt602240_data *data = dev_id; | 679 | struct mxt_data *data = dev_id; |
680 | struct qt602240_message message; | 680 | struct mxt_message message; |
681 | struct qt602240_object *object; | 681 | struct mxt_object *object; |
682 | struct device *dev = &data->client->dev; | 682 | struct device *dev = &data->client->dev; |
683 | int id; | 683 | int id; |
684 | u8 reportid; | 684 | u8 reportid; |
@@ -686,15 +686,15 @@ static irqreturn_t qt602240_interrupt(int irq, void *dev_id) | |||
686 | u8 min_reportid; | 686 | u8 min_reportid; |
687 | 687 | ||
688 | do { | 688 | do { |
689 | if (qt602240_read_message(data, &message)) { | 689 | if (mxt_read_message(data, &message)) { |
690 | dev_err(dev, "Failed to read message\n"); | 690 | dev_err(dev, "Failed to read message\n"); |
691 | goto end; | 691 | goto end; |
692 | } | 692 | } |
693 | 693 | ||
694 | reportid = message.reportid; | 694 | reportid = message.reportid; |
695 | 695 | ||
696 | /* whether reportid is thing of QT602240_TOUCH_MULTI */ | 696 | /* whether reportid is thing of MXT_TOUCH_MULTI */ |
697 | object = qt602240_get_object(data, QT602240_TOUCH_MULTI); | 697 | object = mxt_get_object(data, MXT_TOUCH_MULTI); |
698 | if (!object) | 698 | if (!object) |
699 | goto end; | 699 | goto end; |
700 | 700 | ||
@@ -703,18 +703,18 @@ static irqreturn_t qt602240_interrupt(int irq, void *dev_id) | |||
703 | id = reportid - min_reportid; | 703 | id = reportid - min_reportid; |
704 | 704 | ||
705 | if (reportid >= min_reportid && reportid <= max_reportid) | 705 | if (reportid >= min_reportid && reportid <= max_reportid) |
706 | qt602240_input_touchevent(data, &message, id); | 706 | mxt_input_touchevent(data, &message, id); |
707 | else | 707 | else |
708 | qt602240_dump_message(dev, &message); | 708 | mxt_dump_message(dev, &message); |
709 | } while (reportid != 0xff); | 709 | } while (reportid != 0xff); |
710 | 710 | ||
711 | end: | 711 | end: |
712 | return IRQ_HANDLED; | 712 | return IRQ_HANDLED; |
713 | } | 713 | } |
714 | 714 | ||
715 | static int qt602240_check_reg_init(struct qt602240_data *data) | 715 | static int mxt_check_reg_init(struct mxt_data *data) |
716 | { | 716 | { |
717 | struct qt602240_object *object; | 717 | struct mxt_object *object; |
718 | struct device *dev = &data->client->dev; | 718 | struct device *dev = &data->client->dev; |
719 | int index = 0; | 719 | int index = 0; |
720 | int i, j; | 720 | int i, j; |
@@ -722,13 +722,13 @@ static int qt602240_check_reg_init(struct qt602240_data *data) | |||
722 | u8 *init_vals; | 722 | u8 *init_vals; |
723 | 723 | ||
724 | switch (version) { | 724 | switch (version) { |
725 | case QT602240_VER_20: | 725 | case MXT_VER_20: |
726 | init_vals = (u8 *)init_vals_ver_20; | 726 | init_vals = (u8 *)init_vals_ver_20; |
727 | break; | 727 | break; |
728 | case QT602240_VER_21: | 728 | case MXT_VER_21: |
729 | init_vals = (u8 *)init_vals_ver_21; | 729 | init_vals = (u8 *)init_vals_ver_21; |
730 | break; | 730 | break; |
731 | case QT602240_VER_22: | 731 | case MXT_VER_22: |
732 | init_vals = (u8 *)init_vals_ver_22; | 732 | init_vals = (u8 *)init_vals_ver_22; |
733 | break; | 733 | break; |
734 | default: | 734 | default: |
@@ -739,11 +739,11 @@ static int qt602240_check_reg_init(struct qt602240_data *data) | |||
739 | for (i = 0; i < data->info.object_num; i++) { | 739 | for (i = 0; i < data->info.object_num; i++) { |
740 | object = data->object_table + i; | 740 | object = data->object_table + i; |
741 | 741 | ||
742 | if (!qt602240_object_writable(object->type)) | 742 | if (!mxt_object_writable(object->type)) |
743 | continue; | 743 | continue; |
744 | 744 | ||
745 | for (j = 0; j < object->size + 1; j++) | 745 | for (j = 0; j < object->size + 1; j++) |
746 | qt602240_write_object(data, object->type, j, | 746 | mxt_write_object(data, object->type, j, |
747 | init_vals[index + j]); | 747 | init_vals[index + j]); |
748 | 748 | ||
749 | index += object->size + 1; | 749 | index += object->size + 1; |
@@ -752,9 +752,9 @@ static int qt602240_check_reg_init(struct qt602240_data *data) | |||
752 | return 0; | 752 | return 0; |
753 | } | 753 | } |
754 | 754 | ||
755 | static int qt602240_check_matrix_size(struct qt602240_data *data) | 755 | static int mxt_check_matrix_size(struct mxt_data *data) |
756 | { | 756 | { |
757 | const struct qt602240_platform_data *pdata = data->pdata; | 757 | const struct mxt_platform_data *pdata = data->pdata; |
758 | struct device *dev = &data->client->dev; | 758 | struct device *dev = &data->client->dev; |
759 | int mode = -1; | 759 | int mode = -1; |
760 | int error; | 760 | int error; |
@@ -801,8 +801,8 @@ static int qt602240_check_matrix_size(struct qt602240_data *data) | |||
801 | return -EINVAL; | 801 | return -EINVAL; |
802 | } | 802 | } |
803 | 803 | ||
804 | error = qt602240_read_object(data, QT602240_SPT_CTECONFIG, | 804 | error = mxt_read_object(data, MXT_SPT_CTECONFIG, |
805 | QT602240_CTE_MODE, &val); | 805 | MXT_CTE_MODE, &val); |
806 | if (error) | 806 | if (error) |
807 | return error; | 807 | return error; |
808 | 808 | ||
@@ -810,17 +810,17 @@ static int qt602240_check_matrix_size(struct qt602240_data *data) | |||
810 | return 0; | 810 | return 0; |
811 | 811 | ||
812 | /* Change the CTE configuration */ | 812 | /* Change the CTE configuration */ |
813 | qt602240_write_object(data, QT602240_SPT_CTECONFIG, | 813 | mxt_write_object(data, MXT_SPT_CTECONFIG, |
814 | QT602240_CTE_CTRL, 1); | 814 | MXT_CTE_CTRL, 1); |
815 | qt602240_write_object(data, QT602240_SPT_CTECONFIG, | 815 | mxt_write_object(data, MXT_SPT_CTECONFIG, |
816 | QT602240_CTE_MODE, mode); | 816 | MXT_CTE_MODE, mode); |
817 | qt602240_write_object(data, QT602240_SPT_CTECONFIG, | 817 | mxt_write_object(data, MXT_SPT_CTECONFIG, |
818 | QT602240_CTE_CTRL, 0); | 818 | MXT_CTE_CTRL, 0); |
819 | 819 | ||
820 | return 0; | 820 | return 0; |
821 | } | 821 | } |
822 | 822 | ||
823 | static int qt602240_make_highchg(struct qt602240_data *data) | 823 | static int mxt_make_highchg(struct mxt_data *data) |
824 | { | 824 | { |
825 | struct device *dev = &data->client->dev; | 825 | struct device *dev = &data->client->dev; |
826 | int count = 10; | 826 | int count = 10; |
@@ -829,7 +829,7 @@ static int qt602240_make_highchg(struct qt602240_data *data) | |||
829 | 829 | ||
830 | /* Read dummy message to make high CHG pin */ | 830 | /* Read dummy message to make high CHG pin */ |
831 | do { | 831 | do { |
832 | error = qt602240_read_object(data, QT602240_GEN_MESSAGE, 0, &val); | 832 | error = mxt_read_object(data, MXT_GEN_MESSAGE, 0, &val); |
833 | if (error) | 833 | if (error) |
834 | return error; | 834 | return error; |
835 | } while ((val != 0xff) && --count); | 835 | } while ((val != 0xff) && --count); |
@@ -842,82 +842,82 @@ static int qt602240_make_highchg(struct qt602240_data *data) | |||
842 | return 0; | 842 | return 0; |
843 | } | 843 | } |
844 | 844 | ||
845 | static void qt602240_handle_pdata(struct qt602240_data *data) | 845 | static void mxt_handle_pdata(struct mxt_data *data) |
846 | { | 846 | { |
847 | const struct qt602240_platform_data *pdata = data->pdata; | 847 | const struct mxt_platform_data *pdata = data->pdata; |
848 | u8 voltage; | 848 | u8 voltage; |
849 | 849 | ||
850 | /* Set touchscreen lines */ | 850 | /* Set touchscreen lines */ |
851 | qt602240_write_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_XSIZE, | 851 | mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_XSIZE, |
852 | pdata->x_line); | 852 | pdata->x_line); |
853 | qt602240_write_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_YSIZE, | 853 | mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_YSIZE, |
854 | pdata->y_line); | 854 | pdata->y_line); |
855 | 855 | ||
856 | /* Set touchscreen orient */ | 856 | /* Set touchscreen orient */ |
857 | qt602240_write_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_ORIENT, | 857 | mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_ORIENT, |
858 | pdata->orient); | 858 | pdata->orient); |
859 | 859 | ||
860 | /* Set touchscreen burst length */ | 860 | /* Set touchscreen burst length */ |
861 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 861 | mxt_write_object(data, MXT_TOUCH_MULTI, |
862 | QT602240_TOUCH_BLEN, pdata->blen); | 862 | MXT_TOUCH_BLEN, pdata->blen); |
863 | 863 | ||
864 | /* Set touchscreen threshold */ | 864 | /* Set touchscreen threshold */ |
865 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 865 | mxt_write_object(data, MXT_TOUCH_MULTI, |
866 | QT602240_TOUCH_TCHTHR, pdata->threshold); | 866 | MXT_TOUCH_TCHTHR, pdata->threshold); |
867 | 867 | ||
868 | /* Set touchscreen resolution */ | 868 | /* Set touchscreen resolution */ |
869 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 869 | mxt_write_object(data, MXT_TOUCH_MULTI, |
870 | QT602240_TOUCH_XRANGE_LSB, (pdata->x_size - 1) & 0xff); | 870 | MXT_TOUCH_XRANGE_LSB, (pdata->x_size - 1) & 0xff); |
871 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 871 | mxt_write_object(data, MXT_TOUCH_MULTI, |
872 | QT602240_TOUCH_XRANGE_MSB, (pdata->x_size - 1) >> 8); | 872 | MXT_TOUCH_XRANGE_MSB, (pdata->x_size - 1) >> 8); |
873 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 873 | mxt_write_object(data, MXT_TOUCH_MULTI, |
874 | QT602240_TOUCH_YRANGE_LSB, (pdata->y_size - 1) & 0xff); | 874 | MXT_TOUCH_YRANGE_LSB, (pdata->y_size - 1) & 0xff); |
875 | qt602240_write_object(data, QT602240_TOUCH_MULTI, | 875 | mxt_write_object(data, MXT_TOUCH_MULTI, |
876 | QT602240_TOUCH_YRANGE_MSB, (pdata->y_size - 1) >> 8); | 876 | MXT_TOUCH_YRANGE_MSB, (pdata->y_size - 1) >> 8); |
877 | 877 | ||
878 | /* Set touchscreen voltage */ | 878 | /* Set touchscreen voltage */ |
879 | if (data->info.version >= QT602240_VER_21 && pdata->voltage) { | 879 | if (data->info.version >= MXT_VER_21 && pdata->voltage) { |
880 | if (pdata->voltage < QT602240_VOLTAGE_DEFAULT) { | 880 | if (pdata->voltage < MXT_VOLTAGE_DEFAULT) { |
881 | voltage = (QT602240_VOLTAGE_DEFAULT - pdata->voltage) / | 881 | voltage = (MXT_VOLTAGE_DEFAULT - pdata->voltage) / |
882 | QT602240_VOLTAGE_STEP; | 882 | MXT_VOLTAGE_STEP; |
883 | voltage = 0xff - voltage + 1; | 883 | voltage = 0xff - voltage + 1; |
884 | } else | 884 | } else |
885 | voltage = (pdata->voltage - QT602240_VOLTAGE_DEFAULT) / | 885 | voltage = (pdata->voltage - MXT_VOLTAGE_DEFAULT) / |
886 | QT602240_VOLTAGE_STEP; | 886 | MXT_VOLTAGE_STEP; |
887 | 887 | ||
888 | qt602240_write_object(data, QT602240_SPT_CTECONFIG, | 888 | mxt_write_object(data, MXT_SPT_CTECONFIG, |
889 | QT602240_CTE_VOLTAGE, voltage); | 889 | MXT_CTE_VOLTAGE, voltage); |
890 | } | 890 | } |
891 | } | 891 | } |
892 | 892 | ||
893 | static int qt602240_get_info(struct qt602240_data *data) | 893 | static int mxt_get_info(struct mxt_data *data) |
894 | { | 894 | { |
895 | struct i2c_client *client = data->client; | 895 | struct i2c_client *client = data->client; |
896 | struct qt602240_info *info = &data->info; | 896 | struct mxt_info *info = &data->info; |
897 | int error; | 897 | int error; |
898 | u8 val; | 898 | u8 val; |
899 | 899 | ||
900 | error = qt602240_read_reg(client, QT602240_FAMILY_ID, &val); | 900 | error = mxt_read_reg(client, MXT_FAMILY_ID, &val); |
901 | if (error) | 901 | if (error) |
902 | return error; | 902 | return error; |
903 | info->family_id = val; | 903 | info->family_id = val; |
904 | 904 | ||
905 | error = qt602240_read_reg(client, QT602240_VARIANT_ID, &val); | 905 | error = mxt_read_reg(client, MXT_VARIANT_ID, &val); |
906 | if (error) | 906 | if (error) |
907 | return error; | 907 | return error; |
908 | info->variant_id = val; | 908 | info->variant_id = val; |
909 | 909 | ||
910 | error = qt602240_read_reg(client, QT602240_VERSION, &val); | 910 | error = mxt_read_reg(client, MXT_VERSION, &val); |
911 | if (error) | 911 | if (error) |
912 | return error; | 912 | return error; |
913 | info->version = val; | 913 | info->version = val; |
914 | 914 | ||
915 | error = qt602240_read_reg(client, QT602240_BUILD, &val); | 915 | error = mxt_read_reg(client, MXT_BUILD, &val); |
916 | if (error) | 916 | if (error) |
917 | return error; | 917 | return error; |
918 | info->build = val; | 918 | info->build = val; |
919 | 919 | ||
920 | error = qt602240_read_reg(client, QT602240_OBJECT_NUM, &val); | 920 | error = mxt_read_reg(client, MXT_OBJECT_NUM, &val); |
921 | if (error) | 921 | if (error) |
922 | return error; | 922 | return error; |
923 | info->object_num = val; | 923 | info->object_num = val; |
@@ -925,19 +925,19 @@ static int qt602240_get_info(struct qt602240_data *data) | |||
925 | return 0; | 925 | return 0; |
926 | } | 926 | } |
927 | 927 | ||
928 | static int qt602240_get_object_table(struct qt602240_data *data) | 928 | static int mxt_get_object_table(struct mxt_data *data) |
929 | { | 929 | { |
930 | int error; | 930 | int error; |
931 | int i; | 931 | int i; |
932 | u16 reg; | 932 | u16 reg; |
933 | u8 reportid = 0; | 933 | u8 reportid = 0; |
934 | u8 buf[QT602240_OBJECT_SIZE]; | 934 | u8 buf[MXT_OBJECT_SIZE]; |
935 | 935 | ||
936 | for (i = 0; i < data->info.object_num; i++) { | 936 | for (i = 0; i < data->info.object_num; i++) { |
937 | struct qt602240_object *object = data->object_table + i; | 937 | struct mxt_object *object = data->object_table + i; |
938 | 938 | ||
939 | reg = QT602240_OBJECT_START + QT602240_OBJECT_SIZE * i; | 939 | reg = MXT_OBJECT_START + MXT_OBJECT_SIZE * i; |
940 | error = qt602240_read_object_table(data->client, reg, buf); | 940 | error = mxt_read_object_table(data->client, reg, buf); |
941 | if (error) | 941 | if (error) |
942 | return error; | 942 | return error; |
943 | 943 | ||
@@ -957,19 +957,19 @@ static int qt602240_get_object_table(struct qt602240_data *data) | |||
957 | return 0; | 957 | return 0; |
958 | } | 958 | } |
959 | 959 | ||
960 | static int qt602240_initialize(struct qt602240_data *data) | 960 | static int mxt_initialize(struct mxt_data *data) |
961 | { | 961 | { |
962 | struct i2c_client *client = data->client; | 962 | struct i2c_client *client = data->client; |
963 | struct qt602240_info *info = &data->info; | 963 | struct mxt_info *info = &data->info; |
964 | int error; | 964 | int error; |
965 | u8 val; | 965 | u8 val; |
966 | 966 | ||
967 | error = qt602240_get_info(data); | 967 | error = mxt_get_info(data); |
968 | if (error) | 968 | if (error) |
969 | return error; | 969 | return error; |
970 | 970 | ||
971 | data->object_table = kcalloc(info->object_num, | 971 | data->object_table = kcalloc(info->object_num, |
972 | sizeof(struct qt602240_object), | 972 | sizeof(struct mxt_object), |
973 | GFP_KERNEL); | 973 | GFP_KERNEL); |
974 | if (!data->object_table) { | 974 | if (!data->object_table) { |
975 | dev_err(&client->dev, "Failed to allocate memory\n"); | 975 | dev_err(&client->dev, "Failed to allocate memory\n"); |
@@ -977,44 +977,44 @@ static int qt602240_initialize(struct qt602240_data *data) | |||
977 | } | 977 | } |
978 | 978 | ||
979 | /* Get object table information */ | 979 | /* Get object table information */ |
980 | error = qt602240_get_object_table(data); | 980 | error = mxt_get_object_table(data); |
981 | if (error) | 981 | if (error) |
982 | return error; | 982 | return error; |
983 | 983 | ||
984 | /* Check register init values */ | 984 | /* Check register init values */ |
985 | error = qt602240_check_reg_init(data); | 985 | error = mxt_check_reg_init(data); |
986 | if (error) | 986 | if (error) |
987 | return error; | 987 | return error; |
988 | 988 | ||
989 | /* Check X/Y matrix size */ | 989 | /* Check X/Y matrix size */ |
990 | error = qt602240_check_matrix_size(data); | 990 | error = mxt_check_matrix_size(data); |
991 | if (error) | 991 | if (error) |
992 | return error; | 992 | return error; |
993 | 993 | ||
994 | error = qt602240_make_highchg(data); | 994 | error = mxt_make_highchg(data); |
995 | if (error) | 995 | if (error) |
996 | return error; | 996 | return error; |
997 | 997 | ||
998 | qt602240_handle_pdata(data); | 998 | mxt_handle_pdata(data); |
999 | 999 | ||
1000 | /* Backup to memory */ | 1000 | /* Backup to memory */ |
1001 | qt602240_write_object(data, QT602240_GEN_COMMAND, | 1001 | mxt_write_object(data, MXT_GEN_COMMAND, |
1002 | QT602240_COMMAND_BACKUPNV, | 1002 | MXT_COMMAND_BACKUPNV, |
1003 | QT602240_BACKUP_VALUE); | 1003 | MXT_BACKUP_VALUE); |
1004 | msleep(QT602240_BACKUP_TIME); | 1004 | msleep(MXT_BACKUP_TIME); |
1005 | 1005 | ||
1006 | /* Soft reset */ | 1006 | /* Soft reset */ |
1007 | qt602240_write_object(data, QT602240_GEN_COMMAND, | 1007 | mxt_write_object(data, MXT_GEN_COMMAND, |
1008 | QT602240_COMMAND_RESET, 1); | 1008 | MXT_COMMAND_RESET, 1); |
1009 | msleep(QT602240_RESET_TIME); | 1009 | msleep(MXT_RESET_TIME); |
1010 | 1010 | ||
1011 | /* Update matrix size at info struct */ | 1011 | /* Update matrix size at info struct */ |
1012 | error = qt602240_read_reg(client, QT602240_MATRIX_X_SIZE, &val); | 1012 | error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); |
1013 | if (error) | 1013 | if (error) |
1014 | return error; | 1014 | return error; |
1015 | info->matrix_xsize = val; | 1015 | info->matrix_xsize = val; |
1016 | 1016 | ||
1017 | error = qt602240_read_reg(client, QT602240_MATRIX_Y_SIZE, &val); | 1017 | error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val); |
1018 | if (error) | 1018 | if (error) |
1019 | return error; | 1019 | return error; |
1020 | info->matrix_ysize = val; | 1020 | info->matrix_ysize = val; |
@@ -1032,11 +1032,11 @@ static int qt602240_initialize(struct qt602240_data *data) | |||
1032 | return 0; | 1032 | return 0; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | static ssize_t qt602240_object_show(struct device *dev, | 1035 | static ssize_t mxt_object_show(struct device *dev, |
1036 | struct device_attribute *attr, char *buf) | 1036 | struct device_attribute *attr, char *buf) |
1037 | { | 1037 | { |
1038 | struct qt602240_data *data = dev_get_drvdata(dev); | 1038 | struct mxt_data *data = dev_get_drvdata(dev); |
1039 | struct qt602240_object *object; | 1039 | struct mxt_object *object; |
1040 | int count = 0; | 1040 | int count = 0; |
1041 | int i, j; | 1041 | int i, j; |
1042 | int error; | 1042 | int error; |
@@ -1049,13 +1049,13 @@ static ssize_t qt602240_object_show(struct device *dev, | |||
1049 | "Object Table Element %d(Type %d)\n", | 1049 | "Object Table Element %d(Type %d)\n", |
1050 | i + 1, object->type); | 1050 | i + 1, object->type); |
1051 | 1051 | ||
1052 | if (!qt602240_object_readable(object->type)) { | 1052 | if (!mxt_object_readable(object->type)) { |
1053 | count += sprintf(buf + count, "\n"); | 1053 | count += sprintf(buf + count, "\n"); |
1054 | continue; | 1054 | continue; |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | for (j = 0; j < object->size + 1; j++) { | 1057 | for (j = 0; j < object->size + 1; j++) { |
1058 | error = qt602240_read_object(data, | 1058 | error = mxt_read_object(data, |
1059 | object->type, j, &val); | 1059 | object->type, j, &val); |
1060 | if (error) | 1060 | if (error) |
1061 | return error; | 1061 | return error; |
@@ -1070,9 +1070,9 @@ static ssize_t qt602240_object_show(struct device *dev, | |||
1070 | return count; | 1070 | return count; |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | static int qt602240_load_fw(struct device *dev, const char *fn) | 1073 | static int mxt_load_fw(struct device *dev, const char *fn) |
1074 | { | 1074 | { |
1075 | struct qt602240_data *data = dev_get_drvdata(dev); | 1075 | struct mxt_data *data = dev_get_drvdata(dev); |
1076 | struct i2c_client *client = data->client; | 1076 | struct i2c_client *client = data->client; |
1077 | const struct firmware *fw = NULL; | 1077 | const struct firmware *fw = NULL; |
1078 | unsigned int frame_size; | 1078 | unsigned int frame_size; |
@@ -1086,26 +1086,26 @@ static int qt602240_load_fw(struct device *dev, const char *fn) | |||
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /* Change to the bootloader mode */ | 1088 | /* Change to the bootloader mode */ |
1089 | qt602240_write_object(data, QT602240_GEN_COMMAND, | 1089 | mxt_write_object(data, MXT_GEN_COMMAND, |
1090 | QT602240_COMMAND_RESET, QT602240_BOOT_VALUE); | 1090 | MXT_COMMAND_RESET, MXT_BOOT_VALUE); |
1091 | msleep(QT602240_RESET_TIME); | 1091 | msleep(MXT_RESET_TIME); |
1092 | 1092 | ||
1093 | /* Change to slave address of bootloader */ | 1093 | /* Change to slave address of bootloader */ |
1094 | if (client->addr == QT602240_APP_LOW) | 1094 | if (client->addr == MXT_APP_LOW) |
1095 | client->addr = QT602240_BOOT_LOW; | 1095 | client->addr = MXT_BOOT_LOW; |
1096 | else | 1096 | else |
1097 | client->addr = QT602240_BOOT_HIGH; | 1097 | client->addr = MXT_BOOT_HIGH; |
1098 | 1098 | ||
1099 | ret = qt602240_check_bootloader(client, QT602240_WAITING_BOOTLOAD_CMD); | 1099 | ret = mxt_check_bootloader(client, MXT_WAITING_BOOTLOAD_CMD); |
1100 | if (ret) | 1100 | if (ret) |
1101 | goto out; | 1101 | goto out; |
1102 | 1102 | ||
1103 | /* Unlock bootloader */ | 1103 | /* Unlock bootloader */ |
1104 | qt602240_unlock_bootloader(client); | 1104 | mxt_unlock_bootloader(client); |
1105 | 1105 | ||
1106 | while (pos < fw->size) { | 1106 | while (pos < fw->size) { |
1107 | ret = qt602240_check_bootloader(client, | 1107 | ret = mxt_check_bootloader(client, |
1108 | QT602240_WAITING_FRAME_DATA); | 1108 | MXT_WAITING_FRAME_DATA); |
1109 | if (ret) | 1109 | if (ret) |
1110 | goto out; | 1110 | goto out; |
1111 | 1111 | ||
@@ -1117,10 +1117,10 @@ static int qt602240_load_fw(struct device *dev, const char *fn) | |||
1117 | frame_size += 2; | 1117 | frame_size += 2; |
1118 | 1118 | ||
1119 | /* Write one frame to device */ | 1119 | /* Write one frame to device */ |
1120 | qt602240_fw_write(client, fw->data + pos, frame_size); | 1120 | mxt_fw_write(client, fw->data + pos, frame_size); |
1121 | 1121 | ||
1122 | ret = qt602240_check_bootloader(client, | 1122 | ret = mxt_check_bootloader(client, |
1123 | QT602240_FRAME_CRC_PASS); | 1123 | MXT_FRAME_CRC_PASS); |
1124 | if (ret) | 1124 | if (ret) |
1125 | goto out; | 1125 | goto out; |
1126 | 1126 | ||
@@ -1133,19 +1133,19 @@ out: | |||
1133 | release_firmware(fw); | 1133 | release_firmware(fw); |
1134 | 1134 | ||
1135 | /* Change to slave address of application */ | 1135 | /* Change to slave address of application */ |
1136 | if (client->addr == QT602240_BOOT_LOW) | 1136 | if (client->addr == MXT_BOOT_LOW) |
1137 | client->addr = QT602240_APP_LOW; | 1137 | client->addr = MXT_APP_LOW; |
1138 | else | 1138 | else |
1139 | client->addr = QT602240_APP_HIGH; | 1139 | client->addr = MXT_APP_HIGH; |
1140 | 1140 | ||
1141 | return ret; | 1141 | return ret; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | static ssize_t qt602240_update_fw_store(struct device *dev, | 1144 | static ssize_t mxt_update_fw_store(struct device *dev, |
1145 | struct device_attribute *attr, | 1145 | struct device_attribute *attr, |
1146 | const char *buf, size_t count) | 1146 | const char *buf, size_t count) |
1147 | { | 1147 | { |
1148 | struct qt602240_data *data = dev_get_drvdata(dev); | 1148 | struct mxt_data *data = dev_get_drvdata(dev); |
1149 | unsigned int version; | 1149 | unsigned int version; |
1150 | int error; | 1150 | int error; |
1151 | 1151 | ||
@@ -1154,14 +1154,14 @@ static ssize_t qt602240_update_fw_store(struct device *dev, | |||
1154 | return -EINVAL; | 1154 | return -EINVAL; |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | if (data->info.version < QT602240_VER_21 || version < QT602240_VER_21) { | 1157 | if (data->info.version < MXT_VER_21 || version < MXT_VER_21) { |
1158 | dev_err(dev, "FW update supported starting with version 21\n"); | 1158 | dev_err(dev, "FW update supported starting with version 21\n"); |
1159 | return -EINVAL; | 1159 | return -EINVAL; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | disable_irq(data->irq); | 1162 | disable_irq(data->irq); |
1163 | 1163 | ||
1164 | error = qt602240_load_fw(dev, QT602240_FW_NAME); | 1164 | error = mxt_load_fw(dev, MXT_FW_NAME); |
1165 | if (error) { | 1165 | if (error) { |
1166 | dev_err(dev, "The firmware update failed(%d)\n", error); | 1166 | dev_err(dev, "The firmware update failed(%d)\n", error); |
1167 | count = error; | 1167 | count = error; |
@@ -1169,12 +1169,12 @@ static ssize_t qt602240_update_fw_store(struct device *dev, | |||
1169 | dev_dbg(dev, "The firmware update succeeded\n"); | 1169 | dev_dbg(dev, "The firmware update succeeded\n"); |
1170 | 1170 | ||
1171 | /* Wait for reset */ | 1171 | /* Wait for reset */ |
1172 | msleep(QT602240_FWRESET_TIME); | 1172 | msleep(MXT_FWRESET_TIME); |
1173 | 1173 | ||
1174 | kfree(data->object_table); | 1174 | kfree(data->object_table); |
1175 | data->object_table = NULL; | 1175 | data->object_table = NULL; |
1176 | 1176 | ||
1177 | qt602240_initialize(data); | 1177 | mxt_initialize(data); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | enable_irq(data->irq); | 1180 | enable_irq(data->irq); |
@@ -1182,60 +1182,60 @@ static ssize_t qt602240_update_fw_store(struct device *dev, | |||
1182 | return count; | 1182 | return count; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | static DEVICE_ATTR(object, 0444, qt602240_object_show, NULL); | 1185 | static DEVICE_ATTR(object, 0444, mxt_object_show, NULL); |
1186 | static DEVICE_ATTR(update_fw, 0664, NULL, qt602240_update_fw_store); | 1186 | static DEVICE_ATTR(update_fw, 0664, NULL, mxt_update_fw_store); |
1187 | 1187 | ||
1188 | static struct attribute *qt602240_attrs[] = { | 1188 | static struct attribute *mxt_attrs[] = { |
1189 | &dev_attr_object.attr, | 1189 | &dev_attr_object.attr, |
1190 | &dev_attr_update_fw.attr, | 1190 | &dev_attr_update_fw.attr, |
1191 | NULL | 1191 | NULL |
1192 | }; | 1192 | }; |
1193 | 1193 | ||
1194 | static const struct attribute_group qt602240_attr_group = { | 1194 | static const struct attribute_group mxt_attr_group = { |
1195 | .attrs = qt602240_attrs, | 1195 | .attrs = mxt_attrs, |
1196 | }; | 1196 | }; |
1197 | 1197 | ||
1198 | static void qt602240_start(struct qt602240_data *data) | 1198 | static void mxt_start(struct mxt_data *data) |
1199 | { | 1199 | { |
1200 | /* Touch enable */ | 1200 | /* Touch enable */ |
1201 | qt602240_write_object(data, | 1201 | mxt_write_object(data, |
1202 | QT602240_TOUCH_MULTI, QT602240_TOUCH_CTRL, 0x83); | 1202 | MXT_TOUCH_MULTI, MXT_TOUCH_CTRL, 0x83); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | static void qt602240_stop(struct qt602240_data *data) | 1205 | static void mxt_stop(struct mxt_data *data) |
1206 | { | 1206 | { |
1207 | /* Touch disable */ | 1207 | /* Touch disable */ |
1208 | qt602240_write_object(data, | 1208 | mxt_write_object(data, |
1209 | QT602240_TOUCH_MULTI, QT602240_TOUCH_CTRL, 0); | 1209 | MXT_TOUCH_MULTI, MXT_TOUCH_CTRL, 0); |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | static int qt602240_input_open(struct input_dev *dev) | 1212 | static int mxt_input_open(struct input_dev *dev) |
1213 | { | 1213 | { |
1214 | struct qt602240_data *data = input_get_drvdata(dev); | 1214 | struct mxt_data *data = input_get_drvdata(dev); |
1215 | 1215 | ||
1216 | qt602240_start(data); | 1216 | mxt_start(data); |
1217 | 1217 | ||
1218 | return 0; | 1218 | return 0; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | static void qt602240_input_close(struct input_dev *dev) | 1221 | static void mxt_input_close(struct input_dev *dev) |
1222 | { | 1222 | { |
1223 | struct qt602240_data *data = input_get_drvdata(dev); | 1223 | struct mxt_data *data = input_get_drvdata(dev); |
1224 | 1224 | ||
1225 | qt602240_stop(data); | 1225 | mxt_stop(data); |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | static int __devinit qt602240_probe(struct i2c_client *client, | 1228 | static int __devinit mxt_probe(struct i2c_client *client, |
1229 | const struct i2c_device_id *id) | 1229 | const struct i2c_device_id *id) |
1230 | { | 1230 | { |
1231 | struct qt602240_data *data; | 1231 | struct mxt_data *data; |
1232 | struct input_dev *input_dev; | 1232 | struct input_dev *input_dev; |
1233 | int error; | 1233 | int error; |
1234 | 1234 | ||
1235 | if (!client->dev.platform_data) | 1235 | if (!client->dev.platform_data) |
1236 | return -EINVAL; | 1236 | return -EINVAL; |
1237 | 1237 | ||
1238 | data = kzalloc(sizeof(struct qt602240_data), GFP_KERNEL); | 1238 | data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL); |
1239 | input_dev = input_allocate_device(); | 1239 | input_dev = input_allocate_device(); |
1240 | if (!data || !input_dev) { | 1240 | if (!data || !input_dev) { |
1241 | dev_err(&client->dev, "Failed to allocate memory\n"); | 1241 | dev_err(&client->dev, "Failed to allocate memory\n"); |
@@ -1243,11 +1243,11 @@ static int __devinit qt602240_probe(struct i2c_client *client, | |||
1243 | goto err_free_mem; | 1243 | goto err_free_mem; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | input_dev->name = "AT42QT602240/ATMXT224 Touchscreen"; | 1246 | input_dev->name = "Atmel maXTouch Touchscreen"; |
1247 | input_dev->id.bustype = BUS_I2C; | 1247 | input_dev->id.bustype = BUS_I2C; |
1248 | input_dev->dev.parent = &client->dev; | 1248 | input_dev->dev.parent = &client->dev; |
1249 | input_dev->open = qt602240_input_open; | 1249 | input_dev->open = mxt_input_open; |
1250 | input_dev->close = qt602240_input_close; | 1250 | input_dev->close = mxt_input_close; |
1251 | 1251 | ||
1252 | __set_bit(EV_ABS, input_dev->evbit); | 1252 | __set_bit(EV_ABS, input_dev->evbit); |
1253 | __set_bit(EV_KEY, input_dev->evbit); | 1253 | __set_bit(EV_KEY, input_dev->evbit); |
@@ -1255,17 +1255,17 @@ static int __devinit qt602240_probe(struct i2c_client *client, | |||
1255 | 1255 | ||
1256 | /* For single touch */ | 1256 | /* For single touch */ |
1257 | input_set_abs_params(input_dev, ABS_X, | 1257 | input_set_abs_params(input_dev, ABS_X, |
1258 | 0, QT602240_MAX_XC, 0, 0); | 1258 | 0, MXT_MAX_XC, 0, 0); |
1259 | input_set_abs_params(input_dev, ABS_Y, | 1259 | input_set_abs_params(input_dev, ABS_Y, |
1260 | 0, QT602240_MAX_YC, 0, 0); | 1260 | 0, MXT_MAX_YC, 0, 0); |
1261 | 1261 | ||
1262 | /* For multi touch */ | 1262 | /* For multi touch */ |
1263 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | 1263 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, |
1264 | 0, QT602240_MAX_AREA, 0, 0); | 1264 | 0, MXT_MAX_AREA, 0, 0); |
1265 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1265 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
1266 | 0, QT602240_MAX_XC, 0, 0); | 1266 | 0, MXT_MAX_XC, 0, 0); |
1267 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | 1267 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
1268 | 0, QT602240_MAX_YC, 0, 0); | 1268 | 0, MXT_MAX_YC, 0, 0); |
1269 | 1269 | ||
1270 | input_set_drvdata(input_dev, data); | 1270 | input_set_drvdata(input_dev, data); |
1271 | 1271 | ||
@@ -1276,11 +1276,11 @@ static int __devinit qt602240_probe(struct i2c_client *client, | |||
1276 | 1276 | ||
1277 | i2c_set_clientdata(client, data); | 1277 | i2c_set_clientdata(client, data); |
1278 | 1278 | ||
1279 | error = qt602240_initialize(data); | 1279 | error = mxt_initialize(data); |
1280 | if (error) | 1280 | if (error) |
1281 | goto err_free_object; | 1281 | goto err_free_object; |
1282 | 1282 | ||
1283 | error = request_threaded_irq(client->irq, NULL, qt602240_interrupt, | 1283 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, |
1284 | IRQF_TRIGGER_FALLING, client->dev.driver->name, data); | 1284 | IRQF_TRIGGER_FALLING, client->dev.driver->name, data); |
1285 | if (error) { | 1285 | if (error) { |
1286 | dev_err(&client->dev, "Failed to register interrupt\n"); | 1286 | dev_err(&client->dev, "Failed to register interrupt\n"); |
@@ -1291,7 +1291,7 @@ static int __devinit qt602240_probe(struct i2c_client *client, | |||
1291 | if (error) | 1291 | if (error) |
1292 | goto err_free_irq; | 1292 | goto err_free_irq; |
1293 | 1293 | ||
1294 | error = sysfs_create_group(&client->dev.kobj, &qt602240_attr_group); | 1294 | error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); |
1295 | if (error) | 1295 | if (error) |
1296 | goto err_unregister_device; | 1296 | goto err_unregister_device; |
1297 | 1297 | ||
@@ -1310,11 +1310,11 @@ err_free_mem: | |||
1310 | return error; | 1310 | return error; |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static int __devexit qt602240_remove(struct i2c_client *client) | 1313 | static int __devexit mxt_remove(struct i2c_client *client) |
1314 | { | 1314 | { |
1315 | struct qt602240_data *data = i2c_get_clientdata(client); | 1315 | struct mxt_data *data = i2c_get_clientdata(client); |
1316 | 1316 | ||
1317 | sysfs_remove_group(&client->dev.kobj, &qt602240_attr_group); | 1317 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); |
1318 | free_irq(data->irq, data); | 1318 | free_irq(data->irq, data); |
1319 | input_unregister_device(data->input_dev); | 1319 | input_unregister_device(data->input_dev); |
1320 | kfree(data->object_table); | 1320 | kfree(data->object_table); |
@@ -1324,83 +1324,84 @@ static int __devexit qt602240_remove(struct i2c_client *client) | |||
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | #ifdef CONFIG_PM | 1326 | #ifdef CONFIG_PM |
1327 | static int qt602240_suspend(struct device *dev) | 1327 | static int mxt_suspend(struct device *dev) |
1328 | { | 1328 | { |
1329 | struct i2c_client *client = to_i2c_client(dev); | 1329 | struct i2c_client *client = to_i2c_client(dev); |
1330 | struct qt602240_data *data = i2c_get_clientdata(client); | 1330 | struct mxt_data *data = i2c_get_clientdata(client); |
1331 | struct input_dev *input_dev = data->input_dev; | 1331 | struct input_dev *input_dev = data->input_dev; |
1332 | 1332 | ||
1333 | mutex_lock(&input_dev->mutex); | 1333 | mutex_lock(&input_dev->mutex); |
1334 | 1334 | ||
1335 | if (input_dev->users) | 1335 | if (input_dev->users) |
1336 | qt602240_stop(data); | 1336 | mxt_stop(data); |
1337 | 1337 | ||
1338 | mutex_unlock(&input_dev->mutex); | 1338 | mutex_unlock(&input_dev->mutex); |
1339 | 1339 | ||
1340 | return 0; | 1340 | return 0; |
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | static int qt602240_resume(struct device *dev) | 1343 | static int mxt_resume(struct device *dev) |
1344 | { | 1344 | { |
1345 | struct i2c_client *client = to_i2c_client(dev); | 1345 | struct i2c_client *client = to_i2c_client(dev); |
1346 | struct qt602240_data *data = i2c_get_clientdata(client); | 1346 | struct mxt_data *data = i2c_get_clientdata(client); |
1347 | struct input_dev *input_dev = data->input_dev; | 1347 | struct input_dev *input_dev = data->input_dev; |
1348 | 1348 | ||
1349 | /* Soft reset */ | 1349 | /* Soft reset */ |
1350 | qt602240_write_object(data, QT602240_GEN_COMMAND, | 1350 | mxt_write_object(data, MXT_GEN_COMMAND, |
1351 | QT602240_COMMAND_RESET, 1); | 1351 | MXT_COMMAND_RESET, 1); |
1352 | 1352 | ||
1353 | msleep(QT602240_RESET_TIME); | 1353 | msleep(MXT_RESET_TIME); |
1354 | 1354 | ||
1355 | mutex_lock(&input_dev->mutex); | 1355 | mutex_lock(&input_dev->mutex); |
1356 | 1356 | ||
1357 | if (input_dev->users) | 1357 | if (input_dev->users) |
1358 | qt602240_start(data); | 1358 | mxt_start(data); |
1359 | 1359 | ||
1360 | mutex_unlock(&input_dev->mutex); | 1360 | mutex_unlock(&input_dev->mutex); |
1361 | 1361 | ||
1362 | return 0; | 1362 | return 0; |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | static const struct dev_pm_ops qt602240_pm_ops = { | 1365 | static const struct dev_pm_ops mxt_pm_ops = { |
1366 | .suspend = qt602240_suspend, | 1366 | .suspend = mxt_suspend, |
1367 | .resume = qt602240_resume, | 1367 | .resume = mxt_resume, |
1368 | }; | 1368 | }; |
1369 | #endif | 1369 | #endif |
1370 | 1370 | ||
1371 | static const struct i2c_device_id qt602240_id[] = { | 1371 | static const struct i2c_device_id mxt_id[] = { |
1372 | { "qt602240_ts", 0 }, | 1372 | { "qt602240_ts", 0 }, |
1373 | { "atmel_mxt_ts", 0 }, | ||
1373 | { } | 1374 | { } |
1374 | }; | 1375 | }; |
1375 | MODULE_DEVICE_TABLE(i2c, qt602240_id); | 1376 | MODULE_DEVICE_TABLE(i2c, mxt_id); |
1376 | 1377 | ||
1377 | static struct i2c_driver qt602240_driver = { | 1378 | static struct i2c_driver mxt_driver = { |
1378 | .driver = { | 1379 | .driver = { |
1379 | .name = "qt602240_ts", | 1380 | .name = "atmel_mxt_ts", |
1380 | .owner = THIS_MODULE, | 1381 | .owner = THIS_MODULE, |
1381 | #ifdef CONFIG_PM | 1382 | #ifdef CONFIG_PM |
1382 | .pm = &qt602240_pm_ops, | 1383 | .pm = &mxt_pm_ops, |
1383 | #endif | 1384 | #endif |
1384 | }, | 1385 | }, |
1385 | .probe = qt602240_probe, | 1386 | .probe = mxt_probe, |
1386 | .remove = __devexit_p(qt602240_remove), | 1387 | .remove = __devexit_p(mxt_remove), |
1387 | .id_table = qt602240_id, | 1388 | .id_table = mxt_id, |
1388 | }; | 1389 | }; |
1389 | 1390 | ||
1390 | static int __init qt602240_init(void) | 1391 | static int __init mxt_init(void) |
1391 | { | 1392 | { |
1392 | return i2c_add_driver(&qt602240_driver); | 1393 | return i2c_add_driver(&mxt_driver); |
1393 | } | 1394 | } |
1394 | 1395 | ||
1395 | static void __exit qt602240_exit(void) | 1396 | static void __exit mxt_exit(void) |
1396 | { | 1397 | { |
1397 | i2c_del_driver(&qt602240_driver); | 1398 | i2c_del_driver(&mxt_driver); |
1398 | } | 1399 | } |
1399 | 1400 | ||
1400 | module_init(qt602240_init); | 1401 | module_init(mxt_init); |
1401 | module_exit(qt602240_exit); | 1402 | module_exit(mxt_exit); |
1402 | 1403 | ||
1403 | /* Module information */ | 1404 | /* Module information */ |
1404 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); | 1405 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); |
1405 | MODULE_DESCRIPTION("AT42QT602240/ATMXT224 Touchscreen driver"); | 1406 | MODULE_DESCRIPTION("Atmel maXTouch Touchscreen driver"); |
1406 | MODULE_LICENSE("GPL"); | 1407 | MODULE_LICENSE("GPL"); |