blob: e27e5cd07d76c3e0e9ce49a9127a1d0ba1075e3f [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2011, Code Aurora Forum. 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#ifndef __QDSP6VOICE_H__
13#define __QDSP6VOICE_H__
14
15#include <mach/qdsp6v2/apr.h>
16
17#define MAX_VOC_PKT_SIZE 322
Helen Zeng69b00962011-07-08 11:38:36 -070018#define SESSION_NAME_LEN 20
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019
20struct voice_header {
21 uint32_t id;
22 uint32_t data_len;
23};
24
25struct voice_init {
26 struct voice_header hdr;
27 void *cb_handle;
28};
29
30/* Device information payload structure */
31
32struct device_data {
33 uint32_t volume; /* in index */
34 uint32_t mute;
35 uint32_t sample;
36 uint32_t enabled;
37 uint32_t dev_id;
38 uint32_t port_id;
39};
40
41struct voice_dev_route_state {
42 u16 rx_route_flag;
43 u16 tx_route_flag;
44};
45
46enum {
47 VOC_INIT = 0,
48 VOC_RUN,
49 VOC_CHANGE,
50 VOC_RELEASE,
51};
52
Helen Zeng29eb7442011-06-20 11:06:29 -070053/* Common */
54#define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025
55#define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026
56/* General shared memory; byte-accessible, 4 kB-aligned. */
57#define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3
58
59struct vss_icommon_cmd_map_memory_t {
60 uint32_t phys_addr;
61 /* Physical address of a memory region; must be at least
62 * 4 kB aligned.
63 */
64
65 uint32_t mem_size;
66 /* Number of bytes in the region; should be a multiple of 32. */
67
68 uint16_t mem_pool_id;
69 /* Type of memory being provided. The memory ID implicitly defines
70 * the characteristics of the memory. The characteristics might include
71 * alignment type, permissions, etc.
72 * Memory pool ID. Possible values:
73 * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL.
74 */
75} __packed;
76
77struct vss_icommon_cmd_unmap_memory_t {
78 uint32_t phys_addr;
79 /* Physical address of a memory region; must be at least
80 * 4 kB aligned.
81 */
82} __packed;
83
84struct vss_map_memory_cmd {
85 struct apr_hdr hdr;
86 struct vss_icommon_cmd_map_memory_t vss_map_mem;
87} __packed;
88
89struct vss_unmap_memory_cmd {
90 struct apr_hdr hdr;
91 struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem;
92} __packed;
93
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094/* TO MVM commands */
95#define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
96/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
97
98#define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
99/* Create a new full control MVM session. */
100
101#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
102/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
103
104#define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
105/* Attach a stream to the MVM. */
106
107#define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
108/* Detach a stream from the MVM. */
109
Helen Zeng69b00962011-07-08 11:38:36 -0700110#define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
111/* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
112 * to all the streams currently attached to it.
113 */
114
115#define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
116/* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
117 * vocproc from all the streams to which it is currently attached.
118*/
119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700120#define VSS_IMVM_CMD_START_VOICE 0x00011190
121/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
122
123#define VSS_IMVM_CMD_STOP_VOICE 0x00011192
124/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
125
126#define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
127/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
128
129#define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
130/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
131
132
133#define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
134/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
135
136#define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
137/* Set the network type. */
138
139#define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
140/* Set the voice timing parameters. */
141
142struct vss_istream_cmd_set_tty_mode_t {
143 uint32_t mode;
144 /**<
145 * TTY mode.
146 *
147 * 0 : TTY disabled
148 * 1 : HCO
149 * 2 : VCO
150 * 3 : FULL
151 */
152} __packed;
153
154struct vss_istream_cmd_attach_vocproc_t {
155 uint16_t handle;
156 /**< Handle of vocproc being attached. */
157} __packed;
158
159struct vss_istream_cmd_detach_vocproc_t {
160 uint16_t handle;
161 /**< Handle of vocproc being detached. */
162} __packed;
163
164struct vss_imvm_cmd_attach_stream_t {
165 uint16_t handle;
166 /* The stream handle to attach. */
167} __packed;
168
169struct vss_imvm_cmd_detach_stream_t {
170 uint16_t handle;
171 /* The stream handle to detach. */
172} __packed;
173
174struct vss_icommon_cmd_set_network_t {
175 uint32_t network_id;
176 /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
177} __packed;
178
179struct vss_icommon_cmd_set_voice_timing_t {
180 uint16_t mode;
181 /*
182 * The vocoder frame synchronization mode.
183 *
184 * 0 : No frame sync.
185 * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
186 */
187 uint16_t enc_offset;
188 /*
189 * The offset in microseconds from the VFR to deliver a Tx vocoder
190 * packet. The offset should be less than 20000us.
191 */
192 uint16_t dec_req_offset;
193 /*
194 * The offset in microseconds from the VFR to request for an Rx vocoder
195 * packet. The offset should be less than 20000us.
196 */
197 uint16_t dec_offset;
198 /*
199 * The offset in microseconds from the VFR to indicate the deadline to
200 * receive an Rx vocoder packet. The offset should be less than 20000us.
201 * Rx vocoder packets received after this deadline are not guaranteed to
202 * be processed.
203 */
204} __packed;
205
Helen Zeng69b00962011-07-08 11:38:36 -0700206struct vss_imvm_cmd_create_control_session_t {
207 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208 /*
209 * A variable-sized stream name.
210 *
211 * The stream name size is the payload size minus the size of the other
212 * fields.
213 */
214} __packed;
215
216
217struct mvm_attach_vocproc_cmd {
218 struct apr_hdr hdr;
219 struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
220} __packed;
221
222struct mvm_detach_vocproc_cmd {
223 struct apr_hdr hdr;
224 struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
225} __packed;
226
Helen Zeng69b00962011-07-08 11:38:36 -0700227struct mvm_create_ctl_session_cmd {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 struct apr_hdr hdr;
Helen Zeng69b00962011-07-08 11:38:36 -0700229 struct vss_imvm_cmd_create_control_session_t mvm_session;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230} __packed;
231
232struct mvm_set_tty_mode_cmd {
233 struct apr_hdr hdr;
234 struct vss_istream_cmd_set_tty_mode_t tty_mode;
235} __packed;
236
237struct mvm_attach_stream_cmd {
238 struct apr_hdr hdr;
239 struct vss_imvm_cmd_attach_stream_t attach_stream;
240} __packed;
241
242struct mvm_detach_stream_cmd {
243 struct apr_hdr hdr;
244 struct vss_imvm_cmd_detach_stream_t detach_stream;
245} __packed;
246
247struct mvm_set_network_cmd {
248 struct apr_hdr hdr;
249 struct vss_icommon_cmd_set_network_t network;
250} __packed;
251
252struct mvm_set_voice_timing_cmd {
253 struct apr_hdr hdr;
254 struct vss_icommon_cmd_set_voice_timing_t timing;
255} __packed;
256
257/* TO CVS commands */
258#define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
259/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
260
261#define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
262/* Create a new full control stream session. */
263
264#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
265
266#define VSS_ISTREAM_CMD_SET_MUTE 0x00011022
267
Helen Zeng29eb7442011-06-20 11:06:29 -0700268#define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA 0x00011279
269
270#define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A
271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272#define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
273/* Set media type on the stream. */
274
275#define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
276/* Event sent by the stream to its client to provide an encoded packet. */
277
278#define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
279/* Event sent by the stream to its client requesting for a decoder packet.
280 * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
281 */
282
283#define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
284/* Event sent by the client to the stream in response to a
285 * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
286 */
287
288#define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
289/* Set AMR encoder rate. */
290
291#define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
292/* Set AMR-WB encoder rate. */
293
294#define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
295/* Set encoder minimum and maximum rate. */
296
297#define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
298/* Set encoder DTX mode. */
299
300struct vss_istream_cmd_create_passive_control_session_t {
Helen Zeng69b00962011-07-08 11:38:36 -0700301 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302 /**<
303 * A variable-sized stream name.
304 *
305 * The stream name size is the payload size minus the size of the other
306 * fields.
307 */
308} __packed;
309
310struct vss_istream_cmd_set_mute_t {
311 uint16_t direction;
312 /**<
313 * 0 : TX only
314 * 1 : RX only
315 * 2 : TX and Rx
316 */
317 uint16_t mute_flag;
318 /**<
319 * Mute, un-mute.
320 *
321 * 0 : Silence disable
322 * 1 : Silence enable
323 * 2 : CNG enable. Applicable to TX only. If set on RX behavior
324 * will be the same as 1
325 */
326} __packed;
327
328struct vss_istream_cmd_create_full_control_session_t {
329 uint16_t direction;
330 /*
331 * Stream direction.
332 *
333 * 0 : TX only
334 * 1 : RX only
335 * 2 : TX and RX
336 * 3 : TX and RX loopback
337 */
338 uint32_t enc_media_type;
339 /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
340 uint32_t dec_media_type;
341 /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
342 uint32_t network_id;
343 /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
Helen Zeng69b00962011-07-08 11:38:36 -0700344 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 /*
346 * A variable-sized stream name.
347 *
348 * The stream name size is the payload size minus the size of the other
349 * fields.
350 */
351} __packed;
352
353struct vss_istream_cmd_set_media_type_t {
354 uint32_t rx_media_id;
355 /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
356 uint32_t tx_media_id;
357 /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
358} __packed;
359
360struct vss_istream_evt_send_enc_buffer_t {
361 uint32_t media_id;
362 /* Media ID of the packet. */
363 uint8_t packet_data[MAX_VOC_PKT_SIZE];
364 /* Packet data buffer. */
365} __packed;
366
367struct vss_istream_evt_send_dec_buffer_t {
368 uint32_t media_id;
369 /* Media ID of the packet. */
370 uint8_t packet_data[MAX_VOC_PKT_SIZE];
371 /* Packet data. */
372} __packed;
373
374struct vss_istream_cmd_voc_amr_set_enc_rate_t {
375 uint32_t mode;
376 /* Set the AMR encoder rate.
377 *
378 * 0x00000000 : 4.75 kbps
379 * 0x00000001 : 5.15 kbps
380 * 0x00000002 : 5.90 kbps
381 * 0x00000003 : 6.70 kbps
382 * 0x00000004 : 7.40 kbps
383 * 0x00000005 : 7.95 kbps
384 * 0x00000006 : 10.2 kbps
385 * 0x00000007 : 12.2 kbps
386 */
387} __packed;
388
389struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
390 uint32_t mode;
391 /* Set the AMR-WB encoder rate.
392 *
393 * 0x00000000 : 6.60 kbps
394 * 0x00000001 : 8.85 kbps
395 * 0x00000002 : 12.65 kbps
396 * 0x00000003 : 14.25 kbps
397 * 0x00000004 : 15.85 kbps
398 * 0x00000005 : 18.25 kbps
399 * 0x00000006 : 19.85 kbps
400 * 0x00000007 : 23.05 kbps
401 * 0x00000008 : 23.85 kbps
402 */
403} __packed;
404
405struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
406 uint16_t min_rate;
407 /* Set the lower bound encoder rate.
408 *
409 * 0x0000 : Blank frame
410 * 0x0001 : Eighth rate
411 * 0x0002 : Quarter rate
412 * 0x0003 : Half rate
413 * 0x0004 : Full rate
414 */
415 uint16_t max_rate;
416 /* Set the upper bound encoder rate.
417 *
418 * 0x0000 : Blank frame
419 * 0x0001 : Eighth rate
420 * 0x0002 : Quarter rate
421 * 0x0003 : Half rate
422 * 0x0004 : Full rate
423 */
424} __packed;
425
426struct vss_istream_cmd_set_enc_dtx_mode_t {
427 uint32_t enable;
428 /* Toggle DTX on or off.
429 *
430 * 0 : Disables DTX
431 * 1 : Enables DTX
432 */
433} __packed;
434
Helen Zeng29eb7442011-06-20 11:06:29 -0700435struct vss_istream_cmd_register_calibration_data_t {
436 uint32_t phys_addr;
437 /* Phsical address to be registered with stream. The calibration data
438 * is stored at this address.
439 */
440 uint32_t mem_size;
441 /* Size of the calibration data in bytes. */
442};
443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700444struct cvs_create_passive_ctl_session_cmd {
445 struct apr_hdr hdr;
446 struct vss_istream_cmd_create_passive_control_session_t cvs_session;
447} __packed;
448
449struct cvs_create_full_ctl_session_cmd {
450 struct apr_hdr hdr;
451 struct vss_istream_cmd_create_full_control_session_t cvs_session;
452};
453
454struct cvs_destroy_session_cmd {
455 struct apr_hdr hdr;
456} __packed;
457
458struct cvs_set_mute_cmd {
459 struct apr_hdr hdr;
460 struct vss_istream_cmd_set_mute_t cvs_set_mute;
461} __packed;
462
463struct cvs_set_media_type_cmd {
464 struct apr_hdr hdr;
465 struct vss_istream_cmd_set_media_type_t media_type;
466} __packed;
467
468struct cvs_send_dec_buf_cmd {
469 struct apr_hdr hdr;
470 struct vss_istream_evt_send_dec_buffer_t dec_buf;
471} __packed;
472
473struct cvs_set_amr_enc_rate_cmd {
474 struct apr_hdr hdr;
475 struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
476} __packed;
477
478struct cvs_set_amrwb_enc_rate_cmd {
479 struct apr_hdr hdr;
480 struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
481} __packed;
482
483struct cvs_set_cdma_enc_minmax_rate_cmd {
484 struct apr_hdr hdr;
485 struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
486} __packed;
487
488struct cvs_set_enc_dtx_mode_cmd {
489 struct apr_hdr hdr;
490 struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
491} __packed;
492
Helen Zeng29eb7442011-06-20 11:06:29 -0700493struct cvs_register_cal_data_cmd {
494 struct apr_hdr hdr;
495 struct vss_istream_cmd_register_calibration_data_t cvs_cal_data;
496} __packed;
497
498struct cvs_deregister_cal_data_cmd {
499 struct apr_hdr hdr;
500} __packed;
501
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502/* TO CVP commands */
503
504#define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
505/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
506
507#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
508
509#define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4
510
511#define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
512
513#define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE
514
515#define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
516/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
517
518#define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
519/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
520
Helen Zeng29eb7442011-06-20 11:06:29 -0700521#define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA 0x00011275
522#define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
523
524#define VSS_IVOCPROC_CMD_REGISTER_VOLUME_CAL_TABLE 0x00011277
525#define VSS_IVOCPROC_CMD_DEREGISTER_VOLUME_CAL_TABLE 0x00011278
526
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527#define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
528#define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
529#define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
530
531#define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
532
533/* Newtwork IDs */
534#define VSS_NETWORK_ID_DEFAULT 0x00010037
535#define VSS_NETWORK_ID_VOIP_NB 0x00011240
536#define VSS_NETWORK_ID_VOIP_WB 0x00011241
537#define VSS_NETWORK_ID_VOIP_WV 0x00011242
538
539/* Media types */
540#define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
541/* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
542#define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
543/* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
544#define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
545/* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
546#define VSS_MEDIA_ID_PCM_NB 0x00010FCB
547#define VSS_MEDIA_ID_PCM_WB 0x00010FCC
548/* Linear PCM (16-bit, little-endian). */
549#define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
550/* G.711 a-law (contains two 10ms vocoder frames). */
551#define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
552/* G.711 mu-law (contains two 10ms vocoder frames). */
553#define VSS_MEDIA_ID_G729 0x00010FD0
554/* G.729AB (contains two 10ms vocoder frames. */
555
556#define VOICE_CMD_SET_PARAM 0x00011006
557#define VOICE_CMD_GET_PARAM 0x00011007
558#define VOICE_EVT_GET_PARAM_ACK 0x00011008
559
560struct vss_ivocproc_cmd_create_full_control_session_t {
561 uint16_t direction;
562 /*
563 * stream direction.
564 * 0 : TX only
565 * 1 : RX only
566 * 2 : TX and RX
567 */
568 uint32_t tx_port_id;
569 /*
570 * TX device port ID which vocproc will connect to. If not supplying a
571 * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
572 */
573 uint32_t tx_topology_id;
574 /*
575 * Tx leg topology ID. If not supplying a topology ID set to
576 * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
577 */
578 uint32_t rx_port_id;
579 /*
580 * RX device port ID which vocproc will connect to. If not supplying a
581 * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
582 */
583 uint32_t rx_topology_id;
584 /*
585 * Rx leg topology ID. If not supplying a topology ID set to
586 * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
587 */
588 int32_t network_id;
589 /*
590 * Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network
591 * ID set to VSS_NETWORK_ID_DEFAULT.
592 */
593} __packed;
594
595struct vss_ivocproc_cmd_set_volume_index_t {
596 uint16_t vol_index;
597 /**<
598 * Volume index utilized by the vocproc to index into the volume table
599 * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
600 * volume on the VDSP.
601 */
602} __packed;
603
604struct vss_ivocproc_cmd_set_device_t {
605 uint32_t tx_port_id;
606 /**<
607 * TX device port ID which vocproc will connect to.
608 * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
609 */
610 uint32_t tx_topology_id;
611 /**<
612 * TX leg topology ID.
613 * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
614 * pre/post-processing blocks and is pass-through.
615 */
616 int32_t rx_port_id;
617 /**<
618 * RX device port ID which vocproc will connect to.
619 * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
620 */
621 uint32_t rx_topology_id;
622 /**<
623 * RX leg topology ID.
624 * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
625 * pre/post-processing blocks and is pass-through.
626 */
627} __packed;
628
Helen Zeng29eb7442011-06-20 11:06:29 -0700629struct vss_ivocproc_cmd_register_calibration_data_t {
630 uint32_t phys_addr;
631 /* Phsical address to be registered with vocproc. Calibration data
632 * is stored at this address.
633 */
634 uint32_t mem_size;
635 /* Size of the calibration data in bytes. */
636} __packed;
637
638struct vss_ivocproc_cmd_register_volume_cal_table_t {
639 uint32_t phys_addr;
640 /* Phsical address to be registered with the vocproc. The volume
641 * calibration table is stored at this location.
642 */
643
644 uint32_t mem_size;
645 /* Size of the volume calibration table in bytes. */
646} __packed;
647
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700648struct cvp_create_full_ctl_session_cmd {
649 struct apr_hdr hdr;
650 struct vss_ivocproc_cmd_create_full_control_session_t cvp_session;
651} __packed;
652
653struct cvp_command {
654 struct apr_hdr hdr;
655} __packed;
656
657struct cvp_set_device_cmd {
658 struct apr_hdr hdr;
659 struct vss_ivocproc_cmd_set_device_t cvp_set_device;
660} __packed;
661
662struct cvp_set_vp3_data_cmd {
663 struct apr_hdr hdr;
664} __packed;
665
666struct cvp_set_rx_volume_index_cmd {
667 struct apr_hdr hdr;
668 struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
669} __packed;
670
Helen Zeng29eb7442011-06-20 11:06:29 -0700671struct cvp_register_cal_data_cmd {
672 struct apr_hdr hdr;
673 struct vss_ivocproc_cmd_register_calibration_data_t cvp_cal_data;
674} __packed;
675
676struct cvp_deregister_cal_data_cmd {
677 struct apr_hdr hdr;
678} __packed;
679
680struct cvp_register_vol_cal_table_cmd {
681 struct apr_hdr hdr;
682 struct vss_ivocproc_cmd_register_volume_cal_table_t cvp_vol_cal_tbl;
683} __packed;
684
685struct cvp_deregister_vol_cal_table_cmd {
686 struct apr_hdr hdr;
687} __packed;
688
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700689/* CB for up-link packets. */
690typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
691 uint32_t pkt_len,
692 void *private_data);
693
694/* CB for down-link packets. */
695typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
696 uint32_t *pkt_len,
697 void *private_data);
698
699
700struct mvs_driver_info {
701 uint32_t media_type;
702 uint32_t rate;
703 uint32_t network_type;
704 ul_cb_fn ul_cb;
705 dl_cb_fn dl_cb;
706 void *private_data;
707};
708
709struct incall_rec_info {
710 uint32_t pending;
711 uint32_t rec_mode;
712};
713
714struct incall_music_info {
715 uint32_t pending;
716 uint32_t playing;
717};
718
719struct voice_data {
720 int voc_state;/*INIT, CHANGE, RELEASE, RUN */
721 uint32_t voc_path;
722
723 wait_queue_head_t mvm_wait;
724 wait_queue_head_t cvs_wait;
725 wait_queue_head_t cvp_wait;
726
727 uint32_t device_events;
728
729 /* cache the values related to Rx and Tx */
730 struct device_data dev_rx;
731 struct device_data dev_tx;
732
733 /* these default values are for all devices */
734 uint32_t default_mute_val;
735 uint32_t default_vol_val;
736 uint32_t default_sample_val;
Helen Zengcc65b5b2011-07-06 19:14:48 -0700737 uint8_t tty_mode;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700738
739 /* APR to MVM in the Q6 */
740 void *apr_q6_mvm;
741 /* APR to CVS in the Q6 */
742 void *apr_q6_cvs;
743 /* APR to CVP in the Q6 */
744 void *apr_q6_cvp;
745
746 u32 mvm_state;
747 u32 cvs_state;
748 u32 cvp_state;
749
750 /* Handle to MVM in the Q6 */
751 u16 mvm_passive_handle; /* for cs call */
752 u16 mvm_full_handle; /* for voip */
753 /* Handle to CVS in the Q6 */
754 u16 cvs_passive_handle;
755 u16 cvs_full_handle;
756 /* Handle to CVP in the Q6 */
757 u16 cvp_passive_handle;
758 u16 cvp_full_handle;
759
760 struct mutex lock;
761
762 struct mvs_driver_info mvs_info;
763
764 uint16_t sidetone_gain;
765
766 struct voice_dev_route_state voc_route_state;
767};
768
769int voc_set_voc_path_full(uint32_t set);
770
771void voc_register_mvs_cb(ul_cb_fn ul_cb,
772 dl_cb_fn dl_cb,
773 void *private_data);
774
775void voc_config_vocoder(uint32_t media_type,
776 uint32_t rate,
777 uint32_t network_type);
778
779enum {
780 DEV_RX = 0,
781 DEV_TX,
782};
783
784enum {
785 RX_PATH = 0,
786 TX_PATH,
787};
788
789/* called by alsa driver */
Helen Zengcc65b5b2011-07-06 19:14:48 -0700790uint8_t voc_get_tty_mode(void);
791int voc_set_tty_mode(uint8_t tty_mode);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700792int voc_start_voice_call(void);
793int voc_end_voice_call(void);
794void voc_set_rxtx_port(uint32_t dev_port_id, uint32_t dev_type);
795int voc_set_rx_vol_index(uint32_t dir, uint32_t voc_idx);
796int voc_set_tx_mute(uint32_t dir, uint32_t mute);
797int voc_disable_cvp(void);
798int voc_enable_cvp(void);
799void voc_set_route_flag(uint8_t path_dir, uint8_t set);
800uint8_t voc_get_route_flag(uint8_t path_dir);
801
802#endif