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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
/*
* arch/arm/mach-tegra/board-touch-atmel_maxtouch.c
*
* Copyright (c) 2011, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT)
#include <linux/i2c/atmel_mxt_ts.h>
#endif
#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9)
#include <linux/i2c/atmel_maxtouch.h>
#endif
#if defined(CONFIG_MACH_CARDHU)
#include "board-cardhu.h"
#define MXT_I2C_ADDRESS MXT1386_I2C_ADDR3
#endif
#if defined(CONFIG_MACH_TEGRA_ENTERPRISE)
#include "board-enterprise.h"
#define MXT_I2C_ADDRESS MXT224_I2C_ADDR1
#endif
#if defined(CONFIG_MACH_VENTANA)
#include "board-ventana.h"
#define MXT_I2C_ADDRESS MXT1386_I2C_ADDR3
#endif
#include "gpio-names.h"
#include "touch.h"
#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT)
/* Atmel MaxTouch touchscreen Driver data */
/*-----------------------------------------------------*/
/*
* Config converted from memory-mapped cfg-file with
* following version information:
*
*
*
* FAMILY_ID=160
* VARIANT=0
* VERSION=16
* BUILD=170
* VENDOR_ID=255
* PRODUCT_ID=TBD
* CHECKSUM=0x144A89
*
*
*/
#if defined(CONFIG_MACH_VENTANA) || defined(CONFIG_MACH_CARDHU)
#define MXT_CONFIG_CRC 0xD62DE8
static const u8 config[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00,
0x1B, 0x2A, 0x00, 0x20, 0x3C, 0x04, 0x05, 0x00,
0x02, 0x01, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF,
0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x64, 0x02, 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, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00,
0x00, 0x04, 0xFF, 0x03, 0x3F, 0x64, 0x64, 0x01,
0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64,
0x00, 0x19, 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, 0x08, 0x10, 0x3C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static struct mxt_platform_data atmel_mxt_info = {
.x_line = 27,
.y_line = 42,
.x_size = 768,
.y_size = 1366,
.blen = 0x20,
.threshold = 0x3C,
.voltage = 3300000, /* 3.3V */
.orient = 5,
.config = config,
.config_length = 157,
.config_crc = MXT_CONFIG_CRC,
.irqflags = IRQF_TRIGGER_FALLING,
/* .read_chg = &read_chg, */
.read_chg = NULL,
};
#endif /* CONFIG_MACH_VENTANA, CONFIG_MACH_CARDHU */
#if defined(CONFIG_MACH_TEGRA_ENTERPRISE)
#define MXT_CONFIG_CRC 0x62F903
/*
* Config converted from memory-mapped cfg-file with
* following version information:
*
*
*
* FAMILY_ID=128
* VARIANT=1
* VERSION=32
* BUILD=170
* VENDOR_ID=255
* PRODUCT_ID=TBD
* CHECKSUM=0xC189B6
*
*
*/
static const u8 config[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00,
0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B,
0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01,
0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B,
0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00,
0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A,
0x0F, 0x14, 0x19, 0x03, 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, 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, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10,
0x00
};
static struct mxt_platform_data atmel_mxt_info = {
.x_line = 19,
.y_line = 11,
.x_size = 960,
.y_size = 540,
.blen = 0x10,
.threshold = 0x32,
.voltage = 3300000, /* 3.3V */
.orient = 3,
.config = config,
.config_length = 168,
.config_crc = MXT_CONFIG_CRC,
.irqflags = IRQF_TRIGGER_FALLING,
/* .read_chg = &read_chg, */
.read_chg = NULL,
};
#endif /* CONFIG_MACH_TEGRA_ENTERPRISE */
/* Reads the CHANGELINE state; interrupt is valid if the changeline
* is low.
*
static u8 read_chg(void)
{
return gpio_get_value(TOUCH_GPIO_IRQ_ATMEL_T9);
}
*/
static struct i2c_board_info __initdata atmxt_i2c_info[] = {
{
I2C_BOARD_INFO("atmel_mxt_ts", MXT_I2C_ADDRESS),
.irq = TEGRA_GPIO_TO_IRQ(TOUCH_GPIO_IRQ_ATMEL_T9),
.platform_data = &atmel_mxt_info,
},
};
#endif
#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9)
/* Atmel MaxTouch touchscreen Driver data */
/*-----------------------------------------------------*/
/*
* Reads the CHANGELINE state; interrupt is valid if the changeline
* is low.
*/
static u8 read_chg(void)
{
return gpio_get_value(TOUCH_GPIO_IRQ_ATMEL_T9);
}
static u8 valid_interrupt(void)
{
return !read_chg();
}
static struct mxt_platform_data atmel_mxt_info = {
/* Maximum number of simultaneous touches to report. */
.numtouch = 10,
/* TODO: no need for any hw-specific things at init/exit? */
.init_platform_hw = NULL,
.exit_platform_hw = NULL,
#if defined(CONFIG_MACH_TEGRA_ENTERPRISE)
.max_x = 540,
.max_y = 960,
#else
.max_x = 1366,
.max_y = 768,
#endif
.valid_interrupt = &valid_interrupt,
.read_chg = &read_chg,
};
static struct i2c_board_info __initdata atmxt_i2c_info[] = {
{
I2C_BOARD_INFO("maXTouch", MXT_I2C_ADDRESS),
.irq = TEGRA_GPIO_TO_IRQ(TOUCH_GPIO_IRQ_ATMEL_T9),
.platform_data = &atmel_mxt_info,
},
};
#endif
struct tegra_touchscreen_init __initdata atmel_mxt_init_data = {
.irq_gpio = TOUCH_GPIO_IRQ_ATMEL_T9, /* GPIO1 Value for IRQ */
.rst_gpio = TOUCH_GPIO_RST_ATMEL_T9, /* GPIO2 Value for RST */
.sv_gpio2 = {1, TOUCH_GPIO_RST_ATMEL_T9, 1, 100}, /* Valid, GPIOx, Set value, Delay */
.ts_boardinfo = {TOUCH_BUS_ATMEL_T9, atmxt_i2c_info, 1} /* BusNum, BoardInfo, Value */
};
|