blob: a43d1dcdac6d08c86777c511e325867f4bcfd17e [file] [log] [blame]
Hemant Kumar0ef9fbb2016-01-28 11:41:42 -08001/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/qmi_encdec.h>
14
15#include <soc/qcom/msm_qmi_interface.h>
16
17#include "usb_audio_qmi_v01.h"
18
19static struct elem_info mem_info_v01_ei[] = {
20 {
21 .data_type = QMI_UNSIGNED_8_BYTE,
22 .elem_len = 1,
23 .elem_size = sizeof(uint64_t),
24 .is_array = NO_ARRAY,
25 .tlv_type = 0,
26 .offset = offsetof(struct mem_info_v01,
27 va),
28 },
29 {
30 .data_type = QMI_UNSIGNED_8_BYTE,
31 .elem_len = 1,
32 .elem_size = sizeof(uint64_t),
33 .is_array = NO_ARRAY,
34 .tlv_type = 0,
35 .offset = offsetof(struct mem_info_v01,
36 pa),
37 },
38 {
39 .data_type = QMI_UNSIGNED_4_BYTE,
40 .elem_len = 1,
41 .elem_size = sizeof(uint32_t),
42 .is_array = NO_ARRAY,
43 .tlv_type = 0,
44 .offset = offsetof(struct mem_info_v01,
45 size),
46 },
47 {
48 .data_type = QMI_EOTI,
49 .is_array = NO_ARRAY,
50 .is_array = QMI_COMMON_TLV_TYPE,
51 },
52};
53
54static struct elem_info apps_mem_info_v01_ei[] = {
55 {
56 .data_type = QMI_STRUCT,
57 .elem_len = 1,
58 .elem_size = sizeof(struct mem_info_v01),
59 .is_array = NO_ARRAY,
60 .tlv_type = 0,
61 .offset = offsetof(struct apps_mem_info_v01,
62 evt_ring),
63 .ei_array = mem_info_v01_ei,
64 },
65 {
66 .data_type = QMI_STRUCT,
67 .elem_len = 1,
68 .elem_size = sizeof(struct mem_info_v01),
69 .is_array = NO_ARRAY,
70 .tlv_type = 0,
71 .offset = offsetof(struct apps_mem_info_v01,
72 tr_data),
73 .ei_array = mem_info_v01_ei,
74 },
75 {
76 .data_type = QMI_STRUCT,
77 .elem_len = 1,
78 .elem_size = sizeof(struct mem_info_v01),
79 .is_array = NO_ARRAY,
80 .tlv_type = 0,
81 .offset = offsetof(struct apps_mem_info_v01,
82 tr_sync),
83 .ei_array = mem_info_v01_ei,
84 },
85 {
86 .data_type = QMI_STRUCT,
87 .elem_len = 1,
88 .elem_size = sizeof(struct mem_info_v01),
89 .is_array = NO_ARRAY,
90 .tlv_type = 0,
91 .offset = offsetof(struct apps_mem_info_v01,
92 xfer_buff),
93 .ei_array = mem_info_v01_ei,
94 },
95 {
96 .data_type = QMI_STRUCT,
97 .elem_len = 1,
98 .elem_size = sizeof(struct mem_info_v01),
99 .is_array = NO_ARRAY,
100 .tlv_type = 0,
101 .offset = offsetof(struct apps_mem_info_v01,
102 dcba),
103 .ei_array = mem_info_v01_ei,
104 },
105 {
106 .data_type = QMI_EOTI,
107 .is_array = NO_ARRAY,
108 .is_array = QMI_COMMON_TLV_TYPE,
109 },
110};
111
112static struct elem_info usb_endpoint_descriptor_v01_ei[] = {
113 {
114 .data_type = QMI_UNSIGNED_1_BYTE,
115 .elem_len = 1,
116 .elem_size = sizeof(uint8_t),
117 .is_array = NO_ARRAY,
118 .tlv_type = 0,
119 .offset = offsetof(struct usb_endpoint_descriptor_v01,
120 bLength),
121 },
122 {
123 .data_type = QMI_UNSIGNED_1_BYTE,
124 .elem_len = 1,
125 .elem_size = sizeof(uint8_t),
126 .is_array = NO_ARRAY,
127 .tlv_type = 0,
128 .offset = offsetof(struct usb_endpoint_descriptor_v01,
129 bDescriptorType),
130 },
131 {
132 .data_type = QMI_UNSIGNED_1_BYTE,
133 .elem_len = 1,
134 .elem_size = sizeof(uint8_t),
135 .is_array = NO_ARRAY,
136 .tlv_type = 0,
137 .offset = offsetof(struct usb_endpoint_descriptor_v01,
138 bEndpointAddress),
139 },
140 {
141 .data_type = QMI_UNSIGNED_1_BYTE,
142 .elem_len = 1,
143 .elem_size = sizeof(uint8_t),
144 .is_array = NO_ARRAY,
145 .tlv_type = 0,
146 .offset = offsetof(struct usb_endpoint_descriptor_v01,
147 bmAttributes),
148 },
149 {
150 .data_type = QMI_UNSIGNED_2_BYTE,
151 .elem_len = 1,
152 .elem_size = sizeof(uint16_t),
153 .is_array = NO_ARRAY,
154 .tlv_type = 0,
155 .offset = offsetof(struct usb_endpoint_descriptor_v01,
156 wMaxPacketSize),
157 },
158 {
159 .data_type = QMI_UNSIGNED_1_BYTE,
160 .elem_len = 1,
161 .elem_size = sizeof(uint8_t),
162 .is_array = NO_ARRAY,
163 .tlv_type = 0,
164 .offset = offsetof(struct usb_endpoint_descriptor_v01,
165 bInterval),
166 },
167 {
168 .data_type = QMI_UNSIGNED_1_BYTE,
169 .elem_len = 1,
170 .elem_size = sizeof(uint8_t),
171 .is_array = NO_ARRAY,
172 .tlv_type = 0,
173 .offset = offsetof(struct usb_endpoint_descriptor_v01,
174 bRefresh),
175 },
176 {
177 .data_type = QMI_UNSIGNED_1_BYTE,
178 .elem_len = 1,
179 .elem_size = sizeof(uint8_t),
180 .is_array = NO_ARRAY,
181 .tlv_type = 0,
182 .offset = offsetof(struct usb_endpoint_descriptor_v01,
183 bSynchAddress),
184 },
185 {
186 .data_type = QMI_EOTI,
187 .is_array = NO_ARRAY,
188 .is_array = QMI_COMMON_TLV_TYPE,
189 },
190};
191
192static struct elem_info usb_interface_descriptor_v01_ei[] = {
193 {
194 .data_type = QMI_UNSIGNED_1_BYTE,
195 .elem_len = 1,
196 .elem_size = sizeof(uint8_t),
197 .is_array = NO_ARRAY,
198 .tlv_type = 0,
199 .offset = offsetof(struct usb_interface_descriptor_v01,
200 bLength),
201 },
202 {
203 .data_type = QMI_UNSIGNED_1_BYTE,
204 .elem_len = 1,
205 .elem_size = sizeof(uint8_t),
206 .is_array = NO_ARRAY,
207 .tlv_type = 0,
208 .offset = offsetof(struct usb_interface_descriptor_v01,
209 bDescriptorType),
210 },
211 {
212 .data_type = QMI_UNSIGNED_1_BYTE,
213 .elem_len = 1,
214 .elem_size = sizeof(uint8_t),
215 .is_array = NO_ARRAY,
216 .tlv_type = 0,
217 .offset = offsetof(struct usb_interface_descriptor_v01,
218 bInterfaceNumber),
219 },
220 {
221 .data_type = QMI_UNSIGNED_1_BYTE,
222 .elem_len = 1,
223 .elem_size = sizeof(uint8_t),
224 .is_array = NO_ARRAY,
225 .tlv_type = 0,
226 .offset = offsetof(struct usb_interface_descriptor_v01,
227 bAlternateSetting),
228 },
229 {
230 .data_type = QMI_UNSIGNED_1_BYTE,
231 .elem_len = 1,
232 .elem_size = sizeof(uint8_t),
233 .is_array = NO_ARRAY,
234 .tlv_type = 0,
235 .offset = offsetof(struct usb_interface_descriptor_v01,
236 bNumEndpoints),
237 },
238 {
239 .data_type = QMI_UNSIGNED_1_BYTE,
240 .elem_len = 1,
241 .elem_size = sizeof(uint8_t),
242 .is_array = NO_ARRAY,
243 .tlv_type = 0,
244 .offset = offsetof(struct usb_interface_descriptor_v01,
245 bInterfaceClass),
246 },
247 {
248 .data_type = QMI_UNSIGNED_1_BYTE,
249 .elem_len = 1,
250 .elem_size = sizeof(uint8_t),
251 .is_array = NO_ARRAY,
252 .tlv_type = 0,
253 .offset = offsetof(struct usb_interface_descriptor_v01,
254 bInterfaceSubClass),
255 },
256 {
257 .data_type = QMI_UNSIGNED_1_BYTE,
258 .elem_len = 1,
259 .elem_size = sizeof(uint8_t),
260 .is_array = NO_ARRAY,
261 .tlv_type = 0,
262 .offset = offsetof(struct usb_interface_descriptor_v01,
263 bInterfaceProtocol),
264 },
265 {
266 .data_type = QMI_UNSIGNED_1_BYTE,
267 .elem_len = 1,
268 .elem_size = sizeof(uint8_t),
269 .is_array = NO_ARRAY,
270 .tlv_type = 0,
271 .offset = offsetof(struct usb_interface_descriptor_v01,
272 iInterface),
273 },
274 {
275 .data_type = QMI_EOTI,
276 .is_array = NO_ARRAY,
277 .is_array = QMI_COMMON_TLV_TYPE,
278 },
279};
280
281struct elem_info qmi_uaudio_stream_req_msg_v01_ei[] = {
282 {
283 .data_type = QMI_UNSIGNED_4_BYTE,
284 .elem_len = 1,
285 .elem_size = sizeof(uint32_t),
286 .is_array = NO_ARRAY,
287 .tlv_type = 0x01,
288 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
289 priv_data),
290 },
291 {
292 .data_type = QMI_UNSIGNED_1_BYTE,
293 .elem_len = 1,
294 .elem_size = sizeof(uint8_t),
295 .is_array = NO_ARRAY,
296 .tlv_type = 0x02,
297 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
298 enable),
299 },
300 {
301 .data_type = QMI_UNSIGNED_4_BYTE,
302 .elem_len = 1,
303 .elem_size = sizeof(uint32_t),
304 .is_array = NO_ARRAY,
305 .tlv_type = 0x03,
306 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
307 usb_token),
308 },
309 {
310 .data_type = QMI_UNSIGNED_4_BYTE,
311 .elem_len = 1,
312 .elem_size = sizeof(uint32_t),
313 .is_array = NO_ARRAY,
314 .tlv_type = 0x04,
315 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
316 audio_format),
317 },
318 {
319 .data_type = QMI_UNSIGNED_4_BYTE,
320 .elem_len = 1,
321 .elem_size = sizeof(uint32_t),
322 .is_array = NO_ARRAY,
323 .tlv_type = 0x05,
324 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
325 number_of_ch),
326 },
327 {
328 .data_type = QMI_UNSIGNED_4_BYTE,
329 .elem_len = 1,
330 .elem_size = sizeof(uint32_t),
331 .is_array = NO_ARRAY,
332 .tlv_type = 0x06,
333 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
334 bit_rate),
335 },
336 {
337 .data_type = QMI_UNSIGNED_4_BYTE,
338 .elem_len = 1,
339 .elem_size = sizeof(uint32_t),
340 .is_array = NO_ARRAY,
341 .tlv_type = 0x07,
342 .offset = offsetof(struct qmi_uaudio_stream_req_msg_v01,
343 xfer_buff_size),
344 },
345 {
346 .data_type = QMI_EOTI,
347 .is_array = NO_ARRAY,
348 .is_array = QMI_COMMON_TLV_TYPE,
349 },
350};
351
352struct elem_info qmi_uaudio_stream_resp_msg_v01_ei[] = {
353 {
354 .data_type = QMI_UNSIGNED_4_BYTE,
355 .elem_len = 1,
356 .elem_size = sizeof(uint32_t),
357 .is_array = NO_ARRAY,
358 .tlv_type = 0x01,
359 .offset = offsetof(
360 struct qmi_uaudio_stream_resp_msg_v01,
361 priv_data),
362 },
363 {
364 .data_type = QMI_UNSIGNED_4_BYTE,
365 .elem_len = 1,
366 .elem_size = sizeof(uint32_t),
367 .is_array = NO_ARRAY,
368 .tlv_type = 0x02,
369 .offset = offsetof(
370 struct qmi_uaudio_stream_resp_msg_v01,
371 status),
372 },
373 {
374 .data_type = QMI_UNSIGNED_4_BYTE,
375 .elem_len = 1,
376 .elem_size = sizeof(uint32_t),
377 .is_array = NO_ARRAY,
378 .tlv_type = 0x03,
379 .offset = offsetof(
380 struct qmi_uaudio_stream_resp_msg_v01,
381 slot_id),
382 },
383 {
384 .data_type = QMI_UNSIGNED_1_BYTE,
385 .elem_len = 1,
386 .elem_size = sizeof(uint8_t),
387 .is_array = NO_ARRAY,
388 .tlv_type = 0x04,
389 .offset = offsetof(
390 struct qmi_uaudio_stream_resp_msg_v01,
391 bSubslotSize),
392 },
393 {
394 .data_type = QMI_STRUCT,
395 .elem_len = 1,
396 .elem_size = sizeof(struct usb_interface_descriptor_v01),
397 .is_array = NO_ARRAY,
398 .tlv_type = 0x05,
399 .offset = offsetof(
400 struct qmi_uaudio_stream_resp_msg_v01,
401 std_as_opr_intf_desc),
402 .ei_array = usb_interface_descriptor_v01_ei,
403 },
404 {
405 .data_type = QMI_STRUCT,
406 .elem_len = 1,
407 .elem_size = sizeof(struct usb_endpoint_descriptor_v01),
408 .is_array = NO_ARRAY,
409 .tlv_type = 0x06,
410 .offset = offsetof(
411 struct qmi_uaudio_stream_resp_msg_v01,
412 std_as_data_ep_desc),
413 .ei_array = usb_endpoint_descriptor_v01_ei,
414 },
415 {
416 .data_type = QMI_STRUCT,
417 .elem_len = 1,
418 .elem_size = sizeof(struct usb_endpoint_descriptor_v01),
419 .is_array = NO_ARRAY,
420 .tlv_type = 0x07,
421 .offset = offsetof(
422 struct qmi_uaudio_stream_resp_msg_v01,
423 std_as_sync_ep_desc),
424 .ei_array = usb_endpoint_descriptor_v01_ei,
425 },
426 {
427 .data_type = QMI_UNSIGNED_1_BYTE,
428 .elem_len = 1,
429 .elem_size = sizeof(uint8_t),
430 .is_array = NO_ARRAY,
431 .tlv_type = 0x08,
432 .offset = offsetof(
433 struct qmi_uaudio_stream_resp_msg_v01,
434 bDelay),
435 },
436 {
437 .data_type = QMI_UNSIGNED_2_BYTE,
438 .elem_len = 1,
439 .elem_size = sizeof(uint16_t),
440 .is_array = NO_ARRAY,
441 .tlv_type = 0x09,
442 .offset = offsetof(
443 struct qmi_uaudio_stream_resp_msg_v01,
444 bcdADC),
445 },
446 {
447 .data_type = QMI_STRUCT,
448 .elem_len = 1,
449 .elem_size = sizeof(struct apps_mem_info_v01),
450 .is_array = NO_ARRAY,
451 .tlv_type = 0x0A,
452 .offset = offsetof(
453 struct qmi_uaudio_stream_resp_msg_v01,
454 xhci_mem_info),
455 .ei_array = apps_mem_info_v01_ei,
456 },
457 {
458 .data_type = QMI_UNSIGNED_1_BYTE,
459 .elem_len = 1,
460 .elem_size = sizeof(uint8_t),
461 .is_array = NO_ARRAY,
462 .tlv_type = 0x0B,
463 .offset = offsetof(
464 struct qmi_uaudio_stream_resp_msg_v01,
465 interrupter_num),
466 },
467 {
468 .data_type = QMI_EOTI,
469 .is_array = NO_ARRAY,
470 .is_array = QMI_COMMON_TLV_TYPE,
471 },
472};
473
474struct elem_info qmi_uaudio_stream_ind_msg_v01_ei[] = {
475 {
476 .data_type = QMI_UNSIGNED_4_BYTE,
477 .elem_len = 1,
478 .elem_size = sizeof(uint32_t),
479 .is_array = NO_ARRAY,
480 .tlv_type = 0x01,
481 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
482 usb_token),
483 },
484 {
485 .data_type = QMI_UNSIGNED_4_BYTE,
486 .elem_len = 1,
487 .elem_size = sizeof(uint32_t),
488 .is_array = NO_ARRAY,
489 .tlv_type = 0x02,
490 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
491 priv_data),
492 },
493 {
494 .data_type = QMI_UNSIGNED_4_BYTE,
495 .elem_len = 1,
496 .elem_size = sizeof(uint32_t),
497 .is_array = NO_ARRAY,
498 .tlv_type = 0x03,
499 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
500 status),
501 },
502 {
503 .data_type = QMI_UNSIGNED_4_BYTE,
504 .elem_len = 1,
505 .elem_size = sizeof(uint32_t),
506 .is_array = NO_ARRAY,
507 .tlv_type = 0x04,
508 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
509 slot_id),
510 },
511 {
512 .data_type = QMI_UNSIGNED_1_BYTE,
513 .elem_len = 1,
514 .elem_size = sizeof(uint8_t),
515 .is_array = NO_ARRAY,
516 .tlv_type = 0x05,
517 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
518 bSubslotSize),
519 },
520 {
521 .data_type = QMI_STRUCT,
522 .elem_len = 1,
523 .elem_size = sizeof(struct usb_interface_descriptor_v01),
524 .is_array = NO_ARRAY,
525 .tlv_type = 0x06,
526 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
527 std_as_opr_intf_desc),
528 .ei_array = usb_interface_descriptor_v01_ei,
529 },
530 {
531 .data_type = QMI_STRUCT,
532 .elem_len = 1,
533 .elem_size = sizeof(struct usb_endpoint_descriptor_v01),
534 .is_array = NO_ARRAY,
535 .tlv_type = 0x07,
536 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
537 std_as_data_ep_desc),
538 .ei_array = usb_endpoint_descriptor_v01_ei,
539 },
540 {
541 .data_type = QMI_STRUCT,
542 .elem_len = 1,
543 .elem_size = sizeof(struct usb_endpoint_descriptor_v01),
544 .is_array = NO_ARRAY,
545 .tlv_type = 0x08,
546 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
547 std_as_sync_ep_desc),
548 .ei_array = usb_endpoint_descriptor_v01_ei,
549 },
550 {
551 .data_type = QMI_STRUCT,
552 .elem_len = 1,
553 .elem_size = sizeof(struct apps_mem_info_v01),
554 .is_array = NO_ARRAY,
555 .tlv_type = 0x09,
556 .offset = offsetof(struct qmi_uaudio_stream_ind_msg_v01,
557 xhci_mem_info),
558 .ei_array = apps_mem_info_v01_ei,
559 },
560 {
561 .data_type = QMI_EOTI,
562 .is_array = NO_ARRAY,
563 .is_array = QMI_COMMON_TLV_TYPE,
564 },
565};