Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | /* include/linux/input/max1187x.h |
2 | * | |
3 | * Copyright (c)2012 Maxim Integrated Products, Inc. | |
4 | * | |
5 | * Driver Version: 3.1.4 | |
6 | * Release Date: Mar 27, 2013 | |
7 | * | |
8 | * This software is licensed under the terms of the GNU General Public | |
9 | * License version 2, as published by the Free Software Foundation, and | |
10 | * may be copied, distributed, and modified under those terms. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | */ | |
18 | ||
19 | #ifndef __MAX1187X_H | |
20 | #define __MAX1187X_H | |
21 | ||
22 | #define MAX1187X_NAME "max1187x" | |
23 | #define MAX1187X_TOUCH MAX1187X_NAME "_touchscreen_0" | |
24 | #define MAX1187X_KEY MAX1187X_NAME "_key_0" | |
25 | ||
26 | #define CMD_LEN_PACKET_MAX 9 /* command address space 0x00-0x09 minus header | |
27 | => 9 command words maximum */ | |
28 | #define CMD_LEN_MAX (15 * CMD_LEN_PACKET_MAX) /* maximum 15 packets | |
29 | 9 payload words each */ | |
30 | #define RPT_LEN_PACKET_MAX 245 /* address space 0x00-0xFF minus 0x00-0x09 for | |
31 | commands minus header, maximum 1 report packet*/ | |
32 | #define RPT_LEN_MAX 1000 /* Maximum report size */ | |
33 | ||
34 | #define MAX1187X_NUM_FW_MAPPINGS_MAX 5 | |
35 | #define MAX1187X_TOUCH_COUNT_MAX 10 | |
36 | #define MAX1187X_REPORT_TOUCH_RAW 0x0800 | |
37 | #define MAX1187X_REPORT_TOUCH_BASIC 0x0801 | |
38 | #define MAX1187X_REPORT_TOUCH_EXTENDED 0x0802 | |
39 | #define MAX1187X_REPORT_POWER_MODE 0x0121 | |
40 | /* #define MAX1187X_PROTOCOL_A */ | |
41 | #define MAX1187X_TOUCH_REPORT_MODE 1 /* 1=basic, 2=extended */ | |
42 | #define MAX1187X_REPORT_FAST_CALCULATION | |
43 | #define MAX_REPORT_READERS 5 | |
44 | #define FW_DOWNLOAD_FEATURE | |
45 | /* #define TOUCH_WAKEUP_FEATURE */ | |
46 | #define DEBUG_STRING_LEN_MAX 60 | |
47 | #define MAX_FW_RETRIES 5 | |
48 | ||
49 | /***************************++MTK add++************************************/ | |
50 | #pragma pack(1) | |
51 | typedef struct | |
52 | { | |
53 | u16 pid; //product id // | |
54 | u16 vid; //version id // | |
55 | } st_tpd_info; | |
56 | #pragma pack() | |
57 | ||
58 | #define TPD_KEY_COUNT 4 | |
59 | #define key_1 60,850 //auto define | |
60 | #define key_2 180,850 | |
61 | #define key_3 300,850 | |
62 | #define key_4 420,850 | |
63 | ||
64 | #define TPD_KEYS {KEY_BACK, KEY_HOME, KEY_MENU, KEY_SEARCH} | |
65 | #define TPD_KEYS_DIM {{key_1,50,30},{key_2,50,30},{key_3,50,30},{key_4,50,30}} | |
66 | ||
67 | #define MAX1187X_LOCAL_PDATA | |
68 | #define MAX1187X_PROTOCOL_A | |
69 | ||
70 | #ifdef CONFIG_OF | |
71 | #define CONFIG_OF_TOUCH | |
72 | #endif | |
73 | /***************************--MTK add--************************************/ | |
74 | ||
75 | #define STATUS_ADDR_H 0x00 | |
76 | #define STATUS_ADDR_L 0xFF | |
77 | #define DATA_ADDR_H 0x00 | |
78 | #define DATA_ADDR_L 0xFE | |
79 | #define STATUS_READY_H 0xAB | |
80 | #define STATUS_READY_L 0xCC | |
81 | #define RXTX_COMPLETE_H 0x54 | |
82 | #define RXTX_COMPLETE_L 0x32 | |
83 | ||
84 | ||
85 | #ifndef MAX1187X_REPORT_FAST_CALCULATION | |
86 | #define MAX1187X_PI 205887 /* pi multiplied by 2^16 */ | |
87 | /* tanlist - array containing tan(i)*(2^16-1) for i=[0,45], i in degrees */ | |
88 | u16 tanlist[] = {0, 1144, 2289, 3435, 4583, 5734, | |
89 | 6888, 8047, 9210, 10380, 11556, 12739, | |
90 | 13930, 15130, 16340, 17560, 18792, 20036, | |
91 | 21294, 22566, 23853, 25157, 26478, 27818, | |
92 | 29178, 30559, 31964, 33392, 34846, 36327, | |
93 | 37837, 39377, 40951, 42559, 44204, 45888, | |
94 | 47614, 49384, 51202, 53069, 54990, 56969, | |
95 | 59008, 61112, 63286, 65535}; | |
96 | #endif | |
97 | ||
98 | struct max1187x_touch_report_header { | |
99 | u16 header; | |
100 | u16 report_id; | |
101 | u16 report_size; | |
102 | u16 touch_count:4; | |
103 | u16 reserved0:12; | |
104 | u16 button0:1; | |
105 | u16 button1:1; | |
106 | u16 button2:1; | |
107 | u16 button3:1; | |
108 | u16 reserved1:12; | |
109 | u16 framecounter; | |
110 | }; | |
111 | ||
112 | struct max1187x_touch_report_basic { | |
113 | u16 finger_id:4; | |
114 | u16 reserved0:4; | |
115 | u16 tool_type:4; | |
116 | u16 reserved1:4; | |
117 | u16 x:12; | |
118 | u16 reserved2:4; | |
119 | u16 y:12; | |
120 | u16 reserved3:4; | |
121 | u16 reserved4:8; | |
122 | u16 z:8; | |
123 | }; | |
124 | ||
125 | struct max1187x_touch_report_extended { | |
126 | u16 finger_id:4; | |
127 | u16 reserved0:4; | |
128 | u16 tool_type:4; | |
129 | u16 reserved1:4; | |
130 | u16 x:12; | |
131 | u16 reserved2:4; | |
132 | u16 y:12; | |
133 | u16 reserved3:4; | |
134 | u16 reserved4:8; | |
135 | u16 z:8; | |
136 | s16 xspeed; | |
137 | s16 yspeed; | |
138 | s8 xpixel; | |
139 | s8 ypixel; | |
140 | u16 area; | |
141 | u16 xmin; | |
142 | u16 xmax; | |
143 | u16 ymin; | |
144 | u16 ymax; | |
145 | }; | |
146 | ||
147 | struct max1187x_fw_mapping { | |
148 | u32 config_id; | |
149 | u32 chip_id; | |
150 | char *filename; | |
151 | u32 filesize; | |
152 | u32 filecrc16; | |
153 | u32 file_codesize; | |
154 | }; | |
155 | ||
156 | struct max1187x_pdata { | |
157 | u32 gpio_tirq; | |
158 | u32 num_fw_mappings; | |
159 | struct max1187x_fw_mapping fw_mapping[MAX1187X_NUM_FW_MAPPINGS_MAX]; | |
160 | u32 defaults_allow; | |
161 | u32 default_config_id; | |
162 | u32 default_chip_id; | |
163 | u32 i2c_words; | |
164 | #define MAX1187X_REVERSE_X 0x0001 | |
165 | #define MAX1187X_REVERSE_Y 0x0002 | |
166 | #define MAX1187X_SWAP_XY 0x0004 | |
167 | u32 coordinate_settings; | |
168 | u32 panel_margin_xl; | |
169 | u32 lcd_x; | |
170 | u32 panel_margin_xh; | |
171 | u32 panel_margin_yl; | |
172 | u32 lcd_y; | |
173 | u32 panel_margin_yh; | |
174 | u32 num_sensor_x; | |
175 | u32 num_sensor_y; | |
176 | u32 button_code0; | |
177 | u32 button_code1; | |
178 | u32 button_code2; | |
179 | u32 button_code3; | |
180 | }; | |
181 | ||
182 | #endif /* __MAX1187X_H */ | |
183 |