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
|
/*
* Copyright (C) 2010-2012 Motorola Mobility, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA
*/
/* Local header for Atmel maXTouch touchscreens that uses tdat files */
#ifndef _LINUX_ATMXT_H
#define _LINUX_ATMXT_H
#include <linux/types.h>
#include <linux/input/touch_platform.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/mutex.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#define ATMXT_DRIVER_VERSION "YN-04-01"
#define ATMXT_DRIVER_DATE "2012-06-28"
#ifdef CONFIG_TOUCHSCREEN_DEBUG
#define atmxt_dbg(dd, level, format, args...) \
{\
if ((dd->dbg->dbg_lvl) >= level) \
printk(KERN_INFO format, ## args); \
}
#else
#define atmxt_dbg(dd, level, format, args...) {}
#endif
#define ATMXT_DBG0 0
#define ATMXT_DBG1 1
#define ATMXT_DBG2 2
#define ATMXT_DBG3 3
#define ATMXT_IRQ_ENABLED_FLAG 0
#define ATMXT_WAITING_FOR_TDAT 1
#define ATMXT_CHECKSUM_FAILED 2
#define ATMXT_IGNORE_CHECKSUM 3
#define ATMXT_REPORT_TOUCHES 4
#define ATMXT_FIXING_CALIBRATION 5
#define ATMXT_RECEIVED_CALIBRATION 6
#define ATMXT_RESTART_REQUIRED 7
#define ATMXT_SET_MESSAGE_POINTER 8
#define ATMXT_I2C_ATTEMPTS 10
#define ATMXT_I2C_WAIT_TIME 50
#define ATMXT_MAX_TOUCHES 10
#define ATMXT_ABS_RESERVED 0xFFFF
#define ATMXT_IC_RESET_HOLD_TIME 1000
enum atmxt_driver_state {
ATMXT_DRV_ACTIVE,
ATMXT_DRV_IDLE,
ATMXT_DRV_REFLASH,
ATMXT_DRV_INIT,
};
static const char * const atmxt_driver_state_string[] = {
"ACTIVE",
"IDLE",
"REFLASH",
"INIT",
};
enum atmxt_ic_state {
ATMXT_IC_ACTIVE,
ATMXT_IC_SLEEP,
ATMXT_IC_UNKNOWN,
ATMXT_IC_BOOTLOADER,
ATMXT_IC_PRESENT,
};
static const char * const atmxt_ic_state_string[] = {
"ACTIVE",
"SLEEP",
"UNKNOWN",
"BOOTLOADER",
"PRESENT",
};
struct atmxt_util_data {
uint8_t *data;
size_t size;
uint8_t *tsett;
uint32_t tsett_size;
uint8_t *fw;
uint32_t fw_size;
uint8_t addr[2];
} __packed;
struct atmxt_nvm {
uint8_t *data;
uint16_t size;
uint8_t addr[2];
uint8_t chksum[3];
} __packed;
struct atmxt_info_block {
uint8_t header[7];
uint8_t *data;
uint8_t size;
uint8_t *msg_id;
uint8_t id_size;
} __packed;
struct atmxt_addr {
uint8_t msg[2];
uint8_t pwr[2];
uint8_t rst[2];
uint8_t nvm[2];
uint8_t cal[2];
uint8_t acq[2];
} __packed;
struct atmxt_data {
uint8_t pwr[2];
uint8_t max_msg_size;
uint8_t touch_id_offset;
bool res[2];
uint8_t acq[6];
unsigned long timer;
uint8_t last_stat;
} __packed;
struct atmxt_touch_data {
bool active;
uint16_t x;
uint16_t y;
uint8_t p;
uint8_t w;
uint8_t id;
} __packed;
struct atmxt_report_data {
uint16_t axis[5];
uint8_t active_touches;
struct atmxt_touch_data tchdat[ATMXT_MAX_TOUCHES];
} __packed;
struct atmxt_debug {
uint8_t dbg_lvl;
uint8_t grp_num;
uint8_t grp_off;
} __packed;
struct atmxt_driver_data {
struct touch_platform_data *pdata;
struct atmxt_util_data *util;
struct i2c_client *client;
struct mutex *mutex;
struct input_dev *in_dev;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend es;
#endif
enum atmxt_driver_state drv_stat;
enum atmxt_ic_state ic_stat;
struct atmxt_info_block *info_blk;
struct atmxt_nvm *nvm;
struct atmxt_addr *addr;
struct atmxt_data *data;
struct atmxt_report_data *rdat;
struct atmxt_debug *dbg;
uint16_t status;
uint16_t settings;
} __packed;
#endif /* _LINUX_ATMXT_H */
|