diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/media/video/tegra/avp/avp_msg.h | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'drivers/media/video/tegra/avp/avp_msg.h')
-rw-r--r-- | drivers/media/video/tegra/avp/avp_msg.h | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/avp/avp_msg.h b/drivers/media/video/tegra/avp/avp_msg.h new file mode 100644 index 00000000000..615d890d544 --- /dev/null +++ b/drivers/media/video/tegra/avp/avp_msg.h | |||
@@ -0,0 +1,358 @@ | |||
1 | /* drivers/media/video/tegra/avp/avp_msg.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * Author: Dima Zavin <dima@android.com> | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef __MEDIA_VIDEO_TEGRA_AVP_MSG_H | ||
18 | #define __MEDIA_VIDEO_TEGRA_AVP_MSG_H | ||
19 | |||
20 | #include <linux/tegra_avp.h> | ||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* Note: the port name string is not NUL terminated, so make sure to | ||
24 | * allocate appropriate space locally when operating on the string */ | ||
25 | #define XPC_PORT_NAME_LEN 16 | ||
26 | |||
27 | #define SVC_ARGS_MAX_LEN 220 | ||
28 | #define SVC_MAX_STRING_LEN 200 | ||
29 | |||
30 | #define AVP_ERR_ENOTSUP 0x2 | ||
31 | #define AVP_ERR_EINVAL 0x4 | ||
32 | #define AVP_ERR_ENOMEM 0x6 | ||
33 | #define AVP_ERR_EACCES 0x00030010 | ||
34 | |||
35 | enum { | ||
36 | SVC_NVMAP_CREATE = 0, | ||
37 | SVC_NVMAP_CREATE_RESPONSE = 1, | ||
38 | SVC_NVMAP_FREE = 3, | ||
39 | SVC_NVMAP_ALLOC = 4, | ||
40 | SVC_NVMAP_ALLOC_RESPONSE = 5, | ||
41 | SVC_NVMAP_PIN = 6, | ||
42 | SVC_NVMAP_PIN_RESPONSE = 7, | ||
43 | SVC_NVMAP_UNPIN = 8, | ||
44 | SVC_NVMAP_UNPIN_RESPONSE = 9, | ||
45 | SVC_NVMAP_GET_ADDRESS = 10, | ||
46 | SVC_NVMAP_GET_ADDRESS_RESPONSE = 11, | ||
47 | SVC_NVMAP_FROM_ID = 12, | ||
48 | SVC_NVMAP_FROM_ID_RESPONSE = 13, | ||
49 | SVC_MODULE_CLOCK = 14, | ||
50 | SVC_MODULE_CLOCK_RESPONSE = 15, | ||
51 | SVC_MODULE_RESET = 16, | ||
52 | SVC_MODULE_RESET_RESPONSE = 17, | ||
53 | SVC_POWER_REGISTER = 18, | ||
54 | SVC_POWER_UNREGISTER = 19, | ||
55 | SVC_POWER_STARVATION = 20, | ||
56 | SVC_POWER_BUSY_HINT = 21, | ||
57 | SVC_POWER_BUSY_HINT_MULTI = 22, | ||
58 | SVC_DFS_GETSTATE = 23, | ||
59 | SVC_DFS_GETSTATE_RESPONSE = 24, | ||
60 | SVC_POWER_RESPONSE = 25, | ||
61 | SVC_POWER_MAXFREQ = 26, | ||
62 | SVC_ENTER_LP0 = 27, | ||
63 | SVC_ENTER_LP0_RESPONSE = 28, | ||
64 | SVC_PRINTF = 29, | ||
65 | SVC_LIBRARY_ATTACH = 30, | ||
66 | SVC_LIBRARY_ATTACH_RESPONSE = 31, | ||
67 | SVC_LIBRARY_DETACH = 32, | ||
68 | SVC_LIBRARY_DETACH_RESPONSE = 33, | ||
69 | SVC_AVP_WDT_RESET = 34, | ||
70 | SVC_DFS_GET_CLK_UTIL = 35, | ||
71 | SVC_DFS_GET_CLK_UTIL_RESPONSE = 36, | ||
72 | SVC_MODULE_CLOCK_SET = 37, | ||
73 | SVC_MODULE_CLOCK_SET_RESPONSE = 38, | ||
74 | SVC_MODULE_CLOCK_GET = 39, | ||
75 | SVC_MODULE_CLOCK_GET_RESPONSE = 40, | ||
76 | }; | ||
77 | |||
78 | struct svc_msg { | ||
79 | u32 svc_id; | ||
80 | u8 data[0]; | ||
81 | }; | ||
82 | |||
83 | struct svc_common_resp { | ||
84 | u32 svc_id; | ||
85 | u32 err; | ||
86 | }; | ||
87 | |||
88 | struct svc_printf { | ||
89 | u32 svc_id; | ||
90 | const char str[SVC_MAX_STRING_LEN]; | ||
91 | }; | ||
92 | |||
93 | struct svc_enter_lp0 { | ||
94 | u32 svc_id; | ||
95 | u32 src_addr; | ||
96 | u32 buf_addr; | ||
97 | u32 buf_size; | ||
98 | }; | ||
99 | |||
100 | /* nvmap messages */ | ||
101 | struct svc_nvmap_create { | ||
102 | u32 svc_id; | ||
103 | u32 size; | ||
104 | }; | ||
105 | |||
106 | struct svc_nvmap_create_resp { | ||
107 | u32 svc_id; | ||
108 | u32 handle_id; | ||
109 | u32 err; | ||
110 | }; | ||
111 | |||
112 | enum { | ||
113 | AVP_NVMAP_HEAP_EXTERNAL = 1, | ||
114 | AVP_NVMAP_HEAP_GART = 2, | ||
115 | AVP_NVMAP_HEAP_EXTERNAL_CARVEOUT = 3, | ||
116 | AVP_NVMAP_HEAP_IRAM = 4, | ||
117 | }; | ||
118 | |||
119 | struct svc_nvmap_alloc { | ||
120 | u32 svc_id; | ||
121 | u32 handle_id; | ||
122 | u32 heaps[4]; | ||
123 | u32 num_heaps; | ||
124 | u32 align; | ||
125 | u32 mapping_type; | ||
126 | }; | ||
127 | |||
128 | struct svc_nvmap_free { | ||
129 | u32 svc_id; | ||
130 | u32 handle_id; | ||
131 | }; | ||
132 | |||
133 | struct svc_nvmap_pin { | ||
134 | u32 svc_id; | ||
135 | u32 handle_id; | ||
136 | }; | ||
137 | |||
138 | struct svc_nvmap_pin_resp { | ||
139 | u32 svc_id; | ||
140 | u32 addr; | ||
141 | }; | ||
142 | |||
143 | struct svc_nvmap_unpin { | ||
144 | u32 svc_id; | ||
145 | u32 handle_id; | ||
146 | }; | ||
147 | |||
148 | struct svc_nvmap_from_id { | ||
149 | u32 svc_id; | ||
150 | u32 handle_id; | ||
151 | }; | ||
152 | |||
153 | struct svc_nvmap_get_addr { | ||
154 | u32 svc_id; | ||
155 | u32 handle_id; | ||
156 | u32 offs; | ||
157 | }; | ||
158 | |||
159 | struct svc_nvmap_get_addr_resp { | ||
160 | u32 svc_id; | ||
161 | u32 addr; | ||
162 | }; | ||
163 | |||
164 | /* library management messages */ | ||
165 | enum { | ||
166 | AVP_LIB_REASON_ATTACH = 0, | ||
167 | AVP_LIB_REASON_DETACH = 1, | ||
168 | AVP_LIB_REASON_ATTACH_GREEDY = 2, | ||
169 | }; | ||
170 | |||
171 | struct svc_lib_attach { | ||
172 | u32 svc_id; | ||
173 | u32 address; | ||
174 | u32 args_len; | ||
175 | u32 lib_size; | ||
176 | u8 args[SVC_ARGS_MAX_LEN]; | ||
177 | u32 reason; | ||
178 | }; | ||
179 | |||
180 | struct svc_lib_attach_resp { | ||
181 | u32 svc_id; | ||
182 | u32 err; | ||
183 | u32 lib_id; | ||
184 | }; | ||
185 | |||
186 | struct svc_lib_detach { | ||
187 | u32 svc_id; | ||
188 | u32 reason; | ||
189 | u32 lib_id; | ||
190 | }; | ||
191 | |||
192 | struct svc_lib_detach_resp { | ||
193 | u32 svc_id; | ||
194 | u32 err; | ||
195 | }; | ||
196 | |||
197 | /* hw module management from the AVP side */ | ||
198 | enum { | ||
199 | AVP_MODULE_ID_AVP = 2, | ||
200 | AVP_MODULE_ID_VCP = 3, | ||
201 | AVP_MODULE_ID_BSEA = 27, | ||
202 | AVP_MODULE_ID_VDE = 28, | ||
203 | AVP_MODULE_ID_MPE = 29, | ||
204 | }; | ||
205 | |||
206 | struct svc_module_ctrl { | ||
207 | u32 svc_id; | ||
208 | u32 module_id; | ||
209 | u32 client_id; | ||
210 | u8 enable; | ||
211 | }; | ||
212 | |||
213 | struct svc_clock_ctrl { | ||
214 | u32 svc_id; | ||
215 | u32 module_id; | ||
216 | u32 clk_freq; | ||
217 | }; | ||
218 | |||
219 | struct svc_clock_ctrl_response { | ||
220 | u32 svc_id; | ||
221 | u32 err; | ||
222 | u32 act_freq; | ||
223 | }; | ||
224 | |||
225 | /* power messages */ | ||
226 | struct svc_pwr_register { | ||
227 | u32 svc_id; | ||
228 | u32 client_id; | ||
229 | u32 unused; | ||
230 | }; | ||
231 | |||
232 | struct svc_pwr_register_resp { | ||
233 | u32 svc_id; | ||
234 | u32 err; | ||
235 | u32 client_id; | ||
236 | }; | ||
237 | |||
238 | struct svc_pwr_starve_hint { | ||
239 | u32 svc_id; | ||
240 | u32 dfs_clk_id; | ||
241 | u32 client_id; | ||
242 | u8 starving; | ||
243 | }; | ||
244 | |||
245 | struct svc_pwr_busy_hint { | ||
246 | u32 svc_id; | ||
247 | u32 dfs_clk_id; | ||
248 | u32 client_id; | ||
249 | u32 boost_ms; /* duration */ | ||
250 | u32 boost_freq; /* in khz */ | ||
251 | }; | ||
252 | |||
253 | struct svc_pwr_max_freq { | ||
254 | u32 svc_id; | ||
255 | u32 module_id; | ||
256 | }; | ||
257 | |||
258 | struct svc_pwr_max_freq_resp { | ||
259 | u32 svc_id; | ||
260 | u32 freq; | ||
261 | }; | ||
262 | |||
263 | /* dfs related messages */ | ||
264 | enum { | ||
265 | AVP_DFS_STATE_INVALID = 0, | ||
266 | AVP_DFS_STATE_DISABLED = 1, | ||
267 | AVP_DFS_STATE_STOPPED = 2, | ||
268 | AVP_DFS_STATE_CLOSED_LOOP = 3, | ||
269 | AVP_DFS_STATE_PROFILED_LOOP = 4, | ||
270 | }; | ||
271 | |||
272 | struct svc_dfs_get_state_resp { | ||
273 | u32 svc_id; | ||
274 | u32 state; | ||
275 | }; | ||
276 | |||
277 | enum { | ||
278 | AVP_DFS_CLK_CPU = 1, | ||
279 | AVP_DFS_CLK_AVP = 2, | ||
280 | AVP_DFS_CLK_SYSTEM = 3, | ||
281 | AVP_DFS_CLK_AHB = 4, | ||
282 | AVP_DFS_CLK_APB = 5, | ||
283 | AVP_DFS_CLK_VDE = 6, | ||
284 | /* external memory controller */ | ||
285 | AVP_DFS_CLK_EMC = 7, | ||
286 | }; | ||
287 | |||
288 | struct avp_clk_usage { | ||
289 | u32 min; | ||
290 | u32 max; | ||
291 | u32 curr_min; | ||
292 | u32 curr_max; | ||
293 | u32 curr; | ||
294 | u32 avg; /* average activity.. whatever that means */ | ||
295 | }; | ||
296 | |||
297 | struct svc_dfs_get_clk_util { | ||
298 | u32 svc_id; | ||
299 | u32 dfs_clk_id; | ||
300 | }; | ||
301 | |||
302 | /* all units are in kHz */ | ||
303 | struct svc_dfs_get_clk_util_resp { | ||
304 | u32 svc_id; | ||
305 | u32 err; | ||
306 | struct avp_clk_usage usage; | ||
307 | }; | ||
308 | |||
309 | /************************/ | ||
310 | |||
311 | enum { | ||
312 | CMD_ACK = 0, | ||
313 | CMD_CONNECT = 2, | ||
314 | CMD_DISCONNECT = 3, | ||
315 | CMD_MESSAGE = 4, | ||
316 | CMD_RESPONSE = 5, | ||
317 | }; | ||
318 | |||
319 | struct msg_data { | ||
320 | u32 cmd; | ||
321 | u8 data[0]; | ||
322 | }; | ||
323 | |||
324 | struct msg_ack { | ||
325 | u32 cmd; | ||
326 | u32 arg; | ||
327 | }; | ||
328 | |||
329 | struct msg_connect { | ||
330 | u32 cmd; | ||
331 | u32 port_id; | ||
332 | /* not NUL terminated, just 0 padded */ | ||
333 | char name[XPC_PORT_NAME_LEN]; | ||
334 | }; | ||
335 | |||
336 | struct msg_connect_reply { | ||
337 | u32 cmd; | ||
338 | u32 port_id; | ||
339 | }; | ||
340 | |||
341 | struct msg_disconnect { | ||
342 | u32 cmd; | ||
343 | u32 port_id; | ||
344 | }; | ||
345 | |||
346 | struct msg_disconnect_reply { | ||
347 | u32 cmd; | ||
348 | u32 ack; | ||
349 | }; | ||
350 | |||
351 | struct msg_port_data { | ||
352 | u32 cmd; | ||
353 | u32 port_id; | ||
354 | u32 msg_len; | ||
355 | u8 data[0]; | ||
356 | }; | ||
357 | |||
358 | #endif | ||