blob: 03993f6616ae8ac1bc958a55c38d3cb1690a8391 [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
Helen Zeng2095e572011-08-15 18:30:43 -070017#define MAX_VOC_PKT_SIZE 642
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 */
Helen Zengbb49c702011-09-06 14:09:13 -070054#define VSS_ICOMMON_CMD_SET_UI_PROPERTY 0x00011103
55/* Set a UI property */
Helen Zeng29eb7442011-06-20 11:06:29 -070056#define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025
57#define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026
58/* General shared memory; byte-accessible, 4 kB-aligned. */
59#define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3
60
61struct vss_icommon_cmd_map_memory_t {
62 uint32_t phys_addr;
63 /* Physical address of a memory region; must be at least
64 * 4 kB aligned.
65 */
66
67 uint32_t mem_size;
68 /* Number of bytes in the region; should be a multiple of 32. */
69
70 uint16_t mem_pool_id;
71 /* Type of memory being provided. The memory ID implicitly defines
72 * the characteristics of the memory. The characteristics might include
73 * alignment type, permissions, etc.
74 * Memory pool ID. Possible values:
75 * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL.
76 */
77} __packed;
78
79struct vss_icommon_cmd_unmap_memory_t {
80 uint32_t phys_addr;
81 /* Physical address of a memory region; must be at least
82 * 4 kB aligned.
83 */
84} __packed;
85
86struct vss_map_memory_cmd {
87 struct apr_hdr hdr;
88 struct vss_icommon_cmd_map_memory_t vss_map_mem;
89} __packed;
90
91struct vss_unmap_memory_cmd {
92 struct apr_hdr hdr;
93 struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem;
94} __packed;
95
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096/* TO MVM commands */
97#define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
98/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
99
100#define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
101/* Create a new full control MVM session. */
102
103#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
104/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
105
106#define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
107/* Attach a stream to the MVM. */
108
109#define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
110/* Detach a stream from the MVM. */
111
Helen Zeng69b00962011-07-08 11:38:36 -0700112#define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
113/* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
114 * to all the streams currently attached to it.
115 */
116
117#define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
118/* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
119 * vocproc from all the streams to which it is currently attached.
120*/
121
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700122#define VSS_IMVM_CMD_START_VOICE 0x00011190
123/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
124
125#define VSS_IMVM_CMD_STOP_VOICE 0x00011192
126/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
127
128#define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
129/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
130
131#define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
132/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
133
134
135#define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
136/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
137
138#define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
139/* Set the network type. */
140
141#define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
142/* Set the voice timing parameters. */
143
Helen Zeng44d4d272011-08-10 14:49:20 -0700144#define VSS_IWIDEVOICE_CMD_SET_WIDEVOICE 0x00011243
145/* Enable/disable WideVoice */
146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147struct vss_istream_cmd_set_tty_mode_t {
148 uint32_t mode;
149 /**<
150 * TTY mode.
151 *
152 * 0 : TTY disabled
153 * 1 : HCO
154 * 2 : VCO
155 * 3 : FULL
156 */
157} __packed;
158
159struct vss_istream_cmd_attach_vocproc_t {
160 uint16_t handle;
161 /**< Handle of vocproc being attached. */
162} __packed;
163
164struct vss_istream_cmd_detach_vocproc_t {
165 uint16_t handle;
166 /**< Handle of vocproc being detached. */
167} __packed;
168
169struct vss_imvm_cmd_attach_stream_t {
170 uint16_t handle;
171 /* The stream handle to attach. */
172} __packed;
173
174struct vss_imvm_cmd_detach_stream_t {
175 uint16_t handle;
176 /* The stream handle to detach. */
177} __packed;
178
179struct vss_icommon_cmd_set_network_t {
180 uint32_t network_id;
181 /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
182} __packed;
183
184struct vss_icommon_cmd_set_voice_timing_t {
185 uint16_t mode;
186 /*
187 * The vocoder frame synchronization mode.
188 *
189 * 0 : No frame sync.
190 * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
191 */
192 uint16_t enc_offset;
193 /*
194 * The offset in microseconds from the VFR to deliver a Tx vocoder
195 * packet. The offset should be less than 20000us.
196 */
197 uint16_t dec_req_offset;
198 /*
199 * The offset in microseconds from the VFR to request for an Rx vocoder
200 * packet. The offset should be less than 20000us.
201 */
202 uint16_t dec_offset;
203 /*
204 * The offset in microseconds from the VFR to indicate the deadline to
205 * receive an Rx vocoder packet. The offset should be less than 20000us.
206 * Rx vocoder packets received after this deadline are not guaranteed to
207 * be processed.
208 */
209} __packed;
210
Helen Zeng69b00962011-07-08 11:38:36 -0700211struct vss_imvm_cmd_create_control_session_t {
212 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213 /*
214 * A variable-sized stream name.
215 *
216 * The stream name size is the payload size minus the size of the other
217 * fields.
218 */
219} __packed;
220
Helen Zeng44d4d272011-08-10 14:49:20 -0700221struct vss_iwidevoice_cmd_set_widevoice_t {
222 uint32_t enable;
223 /* WideVoice enable/disable; possible values:
224 * - 0 -- WideVoice disabled
225 * - 1 -- WideVoice enabled
226 */
227} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228
229struct mvm_attach_vocproc_cmd {
230 struct apr_hdr hdr;
231 struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
232} __packed;
233
234struct mvm_detach_vocproc_cmd {
235 struct apr_hdr hdr;
236 struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
237} __packed;
238
Helen Zeng69b00962011-07-08 11:38:36 -0700239struct mvm_create_ctl_session_cmd {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700240 struct apr_hdr hdr;
Helen Zeng69b00962011-07-08 11:38:36 -0700241 struct vss_imvm_cmd_create_control_session_t mvm_session;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242} __packed;
243
244struct mvm_set_tty_mode_cmd {
245 struct apr_hdr hdr;
246 struct vss_istream_cmd_set_tty_mode_t tty_mode;
247} __packed;
248
249struct mvm_attach_stream_cmd {
250 struct apr_hdr hdr;
251 struct vss_imvm_cmd_attach_stream_t attach_stream;
252} __packed;
253
254struct mvm_detach_stream_cmd {
255 struct apr_hdr hdr;
256 struct vss_imvm_cmd_detach_stream_t detach_stream;
257} __packed;
258
259struct mvm_set_network_cmd {
260 struct apr_hdr hdr;
261 struct vss_icommon_cmd_set_network_t network;
262} __packed;
263
264struct mvm_set_voice_timing_cmd {
265 struct apr_hdr hdr;
266 struct vss_icommon_cmd_set_voice_timing_t timing;
267} __packed;
268
Helen Zeng44d4d272011-08-10 14:49:20 -0700269struct mvm_set_widevoice_enable_cmd {
270 struct apr_hdr hdr;
271 struct vss_iwidevoice_cmd_set_widevoice_t vss_set_wv;
272} __packed;
273
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700274/* TO CVS commands */
275#define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
276/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
277
278#define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
279/* Create a new full control stream session. */
280
281#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
282
283#define VSS_ISTREAM_CMD_SET_MUTE 0x00011022
284
Helen Zeng29eb7442011-06-20 11:06:29 -0700285#define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA 0x00011279
286
287#define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A
288
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700289#define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
290/* Set media type on the stream. */
291
292#define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
293/* Event sent by the stream to its client to provide an encoded packet. */
294
295#define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
296/* Event sent by the stream to its client requesting for a decoder packet.
297 * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
298 */
299
300#define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
301/* Event sent by the client to the stream in response to a
302 * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
303 */
304
305#define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
306/* Set AMR encoder rate. */
307
308#define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
309/* Set AMR-WB encoder rate. */
310
311#define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
312/* Set encoder minimum and maximum rate. */
313
314#define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
315/* Set encoder DTX mode. */
316
Helen Zengbb49c702011-09-06 14:09:13 -0700317#define MODULE_ID_VOICE_MODULE_ST 0x00010EE3
318#define VOICE_PARAM_MOD_ENABLE 0x00010E00
319#define MOD_ENABLE_PARAM_LEN 4
320
Helen Zeng0705a5f2011-10-14 15:29:52 -0700321#define VSS_ISTREAM_CMD_START_PLAYBACK 0x00011238
322/* Start in-call music delivery on the Tx voice path. */
323
324#define VSS_ISTREAM_CMD_STOP_PLAYBACK 0x00011239
325/* Stop the in-call music delivery on the Tx voice path. */
326
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327struct vss_istream_cmd_create_passive_control_session_t {
Helen Zeng69b00962011-07-08 11:38:36 -0700328 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 /**<
330 * A variable-sized stream name.
331 *
332 * The stream name size is the payload size minus the size of the other
333 * fields.
334 */
335} __packed;
336
337struct vss_istream_cmd_set_mute_t {
338 uint16_t direction;
339 /**<
340 * 0 : TX only
341 * 1 : RX only
342 * 2 : TX and Rx
343 */
344 uint16_t mute_flag;
345 /**<
346 * Mute, un-mute.
347 *
348 * 0 : Silence disable
349 * 1 : Silence enable
350 * 2 : CNG enable. Applicable to TX only. If set on RX behavior
351 * will be the same as 1
352 */
353} __packed;
354
355struct vss_istream_cmd_create_full_control_session_t {
356 uint16_t direction;
357 /*
358 * Stream direction.
359 *
360 * 0 : TX only
361 * 1 : RX only
362 * 2 : TX and RX
363 * 3 : TX and RX loopback
364 */
365 uint32_t enc_media_type;
366 /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
367 uint32_t dec_media_type;
368 /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
369 uint32_t network_id;
370 /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
Helen Zeng69b00962011-07-08 11:38:36 -0700371 char name[SESSION_NAME_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700372 /*
373 * A variable-sized stream name.
374 *
375 * The stream name size is the payload size minus the size of the other
376 * fields.
377 */
378} __packed;
379
380struct vss_istream_cmd_set_media_type_t {
381 uint32_t rx_media_id;
382 /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
383 uint32_t tx_media_id;
384 /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
385} __packed;
386
387struct vss_istream_evt_send_enc_buffer_t {
388 uint32_t media_id;
389 /* Media ID of the packet. */
390 uint8_t packet_data[MAX_VOC_PKT_SIZE];
391 /* Packet data buffer. */
392} __packed;
393
394struct vss_istream_evt_send_dec_buffer_t {
395 uint32_t media_id;
396 /* Media ID of the packet. */
397 uint8_t packet_data[MAX_VOC_PKT_SIZE];
398 /* Packet data. */
399} __packed;
400
401struct vss_istream_cmd_voc_amr_set_enc_rate_t {
402 uint32_t mode;
403 /* Set the AMR encoder rate.
404 *
405 * 0x00000000 : 4.75 kbps
406 * 0x00000001 : 5.15 kbps
407 * 0x00000002 : 5.90 kbps
408 * 0x00000003 : 6.70 kbps
409 * 0x00000004 : 7.40 kbps
410 * 0x00000005 : 7.95 kbps
411 * 0x00000006 : 10.2 kbps
412 * 0x00000007 : 12.2 kbps
413 */
414} __packed;
415
416struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
417 uint32_t mode;
418 /* Set the AMR-WB encoder rate.
419 *
420 * 0x00000000 : 6.60 kbps
421 * 0x00000001 : 8.85 kbps
422 * 0x00000002 : 12.65 kbps
423 * 0x00000003 : 14.25 kbps
424 * 0x00000004 : 15.85 kbps
425 * 0x00000005 : 18.25 kbps
426 * 0x00000006 : 19.85 kbps
427 * 0x00000007 : 23.05 kbps
428 * 0x00000008 : 23.85 kbps
429 */
430} __packed;
431
432struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
433 uint16_t min_rate;
434 /* Set the lower bound encoder rate.
435 *
436 * 0x0000 : Blank frame
437 * 0x0001 : Eighth rate
438 * 0x0002 : Quarter rate
439 * 0x0003 : Half rate
440 * 0x0004 : Full rate
441 */
442 uint16_t max_rate;
443 /* Set the upper bound encoder rate.
444 *
445 * 0x0000 : Blank frame
446 * 0x0001 : Eighth rate
447 * 0x0002 : Quarter rate
448 * 0x0003 : Half rate
449 * 0x0004 : Full rate
450 */
451} __packed;
452
453struct vss_istream_cmd_set_enc_dtx_mode_t {
454 uint32_t enable;
455 /* Toggle DTX on or off.
456 *
457 * 0 : Disables DTX
458 * 1 : Enables DTX
459 */
460} __packed;
461
Helen Zeng29eb7442011-06-20 11:06:29 -0700462struct vss_istream_cmd_register_calibration_data_t {
463 uint32_t phys_addr;
464 /* Phsical address to be registered with stream. The calibration data
465 * is stored at this address.
466 */
467 uint32_t mem_size;
468 /* Size of the calibration data in bytes. */
469};
470
Helen Zengbb49c702011-09-06 14:09:13 -0700471struct vss_icommon_cmd_set_ui_property_st_enable_t {
472 uint32_t module_id;
473 /* Unique ID of the module. */
474 uint32_t param_id;
475 /* Unique ID of the parameter. */
476 uint16_t param_size;
477 /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
478 uint16_t reserved;
479 /* Reserved; set to 0. */
480 uint16_t enable;
481 uint16_t reserved_field;
482 /* Reserved, set to 0. */
483};
484
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485struct cvs_create_passive_ctl_session_cmd {
486 struct apr_hdr hdr;
487 struct vss_istream_cmd_create_passive_control_session_t cvs_session;
488} __packed;
489
490struct cvs_create_full_ctl_session_cmd {
491 struct apr_hdr hdr;
492 struct vss_istream_cmd_create_full_control_session_t cvs_session;
Neema Shetty2c07eb52011-08-21 20:33:52 -0700493} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494
495struct cvs_destroy_session_cmd {
496 struct apr_hdr hdr;
497} __packed;
498
499struct cvs_set_mute_cmd {
500 struct apr_hdr hdr;
501 struct vss_istream_cmd_set_mute_t cvs_set_mute;
502} __packed;
503
504struct cvs_set_media_type_cmd {
505 struct apr_hdr hdr;
506 struct vss_istream_cmd_set_media_type_t media_type;
507} __packed;
508
509struct cvs_send_dec_buf_cmd {
510 struct apr_hdr hdr;
511 struct vss_istream_evt_send_dec_buffer_t dec_buf;
512} __packed;
513
514struct cvs_set_amr_enc_rate_cmd {
515 struct apr_hdr hdr;
516 struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
517} __packed;
518
519struct cvs_set_amrwb_enc_rate_cmd {
520 struct apr_hdr hdr;
521 struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
522} __packed;
523
524struct cvs_set_cdma_enc_minmax_rate_cmd {
525 struct apr_hdr hdr;
526 struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
527} __packed;
528
529struct cvs_set_enc_dtx_mode_cmd {
530 struct apr_hdr hdr;
531 struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
532} __packed;
533
Helen Zeng29eb7442011-06-20 11:06:29 -0700534struct cvs_register_cal_data_cmd {
535 struct apr_hdr hdr;
536 struct vss_istream_cmd_register_calibration_data_t cvs_cal_data;
537} __packed;
538
539struct cvs_deregister_cal_data_cmd {
540 struct apr_hdr hdr;
541} __packed;
542
Helen Zengbb49c702011-09-06 14:09:13 -0700543struct cvs_set_slowtalk_enable_cmd {
544 struct apr_hdr hdr;
545 struct vss_icommon_cmd_set_ui_property_st_enable_t vss_set_st;
546} __packed;
547
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548/* TO CVP commands */
549
550#define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
551/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
552
553#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
554
555#define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4
556
557#define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
558
559#define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE
560
561#define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
562/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
563
564#define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
565/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
566
Helen Zeng29eb7442011-06-20 11:06:29 -0700567#define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA 0x00011275
568#define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
569
570#define VSS_IVOCPROC_CMD_REGISTER_VOLUME_CAL_TABLE 0x00011277
571#define VSS_IVOCPROC_CMD_DEREGISTER_VOLUME_CAL_TABLE 0x00011278
572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573#define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
574#define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
575#define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
576
577#define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
578
579/* Newtwork IDs */
580#define VSS_NETWORK_ID_DEFAULT 0x00010037
581#define VSS_NETWORK_ID_VOIP_NB 0x00011240
582#define VSS_NETWORK_ID_VOIP_WB 0x00011241
583#define VSS_NETWORK_ID_VOIP_WV 0x00011242
584
585/* Media types */
586#define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
587/* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
588#define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
589/* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
590#define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
591/* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
592#define VSS_MEDIA_ID_PCM_NB 0x00010FCB
593#define VSS_MEDIA_ID_PCM_WB 0x00010FCC
594/* Linear PCM (16-bit, little-endian). */
595#define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
596/* G.711 a-law (contains two 10ms vocoder frames). */
597#define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
598/* G.711 mu-law (contains two 10ms vocoder frames). */
599#define VSS_MEDIA_ID_G729 0x00010FD0
600/* G.729AB (contains two 10ms vocoder frames. */
601
602#define VOICE_CMD_SET_PARAM 0x00011006
603#define VOICE_CMD_GET_PARAM 0x00011007
604#define VOICE_EVT_GET_PARAM_ACK 0x00011008
605
606struct vss_ivocproc_cmd_create_full_control_session_t {
607 uint16_t direction;
608 /*
609 * stream direction.
610 * 0 : TX only
611 * 1 : RX only
612 * 2 : TX and RX
613 */
614 uint32_t tx_port_id;
615 /*
616 * TX device port ID which vocproc will connect to. If not supplying a
617 * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
618 */
619 uint32_t tx_topology_id;
620 /*
621 * Tx leg topology ID. If not supplying a topology ID set to
622 * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
623 */
624 uint32_t rx_port_id;
625 /*
626 * RX device port ID which vocproc will connect to. If not supplying a
627 * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
628 */
629 uint32_t rx_topology_id;
630 /*
631 * Rx leg topology ID. If not supplying a topology ID set to
632 * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
633 */
634 int32_t network_id;
635 /*
636 * Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network
637 * ID set to VSS_NETWORK_ID_DEFAULT.
638 */
639} __packed;
640
641struct vss_ivocproc_cmd_set_volume_index_t {
642 uint16_t vol_index;
643 /**<
644 * Volume index utilized by the vocproc to index into the volume table
645 * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
646 * volume on the VDSP.
647 */
648} __packed;
649
650struct vss_ivocproc_cmd_set_device_t {
651 uint32_t tx_port_id;
652 /**<
653 * TX device port ID which vocproc will connect to.
654 * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
655 */
656 uint32_t tx_topology_id;
657 /**<
658 * TX leg topology ID.
659 * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
660 * pre/post-processing blocks and is pass-through.
661 */
662 int32_t rx_port_id;
663 /**<
664 * RX device port ID which vocproc will connect to.
665 * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
666 */
667 uint32_t rx_topology_id;
668 /**<
669 * RX leg topology ID.
670 * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
671 * pre/post-processing blocks and is pass-through.
672 */
673} __packed;
674
Helen Zeng29eb7442011-06-20 11:06:29 -0700675struct vss_ivocproc_cmd_register_calibration_data_t {
676 uint32_t phys_addr;
677 /* Phsical address to be registered with vocproc. Calibration data
678 * is stored at this address.
679 */
680 uint32_t mem_size;
681 /* Size of the calibration data in bytes. */
682} __packed;
683
684struct vss_ivocproc_cmd_register_volume_cal_table_t {
685 uint32_t phys_addr;
686 /* Phsical address to be registered with the vocproc. The volume
687 * calibration table is stored at this location.
688 */
689
690 uint32_t mem_size;
691 /* Size of the volume calibration table in bytes. */
692} __packed;
693
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700694struct cvp_create_full_ctl_session_cmd {
695 struct apr_hdr hdr;
696 struct vss_ivocproc_cmd_create_full_control_session_t cvp_session;
697} __packed;
698
699struct cvp_command {
700 struct apr_hdr hdr;
701} __packed;
702
703struct cvp_set_device_cmd {
704 struct apr_hdr hdr;
705 struct vss_ivocproc_cmd_set_device_t cvp_set_device;
706} __packed;
707
708struct cvp_set_vp3_data_cmd {
709 struct apr_hdr hdr;
710} __packed;
711
712struct cvp_set_rx_volume_index_cmd {
713 struct apr_hdr hdr;
714 struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
715} __packed;
716
Helen Zeng29eb7442011-06-20 11:06:29 -0700717struct cvp_register_cal_data_cmd {
718 struct apr_hdr hdr;
719 struct vss_ivocproc_cmd_register_calibration_data_t cvp_cal_data;
720} __packed;
721
722struct cvp_deregister_cal_data_cmd {
723 struct apr_hdr hdr;
724} __packed;
725
726struct cvp_register_vol_cal_table_cmd {
727 struct apr_hdr hdr;
728 struct vss_ivocproc_cmd_register_volume_cal_table_t cvp_vol_cal_tbl;
729} __packed;
730
731struct cvp_deregister_vol_cal_table_cmd {
732 struct apr_hdr hdr;
733} __packed;
734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735/* CB for up-link packets. */
736typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
737 uint32_t pkt_len,
738 void *private_data);
739
740/* CB for down-link packets. */
741typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
742 uint32_t *pkt_len,
743 void *private_data);
744
745
746struct mvs_driver_info {
747 uint32_t media_type;
748 uint32_t rate;
749 uint32_t network_type;
750 ul_cb_fn ul_cb;
751 dl_cb_fn dl_cb;
752 void *private_data;
753};
754
755struct incall_rec_info {
756 uint32_t pending;
757 uint32_t rec_mode;
758};
759
760struct incall_music_info {
Helen Zeng0705a5f2011-10-14 15:29:52 -0700761 uint32_t play_enable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700762 uint32_t playing;
Helen Zeng0705a5f2011-10-14 15:29:52 -0700763 int count;
764 int force;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700765};
766
767struct voice_data {
768 int voc_state;/*INIT, CHANGE, RELEASE, RUN */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769
770 wait_queue_head_t mvm_wait;
771 wait_queue_head_t cvs_wait;
772 wait_queue_head_t cvp_wait;
773
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700774 /* cache the values related to Rx and Tx */
775 struct device_data dev_rx;
776 struct device_data dev_tx;
777
Neema Shetty2c07eb52011-08-21 20:33:52 -0700778 u32 mvm_state;
779 u32 cvs_state;
780 u32 cvp_state;
781
782 /* Handle to MVM in the Q6 */
783 u16 mvm_handle;
784 /* Handle to CVS in the Q6 */
785 u16 cvs_handle;
786 /* Handle to CVP in the Q6 */
787 u16 cvp_handle;
788
789 struct mutex lock;
790
791 uint16_t sidetone_gain;
792 uint8_t tty_mode;
793 /* widevoice enable value */
794 uint8_t wv_enable;
Helen Zengbb49c702011-09-06 14:09:13 -0700795 /* slowtalk enable value */
796 uint32_t st_enable;
Neema Shetty2c07eb52011-08-21 20:33:52 -0700797
798 struct voice_dev_route_state voc_route_state;
799
800 u16 session_id;
Helen Zeng0705a5f2011-10-14 15:29:52 -0700801 struct incall_music_info music_info;
Neema Shetty2c07eb52011-08-21 20:33:52 -0700802};
803
804#define MAX_VOC_SESSIONS 2
805#define SESSION_ID_BASE 0xFFF0
806
807struct common_data {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700808 /* these default values are for all devices */
809 uint32_t default_mute_val;
810 uint32_t default_vol_val;
811 uint32_t default_sample_val;
812
813 /* APR to MVM in the Q6 */
814 void *apr_q6_mvm;
815 /* APR to CVS in the Q6 */
816 void *apr_q6_cvs;
817 /* APR to CVP in the Q6 */
818 void *apr_q6_cvp;
819
Neema Shetty2c07eb52011-08-21 20:33:52 -0700820 struct mutex common_lock;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821
822 struct mvs_driver_info mvs_info;
823
Neema Shetty2c07eb52011-08-21 20:33:52 -0700824 struct voice_data voice[MAX_VOC_SESSIONS];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700825};
826
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700827void voc_register_mvs_cb(ul_cb_fn ul_cb,
828 dl_cb_fn dl_cb,
829 void *private_data);
830
831void voc_config_vocoder(uint32_t media_type,
832 uint32_t rate,
833 uint32_t network_type);
834
835enum {
836 DEV_RX = 0,
837 DEV_TX,
838};
839
840enum {
841 RX_PATH = 0,
842 TX_PATH,
843};
844
845/* called by alsa driver */
Helen Zengbb49c702011-09-06 14:09:13 -0700846int voc_set_slowtalk_enable(uint16_t session_id, uint32_t st_enable);
847uint32_t voc_get_slowtalk_enable(uint16_t session_id);
Neema Shetty2c07eb52011-08-21 20:33:52 -0700848int voc_set_widevoice_enable(uint16_t session_id, uint32_t wv_enable);
849uint32_t voc_get_widevoice_enable(uint16_t session_id);
850uint8_t voc_get_tty_mode(uint16_t session_id);
851int voc_set_tty_mode(uint16_t session_id, uint8_t tty_mode);
852int voc_start_voice_call(uint16_t session_id);
853int voc_end_voice_call(uint16_t session_id);
854int voc_set_rxtx_port(uint16_t session_id,
855 uint32_t dev_port_id,
856 uint32_t dev_type);
857int voc_set_rx_vol_index(uint16_t session_id, uint32_t dir, uint32_t voc_idx);
858int voc_set_tx_mute(uint16_t session_id, uint32_t dir, uint32_t mute);
859int voc_disable_cvp(uint16_t session_id);
860int voc_enable_cvp(uint16_t session_id);
861int voc_set_route_flag(uint16_t session_id, uint8_t path_dir, uint8_t set);
862uint8_t voc_get_route_flag(uint16_t session_id, uint8_t path_dir);
863
864#define VOICE_SESSION_NAME "Voice session"
865#define VOIP_SESSION_NAME "VoIP session"
866uint16_t voc_get_session_id(char *name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867
Helen Zeng0705a5f2011-10-14 15:29:52 -0700868int voc_start_playback(uint32_t set);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869#endif