| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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> |
| Helen Zeng | 6e64dba | 2012-03-08 18:30:11 -0800 | [diff] [blame] | 16 | #include <linux/ion.h> |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | |
| Helen Zeng | 2095e57 | 2011-08-15 18:30:43 -0700 | [diff] [blame] | 18 | #define MAX_VOC_PKT_SIZE 642 |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 19 | #define SESSION_NAME_LEN 20 |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 21 | #define VOC_REC_UPLINK 0x00 |
| 22 | #define VOC_REC_DOWNLINK 0x01 |
| 23 | #define VOC_REC_BOTH 0x02 |
| 24 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | struct voice_header { |
| 26 | uint32_t id; |
| 27 | uint32_t data_len; |
| 28 | }; |
| 29 | |
| 30 | struct voice_init { |
| 31 | struct voice_header hdr; |
| 32 | void *cb_handle; |
| 33 | }; |
| 34 | |
| 35 | /* Device information payload structure */ |
| 36 | |
| 37 | struct device_data { |
| 38 | uint32_t volume; /* in index */ |
| 39 | uint32_t mute; |
| 40 | uint32_t sample; |
| 41 | uint32_t enabled; |
| 42 | uint32_t dev_id; |
| 43 | uint32_t port_id; |
| 44 | }; |
| 45 | |
| 46 | struct voice_dev_route_state { |
| 47 | u16 rx_route_flag; |
| 48 | u16 tx_route_flag; |
| 49 | }; |
| 50 | |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 51 | struct voice_rec_route_state { |
| 52 | u16 ul_flag; |
| 53 | u16 dl_flag; |
| 54 | }; |
| 55 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 56 | enum { |
| 57 | VOC_INIT = 0, |
| 58 | VOC_RUN, |
| 59 | VOC_CHANGE, |
| 60 | VOC_RELEASE, |
| 61 | }; |
| 62 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 63 | /* Common */ |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 64 | #define VSS_ICOMMON_CMD_SET_UI_PROPERTY 0x00011103 |
| 65 | /* Set a UI property */ |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 66 | #define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025 |
| 67 | #define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026 |
| 68 | /* General shared memory; byte-accessible, 4 kB-aligned. */ |
| 69 | #define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3 |
| 70 | |
| 71 | struct vss_icommon_cmd_map_memory_t { |
| 72 | uint32_t phys_addr; |
| 73 | /* Physical address of a memory region; must be at least |
| 74 | * 4 kB aligned. |
| 75 | */ |
| 76 | |
| 77 | uint32_t mem_size; |
| 78 | /* Number of bytes in the region; should be a multiple of 32. */ |
| 79 | |
| 80 | uint16_t mem_pool_id; |
| 81 | /* Type of memory being provided. The memory ID implicitly defines |
| 82 | * the characteristics of the memory. The characteristics might include |
| 83 | * alignment type, permissions, etc. |
| 84 | * Memory pool ID. Possible values: |
| 85 | * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL. |
| 86 | */ |
| 87 | } __packed; |
| 88 | |
| 89 | struct vss_icommon_cmd_unmap_memory_t { |
| 90 | uint32_t phys_addr; |
| 91 | /* Physical address of a memory region; must be at least |
| 92 | * 4 kB aligned. |
| 93 | */ |
| 94 | } __packed; |
| 95 | |
| 96 | struct vss_map_memory_cmd { |
| 97 | struct apr_hdr hdr; |
| 98 | struct vss_icommon_cmd_map_memory_t vss_map_mem; |
| 99 | } __packed; |
| 100 | |
| 101 | struct vss_unmap_memory_cmd { |
| 102 | struct apr_hdr hdr; |
| 103 | struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem; |
| 104 | } __packed; |
| 105 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | /* TO MVM commands */ |
| 107 | #define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF |
| 108 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 109 | |
| 110 | #define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE |
| 111 | /* Create a new full control MVM session. */ |
| 112 | |
| 113 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 114 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 115 | |
| 116 | #define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C |
| 117 | /* Attach a stream to the MVM. */ |
| 118 | |
| 119 | #define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D |
| 120 | /* Detach a stream from the MVM. */ |
| 121 | |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 122 | #define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E |
| 123 | /* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc |
| 124 | * to all the streams currently attached to it. |
| 125 | */ |
| 126 | |
| 127 | #define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F |
| 128 | /* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this |
| 129 | * vocproc from all the streams to which it is currently attached. |
| 130 | */ |
| 131 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 132 | #define VSS_IMVM_CMD_START_VOICE 0x00011190 |
| 133 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 134 | |
| 135 | #define VSS_IMVM_CMD_STOP_VOICE 0x00011192 |
| 136 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 137 | |
| 138 | #define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8 |
| 139 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 140 | |
| 141 | #define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9 |
| 142 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 143 | |
| 144 | |
| 145 | #define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196 |
| 146 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 147 | |
| 148 | #define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C |
| 149 | /* Set the network type. */ |
| 150 | |
| 151 | #define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0 |
| 152 | /* Set the voice timing parameters. */ |
| 153 | |
| Helen Zeng | 44d4d27 | 2011-08-10 14:49:20 -0700 | [diff] [blame] | 154 | #define VSS_IWIDEVOICE_CMD_SET_WIDEVOICE 0x00011243 |
| 155 | /* Enable/disable WideVoice */ |
| 156 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 157 | struct vss_istream_cmd_set_tty_mode_t { |
| 158 | uint32_t mode; |
| 159 | /**< |
| 160 | * TTY mode. |
| 161 | * |
| 162 | * 0 : TTY disabled |
| 163 | * 1 : HCO |
| 164 | * 2 : VCO |
| 165 | * 3 : FULL |
| 166 | */ |
| 167 | } __packed; |
| 168 | |
| 169 | struct vss_istream_cmd_attach_vocproc_t { |
| 170 | uint16_t handle; |
| 171 | /**< Handle of vocproc being attached. */ |
| 172 | } __packed; |
| 173 | |
| 174 | struct vss_istream_cmd_detach_vocproc_t { |
| 175 | uint16_t handle; |
| 176 | /**< Handle of vocproc being detached. */ |
| 177 | } __packed; |
| 178 | |
| 179 | struct vss_imvm_cmd_attach_stream_t { |
| 180 | uint16_t handle; |
| 181 | /* The stream handle to attach. */ |
| 182 | } __packed; |
| 183 | |
| 184 | struct vss_imvm_cmd_detach_stream_t { |
| 185 | uint16_t handle; |
| 186 | /* The stream handle to detach. */ |
| 187 | } __packed; |
| 188 | |
| 189 | struct vss_icommon_cmd_set_network_t { |
| 190 | uint32_t network_id; |
| 191 | /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */ |
| 192 | } __packed; |
| 193 | |
| 194 | struct vss_icommon_cmd_set_voice_timing_t { |
| 195 | uint16_t mode; |
| 196 | /* |
| 197 | * The vocoder frame synchronization mode. |
| 198 | * |
| 199 | * 0 : No frame sync. |
| 200 | * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt). |
| 201 | */ |
| 202 | uint16_t enc_offset; |
| 203 | /* |
| 204 | * The offset in microseconds from the VFR to deliver a Tx vocoder |
| 205 | * packet. The offset should be less than 20000us. |
| 206 | */ |
| 207 | uint16_t dec_req_offset; |
| 208 | /* |
| 209 | * The offset in microseconds from the VFR to request for an Rx vocoder |
| 210 | * packet. The offset should be less than 20000us. |
| 211 | */ |
| 212 | uint16_t dec_offset; |
| 213 | /* |
| 214 | * The offset in microseconds from the VFR to indicate the deadline to |
| 215 | * receive an Rx vocoder packet. The offset should be less than 20000us. |
| 216 | * Rx vocoder packets received after this deadline are not guaranteed to |
| 217 | * be processed. |
| 218 | */ |
| 219 | } __packed; |
| 220 | |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 221 | struct vss_imvm_cmd_create_control_session_t { |
| 222 | char name[SESSION_NAME_LEN]; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 223 | /* |
| 224 | * A variable-sized stream name. |
| 225 | * |
| 226 | * The stream name size is the payload size minus the size of the other |
| 227 | * fields. |
| 228 | */ |
| 229 | } __packed; |
| 230 | |
| Helen Zeng | 44d4d27 | 2011-08-10 14:49:20 -0700 | [diff] [blame] | 231 | struct vss_iwidevoice_cmd_set_widevoice_t { |
| 232 | uint32_t enable; |
| 233 | /* WideVoice enable/disable; possible values: |
| 234 | * - 0 -- WideVoice disabled |
| 235 | * - 1 -- WideVoice enabled |
| 236 | */ |
| 237 | } __packed; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 238 | |
| 239 | struct mvm_attach_vocproc_cmd { |
| 240 | struct apr_hdr hdr; |
| 241 | struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle; |
| 242 | } __packed; |
| 243 | |
| 244 | struct mvm_detach_vocproc_cmd { |
| 245 | struct apr_hdr hdr; |
| 246 | struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle; |
| 247 | } __packed; |
| 248 | |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 249 | struct mvm_create_ctl_session_cmd { |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 250 | struct apr_hdr hdr; |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 251 | struct vss_imvm_cmd_create_control_session_t mvm_session; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 252 | } __packed; |
| 253 | |
| 254 | struct mvm_set_tty_mode_cmd { |
| 255 | struct apr_hdr hdr; |
| 256 | struct vss_istream_cmd_set_tty_mode_t tty_mode; |
| 257 | } __packed; |
| 258 | |
| 259 | struct mvm_attach_stream_cmd { |
| 260 | struct apr_hdr hdr; |
| 261 | struct vss_imvm_cmd_attach_stream_t attach_stream; |
| 262 | } __packed; |
| 263 | |
| 264 | struct mvm_detach_stream_cmd { |
| 265 | struct apr_hdr hdr; |
| 266 | struct vss_imvm_cmd_detach_stream_t detach_stream; |
| 267 | } __packed; |
| 268 | |
| 269 | struct mvm_set_network_cmd { |
| 270 | struct apr_hdr hdr; |
| 271 | struct vss_icommon_cmd_set_network_t network; |
| 272 | } __packed; |
| 273 | |
| 274 | struct mvm_set_voice_timing_cmd { |
| 275 | struct apr_hdr hdr; |
| 276 | struct vss_icommon_cmd_set_voice_timing_t timing; |
| 277 | } __packed; |
| 278 | |
| Helen Zeng | 44d4d27 | 2011-08-10 14:49:20 -0700 | [diff] [blame] | 279 | struct mvm_set_widevoice_enable_cmd { |
| 280 | struct apr_hdr hdr; |
| 281 | struct vss_iwidevoice_cmd_set_widevoice_t vss_set_wv; |
| 282 | } __packed; |
| 283 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 284 | /* TO CVS commands */ |
| 285 | #define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140 |
| 286 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 287 | |
| 288 | #define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7 |
| 289 | /* Create a new full control stream session. */ |
| 290 | |
| 291 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 292 | |
| 293 | #define VSS_ISTREAM_CMD_SET_MUTE 0x00011022 |
| 294 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 295 | #define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA 0x00011279 |
| 296 | |
| 297 | #define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A |
| 298 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 299 | #define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186 |
| 300 | /* Set media type on the stream. */ |
| 301 | |
| 302 | #define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015 |
| 303 | /* Event sent by the stream to its client to provide an encoded packet. */ |
| 304 | |
| 305 | #define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017 |
| 306 | /* Event sent by the stream to its client requesting for a decoder packet. |
| 307 | * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event. |
| 308 | */ |
| 309 | |
| 310 | #define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016 |
| 311 | /* Event sent by the client to the stream in response to a |
| 312 | * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet. |
| 313 | */ |
| 314 | |
| 315 | #define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E |
| 316 | /* Set AMR encoder rate. */ |
| 317 | |
| 318 | #define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F |
| 319 | /* Set AMR-WB encoder rate. */ |
| 320 | |
| 321 | #define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019 |
| 322 | /* Set encoder minimum and maximum rate. */ |
| 323 | |
| 324 | #define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D |
| 325 | /* Set encoder DTX mode. */ |
| 326 | |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 327 | #define MODULE_ID_VOICE_MODULE_FENS 0x00010EEB |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 328 | #define MODULE_ID_VOICE_MODULE_ST 0x00010EE3 |
| 329 | #define VOICE_PARAM_MOD_ENABLE 0x00010E00 |
| 330 | #define MOD_ENABLE_PARAM_LEN 4 |
| 331 | |
| Helen Zeng | 0705a5f | 2011-10-14 15:29:52 -0700 | [diff] [blame] | 332 | #define VSS_ISTREAM_CMD_START_PLAYBACK 0x00011238 |
| 333 | /* Start in-call music delivery on the Tx voice path. */ |
| 334 | |
| 335 | #define VSS_ISTREAM_CMD_STOP_PLAYBACK 0x00011239 |
| 336 | /* Stop the in-call music delivery on the Tx voice path. */ |
| 337 | |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 338 | #define VSS_ISTREAM_CMD_START_RECORD 0x00011236 |
| 339 | /* Start in-call conversation recording. */ |
| 340 | #define VSS_ISTREAM_CMD_STOP_RECORD 0x00011237 |
| 341 | /* Stop in-call conversation recording. */ |
| 342 | |
| 343 | #define VSS_TAP_POINT_NONE 0x00010F78 |
| 344 | /* Indicates no tapping for specified path. */ |
| 345 | |
| 346 | #define VSS_TAP_POINT_STREAM_END 0x00010F79 |
| 347 | /* Indicates that specified path should be tapped at the end of the stream. */ |
| 348 | |
| 349 | struct vss_istream_cmd_start_record_t { |
| 350 | uint32_t rx_tap_point; |
| 351 | /* Tap point to use on the Rx path. Supported values are: |
| 352 | * VSS_TAP_POINT_NONE : Do not record Rx path. |
| 353 | * VSS_TAP_POINT_STREAM_END : Rx tap point is at the end of the stream. |
| 354 | */ |
| 355 | uint32_t tx_tap_point; |
| 356 | /* Tap point to use on the Tx path. Supported values are: |
| 357 | * VSS_TAP_POINT_NONE : Do not record tx path. |
| 358 | * VSS_TAP_POINT_STREAM_END : Tx tap point is at the end of the stream. |
| 359 | */ |
| 360 | } __packed; |
| 361 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 362 | struct vss_istream_cmd_create_passive_control_session_t { |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 363 | char name[SESSION_NAME_LEN]; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 364 | /**< |
| 365 | * A variable-sized stream name. |
| 366 | * |
| 367 | * The stream name size is the payload size minus the size of the other |
| 368 | * fields. |
| 369 | */ |
| 370 | } __packed; |
| 371 | |
| 372 | struct vss_istream_cmd_set_mute_t { |
| 373 | uint16_t direction; |
| 374 | /**< |
| 375 | * 0 : TX only |
| 376 | * 1 : RX only |
| 377 | * 2 : TX and Rx |
| 378 | */ |
| 379 | uint16_t mute_flag; |
| 380 | /**< |
| 381 | * Mute, un-mute. |
| 382 | * |
| 383 | * 0 : Silence disable |
| 384 | * 1 : Silence enable |
| 385 | * 2 : CNG enable. Applicable to TX only. If set on RX behavior |
| 386 | * will be the same as 1 |
| 387 | */ |
| 388 | } __packed; |
| 389 | |
| 390 | struct vss_istream_cmd_create_full_control_session_t { |
| 391 | uint16_t direction; |
| 392 | /* |
| 393 | * Stream direction. |
| 394 | * |
| 395 | * 0 : TX only |
| 396 | * 1 : RX only |
| 397 | * 2 : TX and RX |
| 398 | * 3 : TX and RX loopback |
| 399 | */ |
| 400 | uint32_t enc_media_type; |
| 401 | /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 402 | uint32_t dec_media_type; |
| 403 | /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 404 | uint32_t network_id; |
| 405 | /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */ |
| Helen Zeng | 69b0096 | 2011-07-08 11:38:36 -0700 | [diff] [blame] | 406 | char name[SESSION_NAME_LEN]; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 407 | /* |
| 408 | * A variable-sized stream name. |
| 409 | * |
| 410 | * The stream name size is the payload size minus the size of the other |
| 411 | * fields. |
| 412 | */ |
| 413 | } __packed; |
| 414 | |
| 415 | struct vss_istream_cmd_set_media_type_t { |
| 416 | uint32_t rx_media_id; |
| 417 | /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 418 | uint32_t tx_media_id; |
| 419 | /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 420 | } __packed; |
| 421 | |
| 422 | struct vss_istream_evt_send_enc_buffer_t { |
| 423 | uint32_t media_id; |
| 424 | /* Media ID of the packet. */ |
| 425 | uint8_t packet_data[MAX_VOC_PKT_SIZE]; |
| 426 | /* Packet data buffer. */ |
| 427 | } __packed; |
| 428 | |
| 429 | struct vss_istream_evt_send_dec_buffer_t { |
| 430 | uint32_t media_id; |
| 431 | /* Media ID of the packet. */ |
| 432 | uint8_t packet_data[MAX_VOC_PKT_SIZE]; |
| 433 | /* Packet data. */ |
| 434 | } __packed; |
| 435 | |
| 436 | struct vss_istream_cmd_voc_amr_set_enc_rate_t { |
| 437 | uint32_t mode; |
| 438 | /* Set the AMR encoder rate. |
| 439 | * |
| 440 | * 0x00000000 : 4.75 kbps |
| 441 | * 0x00000001 : 5.15 kbps |
| 442 | * 0x00000002 : 5.90 kbps |
| 443 | * 0x00000003 : 6.70 kbps |
| 444 | * 0x00000004 : 7.40 kbps |
| 445 | * 0x00000005 : 7.95 kbps |
| 446 | * 0x00000006 : 10.2 kbps |
| 447 | * 0x00000007 : 12.2 kbps |
| 448 | */ |
| 449 | } __packed; |
| 450 | |
| 451 | struct vss_istream_cmd_voc_amrwb_set_enc_rate_t { |
| 452 | uint32_t mode; |
| 453 | /* Set the AMR-WB encoder rate. |
| 454 | * |
| 455 | * 0x00000000 : 6.60 kbps |
| 456 | * 0x00000001 : 8.85 kbps |
| 457 | * 0x00000002 : 12.65 kbps |
| 458 | * 0x00000003 : 14.25 kbps |
| 459 | * 0x00000004 : 15.85 kbps |
| 460 | * 0x00000005 : 18.25 kbps |
| 461 | * 0x00000006 : 19.85 kbps |
| 462 | * 0x00000007 : 23.05 kbps |
| 463 | * 0x00000008 : 23.85 kbps |
| 464 | */ |
| 465 | } __packed; |
| 466 | |
| 467 | struct vss_istream_cmd_cdma_set_enc_minmax_rate_t { |
| 468 | uint16_t min_rate; |
| 469 | /* Set the lower bound encoder rate. |
| 470 | * |
| 471 | * 0x0000 : Blank frame |
| 472 | * 0x0001 : Eighth rate |
| 473 | * 0x0002 : Quarter rate |
| 474 | * 0x0003 : Half rate |
| 475 | * 0x0004 : Full rate |
| 476 | */ |
| 477 | uint16_t max_rate; |
| 478 | /* Set the upper bound encoder rate. |
| 479 | * |
| 480 | * 0x0000 : Blank frame |
| 481 | * 0x0001 : Eighth rate |
| 482 | * 0x0002 : Quarter rate |
| 483 | * 0x0003 : Half rate |
| 484 | * 0x0004 : Full rate |
| 485 | */ |
| 486 | } __packed; |
| 487 | |
| 488 | struct vss_istream_cmd_set_enc_dtx_mode_t { |
| 489 | uint32_t enable; |
| 490 | /* Toggle DTX on or off. |
| 491 | * |
| 492 | * 0 : Disables DTX |
| 493 | * 1 : Enables DTX |
| 494 | */ |
| 495 | } __packed; |
| 496 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 497 | struct vss_istream_cmd_register_calibration_data_t { |
| 498 | uint32_t phys_addr; |
| 499 | /* Phsical address to be registered with stream. The calibration data |
| 500 | * is stored at this address. |
| 501 | */ |
| 502 | uint32_t mem_size; |
| 503 | /* Size of the calibration data in bytes. */ |
| 504 | }; |
| 505 | |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 506 | struct vss_icommon_cmd_set_ui_property_enable_t { |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 507 | uint32_t module_id; |
| 508 | /* Unique ID of the module. */ |
| 509 | uint32_t param_id; |
| 510 | /* Unique ID of the parameter. */ |
| 511 | uint16_t param_size; |
| 512 | /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */ |
| 513 | uint16_t reserved; |
| 514 | /* Reserved; set to 0. */ |
| 515 | uint16_t enable; |
| 516 | uint16_t reserved_field; |
| 517 | /* Reserved, set to 0. */ |
| 518 | }; |
| 519 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 520 | struct cvs_create_passive_ctl_session_cmd { |
| 521 | struct apr_hdr hdr; |
| 522 | struct vss_istream_cmd_create_passive_control_session_t cvs_session; |
| 523 | } __packed; |
| 524 | |
| 525 | struct cvs_create_full_ctl_session_cmd { |
| 526 | struct apr_hdr hdr; |
| 527 | struct vss_istream_cmd_create_full_control_session_t cvs_session; |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 528 | } __packed; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 529 | |
| 530 | struct cvs_destroy_session_cmd { |
| 531 | struct apr_hdr hdr; |
| 532 | } __packed; |
| 533 | |
| 534 | struct cvs_set_mute_cmd { |
| 535 | struct apr_hdr hdr; |
| 536 | struct vss_istream_cmd_set_mute_t cvs_set_mute; |
| 537 | } __packed; |
| 538 | |
| 539 | struct cvs_set_media_type_cmd { |
| 540 | struct apr_hdr hdr; |
| 541 | struct vss_istream_cmd_set_media_type_t media_type; |
| 542 | } __packed; |
| 543 | |
| 544 | struct cvs_send_dec_buf_cmd { |
| 545 | struct apr_hdr hdr; |
| 546 | struct vss_istream_evt_send_dec_buffer_t dec_buf; |
| 547 | } __packed; |
| 548 | |
| 549 | struct cvs_set_amr_enc_rate_cmd { |
| 550 | struct apr_hdr hdr; |
| 551 | struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate; |
| 552 | } __packed; |
| 553 | |
| 554 | struct cvs_set_amrwb_enc_rate_cmd { |
| 555 | struct apr_hdr hdr; |
| 556 | struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate; |
| 557 | } __packed; |
| 558 | |
| 559 | struct cvs_set_cdma_enc_minmax_rate_cmd { |
| 560 | struct apr_hdr hdr; |
| 561 | struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate; |
| 562 | } __packed; |
| 563 | |
| 564 | struct cvs_set_enc_dtx_mode_cmd { |
| 565 | struct apr_hdr hdr; |
| 566 | struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode; |
| 567 | } __packed; |
| 568 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 569 | struct cvs_register_cal_data_cmd { |
| 570 | struct apr_hdr hdr; |
| 571 | struct vss_istream_cmd_register_calibration_data_t cvs_cal_data; |
| 572 | } __packed; |
| 573 | |
| 574 | struct cvs_deregister_cal_data_cmd { |
| 575 | struct apr_hdr hdr; |
| 576 | } __packed; |
| 577 | |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 578 | struct cvs_set_pp_enable_cmd { |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 579 | struct apr_hdr hdr; |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 580 | struct vss_icommon_cmd_set_ui_property_enable_t vss_set_pp; |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 581 | } __packed; |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 582 | struct cvs_start_record_cmd { |
| 583 | struct apr_hdr hdr; |
| 584 | struct vss_istream_cmd_start_record_t rec_mode; |
| 585 | } __packed; |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 586 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 587 | /* TO CVP commands */ |
| 588 | |
| 589 | #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3 |
| 590 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 591 | |
| 592 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 593 | |
| 594 | #define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4 |
| 595 | |
| 596 | #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB |
| 597 | |
| 598 | #define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE |
| 599 | |
| 600 | #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6 |
| 601 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 602 | |
| 603 | #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1 |
| 604 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 605 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 606 | #define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA 0x00011275 |
| 607 | #define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276 |
| 608 | |
| 609 | #define VSS_IVOCPROC_CMD_REGISTER_VOLUME_CAL_TABLE 0x00011277 |
| 610 | #define VSS_IVOCPROC_CMD_DEREGISTER_VOLUME_CAL_TABLE 0x00011278 |
| 611 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 612 | #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70 |
| 613 | #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71 |
| 614 | #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72 |
| 615 | |
| 616 | #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77 |
| 617 | |
| 618 | /* Newtwork IDs */ |
| 619 | #define VSS_NETWORK_ID_DEFAULT 0x00010037 |
| 620 | #define VSS_NETWORK_ID_VOIP_NB 0x00011240 |
| 621 | #define VSS_NETWORK_ID_VOIP_WB 0x00011241 |
| 622 | #define VSS_NETWORK_ID_VOIP_WV 0x00011242 |
| 623 | |
| 624 | /* Media types */ |
| 625 | #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2 |
| 626 | /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */ |
| 627 | #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6 |
| 628 | /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */ |
| 629 | #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7 |
| 630 | /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */ |
| 631 | #define VSS_MEDIA_ID_PCM_NB 0x00010FCB |
| 632 | #define VSS_MEDIA_ID_PCM_WB 0x00010FCC |
| 633 | /* Linear PCM (16-bit, little-endian). */ |
| 634 | #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD |
| 635 | /* G.711 a-law (contains two 10ms vocoder frames). */ |
| 636 | #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE |
| 637 | /* G.711 mu-law (contains two 10ms vocoder frames). */ |
| 638 | #define VSS_MEDIA_ID_G729 0x00010FD0 |
| 639 | /* G.729AB (contains two 10ms vocoder frames. */ |
| 640 | |
| Helen Zeng | 6865693 | 2011-11-02 18:08:23 -0700 | [diff] [blame] | 641 | #define VSS_IVOCPROC_CMD_SET_MUTE 0x000110EF |
| 642 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 643 | #define VOICE_CMD_SET_PARAM 0x00011006 |
| 644 | #define VOICE_CMD_GET_PARAM 0x00011007 |
| 645 | #define VOICE_EVT_GET_PARAM_ACK 0x00011008 |
| 646 | |
| 647 | struct vss_ivocproc_cmd_create_full_control_session_t { |
| 648 | uint16_t direction; |
| 649 | /* |
| 650 | * stream direction. |
| 651 | * 0 : TX only |
| 652 | * 1 : RX only |
| 653 | * 2 : TX and RX |
| 654 | */ |
| 655 | uint32_t tx_port_id; |
| 656 | /* |
| 657 | * TX device port ID which vocproc will connect to. If not supplying a |
| 658 | * port ID set to VSS_IVOCPROC_PORT_ID_NONE. |
| 659 | */ |
| 660 | uint32_t tx_topology_id; |
| 661 | /* |
| 662 | * Tx leg topology ID. If not supplying a topology ID set to |
| 663 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE. |
| 664 | */ |
| 665 | uint32_t rx_port_id; |
| 666 | /* |
| 667 | * RX device port ID which vocproc will connect to. If not supplying a |
| 668 | * port ID set to VSS_IVOCPROC_PORT_ID_NONE. |
| 669 | */ |
| 670 | uint32_t rx_topology_id; |
| 671 | /* |
| 672 | * Rx leg topology ID. If not supplying a topology ID set to |
| 673 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE. |
| 674 | */ |
| 675 | int32_t network_id; |
| 676 | /* |
| 677 | * Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network |
| 678 | * ID set to VSS_NETWORK_ID_DEFAULT. |
| 679 | */ |
| 680 | } __packed; |
| 681 | |
| 682 | struct vss_ivocproc_cmd_set_volume_index_t { |
| 683 | uint16_t vol_index; |
| 684 | /**< |
| 685 | * Volume index utilized by the vocproc to index into the volume table |
| 686 | * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set |
| 687 | * volume on the VDSP. |
| 688 | */ |
| 689 | } __packed; |
| 690 | |
| 691 | struct vss_ivocproc_cmd_set_device_t { |
| 692 | uint32_t tx_port_id; |
| 693 | /**< |
| 694 | * TX device port ID which vocproc will connect to. |
| 695 | * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port. |
| 696 | */ |
| 697 | uint32_t tx_topology_id; |
| 698 | /**< |
| 699 | * TX leg topology ID. |
| 700 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any |
| 701 | * pre/post-processing blocks and is pass-through. |
| 702 | */ |
| 703 | int32_t rx_port_id; |
| 704 | /**< |
| 705 | * RX device port ID which vocproc will connect to. |
| 706 | * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port. |
| 707 | */ |
| 708 | uint32_t rx_topology_id; |
| 709 | /**< |
| 710 | * RX leg topology ID. |
| 711 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any |
| 712 | * pre/post-processing blocks and is pass-through. |
| 713 | */ |
| 714 | } __packed; |
| 715 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 716 | struct vss_ivocproc_cmd_register_calibration_data_t { |
| 717 | uint32_t phys_addr; |
| 718 | /* Phsical address to be registered with vocproc. Calibration data |
| 719 | * is stored at this address. |
| 720 | */ |
| 721 | uint32_t mem_size; |
| 722 | /* Size of the calibration data in bytes. */ |
| 723 | } __packed; |
| 724 | |
| 725 | struct vss_ivocproc_cmd_register_volume_cal_table_t { |
| 726 | uint32_t phys_addr; |
| 727 | /* Phsical address to be registered with the vocproc. The volume |
| 728 | * calibration table is stored at this location. |
| 729 | */ |
| 730 | |
| 731 | uint32_t mem_size; |
| 732 | /* Size of the volume calibration table in bytes. */ |
| 733 | } __packed; |
| 734 | |
| Helen Zeng | 6865693 | 2011-11-02 18:08:23 -0700 | [diff] [blame] | 735 | struct vss_ivocproc_cmd_set_mute_t { |
| 736 | uint16_t direction; |
| 737 | /* |
| 738 | * 0 : TX only. |
| 739 | * 1 : RX only. |
| 740 | * 2 : TX and Rx. |
| 741 | */ |
| 742 | uint16_t mute_flag; |
| 743 | /* |
| 744 | * Mute, un-mute. |
| 745 | * |
| 746 | * 0 : Disable. |
| 747 | * 1 : Enable. |
| 748 | */ |
| 749 | } __packed; |
| 750 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 751 | struct cvp_create_full_ctl_session_cmd { |
| 752 | struct apr_hdr hdr; |
| 753 | struct vss_ivocproc_cmd_create_full_control_session_t cvp_session; |
| 754 | } __packed; |
| 755 | |
| 756 | struct cvp_command { |
| 757 | struct apr_hdr hdr; |
| 758 | } __packed; |
| 759 | |
| 760 | struct cvp_set_device_cmd { |
| 761 | struct apr_hdr hdr; |
| 762 | struct vss_ivocproc_cmd_set_device_t cvp_set_device; |
| 763 | } __packed; |
| 764 | |
| 765 | struct cvp_set_vp3_data_cmd { |
| 766 | struct apr_hdr hdr; |
| 767 | } __packed; |
| 768 | |
| 769 | struct cvp_set_rx_volume_index_cmd { |
| 770 | struct apr_hdr hdr; |
| 771 | struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx; |
| 772 | } __packed; |
| 773 | |
| Helen Zeng | 29eb744 | 2011-06-20 11:06:29 -0700 | [diff] [blame] | 774 | struct cvp_register_cal_data_cmd { |
| 775 | struct apr_hdr hdr; |
| 776 | struct vss_ivocproc_cmd_register_calibration_data_t cvp_cal_data; |
| 777 | } __packed; |
| 778 | |
| 779 | struct cvp_deregister_cal_data_cmd { |
| 780 | struct apr_hdr hdr; |
| 781 | } __packed; |
| 782 | |
| 783 | struct cvp_register_vol_cal_table_cmd { |
| 784 | struct apr_hdr hdr; |
| 785 | struct vss_ivocproc_cmd_register_volume_cal_table_t cvp_vol_cal_tbl; |
| 786 | } __packed; |
| 787 | |
| 788 | struct cvp_deregister_vol_cal_table_cmd { |
| 789 | struct apr_hdr hdr; |
| 790 | } __packed; |
| 791 | |
| Helen Zeng | 6865693 | 2011-11-02 18:08:23 -0700 | [diff] [blame] | 792 | struct cvp_set_mute_cmd { |
| 793 | struct apr_hdr hdr; |
| 794 | struct vss_ivocproc_cmd_set_mute_t cvp_set_mute; |
| 795 | } __packed; |
| 796 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 797 | /* CB for up-link packets. */ |
| 798 | typedef void (*ul_cb_fn)(uint8_t *voc_pkt, |
| 799 | uint32_t pkt_len, |
| 800 | void *private_data); |
| 801 | |
| 802 | /* CB for down-link packets. */ |
| 803 | typedef void (*dl_cb_fn)(uint8_t *voc_pkt, |
| 804 | uint32_t *pkt_len, |
| 805 | void *private_data); |
| 806 | |
| 807 | |
| 808 | struct mvs_driver_info { |
| 809 | uint32_t media_type; |
| 810 | uint32_t rate; |
| 811 | uint32_t network_type; |
| Helen Zeng | ff97bec | 2012-02-20 14:30:50 -0800 | [diff] [blame] | 812 | uint32_t dtx_mode; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 813 | ul_cb_fn ul_cb; |
| 814 | dl_cb_fn dl_cb; |
| 815 | void *private_data; |
| 816 | }; |
| 817 | |
| 818 | struct incall_rec_info { |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 819 | uint32_t rec_enable; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 820 | uint32_t rec_mode; |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 821 | uint32_t recording; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 822 | }; |
| 823 | |
| 824 | struct incall_music_info { |
| Helen Zeng | 0705a5f | 2011-10-14 15:29:52 -0700 | [diff] [blame] | 825 | uint32_t play_enable; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 826 | uint32_t playing; |
| Helen Zeng | 0705a5f | 2011-10-14 15:29:52 -0700 | [diff] [blame] | 827 | int count; |
| 828 | int force; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 829 | }; |
| 830 | |
| 831 | struct voice_data { |
| 832 | int voc_state;/*INIT, CHANGE, RELEASE, RUN */ |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 833 | |
| 834 | wait_queue_head_t mvm_wait; |
| 835 | wait_queue_head_t cvs_wait; |
| 836 | wait_queue_head_t cvp_wait; |
| 837 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 838 | /* cache the values related to Rx and Tx */ |
| 839 | struct device_data dev_rx; |
| 840 | struct device_data dev_tx; |
| 841 | |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 842 | u32 mvm_state; |
| 843 | u32 cvs_state; |
| 844 | u32 cvp_state; |
| 845 | |
| 846 | /* Handle to MVM in the Q6 */ |
| 847 | u16 mvm_handle; |
| 848 | /* Handle to CVS in the Q6 */ |
| 849 | u16 cvs_handle; |
| 850 | /* Handle to CVP in the Q6 */ |
| 851 | u16 cvp_handle; |
| 852 | |
| 853 | struct mutex lock; |
| 854 | |
| 855 | uint16_t sidetone_gain; |
| 856 | uint8_t tty_mode; |
| 857 | /* widevoice enable value */ |
| 858 | uint8_t wv_enable; |
| Helen Zeng | bb49c70 | 2011-09-06 14:09:13 -0700 | [diff] [blame] | 859 | /* slowtalk enable value */ |
| 860 | uint32_t st_enable; |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 861 | /* FENC enable value */ |
| 862 | uint32_t fens_enable; |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 863 | |
| 864 | struct voice_dev_route_state voc_route_state; |
| 865 | |
| 866 | u16 session_id; |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 867 | |
| 868 | struct incall_rec_info rec_info; |
| 869 | |
| Helen Zeng | 0705a5f | 2011-10-14 15:29:52 -0700 | [diff] [blame] | 870 | struct incall_music_info music_info; |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 871 | |
| 872 | struct voice_rec_route_state rec_route_state; |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 873 | }; |
| 874 | |
| Helen Zeng | 6e64dba | 2012-03-08 18:30:11 -0800 | [diff] [blame] | 875 | struct cal_mem { |
| 876 | struct ion_handle *handle; |
| 877 | uint32_t phy; |
| 878 | void *buf; |
| 879 | }; |
| 880 | |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 881 | #define MAX_VOC_SESSIONS 2 |
| 882 | #define SESSION_ID_BASE 0xFFF0 |
| 883 | |
| 884 | struct common_data { |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 885 | /* these default values are for all devices */ |
| 886 | uint32_t default_mute_val; |
| 887 | uint32_t default_vol_val; |
| 888 | uint32_t default_sample_val; |
| 889 | |
| 890 | /* APR to MVM in the Q6 */ |
| 891 | void *apr_q6_mvm; |
| 892 | /* APR to CVS in the Q6 */ |
| 893 | void *apr_q6_cvs; |
| 894 | /* APR to CVP in the Q6 */ |
| 895 | void *apr_q6_cvp; |
| 896 | |
| Helen Zeng | 6e64dba | 2012-03-08 18:30:11 -0800 | [diff] [blame] | 897 | struct ion_client *client; |
| 898 | struct cal_mem cvp_cal; |
| 899 | struct cal_mem cvs_cal; |
| 900 | |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 901 | struct mutex common_lock; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 902 | |
| 903 | struct mvs_driver_info mvs_info; |
| 904 | |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 905 | struct voice_data voice[MAX_VOC_SESSIONS]; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 906 | }; |
| 907 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 908 | void voc_register_mvs_cb(ul_cb_fn ul_cb, |
| 909 | dl_cb_fn dl_cb, |
| 910 | void *private_data); |
| 911 | |
| 912 | void voc_config_vocoder(uint32_t media_type, |
| 913 | uint32_t rate, |
| Helen Zeng | ff97bec | 2012-02-20 14:30:50 -0800 | [diff] [blame] | 914 | uint32_t network_type, |
| 915 | uint32_t dtx_mode); |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 916 | |
| 917 | enum { |
| 918 | DEV_RX = 0, |
| 919 | DEV_TX, |
| 920 | }; |
| 921 | |
| 922 | enum { |
| 923 | RX_PATH = 0, |
| 924 | TX_PATH, |
| 925 | }; |
| 926 | |
| 927 | /* called by alsa driver */ |
| Helen Zeng | 4e53194 | 2011-12-17 21:14:40 -0800 | [diff] [blame] | 928 | int voc_set_pp_enable(uint16_t session_id, uint32_t module_id, uint32_t enable); |
| 929 | int voc_get_pp_enable(uint16_t session_id, uint32_t module_id); |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 930 | int voc_set_widevoice_enable(uint16_t session_id, uint32_t wv_enable); |
| 931 | uint32_t voc_get_widevoice_enable(uint16_t session_id); |
| 932 | uint8_t voc_get_tty_mode(uint16_t session_id); |
| 933 | int voc_set_tty_mode(uint16_t session_id, uint8_t tty_mode); |
| 934 | int voc_start_voice_call(uint16_t session_id); |
| 935 | int voc_end_voice_call(uint16_t session_id); |
| 936 | int voc_set_rxtx_port(uint16_t session_id, |
| 937 | uint32_t dev_port_id, |
| 938 | uint32_t dev_type); |
| 939 | int voc_set_rx_vol_index(uint16_t session_id, uint32_t dir, uint32_t voc_idx); |
| 940 | int voc_set_tx_mute(uint16_t session_id, uint32_t dir, uint32_t mute); |
| Helen Zeng | 6865693 | 2011-11-02 18:08:23 -0700 | [diff] [blame] | 941 | int voc_set_rx_device_mute(uint16_t session_id, uint32_t mute); |
| 942 | int voc_get_rx_device_mute(uint16_t session_id); |
| Neema Shetty | 2c07eb5 | 2011-08-21 20:33:52 -0700 | [diff] [blame] | 943 | int voc_disable_cvp(uint16_t session_id); |
| 944 | int voc_enable_cvp(uint16_t session_id); |
| 945 | int voc_set_route_flag(uint16_t session_id, uint8_t path_dir, uint8_t set); |
| 946 | uint8_t voc_get_route_flag(uint16_t session_id, uint8_t path_dir); |
| 947 | |
| 948 | #define VOICE_SESSION_NAME "Voice session" |
| 949 | #define VOIP_SESSION_NAME "VoIP session" |
| 950 | uint16_t voc_get_session_id(char *name); |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 951 | |
| Helen Zeng | 0705a5f | 2011-10-14 15:29:52 -0700 | [diff] [blame] | 952 | int voc_start_playback(uint32_t set); |
| Helen Zeng | e3d716a | 2011-10-14 16:32:16 -0700 | [diff] [blame] | 953 | int voc_start_record(uint32_t port_id, uint32_t set); |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 954 | #endif |