Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2009-2010, 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 | */ |
| 13 | |
| 14 | #ifndef __DAL_AUDIO_H__ |
| 15 | #define __DAL_AUDIO_H__ |
| 16 | |
| 17 | #include "dal_audio_format.h" |
| 18 | |
| 19 | #define AUDIO_DAL_DEVICE 0x02000028 |
| 20 | #define AUDIO_DAL_PORT "DAL_AQ_AUD" |
| 21 | |
| 22 | enum { |
| 23 | AUDIO_OP_CONTROL = DAL_OP_FIRST_DEVICE_API, |
| 24 | AUDIO_OP_DATA, |
| 25 | AUDIO_OP_INIT, |
| 26 | }; |
| 27 | |
| 28 | /* ---- common audio structures ---- */ |
| 29 | |
| 30 | /* This flag, if set, indicates that the beginning of the data in the*/ |
| 31 | /* buffer is a synchronization point or key frame, meaning no data */ |
| 32 | /* before it in the stream is required in order to render the stream */ |
| 33 | /* from this point onward. */ |
| 34 | #define ADSP_AUDIO_BUFFER_FLAG_SYNC_POINT 0x01 |
| 35 | |
| 36 | /* This flag, if set, indicates that the buffer object is using valid */ |
| 37 | /* physical address used to store the media data */ |
| 38 | #define ADSP_AUDIO_BUFFER_FLAG_PHYS_ADDR 0x04 |
| 39 | |
| 40 | /* This flag, if set, indicates that a media start timestamp has been */ |
| 41 | /* set for a buffer. */ |
| 42 | #define ADSP_AUDIO_BUFFER_FLAG_START_SET 0x08 |
| 43 | |
| 44 | /* This flag, if set, indicates that a media stop timestamp has been set */ |
| 45 | /* for a buffer. */ |
| 46 | #define ADSP_AUDIO_BUFFER_FLAG_STOP_SET 0x10 |
| 47 | |
| 48 | /* This flag, if set, indicates that a preroll timestamp has been set */ |
| 49 | /* for a buffer. */ |
| 50 | #define ADSP_AUDIO_BUFFER_FLAG_PREROLL_SET 0x20 |
| 51 | |
| 52 | /* This flag, if set, indicates that the data in the buffer is a fragment of */ |
| 53 | /* a larger block of data, and will be continued by the data in the next */ |
| 54 | /* buffer to be delivered. */ |
| 55 | #define ADSP_AUDIO_BUFFER_FLAG_CONTINUATION 0x40 |
| 56 | |
| 57 | struct adsp_audio_buffer { |
| 58 | u32 addr; /* Physical Address of buffer */ |
| 59 | u32 max_size; /* Maximum size of buffer */ |
| 60 | u32 actual_size; /* Actual size of valid data in the buffer */ |
| 61 | u32 offset; /* Offset to the first valid byte */ |
| 62 | u32 flags; /* ADSP_AUDIO_BUFFER_FLAGs that has been set */ |
| 63 | s64 start; /* Start timestamp, if any */ |
| 64 | s64 stop; /* Stop timestamp, if any */ |
| 65 | s64 preroll; /* Preroll timestamp, if any */ |
| 66 | } __attribute__ ((packed)); |
| 67 | |
| 68 | |
| 69 | |
| 70 | /* ---- audio commands ---- */ |
| 71 | |
| 72 | /* Command/event response types */ |
| 73 | #define ADSP_AUDIO_RESPONSE_COMMAND 0 |
| 74 | #define ADSP_AUDIO_RESPONSE_ASYNC 1 |
| 75 | |
| 76 | struct adsp_command_hdr { |
| 77 | u32 size; /* sizeof(cmd) - sizeof(u32) */ |
| 78 | |
| 79 | u32 dst; |
| 80 | u32 src; |
| 81 | |
| 82 | u32 opcode; |
| 83 | u32 response_type; |
| 84 | u32 seq_number; |
| 85 | |
| 86 | u32 context; /* opaque to DSP */ |
| 87 | u32 data; |
| 88 | |
| 89 | u32 padding; |
| 90 | } __attribute__ ((packed)); |
| 91 | |
| 92 | |
| 93 | #define AUDIO_DOMAIN_APP 0 |
| 94 | #define AUDIO_DOMAIN_MODEM 1 |
| 95 | #define AUDIO_DOMAIN_DSP 2 |
| 96 | |
| 97 | #define AUDIO_SERVICE_AUDIO 0 |
| 98 | #define AUDIO_SERVICE_VIDEO 1 /* really? */ |
| 99 | |
| 100 | /* adsp audio addresses are (byte order) domain, service, major, minor */ |
| 101 | //#define AUDIO_ADDR(maj,min) ( (((maj) & 0xff) << 16) | (((min) & 0xff) << 24) | (1) ) |
| 102 | |
| 103 | #define AUDIO_ADDR(maj,min,dom) ( (((min) & 0xff) << 24) | (((maj) & 0xff) << 16) | ((AUDIO_SERVICE_AUDIO) << 8) | (dom) ) |
| 104 | |
| 105 | |
| 106 | /* AAC Encoder modes */ |
| 107 | #define ADSP_AUDIO_ENC_AAC_LC_ONLY_MODE 0 |
| 108 | #define ADSP_AUDIO_ENC_AAC_PLUS_MODE 1 |
| 109 | #define ADSP_AUDIO_ENC_ENHANCED_AAC_PLUS_MODE 2 |
| 110 | |
| 111 | struct adsp_audio_aac_enc_cfg { |
| 112 | u32 bit_rate; /* bits per second */ |
| 113 | u32 encoder_mode; /* ADSP_AUDIO_ENC_* */ |
| 114 | } __attribute__ ((packed)); |
| 115 | |
| 116 | #define ADSP_AUDIO_ENC_SBC_ALLOCATION_METHOD_LOUNDNESS 0 |
| 117 | #define ADSP_AUDIO_ENC_SBC_ALLOCATION_METHOD_SNR 1 |
| 118 | |
| 119 | #define ADSP_AUDIO_ENC_SBC_CHANNEL_MODE_MONO 1 |
| 120 | #define ADSP_AUDIO_ENC_SBC_CHANNEL_MODE_STEREO 2 |
| 121 | #define ADSP_AUDIO_ENC_SBC_CHANNEL_MODE_DUAL 8 |
| 122 | #define ADSP_AUDIO_ENC_SBC_CHANNEL_MODE_JOINT_STEREO 9 |
| 123 | |
| 124 | struct adsp_audio_sbc_encoder_cfg { |
| 125 | u32 num_subbands; |
| 126 | u32 block_len; |
| 127 | u32 channel_mode; |
| 128 | u32 allocation_method; |
| 129 | u32 bit_rate; |
| 130 | } __attribute__ ((packed)); |
| 131 | |
| 132 | /* AMR NB encoder modes */ |
| 133 | #define ADSP_AUDIO_AMR_MR475 0 |
| 134 | #define ADSP_AUDIO_AMR_MR515 1 |
| 135 | #define ADSP_AUDIO_AMR_MMR59 2 |
| 136 | #define ADSP_AUDIO_AMR_MMR67 3 |
| 137 | #define ADSP_AUDIO_AMR_MMR74 4 |
| 138 | #define ADSP_AUDIO_AMR_MMR795 5 |
| 139 | #define ADSP_AUDIO_AMR_MMR102 6 |
| 140 | #define ADSP_AUDIO_AMR_MMR122 7 |
| 141 | |
| 142 | /* The following are valid AMR NB DTX modes */ |
| 143 | #define ADSP_AUDIO_AMR_DTX_MODE_OFF 0 |
| 144 | #define ADSP_AUDIO_AMR_DTX_MODE_ON_VAD1 1 |
| 145 | #define ADSP_AUDIO_AMR_DTX_MODE_ON_VAD2 2 |
| 146 | #define ADSP_AUDIO_AMR_DTX_MODE_ON_AUTO 3 |
| 147 | |
| 148 | /* AMR Encoder configuration */ |
| 149 | struct adsp_audio_amr_enc_cfg { |
| 150 | u32 mode; /* ADSP_AUDIO_AMR_MR* */ |
| 151 | u32 dtx_mode; /* ADSP_AUDIO_AMR_DTX_MODE* */ |
| 152 | u32 enable; /* 1 = enable, 0 = disable */ |
| 153 | } __attribute__ ((packed)); |
| 154 | |
| 155 | struct adsp_audio_qcelp13k_enc_cfg { |
| 156 | u16 min_rate; |
| 157 | u16 max_rate; |
| 158 | } __attribute__ ((packed)); |
| 159 | |
| 160 | struct adsp_audio_evrc_enc_cfg { |
| 161 | u16 min_rate; |
| 162 | u16 max_rate; |
| 163 | } __attribute__ ((packed)); |
| 164 | |
| 165 | union adsp_audio_codec_config { |
| 166 | struct adsp_audio_amr_enc_cfg amr; |
| 167 | struct adsp_audio_aac_enc_cfg aac; |
| 168 | struct adsp_audio_qcelp13k_enc_cfg qcelp13k; |
| 169 | struct adsp_audio_evrc_enc_cfg evrc; |
| 170 | struct adsp_audio_sbc_encoder_cfg sbc; |
| 171 | } __attribute__ ((packed)); |
| 172 | |
| 173 | |
| 174 | /* This is the default value. */ |
| 175 | #define ADSP_AUDIO_OPEN_STREAM_MODE_NONE 0x0000 |
| 176 | |
| 177 | /* This bit, if set, indicates that the AVSync mode is activated. */ |
| 178 | #define ADSP_AUDIO_OPEN_STREAM_MODE_AVSYNC 0x0001 |
| 179 | |
| 180 | /* This bit, if set, indicates that the Sample Rate/Channel Mode */ |
| 181 | /* Change Notification mode is activated. */ |
| 182 | #define ADSP_AUDIO_OPEN_STREAM_MODE_SR_CM_NOTIFY 0x0002 |
| 183 | |
| 184 | /* This bit, if set, indicates that the sync clock is enabled */ |
| 185 | #define ADSP_AUDIO_OPEN_STREAM_MODE_ENABLE_SYNC_CLOCK 0x0004 |
| 186 | |
| 187 | /* This bit, if set, indicates that the AUX PCM loopback is enabled */ |
| 188 | #define ADSP_AUDIO_OPEN_STREAM_MODE_AUX_PCM 0x0040 |
| 189 | |
| 190 | struct adsp_open_command { |
| 191 | struct adsp_command_hdr hdr; |
| 192 | |
| 193 | u32 device; |
| 194 | u32 endpoint; /* address */ |
| 195 | |
| 196 | u32 stream_context; |
| 197 | u32 mode; |
| 198 | |
| 199 | u32 buf_max_size; |
| 200 | |
| 201 | union adsp_audio_format format; |
| 202 | union adsp_audio_codec_config config; |
| 203 | } __attribute__ ((packed)); |
| 204 | |
| 205 | |
| 206 | /* --- audio control and stream session ioctls ---- */ |
| 207 | |
| 208 | /* Opcode to open a device stream session to capture audio */ |
| 209 | #define ADSP_AUDIO_IOCTL_CMD_OPEN_READ 0x0108dd79 |
| 210 | |
| 211 | /* Opcode to open a device stream session to render audio */ |
| 212 | #define ADSP_AUDIO_IOCTL_CMD_OPEN_WRITE 0x0108dd7a |
| 213 | |
| 214 | /* Opcode to open a device session, must open a device */ |
| 215 | #define ADSP_AUDIO_IOCTL_CMD_OPEN_DEVICE 0x0108dd7b |
| 216 | |
| 217 | /* Close an existing stream or device */ |
| 218 | #define ADSP_AUDIO_IOCTL_CMD_CLOSE 0x0108d8bc |
| 219 | |
| 220 | |
| 221 | |
| 222 | /* A device switch requires three IOCTL */ |
| 223 | /* commands in the following sequence: PREPARE, STANDBY, COMMIT */ |
| 224 | |
| 225 | /* adsp_audio_device_switch_command structure is needed for */ |
| 226 | /* DEVICE_SWITCH_PREPARE */ |
| 227 | |
| 228 | /* Device switch protocol step #1. Pause old device and */ |
| 229 | /* generate silence for the old device. */ |
| 230 | #define ADSP_AUDIO_IOCTL_CMD_DEVICE_SWITCH_PREPARE 0x010815c4 |
| 231 | |
| 232 | /* Device switch protocol step #2. Release old device, */ |
| 233 | /* create new device and generate silence for the new device. */ |
| 234 | |
| 235 | /* When client receives ack for this IOCTL, the client can */ |
| 236 | /* start sending IOCTL commands to configure, calibrate and */ |
| 237 | /* change filter settings on the new device. */ |
| 238 | #define ADSP_AUDIO_IOCTL_CMD_DEVICE_SWITCH_STANDBY 0x010815c5 |
| 239 | |
| 240 | /* Device switch protocol step #3. Start normal operations on new device */ |
| 241 | #define ADSP_AUDIO_IOCTL_CMD_DEVICE_SWITCH_COMMIT 0x01075ee7 |
| 242 | |
| 243 | struct adsp_device_switch_command { |
| 244 | struct adsp_command_hdr hdr; |
| 245 | u32 old_device; |
| 246 | u32 new_device; |
| 247 | u8 device_class; /* 0 = i.rx, 1 = i.tx, 2 = e.rx, 3 = e.tx */ |
| 248 | u8 device_type; /* 0 = rx, 1 = tx, 2 = both */ |
| 249 | } __attribute__ ((packed)); |
| 250 | |
| 251 | |
| 252 | |
| 253 | /* --- audio control session ioctls ---- */ |
| 254 | |
| 255 | #define ADSP_PATH_RX 0 |
| 256 | #define ADSP_PATH_TX 1 |
| 257 | #define ADSP_PATH_BOTH 2 |
| 258 | #define ADSP_PATH_TX_CNG_DIS 3 |
| 259 | |
| 260 | struct adsp_audio_dtmf_start_command { |
| 261 | struct adsp_command_hdr hdr; |
| 262 | u32 tone1_hz; |
| 263 | u32 tone2_hz; |
| 264 | u32 duration_usec; |
| 265 | s32 gain_mb; |
| 266 | } __attribute__ ((packed)); |
| 267 | |
| 268 | /* These commands will affect a logical device and all its associated */ |
| 269 | /* streams. */ |
| 270 | |
| 271 | #define ADSP_AUDIO_MAX_EQ_BANDS 12 |
| 272 | |
| 273 | struct adsp_audio_eq_band { |
| 274 | u16 band_idx; /* The band index, 0 .. 11 */ |
| 275 | u32 filter_type; /* Filter band type */ |
| 276 | u32 center_freq_hz; /* Filter band center frequency */ |
| 277 | s32 filter_gain; /* Filter band initial gain (dB) */ |
| 278 | /* Range is +12 dB to -12 dB with 1dB increments. */ |
| 279 | s32 q_factor; |
| 280 | /* Filter band quality factor expressed as q-8 number, */ |
| 281 | /* e.g. 3000/(2^8) */ |
| 282 | } __attribute__ ((packed)); |
| 283 | |
| 284 | struct adsp_audio_eq_stream_config { |
| 285 | uint32_t enable; /* Number of consequtive bands specified */ |
| 286 | uint32_t num_bands; |
| 287 | struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS]; |
| 288 | } __attribute__ ((packed)); |
| 289 | |
| 290 | /* set device equalizer */ |
| 291 | struct adsp_set_dev_equalizer_command { |
| 292 | struct adsp_command_hdr hdr; |
| 293 | u32 device_id; |
| 294 | u32 enable; |
| 295 | u32 num_bands; |
| 296 | struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS]; |
| 297 | } __attribute__ ((packed)); |
| 298 | |
| 299 | /* Set device volume. */ |
| 300 | #define ADSP_AUDIO_IOCTL_CMD_SET_DEVICE_VOL 0x0107605c |
| 301 | |
| 302 | struct adsp_set_dev_volume_command { |
| 303 | struct adsp_command_hdr hdr; |
| 304 | u32 device_id; |
| 305 | u32 path; /* 0 = rx, 1 = tx, 2 = both */ |
| 306 | s32 volume; |
| 307 | } __attribute__ ((packed)); |
| 308 | |
| 309 | /* Set Device stereo volume. This command has data payload, */ |
| 310 | /* struct adsp_audio_set_dev_stereo_volume_command. */ |
| 311 | #define ADSP_AUDIO_IOCTL_SET_DEVICE_STEREO_VOL 0x0108df3e |
| 312 | |
| 313 | /* Set L, R cross channel gain for a Device. This command has */ |
| 314 | /* data payload, struct adsp_audio_set_dev_x_chan_gain_command. */ |
| 315 | #define ADSP_AUDIO_IOCTL_SET_DEVICE_XCHAN_GAIN 0x0108df40 |
| 316 | |
| 317 | /* Set device mute state. */ |
| 318 | #define ADSP_AUDIO_IOCTL_CMD_SET_DEVICE_MUTE 0x0107605f |
| 319 | |
| 320 | struct adsp_set_dev_mute_command { |
| 321 | struct adsp_command_hdr hdr; |
| 322 | u32 device_id; |
| 323 | u32 path; /* 0 = rx, 1 = tx, 2 = both */ |
| 324 | u32 mute; /* 1 = mute */ |
| 325 | } __attribute__ ((packed)); |
| 326 | |
| 327 | /* Configure Equalizer for a device. */ |
| 328 | /* This command has payload struct adsp_audio_set_dev_equalizer_command. */ |
| 329 | #define ADSP_AUDIO_IOCTL_CMD_SET_DEVICE_EQ_CONFIG 0x0108b10e |
| 330 | |
| 331 | /* Set configuration data for an algorithm aspect of a device. */ |
| 332 | /* This command has payload struct adsp_audio_set_dev_cfg_command. */ |
| 333 | #define ADSP_AUDIO_IOCTL_SET_DEVICE_CONFIG 0x0108b6cb |
| 334 | |
| 335 | struct adsp_set_dev_cfg_command { |
| 336 | struct adsp_command_hdr hdr; |
| 337 | u32 device_id; |
| 338 | u32 block_id; |
| 339 | u32 interface_id; |
| 340 | u32 phys_addr; |
| 341 | u32 phys_size; |
| 342 | u32 phys_used; |
| 343 | } __attribute__ ((packed)); |
| 344 | |
| 345 | /* Set configuration data for all interfaces of a device. */ |
| 346 | #define ADSP_AUDIO_IOCTL_SET_DEVICE_CONFIG_TABLE 0x0108b6bf |
| 347 | |
| 348 | struct adsp_set_dev_cfg_table_command { |
| 349 | struct adsp_command_hdr hdr; |
| 350 | u32 device_id; |
| 351 | u32 phys_addr; |
| 352 | u32 phys_size; |
| 353 | u32 phys_used; |
| 354 | } __attribute__ ((packed)); |
| 355 | |
| 356 | /* ---- audio stream data commands ---- */ |
| 357 | |
| 358 | #define ADSP_AUDIO_IOCTL_CMD_DATA_TX 0x0108dd7f |
| 359 | #define ADSP_AUDIO_IOCTL_CMD_DATA_RX 0x0108dd80 |
| 360 | |
| 361 | struct adsp_buffer_command { |
| 362 | struct adsp_command_hdr hdr; |
| 363 | struct adsp_audio_buffer buffer; |
| 364 | } __attribute__ ((packed)); |
| 365 | |
| 366 | |
| 367 | |
| 368 | /* ---- audio stream ioctls (only affect a single stream in a session) ---- */ |
| 369 | |
| 370 | /* Stop stream for audio device. */ |
| 371 | #define ADSP_AUDIO_IOCTL_CMD_STREAM_STOP 0x01075c54 |
| 372 | |
| 373 | /* End of stream reached. Client will not send any more data. */ |
| 374 | #define ADSP_AUDIO_IOCTL_CMD_STREAM_EOS 0x0108b150 |
| 375 | |
| 376 | /* Do sample slipping/stuffing on AAC outputs. The payload of */ |
| 377 | /* this command is struct adsp_audio_slip_sample_command. */ |
| 378 | #define ADSP_AUDIO_IOCTL_CMD_STREAM_SLIPSAMPLE 0x0108d40e |
| 379 | |
| 380 | /* Set stream volume. */ |
| 381 | /* This command has data payload, struct adsp_audio_set_volume_command. */ |
| 382 | #define ADSP_AUDIO_IOCTL_CMD_SET_STREAM_VOL 0x0108c0de |
| 383 | |
| 384 | /* Set stream stereo volume. This command has data payload, */ |
| 385 | /* struct adsp_audio_set_stereo_volume_command. */ |
| 386 | #define ADSP_AUDIO_IOCTL_SET_STREAM_STEREO_VOL 0x0108dd7c |
| 387 | |
| 388 | /* Set L, R cross channel gain for a Stream. This command has */ |
| 389 | /* data payload, struct adsp_audio_set_x_chan_gain_command. */ |
| 390 | #define ADSP_AUDIO_IOCTL_SET_STREAM_XCHAN_GAIN 0x0108dd7d |
| 391 | |
| 392 | /* Set stream mute state. */ |
| 393 | /* This command has data payload, struct adsp_audio_set_stream_mute. */ |
| 394 | #define ADSP_AUDIO_IOCTL_CMD_SET_STREAM_MUTE 0x0108c0df |
| 395 | |
| 396 | /* Reconfigure bit rate information. This command has data */ |
| 397 | /* payload, struct adsp_audio_set_bit_rate_command */ |
| 398 | #define ADSP_AUDIO_IOCTL_SET_STREAM_BITRATE 0x0108ccf1 |
| 399 | |
| 400 | /* Set Channel Mapping. This command has data payload, struct */ |
| 401 | /* This command has data payload struct adsp_audio_set_channel_map_command. */ |
| 402 | #define ADSP_AUDIO_IOCTL_SET_STREAM_CHANNELMAP 0x0108d32a |
| 403 | |
| 404 | /* Enable/disable AACPlus SBR. */ |
| 405 | /* This command has data payload struct adsp_audio_set_sbr_command */ |
| 406 | #define ADSP_AUDIO_IOCTL_SET_STREAM_SBR 0x0108d416 |
| 407 | |
| 408 | /* Enable/disable WMA Pro Chex and Fex. This command has data payload */ |
| 409 | /* struct adsp_audio_stream_set_wma_command. */ |
| 410 | #define ADSP_AUDIO_IOCTL_SET_STREAM_WMAPRO 0x0108d417 |
| 411 | |
| 412 | |
| 413 | /* ---- audio session ioctls (affect all streams in a session) --- */ |
| 414 | |
| 415 | /* Start stream for audio device. */ |
| 416 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_START 0x010815c6 |
| 417 | |
| 418 | /* Stop all stream(s) for audio session as indicated by major id. */ |
| 419 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_STOP 0x0108dd7e |
| 420 | |
| 421 | /* Pause the data flow for a session as indicated by major id. */ |
| 422 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_PAUSE 0x01075ee8 |
| 423 | |
| 424 | /* Resume the data flow for a session as indicated by major id. */ |
| 425 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_RESUME 0x01075ee9 |
| 426 | |
| 427 | /* Drop any unprocessed data buffers for a session as indicated by major id. */ |
| 428 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_FLUSH 0x01075eea |
| 429 | |
| 430 | /* Start Stream DTMF tone */ |
| 431 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_DTMF_START 0x0108c0dd |
| 432 | |
| 433 | /* Stop Stream DTMF tone */ |
| 434 | #define ADSP_AUDIO_IOCTL_CMD_SESSION_DTMF_STOP 0x01087554 |
| 435 | |
| 436 | /* Set Session volume. */ |
| 437 | /* This command has data payload, struct adsp_audio_set_volume_command. */ |
| 438 | #define ADSP_AUDIO_IOCTL_SET_SESSION_VOL 0x0108d8bd |
| 439 | |
| 440 | /* Set session stereo volume. This command has data payload, */ |
| 441 | /* struct adsp_audio_set_stereo_volume_command. */ |
| 442 | #define ADSP_AUDIO_IOCTL_SET_SESSION_STEREO_VOL 0x0108df3d |
| 443 | |
| 444 | /* Set L, R cross channel gain for a session. This command has */ |
| 445 | /* data payload, struct adsp_audio_set_x_chan_gain_command. */ |
| 446 | #define ADSP_AUDIO_IOCTL_SET_SESSION_XCHAN_GAIN 0x0108df3f |
| 447 | |
| 448 | /* Set Session mute state. */ |
| 449 | /* This command has data payload, struct adsp_audio_set_mute_command. */ |
| 450 | #define ADSP_AUDIO_IOCTL_SET_SESSION_MUTE 0x0108d8be |
| 451 | |
| 452 | /* Configure Equalizer for a stream. */ |
| 453 | /* This command has payload struct adsp_audio_set_equalizer_command. */ |
| 454 | #define ADSP_AUDIO_IOCTL_SET_SESSION_EQ_CONFIG 0x0108c0e0 |
| 455 | |
| 456 | /* Set Audio Video sync information. */ |
| 457 | /* This command has data payload, struct adsp_audio_set_av_sync_command. */ |
| 458 | #define ADSP_AUDIO_IOCTL_SET_SESSION_AVSYNC 0x0108d1e2 |
| 459 | |
| 460 | /* Get Audio Media Session time. */ |
| 461 | /* This command returns the audioTime in adsp_audio_unsigned64_event */ |
| 462 | #define ADSP_AUDIO_IOCTL_CMD_GET_AUDIO_TIME 0x0108c26c |
| 463 | |
| 464 | |
| 465 | /* these command structures are used for both STREAM and SESSION ioctls */ |
| 466 | |
| 467 | struct adsp_set_volume_command { |
| 468 | struct adsp_command_hdr hdr; |
| 469 | s32 volume; |
| 470 | } __attribute__ ((packed)); |
| 471 | |
| 472 | struct adsp_set_mute_command { |
| 473 | struct adsp_command_hdr hdr; |
| 474 | u32 mute; /* 1 == mute */ |
| 475 | } __attribute__ ((packed)); |
| 476 | |
| 477 | |
| 478 | struct adsp_set_equalizer_command { |
| 479 | struct adsp_command_hdr hdr; |
| 480 | u32 enable; |
| 481 | u32 num_bands; |
| 482 | struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS]; |
| 483 | } __attribute__ ((packed)); |
| 484 | |
| 485 | /* ---- audio events ---- */ |
| 486 | |
| 487 | /* All IOCTL commands generate an event with the IOCTL opcode as the */ |
| 488 | /* event id after the IOCTL command has been executed. */ |
| 489 | |
| 490 | /* This event is generated after a media stream session is opened. */ |
| 491 | #define ADSP_AUDIO_EVT_STATUS_OPEN 0x0108c0d6 |
| 492 | |
| 493 | /* This event is generated after a media stream session is closed. */ |
| 494 | #define ADSP_AUDIO_EVT_STATUS_CLOSE 0x0108c0d7 |
| 495 | |
| 496 | /* Asyncronous buffer consumption. This event is generated after a */ |
| 497 | /* recived buffer is consumed during rendering or filled during */ |
| 498 | /* capture opeartion. */ |
| 499 | #define ADSP_AUDIO_EVT_STATUS_BUF_DONE 0x0108c0d8 |
| 500 | |
| 501 | /* This event is generated when rendering operation is starving for */ |
| 502 | /* data. In order to avoid audio loss at the end of a plauback, the */ |
| 503 | /* client should wait for this event before issuing the close command. */ |
| 504 | #define ADSP_AUDIO_EVT_STATUS_BUF_UNDERRUN 0x0108c0d9 |
| 505 | |
| 506 | /* This event is generated during capture operation when there are no */ |
| 507 | /* buffers available to copy the captured audio data */ |
| 508 | #define ADSP_AUDIO_EVT_STATUS_BUF_OVERFLOW 0x0108c0da |
| 509 | |
| 510 | /* This asynchronous event is generated as a result of an input */ |
| 511 | /* sample rate change and/or channel mode change detected by the */ |
| 512 | /* decoder. The event payload data is an array of 2 uint32 */ |
| 513 | /* values containing the sample rate in Hz and channel mode. */ |
| 514 | #define ADSP_AUDIO_EVT_SR_CM_CHANGE 0x0108d329 |
| 515 | |
| 516 | struct adsp_event_hdr { |
| 517 | u32 evt_handle; /* DAL common header */ |
| 518 | u32 evt_cookie; |
| 519 | u32 evt_length; |
| 520 | |
| 521 | u32 src; /* "source" audio address */ |
| 522 | u32 dst; /* "destination" audio address */ |
| 523 | |
| 524 | u32 event_id; |
| 525 | u32 response_type; |
| 526 | u32 seq_number; |
| 527 | |
| 528 | u32 context; /* opaque to DSP */ |
| 529 | u32 data; |
| 530 | |
| 531 | u32 status; |
| 532 | } __attribute__ ((packed)); |
| 533 | |
| 534 | struct adsp_buffer_event { |
| 535 | struct adsp_event_hdr hdr; |
| 536 | struct adsp_audio_buffer buffer; |
| 537 | } __attribute__ ((packed)); |
| 538 | |
| 539 | |
| 540 | /* ---- audio device IDs ---- */ |
| 541 | |
| 542 | /* Device direction Rx/Tx flag */ |
| 543 | #define ADSP_AUDIO_RX_DEVICE 0x00 |
| 544 | #define ADSP_AUDIO_TX_DEVICE 0x01 |
| 545 | |
| 546 | /* Default RX or TX device */ |
| 547 | #define ADSP_AUDIO_DEVICE_ID_DEFAULT 0x1081679 |
| 548 | |
| 549 | /* Source (TX) devices */ |
| 550 | #define ADSP_AUDIO_DEVICE_ID_HANDSET_MIC 0x107ac8d |
| 551 | #define ADSP_AUDIO_DEVICE_ID_HEADSET_MIC 0x1081510 |
| 552 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_MIC 0x1081512 |
| 553 | #define ADSP_AUDIO_DEVICE_ID_BT_SCO_MIC 0x1081518 |
| 554 | #define ADSP_AUDIO_DEVICE_ID_AUXPCM_TX 0x1081518 |
| 555 | #define ADSP_AUDIO_DEVICE_ID_TTY_HEADSET_MIC 0x108151b |
| 556 | #define ADSP_AUDIO_DEVICE_ID_I2S_MIC 0x1089bf3 |
| 557 | |
| 558 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_DUAL_MIC 0x108f9c5 |
| 559 | #define ADSP_AUDIO_DEVICE_ID_HANDSET_DUAL_MIC 0x108f9c3 |
| 560 | |
| 561 | /* Special loopback pseudo device to be paired with an RX device */ |
| 562 | /* with usage ADSP_AUDIO_DEVICE_USAGE_MIXED_PCM_LOOPBACK */ |
| 563 | #define ADSP_AUDIO_DEVICE_ID_MIXED_PCM_LOOPBACK_TX 0x1089bf2 |
| 564 | |
| 565 | /* Sink (RX) devices */ |
| 566 | #define ADSP_AUDIO_DEVICE_ID_HANDSET_SPKR 0x107ac88 |
| 567 | #define ADSP_AUDIO_DEVICE_ID_HEADSET_SPKR_MONO 0x1081511 |
| 568 | #define ADSP_AUDIO_DEVICE_ID_HEADSET_SPKR_STEREO 0x107ac8a |
| 569 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_MONO 0x1081513 |
| 570 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_MONO_W_MONO_HEADSET 0x108c508 |
| 571 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_MONO_W_STEREO_HEADSET 0x108c894 |
| 572 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_STEREO 0x1081514 |
| 573 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_STEREO_W_MONO_HEADSET 0x108c895 |
| 574 | #define ADSP_AUDIO_DEVICE_ID_SPKR_PHONE_STEREO_W_STEREO_HEADSET 0x108c509 |
| 575 | #define ADSP_AUDIO_DEVICE_ID_BT_SCO_SPKR 0x1081519 |
| 576 | #define ADSP_AUDIO_DEVICE_ID_AUXPCM_RX 0x1081519 |
| 577 | #define ADSP_AUDIO_DEVICE_ID_TTY_HEADSET_SPKR 0x108151c |
| 578 | #define ADSP_AUDIO_DEVICE_ID_I2S_SPKR 0x1089bf4 |
| 579 | #define ADSP_AUDIO_DEVICE_ID_NULL_SINK 0x108e512 |
| 580 | |
| 581 | /* BT A2DP playback device. */ |
| 582 | /* This device must be paired with */ |
| 583 | /* ADSP_AUDIO_DEVICE_ID_MIXED_PCM_LOOPBACK_TX using */ |
| 584 | /* ADSP_AUDIO_DEVICE_USAGE_MIXED_PCM_LOOPBACK mode */ |
| 585 | #define ADSP_AUDIO_DEVICE_ID_BT_A2DP_SPKR 0x108151a |
| 586 | |
| 587 | /* Voice Destination identifier - specifically used for */ |
| 588 | /* controlling Voice module from the Device Control Session */ |
| 589 | #define ADSP_AUDIO_DEVICE_ID_VOICE 0x0108df3c |
| 590 | |
| 591 | /* Audio device usage types. */ |
| 592 | /* This is a bit mask to determine which topology to use in the */ |
| 593 | /* device session */ |
| 594 | #define ADSP_AUDIO_DEVICE_CONTEXT_VOICE 0x01 |
| 595 | #define ADSP_AUDIO_DEVICE_CONTEXT_PLAYBACK 0x02 |
| 596 | #define ADSP_AUDIO_DEVICE_CONTEXT_MIXED_RECORD 0x10 |
| 597 | #define ADSP_AUDIO_DEVICE_CONTEXT_RECORD 0x20 |
| 598 | #define ADSP_AUDIO_DEVICE_CONTEXT_PCM_LOOPBACK 0x40 |
| 599 | |
| 600 | /* ADSP audio driver return codes */ |
| 601 | #define ADSP_AUDIO_STATUS_SUCCESS 0 |
| 602 | #define ADSP_AUDIO_STATUS_EUNSUPPORTED 20 |
| 603 | |
| 604 | #endif |