Banajit Goswami | 0530e2f | 2016-12-09 21:34:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2010-2013, 2017 The Linux Foundation. All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 and |
| 7 | * only version 2 as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #ifndef _APR_AUDIO_H_ |
| 17 | #define _APR_AUDIO_H_ |
| 18 | |
| 19 | /* ASM opcodes without APR payloads*/ |
| 20 | #include <linux/qdsp6v2/apr.h> |
| 21 | |
| 22 | /* |
| 23 | * Audio Front End (AFE) |
| 24 | */ |
| 25 | |
| 26 | /* Port ID. Update afe_get_port_index when a new port is added here. */ |
| 27 | #define PRIMARY_I2S_RX 0 /* index = 0 */ |
| 28 | #define PRIMARY_I2S_TX 1 /* index = 1 */ |
| 29 | #define PCM_RX 2 /* index = 2 */ |
| 30 | #define PCM_TX 3 /* index = 3 */ |
| 31 | #define SECONDARY_I2S_RX 4 /* index = 4 */ |
| 32 | #define SECONDARY_I2S_TX 5 /* index = 5 */ |
| 33 | #define MI2S_RX 6 /* index = 6 */ |
| 34 | #define MI2S_TX 7 /* index = 7 */ |
| 35 | #define HDMI_RX 8 /* index = 8 */ |
| 36 | #define RSVD_2 9 /* index = 9 */ |
| 37 | #define RSVD_3 10 /* index = 10 */ |
| 38 | #define DIGI_MIC_TX 11 /* index = 11 */ |
| 39 | #define VOICE_RECORD_RX 0x8003 /* index = 12 */ |
| 40 | #define VOICE_RECORD_TX 0x8004 /* index = 13 */ |
| 41 | #define VOICE_PLAYBACK_TX 0x8005 /* index = 14 */ |
| 42 | |
| 43 | /* Slimbus Multi channel port id pool */ |
| 44 | #define SLIMBUS_0_RX 0x4000 /* index = 15 */ |
| 45 | #define SLIMBUS_0_TX 0x4001 /* index = 16 */ |
| 46 | #define SLIMBUS_1_RX 0x4002 /* index = 17 */ |
| 47 | #define SLIMBUS_1_TX 0x4003 /* index = 18 */ |
| 48 | #define SLIMBUS_2_RX 0x4004 |
| 49 | #define SLIMBUS_2_TX 0x4005 |
| 50 | #define SLIMBUS_3_RX 0x4006 |
| 51 | #define SLIMBUS_3_TX 0x4007 |
| 52 | #define SLIMBUS_4_RX 0x4008 |
| 53 | #define SLIMBUS_4_TX 0x4009 /* index = 24 */ |
| 54 | |
| 55 | #define INT_BT_SCO_RX 0x3000 /* index = 25 */ |
| 56 | #define INT_BT_SCO_TX 0x3001 /* index = 26 */ |
| 57 | #define INT_BT_A2DP_RX 0x3002 /* index = 27 */ |
| 58 | #define INT_FM_RX 0x3004 /* index = 28 */ |
| 59 | #define INT_FM_TX 0x3005 /* index = 29 */ |
| 60 | #define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */ |
| 61 | #define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */ |
| 62 | #define SECONDARY_PCM_RX 12 /* index = 32 */ |
| 63 | #define SECONDARY_PCM_TX 13 /* index = 33 */ |
| 64 | #define PSEUDOPORT_01 0x8001 /* index =34 */ |
| 65 | |
| 66 | #define AFE_PORT_INVALID 0xFFFF |
| 67 | #define SLIMBUS_EXTPROC_RX AFE_PORT_INVALID |
| 68 | |
| 69 | #define AFE_PORT_CMD_START 0x000100ca |
| 70 | |
| 71 | #define AFE_EVENT_RTPORT_START 0 |
| 72 | #define AFE_EVENT_RTPORT_STOP 1 |
| 73 | #define AFE_EVENT_RTPORT_LOW_WM 2 |
| 74 | #define AFE_EVENT_RTPORT_HI_WM 3 |
| 75 | |
| 76 | struct afe_port_start_command { |
| 77 | struct apr_hdr hdr; |
| 78 | u16 port_id; |
| 79 | u16 gain; /* Q13 */ |
| 80 | u32 sample_rate; /* 8 , 16, 48khz */ |
| 81 | } __packed; |
| 82 | |
| 83 | #define AFE_PORT_CMD_STOP 0x000100cb |
| 84 | struct afe_port_stop_command { |
| 85 | struct apr_hdr hdr; |
| 86 | u16 port_id; |
| 87 | u16 reserved; |
| 88 | } __packed; |
| 89 | |
| 90 | #define AFE_PORT_CMD_APPLY_GAIN 0x000100cc |
| 91 | struct afe_port_gain_command { |
| 92 | struct apr_hdr hdr; |
| 93 | u16 port_id; |
| 94 | u16 gain;/* Q13 */ |
| 95 | } __packed; |
| 96 | |
| 97 | #define AFE_PORT_CMD_SIDETONE_CTL 0x000100cd |
| 98 | struct afe_port_sidetone_command { |
| 99 | struct apr_hdr hdr; |
| 100 | u16 rx_port_id; /* Primary i2s tx = 1 */ |
| 101 | /* PCM tx = 3 */ |
| 102 | /* Secondary i2s tx = 5 */ |
| 103 | /* Mi2s tx = 7 */ |
| 104 | /* Digital mic tx = 11 */ |
| 105 | u16 tx_port_id; /* Primary i2s rx = 0 */ |
| 106 | /* PCM rx = 2 */ |
| 107 | /* Secondary i2s rx = 4 */ |
| 108 | /* Mi2S rx = 6 */ |
| 109 | /* HDMI rx = 8 */ |
| 110 | u16 gain; /* Q13 */ |
| 111 | u16 enable; /* 1 = enable, 0 = disable */ |
| 112 | } __packed; |
| 113 | |
| 114 | #define AFE_PORT_CMD_LOOPBACK 0x000100ce |
| 115 | struct afe_loopback_command { |
| 116 | struct apr_hdr hdr; |
| 117 | u16 tx_port_id; /* Primary i2s rx = 0 */ |
| 118 | /* PCM rx = 2 */ |
| 119 | /* Secondary i2s rx = 4 */ |
| 120 | /* Mi2S rx = 6 */ |
| 121 | /* HDMI rx = 8 */ |
| 122 | u16 rx_port_id; /* Primary i2s tx = 1 */ |
| 123 | /* PCM tx = 3 */ |
| 124 | /* Secondary i2s tx = 5 */ |
| 125 | /* Mi2s tx = 7 */ |
| 126 | /* Digital mic tx = 11 */ |
| 127 | u16 mode; /* Default -1, DSP will conver |
| 128 | * the tx to rx format |
| 129 | */ |
| 130 | u16 enable; /* 1 = enable, 0 = disable */ |
| 131 | } __packed; |
| 132 | |
| 133 | #define AFE_PSEUDOPORT_CMD_START 0x000100cf |
| 134 | struct afe_pseudoport_start_command { |
| 135 | struct apr_hdr hdr; |
| 136 | u16 port_id; /* Pseudo Port 1 = 0x8000 */ |
| 137 | /* Pseudo Port 2 = 0x8001 */ |
| 138 | /* Pseudo Port 3 = 0x8002 */ |
| 139 | u16 timing; /* FTRT = 0 , AVTimer = 1, */ |
| 140 | } __packed; |
| 141 | |
| 142 | #define AFE_PSEUDOPORT_CMD_STOP 0x000100d0 |
| 143 | struct afe_pseudoport_stop_command { |
| 144 | struct apr_hdr hdr; |
| 145 | u16 port_id; /* Pseudo Port 1 = 0x8000 */ |
| 146 | /* Pseudo Port 2 = 0x8001 */ |
| 147 | /* Pseudo Port 3 = 0x8002 */ |
| 148 | u16 reserved; |
| 149 | } __packed; |
| 150 | |
| 151 | #define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1 |
| 152 | |
| 153 | |
| 154 | #define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2 |
| 155 | struct afe_get_active_handles_command { |
| 156 | struct apr_hdr hdr; |
| 157 | u16 port_id; |
| 158 | u16 reserved; |
| 159 | } __packed; |
| 160 | |
| 161 | /* |
| 162 | * Opcode for AFE to start DTMF. |
| 163 | */ |
| 164 | #define AFE_PORTS_CMD_DTMF_CTL 0x00010102 |
| 165 | |
| 166 | /** DTMF payload.*/ |
| 167 | struct afe_dtmf_generation_command { |
| 168 | struct apr_hdr hdr; |
| 169 | |
| 170 | /* |
| 171 | * Duration of the DTMF tone in ms. |
| 172 | * -1 -> continuous, |
| 173 | * 0 -> disable |
| 174 | */ |
| 175 | int64_t duration_in_ms; |
| 176 | |
| 177 | /* |
| 178 | * The DTMF high tone frequency. |
| 179 | */ |
| 180 | uint16_t high_freq; |
| 181 | |
| 182 | /* |
| 183 | * The DTMF low tone frequency. |
| 184 | */ |
| 185 | uint16_t low_freq; |
| 186 | |
| 187 | /* |
| 188 | * The DTMF volume setting |
| 189 | */ |
| 190 | uint16_t gain; |
| 191 | |
| 192 | /* |
| 193 | * The number of ports to enable/disable on. |
| 194 | */ |
| 195 | uint16_t num_ports; |
| 196 | |
| 197 | /* |
| 198 | * The Destination ports - array . |
| 199 | * For DTMF on multiple ports, portIds needs to |
| 200 | * be populated numPorts times. |
| 201 | */ |
| 202 | uint16_t port_ids; |
| 203 | |
| 204 | /* |
| 205 | * variable for 32 bit alignment of APR packet. |
| 206 | */ |
| 207 | uint16_t reserved; |
| 208 | } __packed; |
| 209 | |
| 210 | #define AFE_PCM_CFG_MODE_PCM 0x0 |
| 211 | #define AFE_PCM_CFG_MODE_AUX 0x1 |
| 212 | #define AFE_PCM_CFG_SYNC_EXT 0x0 |
| 213 | #define AFE_PCM_CFG_SYNC_INT 0x1 |
| 214 | #define AFE_PCM_CFG_FRM_8BPF 0x0 |
| 215 | #define AFE_PCM_CFG_FRM_16BPF 0x1 |
| 216 | #define AFE_PCM_CFG_FRM_32BPF 0x2 |
| 217 | #define AFE_PCM_CFG_FRM_64BPF 0x3 |
| 218 | #define AFE_PCM_CFG_FRM_128BPF 0x4 |
| 219 | #define AFE_PCM_CFG_FRM_256BPF 0x5 |
| 220 | #define AFE_PCM_CFG_QUANT_ALAW_NOPAD 0x0 |
| 221 | #define AFE_PCM_CFG_QUANT_MULAW_NOPAD 0x1 |
| 222 | #define AFE_PCM_CFG_QUANT_LINEAR_NOPAD 0x2 |
| 223 | #define AFE_PCM_CFG_QUANT_ALAW_PAD 0x3 |
| 224 | #define AFE_PCM_CFG_QUANT_MULAW_PAD 0x4 |
| 225 | #define AFE_PCM_CFG_QUANT_LINEAR_PAD 0x5 |
| 226 | #define AFE_PCM_CFG_CDATAOE_MASTER 0x0 |
| 227 | #define AFE_PCM_CFG_CDATAOE_SHARE 0x1 |
| 228 | |
| 229 | struct afe_port_pcm_cfg { |
| 230 | u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */ |
| 231 | u16 sync; /* external = 0 , internal = 1 */ |
| 232 | u16 frame; /* 8 bpf = 0 */ |
| 233 | /* 16 bpf = 1 */ |
| 234 | /* 32 bpf = 2 */ |
| 235 | /* 64 bpf = 3 */ |
| 236 | /* 128 bpf = 4 */ |
| 237 | /* 256 bpf = 5 */ |
| 238 | u16 quant; |
| 239 | u16 slot; /* Slot for PCM stream , 0 - 31 */ |
| 240 | u16 data; /* 0, PCM block is the only master */ |
| 241 | /* 1, PCM block is shares to driver data out signal */ |
| 242 | /* other master */ |
| 243 | u16 reserved; |
| 244 | } __packed; |
| 245 | |
| 246 | enum { |
| 247 | AFE_I2S_SD0 = 1, |
| 248 | AFE_I2S_SD1, |
| 249 | AFE_I2S_SD2, |
| 250 | AFE_I2S_SD3, |
| 251 | AFE_I2S_QUAD01, |
| 252 | AFE_I2S_QUAD23, |
| 253 | AFE_I2S_6CHS, |
| 254 | AFE_I2S_8CHS, |
| 255 | }; |
| 256 | |
| 257 | #define AFE_MI2S_MONO 0 |
| 258 | #define AFE_MI2S_STEREO 3 |
| 259 | #define AFE_MI2S_4CHANNELS 4 |
| 260 | #define AFE_MI2S_6CHANNELS 6 |
| 261 | #define AFE_MI2S_8CHANNELS 8 |
| 262 | |
| 263 | struct afe_port_mi2s_cfg { |
| 264 | u16 bitwidth; /* 16,24,32 */ |
| 265 | u16 line; /* Called ChannelMode in documentation */ |
| 266 | /* i2s_sd0 = 1 */ |
| 267 | /* i2s_sd1 = 2 */ |
| 268 | /* i2s_sd2 = 3 */ |
| 269 | /* i2s_sd3 = 4 */ |
| 270 | /* i2s_quad01 = 5 */ |
| 271 | /* i2s_quad23 = 6 */ |
| 272 | /* i2s_6chs = 7 */ |
| 273 | /* i2s_8chs = 8 */ |
| 274 | u16 channel; /* Called MonoStereo in documentation */ |
| 275 | /* i2s mono = 0 */ |
| 276 | /* i2s mono right = 1 */ |
| 277 | /* i2s mono left = 2 */ |
| 278 | /* i2s stereo = 3 */ |
| 279 | u16 ws; /* 0, word select signal from external source */ |
| 280 | /* 1, word select signal from internal source */ |
| 281 | u16 format; /* don't touch this field if it is not for */ |
| 282 | /* AFE_PORT_CMD_I2S_CONFIG opcode */ |
| 283 | } __packed; |
| 284 | |
| 285 | struct afe_port_hdmi_cfg { |
| 286 | u16 bitwidth; /* 16,24,32 */ |
| 287 | u16 channel_mode; /* HDMI Stereo = 0 */ |
| 288 | /* HDMI_3Point1 (4-ch) = 1 */ |
| 289 | /* HDMI_5Point1 (6-ch) = 2 */ |
| 290 | /* HDMI_6Point1 (8-ch) = 3 */ |
| 291 | u16 data_type; /* HDMI_Linear = 0 */ |
| 292 | /* HDMI_non_Linear = 1 */ |
| 293 | } __packed; |
| 294 | |
| 295 | |
| 296 | struct afe_port_hdmi_multi_ch_cfg { |
| 297 | u16 data_type; /* HDMI_Linear = 0 */ |
| 298 | /* HDMI_non_Linear = 1 */ |
| 299 | u16 channel_allocation; /* The default is 0 (Stereo) */ |
| 300 | u16 reserved; /* must be set to 0 */ |
| 301 | } __packed; |
| 302 | |
| 303 | |
| 304 | /* Slimbus Device Ids */ |
| 305 | #define AFE_SLIMBUS_DEVICE_1 0x0 |
| 306 | #define AFE_SLIMBUS_DEVICE_2 0x1 |
| 307 | #define AFE_PORT_MAX_AUDIO_CHAN_CNT 16 |
| 308 | |
| 309 | struct afe_port_slimbus_cfg { |
| 310 | u16 slimbus_dev_id; /* SLIMBUS Device id.*/ |
| 311 | |
| 312 | u16 slave_dev_pgd_la; /* Slave ported generic device |
| 313 | * logical address. |
| 314 | */ |
| 315 | u16 slave_dev_intfdev_la; /* Slave interface device logical |
| 316 | * address. |
| 317 | */ |
| 318 | u16 bit_width; /* bit width of the samples, 16, 24.*/ |
| 319 | |
| 320 | u16 data_format; /* data format.*/ |
| 321 | |
| 322 | u16 num_channels; /* Number of channels.*/ |
| 323 | |
| 324 | /* Slave port mapping for respective channels.*/ |
| 325 | u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT]; |
| 326 | |
| 327 | u16 reserved; |
| 328 | } __packed; |
| 329 | |
| 330 | struct afe_port_slimbus_sch_cfg { |
| 331 | u16 slimbus_dev_id; /* SLIMBUS Device id.*/ |
| 332 | u16 bit_width; /* bit width of the samples, 16, 24.*/ |
| 333 | u16 data_format; /* data format.*/ |
| 334 | u16 num_channels; /* Number of channels.*/ |
| 335 | u16 reserved; |
| 336 | /* Slave channel mapping for respective channels.*/ |
| 337 | u8 slave_ch_mapping[8]; |
| 338 | } __packed; |
| 339 | |
| 340 | struct afe_port_rtproxy_cfg { |
| 341 | u16 bitwidth; /* 16,24,32 */ |
| 342 | u16 interleaved; /* interleaved = 1 */ |
| 343 | /* Noninterleaved = 0 */ |
| 344 | u16 frame_sz; /* 5ms buffers = 160bytes */ |
| 345 | u16 jitter; /* 10ms of jitter = 320 */ |
| 346 | u16 lw_mark; /* Low watermark in bytes for triggering event*/ |
| 347 | u16 hw_mark; /* High watermark bytes for triggering event*/ |
| 348 | u16 rsvd; |
| 349 | int num_ch; /* 1 to 8 */ |
| 350 | } __packed; |
| 351 | |
| 352 | struct afe_port_pseudo_cfg { |
| 353 | u16 bit_width; |
| 354 | u16 num_channels; |
| 355 | u16 data_format; |
| 356 | u16 timing_mode; |
| 357 | u16 reserved; |
| 358 | } __packed; |
| 359 | |
| 360 | #define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3 |
| 361 | #define AFE_PORT_AUDIO_SLIM_SCH_CONFIG 0x000100e4 |
| 362 | #define AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG 0x000100D9 |
| 363 | #define AFE_PORT_CMD_I2S_CONFIG 0x000100E7 |
| 364 | |
| 365 | union afe_port_config { |
| 366 | struct afe_port_pcm_cfg pcm; |
| 367 | struct afe_port_mi2s_cfg mi2s; |
| 368 | struct afe_port_hdmi_cfg hdmi; |
| 369 | struct afe_port_hdmi_multi_ch_cfg hdmi_multi_ch; |
| 370 | struct afe_port_slimbus_cfg slimbus; |
| 371 | struct afe_port_slimbus_sch_cfg slim_sch; |
| 372 | struct afe_port_rtproxy_cfg rtproxy; |
| 373 | struct afe_port_pseudo_cfg pseudo; |
| 374 | } __packed; |
| 375 | |
| 376 | struct afe_audioif_config_command { |
| 377 | struct apr_hdr hdr; |
| 378 | u16 port_id; |
| 379 | union afe_port_config port; |
| 380 | } __packed; |
| 381 | |
| 382 | #define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5 |
| 383 | struct afe_codec_loopback_command { |
| 384 | u16 port_inf; /* Primary i2s = 0 */ |
| 385 | /* PCM = 2 */ |
| 386 | /* Secondary i2s = 4 */ |
| 387 | /* Mi2s = 6 */ |
| 388 | u16 enable; /* 0, disable. 1, enable */ |
| 389 | } __packed; |
| 390 | |
| 391 | |
| 392 | #define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300 |
| 393 | struct afe_param_sidetone_gain { |
| 394 | u16 gain; |
| 395 | u16 reserved; |
| 396 | } __packed; |
| 397 | |
| 398 | #define AFE_PARAM_ID_SAMPLING_RATE 0x00010301 |
| 399 | struct afe_param_sampling_rate { |
| 400 | u32 sampling_rate; |
| 401 | } __packed; |
| 402 | |
| 403 | |
| 404 | #define AFE_PARAM_ID_CHANNELS 0x00010302 |
| 405 | struct afe_param_channels { |
| 406 | u16 channels; |
| 407 | u16 reserved; |
| 408 | } __packed; |
| 409 | |
| 410 | |
| 411 | #define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303 |
| 412 | struct afe_param_loopback_gain { |
| 413 | u16 gain; |
| 414 | u16 reserved; |
| 415 | } __packed; |
| 416 | |
| 417 | /* Parameter ID used to configure and enable/disable the loopback path. The |
| 418 | * difference with respect to the existing API, AFE_PORT_CMD_LOOPBACK, is that |
| 419 | * it allows Rx port to be configured as source port in loopback path. Port-id |
| 420 | * in AFE_PORT_CMD_SET_PARAM cmd is the source port which can be Tx or Rx port. |
| 421 | * In addition, we can configure the type of routing mode to handle different |
| 422 | * use cases. |
| 423 | */ |
| 424 | enum { |
| 425 | /* Regular loopback from source to destination port */ |
| 426 | LB_MODE_DEFAULT = 1, |
| 427 | /* Sidetone feed from Tx source to Rx destination port */ |
| 428 | LB_MODE_SIDETONE, |
| 429 | /* Echo canceller reference, voice + audio + DTMF */ |
| 430 | LB_MODE_EC_REF_VOICE_AUDIO, |
| 431 | /* Echo canceller reference, voice alone */ |
| 432 | LB_MODE_EC_REF_VOICE |
| 433 | }; |
| 434 | |
| 435 | #define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B |
| 436 | #define AFE_API_VERSION_LOOPBACK_CONFIG 0x1 |
| 437 | struct afe_param_loopback_cfg { |
| 438 | /* Minor version used for tracking the version of the configuration |
| 439 | * interface. |
| 440 | */ |
| 441 | uint32_t loopback_cfg_minor_version; |
| 442 | |
| 443 | /* Destination Port Id. */ |
| 444 | uint16_t dst_port_id; |
| 445 | |
| 446 | /* Specifies data path type from src to dest port. Supported values: |
| 447 | * LB_MODE_DEFAULT |
| 448 | * LB_MODE_SIDETONE |
| 449 | * LB_MODE_EC_REF_VOICE_AUDIO |
| 450 | * LB_MODE_EC_REF_VOICE |
| 451 | */ |
| 452 | uint16_t routing_mode; |
| 453 | |
| 454 | /* Specifies whether to enable (1) or disable (0) an AFE loopback. */ |
| 455 | uint16_t enable; |
| 456 | |
| 457 | /* Reserved for 32-bit alignment. This field must be set to 0. */ |
| 458 | uint16_t reserved; |
| 459 | } __packed; |
| 460 | |
| 461 | #define AFE_MODULE_ID_PORT_INFO 0x00010200 |
| 462 | /* Module ID for the loopback-related parameters. */ |
| 463 | #define AFE_MODULE_LOOPBACK 0x00010205 |
| 464 | struct afe_param_payload_base { |
| 465 | u32 module_id; |
| 466 | u32 param_id; |
| 467 | u16 param_size; |
| 468 | u16 reserved; |
| 469 | } __packed; |
| 470 | |
| 471 | struct afe_param_payload { |
| 472 | struct afe_param_payload_base base; |
| 473 | union { |
| 474 | struct afe_param_sidetone_gain sidetone_gain; |
| 475 | struct afe_param_sampling_rate sampling_rate; |
| 476 | struct afe_param_channels channels; |
| 477 | struct afe_param_loopback_gain loopback_gain; |
| 478 | struct afe_param_loopback_cfg loopback_cfg; |
| 479 | } __packed param; |
| 480 | } __packed; |
| 481 | |
| 482 | #define AFE_PORT_CMD_SET_PARAM 0x000100dc |
| 483 | |
| 484 | struct afe_port_cmd_set_param { |
| 485 | struct apr_hdr hdr; |
| 486 | u16 port_id; |
| 487 | u16 payload_size; |
| 488 | u32 payload_address; |
| 489 | struct afe_param_payload payload; |
| 490 | } __packed; |
| 491 | |
| 492 | struct afe_port_cmd_set_param_no_payload { |
| 493 | struct apr_hdr hdr; |
| 494 | u16 port_id; |
| 495 | u16 payload_size; |
| 496 | u32 payload_address; |
| 497 | } __packed; |
| 498 | |
| 499 | #define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100 |
| 500 | struct afe_get_active_ports_rsp { |
| 501 | u16 num_ports; |
| 502 | u16 port_id; |
| 503 | } __packed; |
| 504 | |
| 505 | |
| 506 | #define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102 |
| 507 | struct afe_get_active_handles_rsp { |
| 508 | u16 port_id; |
| 509 | u16 num_handles; |
| 510 | u16 mode; /* 0, voice rx */ |
| 511 | /* 1, voice tx */ |
| 512 | /* 2, audio rx */ |
| 513 | /* 3, audio tx */ |
| 514 | u16 handle; |
| 515 | } __packed; |
| 516 | |
| 517 | #define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE |
| 518 | struct afe_cmd_memory_map { |
| 519 | struct apr_hdr hdr; |
| 520 | u32 phy_addr; |
| 521 | u32 mem_sz; |
| 522 | u16 mem_id; |
| 523 | u16 rsvd; |
| 524 | } __packed; |
| 525 | |
| 526 | #define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF |
| 527 | struct afe_cmd_memory_unmap { |
| 528 | struct apr_hdr hdr; |
| 529 | u32 phy_addr; |
| 530 | } __packed; |
| 531 | |
| 532 | #define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0 |
| 533 | struct afe_cmd_reg_rtport { |
| 534 | struct apr_hdr hdr; |
| 535 | u16 port_id; |
| 536 | u16 rsvd; |
| 537 | } __packed; |
| 538 | |
| 539 | #define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1 |
| 540 | struct afe_cmd_unreg_rtport { |
| 541 | struct apr_hdr hdr; |
| 542 | u16 port_id; |
| 543 | u16 rsvd; |
| 544 | } __packed; |
| 545 | |
| 546 | #define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2 |
| 547 | struct afe_cmd_rtport_wr { |
| 548 | struct apr_hdr hdr; |
| 549 | u16 port_id; |
| 550 | u16 rsvd; |
| 551 | u32 buf_addr; |
| 552 | u32 bytes_avail; |
| 553 | } __packed; |
| 554 | |
| 555 | #define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3 |
| 556 | struct afe_cmd_rtport_rd { |
| 557 | struct apr_hdr hdr; |
| 558 | u16 port_id; |
| 559 | u16 rsvd; |
| 560 | u32 buf_addr; |
| 561 | u32 bytes_avail; |
| 562 | } __packed; |
| 563 | |
| 564 | #define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105 |
| 565 | |
| 566 | #define ADM_MAX_COPPS 5 |
| 567 | |
| 568 | #define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300 |
| 569 | struct adm_get_copp_handles_command { |
| 570 | struct apr_hdr hdr; |
| 571 | } __packed; |
| 572 | |
| 573 | #define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301 |
| 574 | struct adm_routings_session { |
| 575 | u16 id; |
| 576 | u16 num_copps; |
| 577 | u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */ |
| 578 | } __packed; |
| 579 | |
| 580 | struct adm_routings_command { |
| 581 | struct apr_hdr hdr; |
| 582 | u32 path; /* 0 = Rx, 1 Tx */ |
| 583 | u32 num_sessions; |
| 584 | struct adm_routings_session session[8]; |
| 585 | } __packed; |
| 586 | |
| 587 | |
| 588 | #define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302 |
| 589 | struct adm_ramp_gain { |
| 590 | struct apr_hdr hdr; |
| 591 | u16 session_id; |
| 592 | u16 copp_id; |
| 593 | u16 initial_gain; |
| 594 | u16 gain_increment; |
| 595 | u16 ramp_duration; |
| 596 | u16 reserved; |
| 597 | } __packed; |
| 598 | |
| 599 | struct adm_ramp_gains_command { |
| 600 | struct apr_hdr hdr; |
| 601 | u32 id; |
| 602 | u32 num_gains; |
| 603 | struct adm_ramp_gain gains[ADM_MAX_COPPS]; |
| 604 | } __packed; |
| 605 | |
| 606 | |
| 607 | #define ADM_CMD_COPP_OPEN 0x00010304 |
| 608 | struct adm_copp_open_command { |
| 609 | struct apr_hdr hdr; |
| 610 | u16 flags; |
| 611 | u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */ |
| 612 | u16 endpoint_id1; |
| 613 | u16 endpoint_id2; |
| 614 | u32 topology_id; |
| 615 | u16 channel_config; |
| 616 | u16 reserved; |
| 617 | u32 rate; |
| 618 | } __packed; |
| 619 | |
| 620 | #define ADM_CMD_COPP_CLOSE 0x00010305 |
| 621 | |
| 622 | #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310 |
| 623 | #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3 0x00010333 |
| 624 | struct adm_multi_ch_copp_open_command { |
| 625 | struct apr_hdr hdr; |
| 626 | u16 flags; |
| 627 | u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */ |
| 628 | u16 endpoint_id1; |
| 629 | u16 endpoint_id2; |
| 630 | u32 topology_id; |
| 631 | u16 channel_config; |
| 632 | u16 reserved; |
| 633 | u32 rate; |
| 634 | u8 dev_channel_mapping[8]; |
| 635 | } __packed; |
| 636 | |
| 637 | struct adm_multi_channel_copp_open_v3 { |
| 638 | struct apr_hdr hdr; |
| 639 | u16 flags; |
| 640 | u16 mode; |
| 641 | u16 endpoint_id1; |
| 642 | u16 endpoint_id2; |
| 643 | u32 topology_id; |
| 644 | u16 channel_config; |
| 645 | u16 bit_width; |
| 646 | u32 rate; |
| 647 | u8 dev_channel_mapping[8]; |
| 648 | }; |
| 649 | |
| 650 | #define ADM_CMD_MEMORY_MAP 0x00010C30 |
| 651 | struct adm_cmd_memory_map { |
| 652 | struct apr_hdr hdr; |
| 653 | u32 buf_add; |
| 654 | u32 buf_size; |
| 655 | u16 mempool_id; |
| 656 | u16 reserved; |
| 657 | } __packed; |
| 658 | |
| 659 | #define ADM_CMD_MEMORY_UNMAP 0x00010C31 |
| 660 | struct adm_cmd_memory_unmap { |
| 661 | struct apr_hdr hdr; |
| 662 | u32 buf_add; |
| 663 | } __packed; |
| 664 | |
| 665 | #define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47 |
| 666 | struct adm_memory_map_regions { |
| 667 | u32 phys; |
| 668 | u32 buf_size; |
| 669 | } __packed; |
| 670 | |
| 671 | struct adm_cmd_memory_map_regions { |
| 672 | struct apr_hdr hdr; |
| 673 | u16 mempool_id; |
| 674 | u16 nregions; |
| 675 | } __packed; |
| 676 | |
| 677 | #define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48 |
| 678 | struct adm_memory_unmap_regions { |
| 679 | u32 phys; |
| 680 | } __packed; |
| 681 | |
| 682 | struct adm_cmd_memory_unmap_regions { |
| 683 | struct apr_hdr hdr; |
| 684 | u16 nregions; |
| 685 | u16 reserved; |
| 686 | } __packed; |
| 687 | |
| 688 | #define DEFAULT_COPP_TOPOLOGY 0x00010be3 |
| 689 | #define DEFAULT_POPP_TOPOLOGY 0x00010be4 |
| 690 | #define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71 |
| 691 | #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72 |
| 692 | #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75 |
| 693 | |
| 694 | #define LOWLATENCY_POPP_TOPOLOGY 0x00010C68 |
| 695 | #define LOWLATENCY_COPP_TOPOLOGY 0x00010312 |
| 696 | #define PCM_BITS_PER_SAMPLE 16 |
| 697 | |
| 698 | #define ASM_OPEN_WRITE_PERF_MODE_BIT (1<<28) |
| 699 | #define ASM_OPEN_READ_PERF_MODE_BIT (1<<29) |
| 700 | #define ADM_MULTI_CH_COPP_OPEN_PERF_MODE_BIT (1<<13) |
| 701 | |
| 702 | |
| 703 | #define ASM_MAX_EQ_BANDS 12 |
| 704 | |
| 705 | struct asm_eq_band { |
| 706 | u32 band_idx; /* The band index, 0 .. 11 */ |
| 707 | u32 filter_type; /* Filter band type */ |
| 708 | u32 center_freq_hz; /* Filter band center frequency */ |
| 709 | u32 filter_gain; /* Filter band initial gain (dB) */ |
| 710 | /* Range is +12 dB to -12 dB with 1dB increments. */ |
| 711 | u32 q_factor; |
| 712 | } __packed; |
| 713 | |
| 714 | struct asm_equalizer_params { |
| 715 | u32 enable; |
| 716 | u32 num_bands; |
| 717 | struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS]; |
| 718 | } __packed; |
| 719 | |
| 720 | struct asm_master_gain_params { |
| 721 | u16 master_gain; |
| 722 | u16 padding; |
| 723 | } __packed; |
| 724 | |
| 725 | struct asm_lrchannel_gain_params { |
| 726 | u16 left_gain; |
| 727 | u16 right_gain; |
| 728 | } __packed; |
| 729 | |
| 730 | struct asm_mute_params { |
| 731 | u32 muteflag; |
| 732 | } __packed; |
| 733 | |
| 734 | struct asm_softvolume_params { |
| 735 | u32 period; |
| 736 | u32 step; |
| 737 | u32 rampingcurve; |
| 738 | } __packed; |
| 739 | |
| 740 | struct asm_softpause_params { |
| 741 | u32 enable; |
| 742 | u32 period; |
| 743 | u32 step; |
| 744 | u32 rampingcurve; |
| 745 | } __packed; |
| 746 | |
| 747 | struct asm_pp_param_data_hdr { |
| 748 | u32 module_id; |
| 749 | u32 param_id; |
| 750 | u16 param_size; |
| 751 | u16 reserved; |
| 752 | } __packed; |
| 753 | |
| 754 | struct asm_pp_params_command { |
| 755 | struct apr_hdr hdr; |
| 756 | u32 *payload; |
| 757 | u32 payload_size; |
| 758 | struct asm_pp_param_data_hdr params; |
| 759 | } __packed; |
| 760 | |
| 761 | #define EQUALIZER_MODULE_ID 0x00010c27 |
| 762 | #define EQUALIZER_PARAM_ID 0x00010c28 |
| 763 | |
| 764 | #define VOLUME_CONTROL_MODULE_ID 0x00010bfe |
| 765 | #define MASTER_GAIN_PARAM_ID 0x00010bff |
| 766 | #define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00 |
| 767 | #define MUTE_CONFIG_PARAM_ID 0x00010c01 |
| 768 | #define SOFT_PAUSE_PARAM_ID 0x00010D6A |
| 769 | #define SOFT_VOLUME_PARAM_ID 0x00010C29 |
| 770 | |
| 771 | #define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03 |
| 772 | #define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04 |
| 773 | #define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05 |
| 774 | |
| 775 | #define MBADRC_MODULE_ID 0x00010c06 |
| 776 | #define MBADRC_ENABLE_PARAM_ID 0x00010c07 |
| 777 | #define MBADRC_CONFIG_PARAM_ID 0x00010c08 |
| 778 | |
| 779 | |
| 780 | #define ADM_CMD_SET_PARAMS 0x00010306 |
| 781 | #define ADM_CMD_GET_PARAMS 0x0001030B |
| 782 | #define ADM_CMDRSP_GET_PARAMS 0x0001030C |
| 783 | struct adm_set_params_command { |
| 784 | struct apr_hdr hdr; |
| 785 | u32 payload; |
| 786 | u32 payload_size; |
| 787 | } __packed; |
| 788 | |
| 789 | |
| 790 | #define ADM_CMD_TAP_COPP_PCM 0x00010307 |
| 791 | struct adm_tap_copp_pcm_command { |
| 792 | struct apr_hdr hdr; |
| 793 | } __packed; |
| 794 | |
| 795 | |
| 796 | /* QDSP6 to Client messages */ |
| 797 | #define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308 |
| 798 | struct adm_get_copp_handles_respond { |
| 799 | struct apr_hdr hdr; |
| 800 | u32 handles; |
| 801 | u32 copp_id; |
| 802 | } __packed; |
| 803 | |
| 804 | #define ADM_CMDRSP_COPP_OPEN 0x0001030A |
| 805 | struct adm_copp_open_respond { |
| 806 | u32 status; |
| 807 | u16 copp_id; |
| 808 | u16 reserved; |
| 809 | } __packed; |
| 810 | |
| 811 | #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311 |
| 812 | #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN_V3 0x00010334 |
| 813 | |
| 814 | |
| 815 | #define ASM_STREAM_PRIORITY_NORMAL 0 |
| 816 | #define ASM_STREAM_PRIORITY_LOW 1 |
| 817 | #define ASM_STREAM_PRIORITY_HIGH 2 |
| 818 | #define ASM_STREAM_PRIORITY_RESERVED 3 |
| 819 | |
| 820 | #define ASM_END_POINT_DEVICE_MATRIX 0 |
| 821 | #define ASM_END_POINT_STREAM 1 |
| 822 | |
| 823 | #define AAC_ENC_MODE_AAC_LC 0x02 |
| 824 | #define AAC_ENC_MODE_AAC_P 0x05 |
| 825 | #define AAC_ENC_MODE_EAAC_P 0x1D |
| 826 | |
| 827 | #define ASM_STREAM_CMD_CLOSE 0x00010BCD |
| 828 | #define ASM_STREAM_CMD_FLUSH 0x00010BCE |
| 829 | #define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF |
| 830 | #define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0 |
| 831 | #define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1 |
| 832 | #define ASM_SESSION_CMD_PAUSE 0x00010BD3 |
| 833 | #define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4 |
| 834 | #define ASM_DATA_CMD_EOS 0x00010BDB |
| 835 | #define ASM_DATA_EVENT_EOS 0x00010BDD |
| 836 | |
| 837 | #define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B |
| 838 | #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09 |
| 839 | |
| 840 | #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17 |
| 841 | #define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18 |
| 842 | #define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19 |
| 843 | #define ASM_DATA_CMDRSP_EOS 0x00010C1C |
| 844 | |
| 845 | /* ASM Data structures */ |
| 846 | |
| 847 | /* common declarations */ |
| 848 | struct asm_pcm_cfg { |
| 849 | u16 ch_cfg; |
| 850 | u16 bits_per_sample; |
| 851 | u32 sample_rate; |
| 852 | u16 is_signed; |
| 853 | u16 interleaved; |
| 854 | }; |
| 855 | |
| 856 | #define PCM_CHANNEL_NULL 0 |
| 857 | |
| 858 | /* Front left channel. */ |
| 859 | #define PCM_CHANNEL_FL 1 |
| 860 | |
| 861 | /* Front right channel. */ |
| 862 | #define PCM_CHANNEL_FR 2 |
| 863 | |
| 864 | /* Front center channel. */ |
| 865 | #define PCM_CHANNEL_FC 3 |
| 866 | |
| 867 | /* Left surround channel.*/ |
| 868 | #define PCM_CHANNEL_LS 4 |
| 869 | |
| 870 | /* Right surround channel.*/ |
| 871 | #define PCM_CHANNEL_RS 5 |
| 872 | |
| 873 | /* Low frequency effect channel. */ |
| 874 | #define PCM_CHANNEL_LFE 6 |
| 875 | |
| 876 | /* Center surround channel; Rear center channel. */ |
| 877 | #define PCM_CHANNEL_CS 7 |
| 878 | |
| 879 | /* Left back channel; Rear left channel. */ |
| 880 | #define PCM_CHANNEL_LB 8 |
| 881 | |
| 882 | /* Right back channel; Rear right channel. */ |
| 883 | #define PCM_CHANNEL_RB 9 |
| 884 | |
| 885 | /* Top surround channel. */ |
| 886 | #define PCM_CHANNEL_TS 10 |
| 887 | |
| 888 | /* Center vertical height channel.*/ |
| 889 | #define PCM_CHANNEL_CVH 11 |
| 890 | |
| 891 | /* Mono surround channel.*/ |
| 892 | #define PCM_CHANNEL_MS 12 |
| 893 | |
| 894 | /* Front left of center. */ |
| 895 | #define PCM_CHANNEL_FLC 13 |
| 896 | |
| 897 | /* Front right of center. */ |
| 898 | #define PCM_CHANNEL_FRC 14 |
| 899 | |
| 900 | /* Rear left of center. */ |
| 901 | #define PCM_CHANNEL_RLC 15 |
| 902 | |
| 903 | /* Rear right of center. */ |
| 904 | #define PCM_CHANNEL_RRC 16 |
| 905 | |
| 906 | #define PCM_FORMAT_MAX_NUM_CHANNEL 8 |
| 907 | |
| 908 | /* Maximum number of channels supported |
| 909 | * in ASM_ENCDEC_DEC_CHAN_MAP command |
| 910 | */ |
| 911 | #define MAX_CHAN_MAP_CHANNELS 16 |
| 912 | /* |
| 913 | * Multiple-channel PCM decoder format block structure used in the |
| 914 | * #ASM_STREAM_CMD_OPEN_WRITE command. |
| 915 | * The data must be in little-endian format. |
| 916 | */ |
| 917 | struct asm_multi_channel_pcm_fmt_blk { |
| 918 | |
| 919 | u16 num_channels; /* |
| 920 | * Number of channels. |
| 921 | * Supported values:1 to 8 |
| 922 | */ |
| 923 | |
| 924 | u16 bits_per_sample; /* |
| 925 | * Number of bits per sample per channel. |
| 926 | * Supported values: 16, 24 When used for |
| 927 | * playback, the client must send 24-bit |
| 928 | * samples packed in 32-bit words. The |
| 929 | * 24-bit samples must be placed in the most |
| 930 | * significant 24 bits of the 32-bit word. When |
| 931 | * used for recording, the aDSP sends 24-bit |
| 932 | * samples packed in 32-bit words. The 24-bit |
| 933 | * samples are placed in the most significant |
| 934 | * 24 bits of the 32-bit word. |
| 935 | */ |
| 936 | |
| 937 | u32 sample_rate; /* |
| 938 | * Number of samples per second |
| 939 | * (in Hertz). Supported values: |
| 940 | * 2000 to 48000 |
| 941 | */ |
| 942 | |
| 943 | u16 is_signed; /* |
| 944 | * Flag that indicates the samples |
| 945 | * are signed (1). |
| 946 | */ |
| 947 | |
| 948 | u16 is_interleaved; /* |
| 949 | * Flag that indicates whether the channels are |
| 950 | * de-interleaved (0) or interleaved (1). |
| 951 | * Interleaved format means corresponding |
| 952 | * samples from the left and right channels are |
| 953 | * interleaved within the buffer. |
| 954 | * De-interleaved format means samples from |
| 955 | * each channel are contiguous in the buffer. |
| 956 | * The samples from one channel immediately |
| 957 | * follow those of the previous channel. |
| 958 | */ |
| 959 | |
| 960 | u8 channel_mapping[8]; /* |
| 961 | * Supported values: |
| 962 | * PCM_CHANNEL_NULL, PCM_CHANNEL_FL, |
| 963 | * PCM_CHANNEL_FR, PCM_CHANNEL_FC, |
| 964 | * PCM_CHANNEL_LS, PCM_CHANNEL_RS, |
| 965 | * PCM_CHANNEL_LFE, PCM_CHANNEL_CS, |
| 966 | * PCM_CHANNEL_LB, PCM_CHANNEL_RB, |
| 967 | * PCM_CHANNEL_TS, PCM_CHANNEL_CVH, |
| 968 | * PCM_CHANNEL_MS, PCM_CHANNEL_FLC, |
| 969 | * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC, |
| 970 | * PCM_CHANNEL_RRC. |
| 971 | * Channel[i] mapping describes channel I. Each |
| 972 | * element i of the array describes channel I |
| 973 | * inside the buffer where I < num_channels. |
| 974 | * An unused channel is set to zero. |
| 975 | */ |
| 976 | }; |
| 977 | struct asm_dts_enc_cfg { |
| 978 | uint32_t sample_rate; |
| 979 | /* |
| 980 | * Samples at which input is to be encoded. |
| 981 | * Supported values: |
| 982 | * 44100 -- encode at 44.1 Khz |
| 983 | * 48000 -- encode at 48 Khz |
| 984 | */ |
| 985 | |
| 986 | uint32_t num_channels; |
| 987 | /* |
| 988 | * Number of channels for multi-channel encoding. |
| 989 | * Supported values: 1 to 6 |
| 990 | */ |
| 991 | |
| 992 | uint8_t channel_mapping[6]; |
| 993 | /* |
| 994 | * Channel array of size 16. Channel[i] mapping describes channel I. |
| 995 | * Each element i of the array describes channel I inside the buffer |
| 996 | * where num_channels. An unused channel is set to zero. Only first |
| 997 | * num_channels elements are valid |
| 998 | * |
| 999 | * Supported values: |
| 1000 | * - # PCM_CHANNEL_L |
| 1001 | * - # PCM_CHANNEL_R |
| 1002 | * - # PCM_CHANNEL_C |
| 1003 | * - # PCM_CHANNEL_LS |
| 1004 | * - # PCM_CHANNEL_RS |
| 1005 | * - # PCM_CHANNEL_LFE |
| 1006 | */ |
| 1007 | |
| 1008 | }; |
| 1009 | struct asm_adpcm_cfg { |
| 1010 | u16 ch_cfg; |
| 1011 | u16 bits_per_sample; |
| 1012 | u32 sample_rate; |
| 1013 | u32 block_size; |
| 1014 | }; |
| 1015 | |
| 1016 | struct asm_yadpcm_cfg { |
| 1017 | u16 ch_cfg; |
| 1018 | u16 bits_per_sample; |
| 1019 | u32 sample_rate; |
| 1020 | }; |
| 1021 | |
| 1022 | struct asm_midi_cfg { |
| 1023 | u32 nMode; |
| 1024 | }; |
| 1025 | |
| 1026 | struct asm_wma_cfg { |
| 1027 | u16 format_tag; |
| 1028 | u16 ch_cfg; |
| 1029 | u32 sample_rate; |
| 1030 | u32 avg_bytes_per_sec; |
| 1031 | u16 block_align; |
| 1032 | u16 valid_bits_per_sample; |
| 1033 | u32 ch_mask; |
| 1034 | u16 encode_opt; |
| 1035 | u16 adv_encode_opt; |
| 1036 | u32 adv_encode_opt2; |
| 1037 | u32 drc_peak_ref; |
| 1038 | u32 drc_peak_target; |
| 1039 | u32 drc_ave_ref; |
| 1040 | u32 drc_ave_target; |
| 1041 | }; |
| 1042 | |
| 1043 | struct asm_wmapro_cfg { |
| 1044 | u16 format_tag; |
| 1045 | u16 ch_cfg; |
| 1046 | u32 sample_rate; |
| 1047 | u32 avg_bytes_per_sec; |
| 1048 | u16 block_align; |
| 1049 | u16 valid_bits_per_sample; |
| 1050 | u32 ch_mask; |
| 1051 | u16 encode_opt; |
| 1052 | u16 adv_encode_opt; |
| 1053 | u32 adv_encode_opt2; |
| 1054 | u32 drc_peak_ref; |
| 1055 | u32 drc_peak_target; |
| 1056 | u32 drc_ave_ref; |
| 1057 | u32 drc_ave_target; |
| 1058 | }; |
| 1059 | |
| 1060 | struct asm_aac_cfg { |
| 1061 | u16 format; |
| 1062 | u16 aot; |
| 1063 | u16 ep_config; |
| 1064 | u16 section_data_resilience; |
| 1065 | u16 scalefactor_data_resilience; |
| 1066 | u16 spectral_data_resilience; |
| 1067 | u16 ch_cfg; |
| 1068 | u16 reserved; |
| 1069 | u32 sample_rate; |
| 1070 | }; |
| 1071 | |
| 1072 | struct asm_amrwbplus_cfg { |
| 1073 | u32 size_bytes; |
| 1074 | u32 version; |
| 1075 | u32 num_channels; |
| 1076 | u32 amr_band_mode; |
| 1077 | u32 amr_dtx_mode; |
| 1078 | u32 amr_frame_fmt; |
| 1079 | u32 amr_lsf_idx; |
| 1080 | }; |
| 1081 | |
| 1082 | struct asm_flac_cfg { |
| 1083 | u16 stream_info_present; |
| 1084 | u16 min_blk_size; |
| 1085 | u16 max_blk_size; |
| 1086 | u16 ch_cfg; |
| 1087 | u16 sample_size; |
| 1088 | u16 sample_rate; |
| 1089 | u16 md5_sum; |
| 1090 | u32 ext_sample_rate; |
| 1091 | u32 min_frame_size; |
| 1092 | u32 max_frame_size; |
| 1093 | }; |
| 1094 | |
| 1095 | struct asm_vorbis_cfg { |
| 1096 | u32 ch_cfg; |
| 1097 | u32 bit_rate; |
| 1098 | u32 min_bit_rate; |
| 1099 | u32 max_bit_rate; |
| 1100 | u16 bit_depth_pcm_sample; |
| 1101 | u16 bit_stream_format; |
| 1102 | }; |
| 1103 | |
| 1104 | struct asm_aac_read_cfg { |
| 1105 | u32 bitrate; |
| 1106 | u32 enc_mode; |
| 1107 | u16 format; |
| 1108 | u16 ch_cfg; |
| 1109 | u32 sample_rate; |
| 1110 | }; |
| 1111 | |
| 1112 | struct asm_amrnb_read_cfg { |
| 1113 | u16 mode; |
| 1114 | u16 dtx_mode; |
| 1115 | }; |
| 1116 | |
| 1117 | struct asm_amrwb_read_cfg { |
| 1118 | u16 mode; |
| 1119 | u16 dtx_mode; |
| 1120 | }; |
| 1121 | |
| 1122 | struct asm_evrc_read_cfg { |
| 1123 | u16 max_rate; |
| 1124 | u16 min_rate; |
| 1125 | u16 rate_modulation_cmd; |
| 1126 | u16 reserved; |
| 1127 | }; |
| 1128 | |
| 1129 | struct asm_qcelp13_read_cfg { |
| 1130 | u16 max_rate; |
| 1131 | u16 min_rate; |
| 1132 | u16 reduced_rate_level; |
| 1133 | u16 rate_modulation_cmd; |
| 1134 | }; |
| 1135 | |
| 1136 | struct asm_sbc_read_cfg { |
| 1137 | u32 subband; |
| 1138 | u32 block_len; |
| 1139 | u32 ch_mode; |
| 1140 | u32 alloc_method; |
| 1141 | u32 bit_rate; |
| 1142 | u32 sample_rate; |
| 1143 | }; |
| 1144 | |
| 1145 | struct asm_sbc_bitrate { |
| 1146 | u32 bitrate; |
| 1147 | }; |
| 1148 | |
| 1149 | struct asm_immed_decode { |
| 1150 | u32 mode; |
| 1151 | }; |
| 1152 | |
| 1153 | struct asm_sbr_ps { |
| 1154 | u32 enable; |
| 1155 | }; |
| 1156 | |
| 1157 | struct asm_dual_mono { |
| 1158 | u16 sce_left; |
| 1159 | u16 sce_right; |
| 1160 | }; |
| 1161 | |
| 1162 | struct asm_dec_chan_map { |
| 1163 | u32 num_channels; /* Number of decoder output |
| 1164 | * channels. A value of 0 |
| 1165 | * indicates native channel |
| 1166 | * mapping, which is valid |
| 1167 | * only for NT mode. This |
| 1168 | * means the output of the |
| 1169 | * decoder is to be preserved |
| 1170 | * as is. |
| 1171 | */ |
| 1172 | |
| 1173 | u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size |
| 1174 | * num_channels. It can grow |
| 1175 | * till MAX_CHAN_MAP_CHANNELS. |
| 1176 | * Channel[i] mapping |
| 1177 | * describes channel I inside |
| 1178 | * the decoder output buffer. |
| 1179 | * Valid channel mapping |
| 1180 | * values are to be present at |
| 1181 | * the beginning of the array. |
| 1182 | * All remaining elements of |
| 1183 | * the array are to be filled |
| 1184 | * with PCM_CHANNEL_NULL. |
| 1185 | */ |
| 1186 | }; |
| 1187 | |
| 1188 | struct asm_encode_cfg_blk { |
| 1189 | u32 frames_per_buf; |
| 1190 | u32 format_id; |
| 1191 | u32 cfg_size; |
| 1192 | union { |
| 1193 | struct asm_pcm_cfg pcm; |
| 1194 | struct asm_aac_read_cfg aac; |
| 1195 | struct asm_amrnb_read_cfg amrnb; |
| 1196 | struct asm_evrc_read_cfg evrc; |
| 1197 | struct asm_qcelp13_read_cfg qcelp13; |
| 1198 | struct asm_sbc_read_cfg sbc; |
| 1199 | struct asm_amrwb_read_cfg amrwb; |
| 1200 | struct asm_multi_channel_pcm_fmt_blk mpcm; |
| 1201 | struct asm_dts_enc_cfg dts; |
| 1202 | } __packed cfg; |
| 1203 | }; |
| 1204 | |
| 1205 | struct asm_frame_meta_info { |
| 1206 | u32 offset_to_frame; |
| 1207 | u32 frame_size; |
| 1208 | u32 encoded_pcm_samples; |
| 1209 | u32 msw_ts; |
| 1210 | u32 lsw_ts; |
| 1211 | u32 nflags; |
| 1212 | }; |
| 1213 | |
| 1214 | /* Stream level commands */ |
| 1215 | #define ASM_STREAM_CMD_OPEN_READ 0x00010BCB |
| 1216 | #define ASM_STREAM_CMD_OPEN_READ_V2_1 0x00010DB2 |
| 1217 | struct asm_stream_cmd_open_read { |
| 1218 | struct apr_hdr hdr; |
| 1219 | u32 uMode; |
| 1220 | u32 src_endpoint; |
| 1221 | u32 pre_proc_top; |
| 1222 | u32 format; |
| 1223 | } __packed; |
| 1224 | |
| 1225 | struct asm_stream_cmd_open_read_v2_1 { |
| 1226 | struct apr_hdr hdr; |
| 1227 | u32 uMode; |
| 1228 | u32 src_endpoint; |
| 1229 | u32 pre_proc_top; |
| 1230 | u32 format; |
| 1231 | u16 bits_per_sample; |
| 1232 | u16 reserved; |
| 1233 | } __packed; |
| 1234 | |
| 1235 | /* Supported formats */ |
| 1236 | #define LINEAR_PCM 0x00010BE5 |
| 1237 | #define DTMF 0x00010BE6 |
| 1238 | #define ADPCM 0x00010BE7 |
| 1239 | #define YADPCM 0x00010BE8 |
| 1240 | #define MP3 0x00010BE9 |
| 1241 | #define MPEG4_AAC 0x00010BEA |
| 1242 | #define AMRNB_FS 0x00010BEB |
| 1243 | #define AMRWB_FS 0x00010BEC |
| 1244 | #define V13K_FS 0x00010BED |
| 1245 | #define EVRC_FS 0x00010BEE |
| 1246 | #define EVRCB_FS 0x00010BEF |
| 1247 | #define EVRCWB_FS 0x00010BF0 |
| 1248 | #define MIDI 0x00010BF1 |
| 1249 | #define SBC 0x00010BF2 |
| 1250 | #define WMA_V10PRO 0x00010BF3 |
| 1251 | #define WMA_V9 0x00010BF4 |
| 1252 | #define AMR_WB_PLUS 0x00010BF5 |
| 1253 | #define AC3_DECODER 0x00010BF6 |
| 1254 | #define EAC3_DECODER 0x00010C3C |
| 1255 | #define DTS 0x00010D88 |
| 1256 | #define DTS_LBR 0x00010DBB |
| 1257 | #define MP2 0x00010DBE |
| 1258 | #define ATRAC 0x00010D89 |
| 1259 | #define MAT 0x00010D8A |
| 1260 | #define G711_ALAW_FS 0x00010BF7 |
| 1261 | #define G711_MLAW_FS 0x00010BF8 |
| 1262 | #define G711_PCM_FS 0x00010BF9 |
| 1263 | #define MPEG4_MULTI_AAC 0x00010D86 |
| 1264 | #define US_POINT_EPOS_FORMAT 0x00012310 |
| 1265 | #define US_RAW_FORMAT 0x0001127C |
| 1266 | #define US_PROX_FORMAT 0x0001272B |
| 1267 | #define MULTI_CHANNEL_PCM 0x00010C66 |
| 1268 | |
| 1269 | #define ASM_ENCDEC_SBCRATE 0x00010C13 |
| 1270 | #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14 |
| 1271 | #define ASM_ENCDEC_CFG_BLK 0x00010C2C |
| 1272 | |
| 1273 | #define ASM_ENCDEC_SBCRATE 0x00010C13 |
| 1274 | #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14 |
| 1275 | #define ASM_ENCDEC_CFG_BLK 0x00010C2C |
| 1276 | |
| 1277 | #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95 |
| 1278 | struct asm_stream_cmd_open_read_compressed { |
| 1279 | struct apr_hdr hdr; |
| 1280 | u32 uMode; |
| 1281 | u32 frame_per_buf; |
| 1282 | } __packed; |
| 1283 | |
| 1284 | #define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA |
| 1285 | #define ASM_STREAM_CMD_OPEN_WRITE_V2_1 0x00010DB1 |
| 1286 | struct asm_stream_cmd_open_write { |
| 1287 | struct apr_hdr hdr; |
| 1288 | u32 uMode; |
| 1289 | u16 sink_endpoint; |
| 1290 | u16 stream_handle; |
| 1291 | u32 post_proc_top; |
| 1292 | u32 format; |
| 1293 | } __packed; |
| 1294 | |
| 1295 | #define IEC_61937_MASK 0x00000001 |
| 1296 | #define IEC_60958_MASK 0x00000002 |
| 1297 | |
| 1298 | #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84 |
| 1299 | struct asm_stream_cmd_open_write_compressed { |
| 1300 | struct apr_hdr hdr; |
| 1301 | u32 flags; |
| 1302 | u32 format; |
| 1303 | } __packed; |
| 1304 | #define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA |
| 1305 | struct asm_stream_cmd_open_transcode_loopback { |
| 1306 | struct apr_hdr hdr; |
| 1307 | uint32_t mode_flags; |
| 1308 | /* |
| 1309 | * All bits are reserved. Clients must set them to zero. |
| 1310 | */ |
| 1311 | |
| 1312 | uint32_t src_format_id; |
| 1313 | /* |
| 1314 | * Specifies the media format of the input audio stream. |
| 1315 | * |
| 1316 | * Supported values: |
| 1317 | * - #ASM_MEDIA_FMT_LINEAR_PCM |
| 1318 | * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM |
| 1319 | */ |
| 1320 | |
| 1321 | uint32_t sink_format_id; |
| 1322 | /* |
| 1323 | * Specifies the media format of the output stream. |
| 1324 | * |
| 1325 | * Supported values: |
| 1326 | * - #ASM_MEDIA_FMT_LINEAR_PCM |
| 1327 | * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM |
| 1328 | * - #ASM_MEDIA_FMT_DTS |
| 1329 | */ |
| 1330 | |
| 1331 | uint32_t audproc_topo_id; |
| 1332 | /* |
| 1333 | * Postprocessing topology ID, which specifies the topology (order of |
| 1334 | * processing) of postprocessing algorithms. |
| 1335 | * |
| 1336 | * Supported values: |
| 1337 | * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT |
| 1338 | * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER |
| 1339 | * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE |
| 1340 | * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL |
| 1341 | */ |
| 1342 | |
| 1343 | uint16_t src_endpoint_type; |
| 1344 | /* |
| 1345 | * Specifies the source endpoint that provides the input samples. |
| 1346 | * |
| 1347 | * Supported values: |
| 1348 | * - 0 -- Tx device matrix or stream router |
| 1349 | * (gateway to the hardware ports) |
| 1350 | * - All other values are reserved |
| 1351 | * |
| 1352 | * Clients must set this field to zero. Otherwise, an error is returned. |
| 1353 | */ |
| 1354 | |
| 1355 | uint16_t sink_endpoint_type; |
| 1356 | /* |
| 1357 | * Specifies the sink endpoint type. |
| 1358 | * |
| 1359 | * Supported values: |
| 1360 | * - 0 -- Rx device matrix or stream router |
| 1361 | * (gateway to the hardware ports) |
| 1362 | * - All other values are reserved |
| 1363 | * |
| 1364 | * Clients must set this field to zero. Otherwise, an error is returned. |
| 1365 | */ |
| 1366 | |
| 1367 | uint16_t bits_per_sample; |
| 1368 | /* |
| 1369 | * Number of bits per sample processed by the ASM modules. |
| 1370 | * Supported values: 16, 24 |
| 1371 | */ |
| 1372 | |
| 1373 | uint16_t reserved; |
| 1374 | /* |
| 1375 | * This field must be set to zero. |
| 1376 | */ |
| 1377 | } __packed; |
| 1378 | |
| 1379 | /* |
| 1380 | * ID of the DTS mix LFE channel to front channels parameter in the |
| 1381 | * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command. |
| 1382 | * asm_dts_generic_param_t |
| 1383 | * ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT |
| 1384 | */ |
| 1385 | #define ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT 0x00010DB6 |
| 1386 | |
| 1387 | /* |
| 1388 | * ID of the DTS DRC ratio parameter in the |
| 1389 | * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command. |
| 1390 | * asm_dts_generic_param_t |
| 1391 | * ASM_PARAM_ID_DTS_DRC_RATIO |
| 1392 | */ |
| 1393 | #define ASM_PARAM_ID_DTS_DRC_RATIO 0x00010DB7 |
| 1394 | |
| 1395 | /* |
| 1396 | * ID of the DTS enable dialog normalization parameter in the |
| 1397 | * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command. |
| 1398 | * |
| 1399 | * asm_dts_generic_param_t |
| 1400 | * ASM_PARAM_ID_DTS_ENABLE_DIALNORM |
| 1401 | */ |
| 1402 | #define ASM_PARAM_ID_DTS_ENABLE_DIALNORM 0x00010DB8 |
| 1403 | |
| 1404 | /* |
| 1405 | * ID of the DTS enable parse REV2AUX parameter in the |
| 1406 | * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command. |
| 1407 | * asm_dts_generic_param_t |
| 1408 | * ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX |
| 1409 | */ |
| 1410 | #define ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX 0x00010DB9 |
| 1411 | |
| 1412 | struct asm_dts_generic_param { |
| 1413 | int32_t generic_parameter; |
| 1414 | /* |
| 1415 | * #ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT: |
| 1416 | * - if enabled, mixes LFE channel to front |
| 1417 | * while downmixing (if necessary) |
| 1418 | * - Supported values: 1-> enable, 0-> disable |
| 1419 | * - Default: disabled |
| 1420 | * |
| 1421 | * #ASM_PARAM_ID_DTS_DRC_RATIO: |
| 1422 | * - percentage of DRC ratio. |
| 1423 | * - Supported values: 0-100 |
| 1424 | * - Default: 0, DRC is disabled. |
| 1425 | * |
| 1426 | * #ASM_PARAM_ID_DTS_ENABLE_DIALNORM: |
| 1427 | * - flag to enable dialog normalization post processing. |
| 1428 | * - Supported values: 1-> enable, 0-> disable. |
| 1429 | * - Default: enabled. |
| 1430 | * |
| 1431 | * #ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX: |
| 1432 | * - flag to enable parsing of rev2aux chunk in the bitstream. |
| 1433 | * This chunk contains broadcast metadata. |
| 1434 | * - Supported values: 1-> enable, 0-> disable. |
| 1435 | * - Default: disabled. |
| 1436 | */ |
| 1437 | }; |
| 1438 | |
| 1439 | struct asm_stream_cmd_dts_dec_param { |
| 1440 | struct apr_hdr hdr; |
| 1441 | u32 param_id; |
| 1442 | u32 param_size; |
| 1443 | struct asm_dts_generic_param generic_param; |
| 1444 | } __packed; |
| 1445 | |
| 1446 | |
| 1447 | #define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC |
| 1448 | |
| 1449 | struct asm_stream_cmd_open_read_write { |
| 1450 | struct apr_hdr hdr; |
| 1451 | u32 uMode; |
| 1452 | u32 post_proc_top; |
| 1453 | u32 write_format; |
| 1454 | u32 read_format; |
| 1455 | } __packed; |
| 1456 | |
| 1457 | #define ASM_STREAM_CMD_OPEN_LOOPBACK 0x00010D6E |
| 1458 | struct asm_stream_cmd_open_loopback { |
| 1459 | struct apr_hdr hdr; |
| 1460 | u32 mode_flags; |
| 1461 | /* Mode flags. |
| 1462 | * Bit 0-31: reserved; client should set these bits to 0 |
| 1463 | */ |
| 1464 | u16 src_endpointype; |
| 1465 | /* Endpoint type. 0 = Tx Matrix */ |
| 1466 | u16 sink_endpointype; |
| 1467 | /* Endpoint type. 0 = Rx Matrix */ |
| 1468 | u32 postprocopo_id; |
| 1469 | /* Postprocessor topology ID. Specifies the topology of |
| 1470 | * postprocessing algorithms. |
| 1471 | */ |
| 1472 | } __packed; |
| 1473 | |
| 1474 | #define ADM_CMD_CONNECT_AFE_PORT 0x00010320 |
| 1475 | #define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321 |
| 1476 | |
| 1477 | struct adm_cmd_connect_afe_port { |
| 1478 | struct apr_hdr hdr; |
| 1479 | u8 mode; /*mode represent the interface is for RX or TX*/ |
| 1480 | u8 session_id; /*ASM session ID*/ |
| 1481 | u16 afe_port_id; |
| 1482 | } __packed; |
| 1483 | |
| 1484 | #define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332 |
| 1485 | |
| 1486 | struct adm_cmd_connect_afe_port_v2 { |
| 1487 | struct apr_hdr hdr; |
| 1488 | u8 mode; /*mode represent the interface is for RX or TX*/ |
| 1489 | u8 session_id; /*ASM session ID*/ |
| 1490 | u16 afe_port_id; |
| 1491 | u32 num_channels; |
| 1492 | u32 sampling_rate; |
| 1493 | } __packed; |
| 1494 | |
| 1495 | #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10 |
| 1496 | #define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11 |
| 1497 | #define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C |
| 1498 | #define ASM_ENABLE_SBR_PS 0x00010C63 |
| 1499 | #define ASM_CONFIGURE_DUAL_MONO 0x00010C64 |
| 1500 | struct asm_stream_cmd_encdec_cfg_blk { |
| 1501 | struct apr_hdr hdr; |
| 1502 | u32 param_id; |
| 1503 | u32 param_size; |
| 1504 | struct asm_encode_cfg_blk enc_blk; |
| 1505 | } __packed; |
| 1506 | |
| 1507 | struct asm_stream_cmd_encdec_sbc_bitrate { |
| 1508 | struct apr_hdr hdr; |
| 1509 | u32 param_id; |
| 1510 | struct asm_sbc_bitrate sbc_bitrate; |
| 1511 | } __packed; |
| 1512 | |
| 1513 | struct asm_stream_cmd_encdec_immed_decode { |
| 1514 | struct apr_hdr hdr; |
| 1515 | u32 param_id; |
| 1516 | u32 param_size; |
| 1517 | struct asm_immed_decode dec; |
| 1518 | } __packed; |
| 1519 | |
| 1520 | struct asm_stream_cmd_encdec_sbr { |
| 1521 | struct apr_hdr hdr; |
| 1522 | u32 param_id; |
| 1523 | u32 param_size; |
| 1524 | struct asm_sbr_ps sbr_ps; |
| 1525 | } __packed; |
| 1526 | |
| 1527 | struct asm_stream_cmd_encdec_dualmono { |
| 1528 | struct apr_hdr hdr; |
| 1529 | u32 param_id; |
| 1530 | u32 param_size; |
| 1531 | struct asm_dual_mono channel_map; |
| 1532 | } __packed; |
| 1533 | |
| 1534 | #define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG 0x00010DD8 |
| 1535 | |
| 1536 | /* Structure for AAC decoder stereo coefficient setting. */ |
| 1537 | |
| 1538 | struct asm_aac_stereo_mix_coeff_selection_param { |
| 1539 | struct apr_hdr hdr; |
| 1540 | u32 param_id; |
| 1541 | u32 param_size; |
| 1542 | u32 aac_stereo_mix_coeff_flag; |
| 1543 | } __packed; |
| 1544 | |
| 1545 | #define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82 |
| 1546 | struct asm_stream_cmd_encdec_channelmap { |
| 1547 | struct apr_hdr hdr; |
| 1548 | u32 param_id; |
| 1549 | u32 param_size; |
| 1550 | struct asm_dec_chan_map chan_map; |
| 1551 | } __packed; |
| 1552 | |
| 1553 | #define ASM_STREAM_CMD_ADJUST_SAMPLES 0x00010C0A |
| 1554 | struct asm_stream_cmd_adjust_samples { |
| 1555 | struct apr_hdr hdr; |
| 1556 | u16 nsamples; |
| 1557 | u16 reserved; |
| 1558 | } __packed; |
| 1559 | |
| 1560 | #define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9 |
| 1561 | struct asm_stream_cmd_tap_popp_pcm { |
| 1562 | struct apr_hdr hdr; |
| 1563 | u16 enable; |
| 1564 | u16 reserved; |
| 1565 | u32 module_id; |
| 1566 | } __packed; |
| 1567 | |
| 1568 | /* Session Level commands */ |
| 1569 | #define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32 |
| 1570 | struct asm_stream_cmd_memory_map { |
| 1571 | struct apr_hdr hdr; |
| 1572 | u32 buf_add; |
| 1573 | u32 buf_size; |
| 1574 | u16 mempool_id; |
| 1575 | u16 reserved; |
| 1576 | } __packed; |
| 1577 | |
| 1578 | #define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33 |
| 1579 | struct asm_stream_cmd_memory_unmap { |
| 1580 | struct apr_hdr hdr; |
| 1581 | u32 buf_add; |
| 1582 | } __packed; |
| 1583 | |
| 1584 | #define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45 |
| 1585 | struct asm_memory_map_regions { |
| 1586 | u32 phys; |
| 1587 | u32 buf_size; |
| 1588 | } __packed; |
| 1589 | |
| 1590 | struct asm_stream_cmd_memory_map_regions { |
| 1591 | struct apr_hdr hdr; |
| 1592 | u16 mempool_id; |
| 1593 | u16 nregions; |
| 1594 | } __packed; |
| 1595 | |
| 1596 | #define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46 |
| 1597 | struct asm_memory_unmap_regions { |
| 1598 | u32 phys; |
| 1599 | } __packed; |
| 1600 | |
| 1601 | struct asm_stream_cmd_memory_unmap_regions { |
| 1602 | struct apr_hdr hdr; |
| 1603 | u16 nregions; |
| 1604 | u16 reserved; |
| 1605 | } __packed; |
| 1606 | |
| 1607 | #define ASM_SESSION_CMD_RUN 0x00010BD2 |
| 1608 | struct asm_stream_cmd_run { |
| 1609 | struct apr_hdr hdr; |
| 1610 | u32 flags; |
| 1611 | u32 msw_ts; |
| 1612 | u32 lsw_ts; |
| 1613 | } __packed; |
| 1614 | |
| 1615 | /* Session level events */ |
| 1616 | #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5 |
| 1617 | struct asm_stream_cmd_reg_rx_underflow_event { |
| 1618 | struct apr_hdr hdr; |
| 1619 | u16 enable; |
| 1620 | u16 reserved; |
| 1621 | } __packed; |
| 1622 | |
| 1623 | #define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6 |
| 1624 | struct asm_stream_cmd_reg_tx_overflow_event { |
| 1625 | struct apr_hdr hdr; |
| 1626 | u16 enable; |
| 1627 | u16 reserved; |
| 1628 | } __packed; |
| 1629 | |
| 1630 | /* Data Path commands */ |
| 1631 | #define ASM_DATA_CMD_WRITE 0x00010BD9 |
| 1632 | struct asm_stream_cmd_write { |
| 1633 | struct apr_hdr hdr; |
| 1634 | u32 buf_add; |
| 1635 | u32 avail_bytes; |
| 1636 | u32 uid; |
| 1637 | u32 msw_ts; |
| 1638 | u32 lsw_ts; |
| 1639 | u32 uflags; |
| 1640 | } __packed; |
| 1641 | |
| 1642 | #define ASM_DATA_CMD_READ 0x00010BDA |
| 1643 | struct asm_stream_cmd_read { |
| 1644 | struct apr_hdr hdr; |
| 1645 | u32 buf_add; |
| 1646 | u32 buf_size; |
| 1647 | u32 uid; |
| 1648 | } __packed; |
| 1649 | |
| 1650 | #define ASM_DATA_CMD_READ_COMPRESSED 0x00010DBF |
| 1651 | struct asm_stream_cmd_read_compressed { |
| 1652 | struct apr_hdr hdr; |
| 1653 | u32 buf_add; |
| 1654 | u32 buf_size; |
| 1655 | u32 uid; |
| 1656 | } __packed; |
| 1657 | |
| 1658 | #define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC |
| 1659 | #define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE |
| 1660 | struct asm_stream_media_format_update { |
| 1661 | struct apr_hdr hdr; |
| 1662 | u32 format; |
| 1663 | u32 cfg_size; |
| 1664 | union { |
| 1665 | struct asm_pcm_cfg pcm_cfg; |
| 1666 | struct asm_adpcm_cfg adpcm_cfg; |
| 1667 | struct asm_yadpcm_cfg yadpcm_cfg; |
| 1668 | struct asm_midi_cfg midi_cfg; |
| 1669 | struct asm_wma_cfg wma_cfg; |
| 1670 | struct asm_wmapro_cfg wmapro_cfg; |
| 1671 | struct asm_aac_cfg aac_cfg; |
| 1672 | struct asm_flac_cfg flac_cfg; |
| 1673 | struct asm_vorbis_cfg vorbis_cfg; |
| 1674 | struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg; |
| 1675 | struct asm_amrwbplus_cfg amrwbplus_cfg; |
| 1676 | } __packed write_cfg; |
| 1677 | } __packed; |
| 1678 | |
| 1679 | |
| 1680 | /* Command Responses */ |
| 1681 | #define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12 |
| 1682 | struct asm_stream_cmdrsp_get_readwrite_param { |
| 1683 | struct apr_hdr hdr; |
| 1684 | u32 status; |
| 1685 | u32 param_id; |
| 1686 | u16 param_size; |
| 1687 | u16 padding; |
| 1688 | union { |
| 1689 | struct asm_sbc_bitrate sbc_bitrate; |
| 1690 | struct asm_immed_decode aac_dec; |
| 1691 | } __packed read_write_cfg; |
| 1692 | } __packed; |
| 1693 | |
| 1694 | |
| 1695 | #define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8 |
| 1696 | struct asm_stream_cmdrsp_get_session_time { |
| 1697 | struct apr_hdr hdr; |
| 1698 | u32 status; |
| 1699 | u32 msw_ts; |
| 1700 | u32 lsw_ts; |
| 1701 | } __packed; |
| 1702 | |
| 1703 | #define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF |
| 1704 | struct asm_data_event_write_done { |
| 1705 | u32 buf_add; |
| 1706 | u32 status; |
| 1707 | } __packed; |
| 1708 | |
| 1709 | #define ASM_DATA_EVENT_READ_DONE 0x00010BE0 |
| 1710 | struct asm_data_event_read_done { |
| 1711 | u32 status; |
| 1712 | u32 buffer_add; |
| 1713 | u32 enc_frame_size; |
| 1714 | u32 offset; |
| 1715 | u32 msw_ts; |
| 1716 | u32 lsw_ts; |
| 1717 | u32 flags; |
| 1718 | u32 num_frames; |
| 1719 | u32 id; |
| 1720 | } __packed; |
| 1721 | |
| 1722 | #define ASM_DATA_EVENT_READ_COMPRESSED_DONE 0x00010DC0 |
| 1723 | struct asm_data_event_read_compressed_done { |
| 1724 | u32 status; |
| 1725 | u32 buffer_add; |
| 1726 | u32 enc_frame_size; |
| 1727 | u32 offset; |
| 1728 | u32 msw_ts; |
| 1729 | u32 lsw_ts; |
| 1730 | u32 flags; |
| 1731 | u32 num_frames; |
| 1732 | u32 id; |
| 1733 | } __packed; |
| 1734 | |
| 1735 | #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65 |
| 1736 | struct asm_data_event_sr_cm_change_notify { |
| 1737 | u32 sample_rate; |
| 1738 | u16 no_of_channels; |
| 1739 | u16 reserved; |
| 1740 | u8 channel_map[8]; |
| 1741 | } __packed; |
| 1742 | |
| 1743 | /* service level events */ |
| 1744 | |
| 1745 | #define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B |
| 1746 | struct asm_svc_cmdrsp_get_strm_handles { |
| 1747 | struct apr_hdr hdr; |
| 1748 | u32 num_handles; |
| 1749 | u32 stream_handles; |
| 1750 | } __packed; |
| 1751 | |
| 1752 | |
| 1753 | #define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A |
| 1754 | struct asm_svc_cmdrsp_get_wallclock_time { |
| 1755 | struct apr_hdr hdr; |
| 1756 | u32 status; |
| 1757 | u32 msw_ts; |
| 1758 | u32 lsw_ts; |
| 1759 | } __packed; |
| 1760 | |
| 1761 | /* Error code */ |
| 1762 | #define ADSP_EOK 0x00000000 /* Success / completed / no errors. */ |
| 1763 | #define ADSP_EFAILED 0x00000001 /* General failure. */ |
| 1764 | #define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */ |
| 1765 | #define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */ |
| 1766 | #define ADSP_EVERSION 0x00000004 /* Unsupported version. */ |
| 1767 | #define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */ |
| 1768 | #define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */ |
| 1769 | #define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */ |
| 1770 | #define ADSP_EHANDLE 0x00000008 /* Invalid handle. */ |
| 1771 | #define ADSP_EALREADY 0x00000009 /* Operation is already processed. */ |
| 1772 | #define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/ |
| 1773 | #define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/ |
| 1774 | #define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or |
| 1775 | * processed. |
| 1776 | */ |
| 1777 | #define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */ |
| 1778 | #define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/ |
| 1779 | #define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention |
| 1780 | * to complete. |
| 1781 | */ |
| 1782 | #define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate |
| 1783 | * intervention to complete. |
| 1784 | */ |
| 1785 | #define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */ |
| 1786 | #define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/ |
| 1787 | |
| 1788 | /* SRS TRUMEDIA GUIDS */ |
| 1789 | #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90 |
| 1790 | #define SRS_TRUMEDIA_MODULE_ID 0x10005010 |
| 1791 | #define SRS_TRUMEDIA_PARAMS 0x10005011 |
| 1792 | #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012 |
| 1793 | #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013 |
| 1794 | #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014 |
| 1795 | #define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015 |
| 1796 | #define SRS_TRUMEDIA_PARAMS_HL 0x10005016 |
| 1797 | |
| 1798 | /* SRS STUDIO SOUND 3D GUIDS */ |
| 1799 | #define SRS_SS3D_TOPOLOGY_ID 0x00010720 |
| 1800 | #define SRS_SS3D_MODULE_ID 0x10005020 |
| 1801 | #define SRS_SS3D_PARAMS 0x10005021 |
| 1802 | #define SRS_SS3D_PARAMS_CTRL 0x10005022 |
| 1803 | #define SRS_SS3D_PARAMS_FILTER 0x10005023 |
| 1804 | |
| 1805 | /* SRS ALSA CMD MASKS */ |
| 1806 | #define SRS_CMD_UPLOAD 0x7FFF0000 |
| 1807 | #define SRS_PARAM_INDEX_MASK 0x80000000 |
| 1808 | #define SRS_PARAM_OFFSET_MASK 0x3FFF0000 |
| 1809 | #define SRS_PARAM_VALUE_MASK 0x0000FFFF |
| 1810 | |
| 1811 | /* SRS TRUMEDIA start */ |
| 1812 | #define SRS_ID_GLOBAL 0x00000001 |
| 1813 | #define SRS_ID_WOWHD 0x00000002 |
| 1814 | #define SRS_ID_CSHP 0x00000003 |
| 1815 | #define SRS_ID_HPF 0x00000004 |
| 1816 | #define SRS_ID_PEQ 0x00000005 |
| 1817 | #define SRS_ID_HL 0x00000006 |
| 1818 | |
| 1819 | struct srs_trumedia_params_GLOBAL { |
| 1820 | uint8_t v1; |
| 1821 | uint8_t v2; |
| 1822 | uint8_t v3; |
| 1823 | uint8_t v4; |
| 1824 | uint8_t v5; |
| 1825 | uint8_t v6; |
| 1826 | uint8_t v7; |
| 1827 | uint8_t v8; |
| 1828 | } __packed; |
| 1829 | |
| 1830 | struct srs_trumedia_params_WOWHD { |
| 1831 | uint32_t v1; |
| 1832 | uint16_t v2; |
| 1833 | uint16_t v3; |
| 1834 | uint16_t v4; |
| 1835 | uint16_t v5; |
| 1836 | uint16_t v6; |
| 1837 | uint16_t v7; |
| 1838 | uint16_t v8; |
| 1839 | uint16_t v____A1; |
| 1840 | uint32_t v9; |
| 1841 | uint16_t v10; |
| 1842 | uint16_t v11; |
| 1843 | uint32_t v12[16]; |
| 1844 | } __packed; |
| 1845 | |
| 1846 | struct srs_trumedia_params_CSHP { |
| 1847 | uint32_t v1; |
| 1848 | uint16_t v2; |
| 1849 | uint16_t v3; |
| 1850 | uint16_t v4; |
| 1851 | uint16_t v5; |
| 1852 | uint16_t v6; |
| 1853 | uint16_t v____A1; |
| 1854 | uint32_t v7; |
| 1855 | uint16_t v8; |
| 1856 | uint16_t v9; |
| 1857 | uint32_t v10[16]; |
| 1858 | } __packed; |
| 1859 | |
| 1860 | struct srs_trumedia_params_HPF { |
| 1861 | uint32_t v1; |
| 1862 | uint32_t v2[26]; |
| 1863 | } __packed; |
| 1864 | |
| 1865 | struct srs_trumedia_params_PEQ { |
| 1866 | uint32_t v1; |
| 1867 | uint16_t v2; |
| 1868 | uint16_t v3; |
| 1869 | uint16_t v4; |
| 1870 | uint16_t v____A1; |
| 1871 | uint32_t v5[26]; |
| 1872 | uint32_t v6[26]; |
| 1873 | } __packed; |
| 1874 | |
| 1875 | struct srs_trumedia_params_HL { |
| 1876 | uint16_t v1; |
| 1877 | uint16_t v2; |
| 1878 | uint16_t v3; |
| 1879 | uint16_t v____A1; |
| 1880 | int32_t v4; |
| 1881 | uint32_t v5; |
| 1882 | uint16_t v6; |
| 1883 | uint16_t v____A2; |
| 1884 | uint32_t v7; |
| 1885 | } __packed; |
| 1886 | |
| 1887 | struct srs_trumedia_params { |
| 1888 | struct srs_trumedia_params_GLOBAL global; |
| 1889 | struct srs_trumedia_params_WOWHD wowhd; |
| 1890 | struct srs_trumedia_params_CSHP cshp; |
| 1891 | struct srs_trumedia_params_HPF hpf; |
| 1892 | struct srs_trumedia_params_PEQ peq; |
| 1893 | struct srs_trumedia_params_HL hl; |
| 1894 | } __packed; |
| 1895 | |
| 1896 | int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params); |
| 1897 | /* SRS TruMedia end */ |
| 1898 | |
| 1899 | /* SRS Studio Sound 3D start */ |
| 1900 | #define SRS_ID_SS3D_GLOBAL 0x00000001 |
| 1901 | #define SRS_ID_SS3D_CTRL 0x00000002 |
| 1902 | #define SRS_ID_SS3D_FILTER 0x00000003 |
| 1903 | |
| 1904 | struct srs_SS3D_params_GLOBAL { |
| 1905 | uint8_t v1; |
| 1906 | uint8_t v2; |
| 1907 | uint8_t v3; |
| 1908 | uint8_t v4; |
| 1909 | uint8_t v5; |
| 1910 | uint8_t v6; |
| 1911 | uint8_t v7; |
| 1912 | uint8_t v8; |
| 1913 | } __packed; |
| 1914 | |
| 1915 | struct srs_SS3D_ctrl_params { |
| 1916 | uint8_t v[236]; |
| 1917 | } __packed; |
| 1918 | |
| 1919 | struct srs_SS3D_filter_params { |
| 1920 | uint8_t v[28 + 2752]; |
| 1921 | } __packed; |
| 1922 | |
| 1923 | struct srs_SS3D_params { |
| 1924 | struct srs_SS3D_params_GLOBAL global; |
| 1925 | struct srs_SS3D_ctrl_params ss3d; |
| 1926 | struct srs_SS3D_filter_params ss3d_f; |
| 1927 | } __packed; |
| 1928 | |
| 1929 | int srs_ss3d_open(int port_id, int srs_tech_id, void *srs_params); |
| 1930 | /* SRS Studio Sound 3D end */ |
| 1931 | #endif /*_APR_AUDIO_H_*/ |