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
|
/*
* mms_ts.h - Platform data for Melfas MMS-series touch driver
*
* Copyright (C) 2013 Melfas Inc.
* Author: DVK team <dvk@melfas.com>
*
*
* 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.
*
*/
#ifndef _LINUX_MMS_TOUCH_H
#define _LINUX_MMS_TOUCH_H
#include <linux/cdev.h>
/* Change IIC Slave Address */
#define FW_DL_To_Change_IIC_Address 0//demo address:0x48,some project change for other; anderson
/* Firmware file name */
#define FW_NAME "mms_ts.fw"
#define FW_CONFIG_NAME "mms_ts_cfg.fw"
/* mfsp offset */
#define MMS_MFSP_OFFSET 16
/* Runtime config */
#define MMS_RUN_CONF_POINTER 0xA1
#define MMS_GET_RUN_CONF 0xA2
#define MMS_SET_RUN_CONF 0xA3
#define MMS_READ_BYTE 8//the size of one point info,8 or 6,anderson
/* Registers */
#define MMS_MODE_CONTROL 0x01
#define MMS_TX_NUM 0x0B
#define MMS_RX_NUM 0x0C
#define MMS_EVENT_PKT_SZ 0x0F
#define MMS_INPUT_EVENT 0x10
#define MMS_UNIVERSAL_CMD 0xA0
#define MMS_UNIVERSAL_RESULT_LENGTH 0xAE
#define MMS_UNIVERSAL_RESULT 0xAF
#define MMS_UNIV_SET_SPEC 0x30
#define MMS_UNIV_ENTER_TEST 0x40
#define MMS_UNIV_TEST_CM 0x41
#define MMS_UNIV_GET_CM 0x42
#define MMS_UNIV_EXIT_TEST 0x4F
#define MMS_UNIV_INTENSITY 0x70
#define MMS_CMD_ENTER_ISC 0x5F
#define MMS_FW_VERSION 0xE1
#define MMS_ERASE_DEFEND 0xB0
/* Universal commands */
#define MMS_CMD_SET_LOG_MODE 0x20
#define MMS_CMD_CONTROL 0x22
#define MMS_SUBCMD_START 0x80
/* Firmware Start Control */
#define RUN_START 0
#define RUN_STOP 1
#define MAX_SECTION_NUM 3
#define ISC_XFER_LEN 128
#define MMS_FLASH_PAGE_SZ 1024
#define ISC_BLOCK_NUM (MMS_FLASH_PAGE_SZ / ISC_XFER_LEN)
// runtime config
#define MMS_RUNTIME
enum {
MMS_RUN_TYPE_SINGLE = 1,
MMS_RUN_TYPE_ARRAY,
MMS_RUN_TYPE_END,
MMS_RUN_TYPE_INFO,
MMS_RUN_TYPE_UNKNOWN,
};
enum {
ISC_ADDR = 0xD5,
ISC_CMD_READ_STATUS = 0xD9,
ISC_CMD_READ = 0x4000,
ISC_CMD_EXIT = 0x8200,
ISC_CMD_PAGE_ERASE = 0xC000,
ISC_PAGE_ERASE_DONE = 0x10000,
ISC_PAGE_ERASE_ENTER = 0x20000,
};
struct mms_ts_platform_data {
int max_x;
int max_y;
int gpio_sda;
int gpio_scl;
int gpio_resetb;
int gpio_vdd_en;
};
struct mms_config_item {
u16 type;
u16 category;
u16 offset;
u16 datasize;
u16 data_blocksize;
u16 reserved;
u32 value;
} __attribute__ ((packed));
struct mms_config_hdr {
char mark[4];
char tag[4];
u32 core_version;
u32 config_version;
u32 data_offset;
u32 data_count;
u32 reserved0;
u32 info_offset;
u32 reserved2;
u32 reserved3;
u32 reserved4;
u32 reserved5;
} __attribute__ ((packed));
struct mms_ts_info {
struct i2c_client *client;
struct input_dev *input_dev;
char phys[32];
u8 tx_num;
u8 rx_num;
int data_cmd;
int irq;
struct mms_ts_platform_data *pdata;
char *fw_name;
struct completion init_done;
struct early_suspend early_suspend;
struct mutex lock;
bool enabled;
struct cdev cdev;
dev_t mms_dev;
struct class *class;
u8 ver[3];
int run_count;
struct mms_log_data {
u8 *data;
int cmd;
} log;
char *cm_intensity;
};
struct mms_bin_hdr {
char tag[8];
u16 core_version;
u16 section_num;
u16 contains_full_binary;
u16 reserved0;
u32 binary_offset;
u32 binary_length;
u32 extention_offset;
u32 reserved1;
} __attribute__ ((packed));
struct mms_fw_img {
u16 type;
u16 version;
u16 start_page;
u16 end_page;
u32 offset;
u32 length;
} __attribute__ ((packed));
struct isc_packet {
u8 cmd;
u32 addr;
u8 data[0];
} __attribute__ ((packed));
extern int mms_config_start(struct mms_ts_info *info);
void mms_fw_update_controller(const struct firmware *fw, void * context);
#endif /* _LINUX_MMS_TOUCH_H */
|