Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Ben Romberger | b760323 | 2011-11-23 17:16:27 -0800 | [diff] [blame] | 3 | * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 <mach/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 */ |
Laxminath Kasam | 32657ec | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 60 | #define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */ |
| 61 | #define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */ |
Shiv Maliyappanahalli | a416ee2 | 2012-06-01 16:02:35 -0700 | [diff] [blame] | 62 | #define SECONDARY_PCM_RX 12 /* index = 32 */ |
| 63 | #define SECONDARY_PCM_TX 13 /* index = 33 */ |
| 64 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | |
| 66 | #define AFE_PORT_INVALID 0xFFFF |
Joonwoo Park | c924f3e | 2012-04-11 19:25:03 -0700 | [diff] [blame] | 67 | #define SLIMBUS_EXTPROC_RX AFE_PORT_INVALID |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 68 | |
| 69 | #define AFE_PORT_CMD_START 0x000100ca |
Laxminath Kasam | 32657ec | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 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 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | } __attribute__ ((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 | } __attribute__ ((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 | } __attribute__ ((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 | } __attribute__ ((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 | u16 enable; /* 1 = enable, 0 = disable */ |
| 130 | } __attribute__ ((packed)); |
| 131 | |
| 132 | #define AFE_PSEUDOPORT_CMD_START 0x000100cf |
| 133 | struct afe_pseudoport_start_command { |
| 134 | struct apr_hdr hdr; |
| 135 | u16 port_id; /* Pseudo Port 1 = 0x8000 */ |
| 136 | /* Pseudo Port 2 = 0x8001 */ |
| 137 | /* Pseudo Port 3 = 0x8002 */ |
| 138 | u16 timing; /* FTRT = 0 , AVTimer = 1, */ |
| 139 | } __attribute__ ((packed)); |
| 140 | |
| 141 | #define AFE_PSEUDOPORT_CMD_STOP 0x000100d0 |
| 142 | struct afe_pseudoport_stop_command { |
| 143 | struct apr_hdr hdr; |
| 144 | u16 port_id; /* Pseudo Port 1 = 0x8000 */ |
| 145 | /* Pseudo Port 2 = 0x8001 */ |
| 146 | /* Pseudo Port 3 = 0x8002 */ |
| 147 | u16 reserved; |
| 148 | } __attribute__ ((packed)); |
| 149 | |
| 150 | #define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1 |
| 151 | |
| 152 | |
| 153 | #define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2 |
| 154 | struct afe_get_active_handles_command { |
| 155 | struct apr_hdr hdr; |
| 156 | u16 port_id; |
| 157 | u16 reserved; |
| 158 | } __attribute__ ((packed)); |
| 159 | |
| 160 | #define AFE_PCM_CFG_MODE_PCM 0x0 |
| 161 | #define AFE_PCM_CFG_MODE_AUX 0x1 |
| 162 | #define AFE_PCM_CFG_SYNC_EXT 0x0 |
| 163 | #define AFE_PCM_CFG_SYNC_INT 0x1 |
| 164 | #define AFE_PCM_CFG_FRM_8BPF 0x0 |
| 165 | #define AFE_PCM_CFG_FRM_16BPF 0x1 |
| 166 | #define AFE_PCM_CFG_FRM_32BPF 0x2 |
| 167 | #define AFE_PCM_CFG_FRM_64BPF 0x3 |
| 168 | #define AFE_PCM_CFG_FRM_128BPF 0x4 |
| 169 | #define AFE_PCM_CFG_FRM_256BPF 0x5 |
| 170 | #define AFE_PCM_CFG_QUANT_ALAW_NOPAD 0x0 |
| 171 | #define AFE_PCM_CFG_QUANT_MULAW_NOPAD 0x1 |
| 172 | #define AFE_PCM_CFG_QUANT_LINEAR_NOPAD 0x2 |
| 173 | #define AFE_PCM_CFG_QUANT_ALAW_PAD 0x3 |
| 174 | #define AFE_PCM_CFG_QUANT_MULAW_PAD 0x4 |
| 175 | #define AFE_PCM_CFG_QUANT_LINEAR_PAD 0x5 |
| 176 | #define AFE_PCM_CFG_CDATAOE_MASTER 0x0 |
| 177 | #define AFE_PCM_CFG_CDATAOE_SHARE 0x1 |
| 178 | |
| 179 | struct afe_port_pcm_cfg { |
| 180 | u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */ |
| 181 | u16 sync; /* external = 0 , internal = 1 */ |
| 182 | u16 frame; /* 8 bpf = 0 */ |
| 183 | /* 16 bpf = 1 */ |
| 184 | /* 32 bpf = 2 */ |
| 185 | /* 64 bpf = 3 */ |
| 186 | /* 128 bpf = 4 */ |
| 187 | /* 256 bpf = 5 */ |
| 188 | u16 quant; |
| 189 | u16 slot; /* Slot for PCM stream , 0 - 31 */ |
| 190 | u16 data; /* 0, PCM block is the only master */ |
| 191 | /* 1, PCM block is shares to driver data out signal */ |
| 192 | /* other master */ |
| 193 | u16 reserved; |
| 194 | } __attribute__ ((packed)); |
| 195 | |
| 196 | enum { |
| 197 | AFE_I2S_SD0 = 1, |
| 198 | AFE_I2S_SD1, |
| 199 | AFE_I2S_SD2, |
| 200 | AFE_I2S_SD3, |
| 201 | AFE_I2S_QUAD01, |
| 202 | AFE_I2S_QUAD23, |
| 203 | AFE_I2S_6CHS, |
| 204 | AFE_I2S_8CHS, |
| 205 | }; |
| 206 | |
| 207 | #define AFE_MI2S_MONO 0 |
| 208 | #define AFE_MI2S_STEREO 3 |
| 209 | #define AFE_MI2S_4CHANNELS 4 |
| 210 | #define AFE_MI2S_6CHANNELS 6 |
| 211 | #define AFE_MI2S_8CHANNELS 8 |
| 212 | |
| 213 | struct afe_port_mi2s_cfg { |
| 214 | u16 bitwidth; /* 16,24,32 */ |
| 215 | u16 line; /* Called ChannelMode in documentation */ |
| 216 | /* i2s_sd0 = 1 */ |
| 217 | /* i2s_sd1 = 2 */ |
| 218 | /* i2s_sd2 = 3 */ |
| 219 | /* i2s_sd3 = 4 */ |
| 220 | /* i2s_quad01 = 5 */ |
| 221 | /* i2s_quad23 = 6 */ |
| 222 | /* i2s_6chs = 7 */ |
| 223 | /* i2s_8chs = 8 */ |
| 224 | u16 channel; /* Called MonoStereo in documentation */ |
| 225 | /* i2s mono = 0 */ |
| 226 | /* i2s mono right = 1 */ |
| 227 | /* i2s mono left = 2 */ |
| 228 | /* i2s stereo = 3 */ |
| 229 | u16 ws; /* 0, word select signal from external source */ |
| 230 | /* 1, word select signal from internal source */ |
Kuirong Wang | a36f288 | 2012-04-02 19:45:26 -0700 | [diff] [blame] | 231 | u16 format; /* don't touch this field if it is not for */ |
| 232 | /* AFE_PORT_CMD_I2S_CONFIG opcode */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 233 | } __attribute__ ((packed)); |
| 234 | |
| 235 | struct afe_port_hdmi_cfg { |
| 236 | u16 bitwidth; /* 16,24,32 */ |
| 237 | u16 channel_mode; /* HDMI Stereo = 0 */ |
| 238 | /* HDMI_3Point1 (4-ch) = 1 */ |
| 239 | /* HDMI_5Point1 (6-ch) = 2 */ |
| 240 | /* HDMI_6Point1 (8-ch) = 3 */ |
| 241 | u16 data_type; /* HDMI_Linear = 0 */ |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 242 | /* HDMI_non_Linear = 1 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 243 | } __attribute__ ((packed)); |
| 244 | |
| 245 | |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 246 | struct afe_port_hdmi_multi_ch_cfg { |
| 247 | u16 data_type; /* HDMI_Linear = 0 */ |
| 248 | /* HDMI_non_Linear = 1 */ |
| 249 | u16 channel_allocation; /* The default is 0 (Stereo) */ |
| 250 | u16 reserved; /* must be set to 0 */ |
| 251 | } __packed; |
| 252 | |
| 253 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 254 | /* Slimbus Device Ids */ |
| 255 | #define AFE_SLIMBUS_DEVICE_1 0x0 |
| 256 | #define AFE_SLIMBUS_DEVICE_2 0x1 |
| 257 | #define AFE_PORT_MAX_AUDIO_CHAN_CNT 16 |
| 258 | |
| 259 | struct afe_port_slimbus_cfg { |
| 260 | u16 slimbus_dev_id; /* SLIMBUS Device id.*/ |
| 261 | |
| 262 | u16 slave_dev_pgd_la; /* Slave ported generic device |
| 263 | * logical address. |
| 264 | */ |
| 265 | u16 slave_dev_intfdev_la; /* Slave interface device logical |
| 266 | * address. |
| 267 | */ |
| 268 | u16 bit_width; /** bit width of the samples, 16, 24.*/ |
| 269 | |
| 270 | u16 data_format; /** data format.*/ |
| 271 | |
| 272 | u16 num_channels; /** Number of channels.*/ |
| 273 | |
| 274 | /** Slave port mapping for respective channels.*/ |
| 275 | u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT]; |
| 276 | |
| 277 | u16 reserved; |
| 278 | } __packed; |
| 279 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 280 | struct afe_port_slimbus_sch_cfg { |
| 281 | u16 slimbus_dev_id; /* SLIMBUS Device id.*/ |
| 282 | u16 bit_width; /** bit width of the samples, 16, 24.*/ |
| 283 | u16 data_format; /** data format.*/ |
| 284 | u16 num_channels; /** Number of channels.*/ |
| 285 | u16 reserved; |
| 286 | /** Slave channel mapping for respective channels.*/ |
| 287 | u8 slave_ch_mapping[8]; |
| 288 | } __packed; |
| 289 | |
Laxminath Kasam | 32657ec | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 290 | struct afe_port_rtproxy_cfg { |
| 291 | u16 bitwidth; /* 16,24,32 */ |
| 292 | u16 interleaved; /* interleaved = 1 */ |
| 293 | /* Noninterleaved = 0 */ |
| 294 | u16 frame_sz; /* 5ms buffers = 160bytes */ |
| 295 | u16 jitter; /* 10ms of jitter = 320 */ |
| 296 | u16 lw_mark; /* Low watermark in bytes for triggering event*/ |
| 297 | u16 hw_mark; /* High watermark bytes for triggering event*/ |
| 298 | u16 rsvd; |
| 299 | int num_ch; /* 1 to 8 */ |
| 300 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 301 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 302 | #define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3 |
| 303 | #define AFE_PORT_AUDIO_SLIM_SCH_CONFIG 0x000100e4 |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 304 | #define AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG 0x000100D9 |
Kuirong Wang | a36f288 | 2012-04-02 19:45:26 -0700 | [diff] [blame] | 305 | #define AFE_PORT_CMD_I2S_CONFIG 0x000100E7 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 306 | |
| 307 | union afe_port_config { |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 308 | struct afe_port_pcm_cfg pcm; |
| 309 | struct afe_port_mi2s_cfg mi2s; |
| 310 | struct afe_port_hdmi_cfg hdmi; |
| 311 | struct afe_port_hdmi_multi_ch_cfg hdmi_multi_ch; |
| 312 | struct afe_port_slimbus_cfg slimbus; |
| 313 | struct afe_port_slimbus_sch_cfg slim_sch; |
| 314 | struct afe_port_rtproxy_cfg rtproxy; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 315 | } __attribute__((packed)); |
| 316 | |
| 317 | struct afe_audioif_config_command { |
| 318 | struct apr_hdr hdr; |
| 319 | u16 port_id; |
| 320 | union afe_port_config port; |
| 321 | } __attribute__ ((packed)); |
| 322 | |
| 323 | #define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5 |
| 324 | struct afe_codec_loopback_command { |
| 325 | u16 port_inf; /* Primary i2s = 0 */ |
| 326 | /* PCM = 2 */ |
| 327 | /* Secondary i2s = 4 */ |
| 328 | /* Mi2s = 6 */ |
| 329 | u16 enable; /* 0, disable. 1, enable */ |
| 330 | } __attribute__ ((packed)); |
| 331 | |
| 332 | |
| 333 | #define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300 |
| 334 | struct afe_param_sidetone_gain { |
| 335 | u16 gain; |
| 336 | u16 reserved; |
| 337 | } __attribute__ ((packed)); |
| 338 | |
| 339 | #define AFE_PARAM_ID_SAMPLING_RATE 0x00010301 |
| 340 | struct afe_param_sampling_rate { |
| 341 | u32 sampling_rate; |
| 342 | } __attribute__ ((packed)); |
| 343 | |
| 344 | |
| 345 | #define AFE_PARAM_ID_CHANNELS 0x00010302 |
| 346 | struct afe_param_channels { |
| 347 | u16 channels; |
| 348 | u16 reserved; |
| 349 | } __attribute__ ((packed)); |
| 350 | |
| 351 | |
| 352 | #define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303 |
| 353 | struct afe_param_loopback_gain { |
| 354 | u16 gain; |
| 355 | u16 reserved; |
| 356 | } __attribute__ ((packed)); |
| 357 | |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 358 | /* Parameter ID used to configure and enable/disable the loopback path. The |
| 359 | * difference with respect to the existing API, AFE_PORT_CMD_LOOPBACK, is that |
| 360 | * it allows Rx port to be configured as source port in loopback path. Port-id |
| 361 | * in AFE_PORT_CMD_SET_PARAM cmd is the source port whcih can be Tx or Rx port. |
| 362 | * In addition, we can configure the type of routing mode to handle different |
| 363 | * use cases. |
| 364 | */ |
| 365 | enum { |
| 366 | /* Regular loopback from source to destination port */ |
| 367 | LB_MODE_DEFAULT = 1, |
| 368 | /* Sidetone feed from Tx source to Rx destination port */ |
| 369 | LB_MODE_SIDETONE, |
| 370 | /* Echo canceller reference, voice + audio + DTMF */ |
| 371 | LB_MODE_EC_REF_VOICE_AUDIO, |
| 372 | /* Echo canceller reference, voice alone */ |
| 373 | LB_MODE_EC_REF_VOICE |
| 374 | }; |
| 375 | |
| 376 | #define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B |
| 377 | #define AFE_API_VERSION_LOOPBACK_CONFIG 0x1 |
| 378 | struct afe_param_loopback_cfg { |
| 379 | /* Minor version used for tracking the version of the configuration |
| 380 | * interface. |
| 381 | */ |
| 382 | uint32_t loopback_cfg_minor_version; |
| 383 | |
| 384 | /* Destination Port Id. */ |
| 385 | uint16_t dst_port_id; |
| 386 | |
| 387 | /* Specifies data path type from src to dest port. Supported values: |
| 388 | * LB_MODE_DEFAULT |
| 389 | * LB_MODE_SIDETONE |
| 390 | * LB_MODE_EC_REF_VOICE_AUDIO |
| 391 | * LB_MODE_EC_REF_VOICE |
| 392 | */ |
| 393 | uint16_t routing_mode; |
| 394 | |
| 395 | /* Specifies whether to enable (1) or disable (0) an AFE loopback. */ |
| 396 | uint16_t enable; |
| 397 | |
| 398 | /* Reserved for 32-bit alignment. This field must be set to 0. */ |
| 399 | uint16_t reserved; |
| 400 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 401 | |
| 402 | #define AFE_MODULE_ID_PORT_INFO 0x00010200 |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 403 | /* Module ID for the loopback-related parameters. */ |
| 404 | #define AFE_MODULE_LOOPBACK 0x00010205 |
Patrick Lai | 48da149 | 2012-07-04 20:48:24 -0700 | [diff] [blame] | 405 | struct afe_param_payload_base { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 406 | u32 module_id; |
| 407 | u32 param_id; |
| 408 | u16 param_size; |
| 409 | u16 reserved; |
Patrick Lai | 48da149 | 2012-07-04 20:48:24 -0700 | [diff] [blame] | 410 | } __packed; |
| 411 | |
| 412 | struct afe_param_payload { |
| 413 | struct afe_param_payload_base base; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 414 | union { |
| 415 | struct afe_param_sidetone_gain sidetone_gain; |
| 416 | struct afe_param_sampling_rate sampling_rate; |
| 417 | struct afe_param_channels channels; |
| 418 | struct afe_param_loopback_gain loopback_gain; |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 419 | struct afe_param_loopback_cfg loopback_cfg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 420 | } __attribute__((packed)) param; |
| 421 | } __attribute__ ((packed)); |
| 422 | |
| 423 | #define AFE_PORT_CMD_SET_PARAM 0x000100dc |
| 424 | |
| 425 | struct afe_port_cmd_set_param { |
| 426 | struct apr_hdr hdr; |
| 427 | u16 port_id; |
| 428 | u16 payload_size; |
| 429 | u32 payload_address; |
| 430 | struct afe_param_payload payload; |
| 431 | } __attribute__ ((packed)); |
| 432 | |
Ben Romberger | b760323 | 2011-11-23 17:16:27 -0800 | [diff] [blame] | 433 | struct afe_port_cmd_set_param_no_payload { |
| 434 | struct apr_hdr hdr; |
| 435 | u16 port_id; |
| 436 | u16 payload_size; |
| 437 | u32 payload_address; |
| 438 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 439 | |
| 440 | #define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100 |
| 441 | struct afe_get_active_ports_rsp { |
| 442 | u16 num_ports; |
| 443 | u16 port_id; |
| 444 | } __attribute__ ((packed)); |
| 445 | |
| 446 | |
| 447 | #define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102 |
| 448 | struct afe_get_active_handles_rsp { |
| 449 | u16 port_id; |
| 450 | u16 num_handles; |
| 451 | u16 mode; /* 0, voice rx */ |
| 452 | /* 1, voice tx */ |
| 453 | /* 2, audio rx */ |
| 454 | /* 3, audio tx */ |
| 455 | u16 handle; |
| 456 | } __attribute__ ((packed)); |
| 457 | |
Laxminath Kasam | 32657ec | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 458 | #define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE |
| 459 | struct afe_cmd_memory_map { |
| 460 | struct apr_hdr hdr; |
| 461 | u32 phy_addr; |
| 462 | u32 mem_sz; |
| 463 | u16 mem_id; |
| 464 | u16 rsvd; |
| 465 | } __packed; |
| 466 | |
| 467 | #define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF |
| 468 | struct afe_cmd_memory_unmap { |
| 469 | struct apr_hdr hdr; |
| 470 | u32 phy_addr; |
| 471 | } __packed; |
| 472 | |
| 473 | #define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0 |
| 474 | struct afe_cmd_reg_rtport { |
| 475 | struct apr_hdr hdr; |
| 476 | u16 port_id; |
| 477 | u16 rsvd; |
| 478 | } __packed; |
| 479 | |
| 480 | #define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1 |
| 481 | struct afe_cmd_unreg_rtport { |
| 482 | struct apr_hdr hdr; |
| 483 | u16 port_id; |
| 484 | u16 rsvd; |
| 485 | } __packed; |
| 486 | |
| 487 | #define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2 |
| 488 | struct afe_cmd_rtport_wr { |
| 489 | struct apr_hdr hdr; |
| 490 | u16 port_id; |
| 491 | u16 rsvd; |
| 492 | u32 buf_addr; |
| 493 | u32 bytes_avail; |
| 494 | } __packed; |
| 495 | |
| 496 | #define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3 |
| 497 | struct afe_cmd_rtport_rd { |
| 498 | struct apr_hdr hdr; |
| 499 | u16 port_id; |
| 500 | u16 rsvd; |
| 501 | u32 buf_addr; |
| 502 | u32 bytes_avail; |
| 503 | } __packed; |
| 504 | |
| 505 | #define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105 |
| 506 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 507 | #define ADM_MAX_COPPS 5 |
| 508 | |
| 509 | #define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300 |
| 510 | struct adm_get_copp_handles_command { |
| 511 | struct apr_hdr hdr; |
| 512 | } __attribute__ ((packed)); |
| 513 | |
| 514 | #define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301 |
| 515 | struct adm_routings_session { |
| 516 | u16 id; |
| 517 | u16 num_copps; |
| 518 | u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */ |
| 519 | } __packed; |
| 520 | |
| 521 | struct adm_routings_command { |
| 522 | struct apr_hdr hdr; |
| 523 | u32 path; /* 0 = Rx, 1 Tx */ |
| 524 | u32 num_sessions; |
| 525 | struct adm_routings_session session[8]; |
| 526 | } __attribute__ ((packed)); |
| 527 | |
| 528 | |
| 529 | #define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302 |
| 530 | struct adm_ramp_gain { |
| 531 | struct apr_hdr hdr; |
| 532 | u16 session_id; |
| 533 | u16 copp_id; |
| 534 | u16 initial_gain; |
| 535 | u16 gain_increment; |
| 536 | u16 ramp_duration; |
| 537 | u16 reserved; |
| 538 | } __attribute__ ((packed)); |
| 539 | |
| 540 | struct adm_ramp_gains_command { |
| 541 | struct apr_hdr hdr; |
| 542 | u32 id; |
| 543 | u32 num_gains; |
| 544 | struct adm_ramp_gain gains[ADM_MAX_COPPS]; |
| 545 | } __attribute__ ((packed)); |
| 546 | |
| 547 | |
| 548 | #define ADM_CMD_COPP_OPEN 0x00010304 |
| 549 | struct adm_copp_open_command { |
| 550 | struct apr_hdr hdr; |
| 551 | u16 flags; |
| 552 | u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */ |
| 553 | u16 endpoint_id1; |
| 554 | u16 endpoint_id2; |
| 555 | u32 topology_id; |
| 556 | u16 channel_config; |
| 557 | u16 reserved; |
| 558 | u32 rate; |
| 559 | } __attribute__ ((packed)); |
| 560 | |
| 561 | #define ADM_CMD_COPP_CLOSE 0x00010305 |
| 562 | |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 563 | #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310 |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 564 | #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3 0x00010333 |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 565 | struct adm_multi_ch_copp_open_command { |
| 566 | struct apr_hdr hdr; |
| 567 | u16 flags; |
| 568 | u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */ |
| 569 | u16 endpoint_id1; |
| 570 | u16 endpoint_id2; |
| 571 | u32 topology_id; |
| 572 | u16 channel_config; |
| 573 | u16 reserved; |
| 574 | u32 rate; |
| 575 | u8 dev_channel_mapping[8]; |
| 576 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 577 | #define ADM_CMD_MEMORY_MAP 0x00010C30 |
| 578 | struct adm_cmd_memory_map{ |
| 579 | struct apr_hdr hdr; |
| 580 | u32 buf_add; |
| 581 | u32 buf_size; |
| 582 | u16 mempool_id; |
| 583 | u16 reserved; |
| 584 | } __attribute__((packed)); |
| 585 | |
| 586 | #define ADM_CMD_MEMORY_UNMAP 0x00010C31 |
| 587 | struct adm_cmd_memory_unmap{ |
| 588 | struct apr_hdr hdr; |
| 589 | u32 buf_add; |
| 590 | } __attribute__((packed)); |
| 591 | |
| 592 | #define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47 |
| 593 | struct adm_memory_map_regions{ |
| 594 | u32 phys; |
| 595 | u32 buf_size; |
| 596 | } __attribute__((packed)); |
| 597 | |
| 598 | struct adm_cmd_memory_map_regions{ |
| 599 | struct apr_hdr hdr; |
| 600 | u16 mempool_id; |
| 601 | u16 nregions; |
| 602 | } __attribute__((packed)); |
| 603 | |
| 604 | #define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48 |
| 605 | struct adm_memory_unmap_regions{ |
| 606 | u32 phys; |
| 607 | } __attribute__((packed)); |
| 608 | |
| 609 | struct adm_cmd_memory_unmap_regions{ |
| 610 | struct apr_hdr hdr; |
| 611 | u16 nregions; |
| 612 | u16 reserved; |
| 613 | } __attribute__((packed)); |
| 614 | |
| 615 | #define DEFAULT_COPP_TOPOLOGY 0x00010be3 |
| 616 | #define DEFAULT_POPP_TOPOLOGY 0x00010be4 |
| 617 | #define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71 |
| 618 | #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72 |
Jayasena Sangaraboina | 0fc197d | 2011-12-09 13:20:33 -0800 | [diff] [blame] | 619 | #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 620 | |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 621 | #define LOWLATENCY_POPP_TOPOLOGY 0x00010C68 |
| 622 | #define LOWLATENCY_COPP_TOPOLOGY 0x00010312 |
| 623 | #define PCM_BITS_PER_SAMPLE 16 |
| 624 | |
| 625 | #define ASM_OPEN_WRITE_PERF_MODE_BIT (1<<28) |
| 626 | #define ASM_OPEN_READ_PERF_MODE_BIT (1<<29) |
| 627 | #define ADM_MULTI_CH_COPP_OPEN_PERF_MODE_BIT (1<<13) |
| 628 | |
Sriranjan Srikantam | 22bee8b | 2012-05-31 15:21:53 -0700 | [diff] [blame] | 629 | /* SRS TRUMEDIA GUIDS */ |
| 630 | /* topology */ |
| 631 | #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90 |
| 632 | /* module */ |
| 633 | #define SRS_TRUMEDIA_MODULE_ID 0x10005010 |
| 634 | /* parameters */ |
| 635 | #define SRS_TRUMEDIA_PARAMS 0x10005011 |
| 636 | #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012 |
| 637 | #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013 |
| 638 | #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014 |
| 639 | #define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015 |
| 640 | #define SRS_TRUMEDIA_PARAMS_HL 0x10005016 |
| 641 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 642 | #define ASM_MAX_EQ_BANDS 12 |
| 643 | |
| 644 | struct asm_eq_band { |
| 645 | u32 band_idx; /* The band index, 0 .. 11 */ |
| 646 | u32 filter_type; /* Filter band type */ |
| 647 | u32 center_freq_hz; /* Filter band center frequency */ |
| 648 | u32 filter_gain; /* Filter band initial gain (dB) */ |
| 649 | /* Range is +12 dB to -12 dB with 1dB increments. */ |
| 650 | u32 q_factor; |
| 651 | } __attribute__ ((packed)); |
| 652 | |
| 653 | struct asm_equalizer_params { |
| 654 | u32 enable; |
| 655 | u32 num_bands; |
| 656 | struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS]; |
| 657 | } __attribute__ ((packed)); |
| 658 | |
| 659 | struct asm_master_gain_params { |
| 660 | u16 master_gain; |
| 661 | u16 padding; |
| 662 | } __attribute__ ((packed)); |
| 663 | |
| 664 | struct asm_lrchannel_gain_params { |
| 665 | u16 left_gain; |
| 666 | u16 right_gain; |
| 667 | } __attribute__ ((packed)); |
| 668 | |
| 669 | struct asm_mute_params { |
| 670 | u32 muteflag; |
| 671 | } __attribute__ ((packed)); |
| 672 | |
| 673 | struct asm_softvolume_params { |
| 674 | u32 period; |
| 675 | u32 step; |
| 676 | u32 rampingcurve; |
| 677 | } __attribute__ ((packed)); |
| 678 | |
| 679 | struct asm_softpause_params { |
| 680 | u32 enable; |
| 681 | u32 period; |
| 682 | u32 step; |
| 683 | u32 rampingcurve; |
| 684 | } __packed; |
| 685 | |
| 686 | struct asm_pp_param_data_hdr { |
| 687 | u32 module_id; |
| 688 | u32 param_id; |
| 689 | u16 param_size; |
| 690 | u16 reserved; |
| 691 | } __attribute__ ((packed)); |
| 692 | |
| 693 | struct asm_pp_params_command { |
| 694 | struct apr_hdr hdr; |
| 695 | u32 *payload; |
| 696 | u32 payload_size; |
| 697 | struct asm_pp_param_data_hdr params; |
| 698 | } __attribute__ ((packed)); |
| 699 | |
| 700 | #define EQUALIZER_MODULE_ID 0x00010c27 |
| 701 | #define EQUALIZER_PARAM_ID 0x00010c28 |
| 702 | |
| 703 | #define VOLUME_CONTROL_MODULE_ID 0x00010bfe |
| 704 | #define MASTER_GAIN_PARAM_ID 0x00010bff |
| 705 | #define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00 |
| 706 | #define MUTE_CONFIG_PARAM_ID 0x00010c01 |
| 707 | #define SOFT_PAUSE_PARAM_ID 0x00010D6A |
Swaminathan Sathappan | b0021cd | 2011-08-31 15:20:12 -0700 | [diff] [blame] | 708 | #define SOFT_VOLUME_PARAM_ID 0x00010C29 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 709 | |
| 710 | #define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03 |
| 711 | #define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04 |
| 712 | #define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05 |
| 713 | |
| 714 | #define MBADRC_MODULE_ID 0x00010c06 |
| 715 | #define MBADRC_ENABLE_PARAM_ID 0x00010c07 |
| 716 | #define MBADRC_CONFIG_PARAM_ID 0x00010c08 |
| 717 | |
| 718 | |
| 719 | #define ADM_CMD_SET_PARAMS 0x00010306 |
| 720 | #define ADM_CMD_GET_PARAMS 0x0001030B |
| 721 | #define ADM_CMDRSP_GET_PARAMS 0x0001030C |
| 722 | struct adm_set_params_command { |
| 723 | struct apr_hdr hdr; |
| 724 | u32 payload; |
| 725 | u32 payload_size; |
| 726 | } __attribute__ ((packed)); |
| 727 | |
| 728 | |
| 729 | #define ADM_CMD_TAP_COPP_PCM 0x00010307 |
| 730 | struct adm_tap_copp_pcm_command { |
| 731 | struct apr_hdr hdr; |
| 732 | } __attribute__ ((packed)); |
| 733 | |
| 734 | |
| 735 | /* QDSP6 to Client messages |
| 736 | */ |
| 737 | #define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308 |
| 738 | struct adm_get_copp_handles_respond { |
| 739 | struct apr_hdr hdr; |
| 740 | u32 handles; |
| 741 | u32 copp_id; |
| 742 | } __attribute__ ((packed)); |
| 743 | |
| 744 | #define ADM_CMDRSP_COPP_OPEN 0x0001030A |
| 745 | struct adm_copp_open_respond { |
| 746 | u32 status; |
| 747 | u16 copp_id; |
| 748 | u16 reserved; |
| 749 | } __attribute__ ((packed)); |
| 750 | |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 751 | #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311 |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 752 | #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN_V3 0x00010334 |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 753 | |
| 754 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 755 | #define ASM_STREAM_PRIORITY_NORMAL 0 |
| 756 | #define ASM_STREAM_PRIORITY_LOW 1 |
| 757 | #define ASM_STREAM_PRIORITY_HIGH 2 |
| 758 | #define ASM_STREAM_PRIORITY_RESERVED 3 |
| 759 | |
| 760 | #define ASM_END_POINT_DEVICE_MATRIX 0 |
| 761 | #define ASM_END_POINT_STREAM 1 |
| 762 | |
| 763 | #define AAC_ENC_MODE_AAC_LC 0x02 |
| 764 | #define AAC_ENC_MODE_AAC_P 0x05 |
| 765 | #define AAC_ENC_MODE_EAAC_P 0x1D |
| 766 | |
| 767 | #define ASM_STREAM_CMD_CLOSE 0x00010BCD |
| 768 | #define ASM_STREAM_CMD_FLUSH 0x00010BCE |
| 769 | #define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF |
| 770 | #define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0 |
| 771 | #define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1 |
| 772 | #define ASM_SESSION_CMD_PAUSE 0x00010BD3 |
| 773 | #define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4 |
| 774 | #define ASM_DATA_CMD_EOS 0x00010BDB |
| 775 | #define ASM_DATA_EVENT_EOS 0x00010BDD |
| 776 | |
| 777 | #define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B |
| 778 | #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09 |
| 779 | |
| 780 | #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17 |
| 781 | #define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18 |
| 782 | #define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19 |
| 783 | #define ASM_DATA_CMDRSP_EOS 0x00010C1C |
| 784 | |
| 785 | /* ASM Data structures */ |
| 786 | |
| 787 | /* common declarations */ |
| 788 | struct asm_pcm_cfg { |
| 789 | u16 ch_cfg; |
| 790 | u16 bits_per_sample; |
| 791 | u32 sample_rate; |
| 792 | u16 is_signed; |
| 793 | u16 interleaved; |
| 794 | }; |
| 795 | |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 796 | #define PCM_CHANNEL_NULL 0 |
| 797 | |
| 798 | /* Front left channel. */ |
| 799 | #define PCM_CHANNEL_FL 1 |
| 800 | |
| 801 | /* Front right channel. */ |
| 802 | #define PCM_CHANNEL_FR 2 |
| 803 | |
| 804 | /* Front center channel. */ |
| 805 | #define PCM_CHANNEL_FC 3 |
| 806 | |
| 807 | /* Left surround channel.*/ |
| 808 | #define PCM_CHANNEL_LS 4 |
| 809 | |
| 810 | /* Right surround channel.*/ |
| 811 | #define PCM_CHANNEL_RS 5 |
| 812 | |
| 813 | /* Low frequency effect channel. */ |
| 814 | #define PCM_CHANNEL_LFE 6 |
| 815 | |
| 816 | /* Center surround channel; Rear center channel. */ |
| 817 | #define PCM_CHANNEL_CS 7 |
| 818 | |
| 819 | /* Left back channel; Rear left channel. */ |
| 820 | #define PCM_CHANNEL_LB 8 |
| 821 | |
| 822 | /* Right back channel; Rear right channel. */ |
| 823 | #define PCM_CHANNEL_RB 9 |
| 824 | |
| 825 | /* Top surround channel. */ |
| 826 | #define PCM_CHANNEL_TS 10 |
| 827 | |
| 828 | /* Center vertical height channel.*/ |
| 829 | #define PCM_CHANNEL_CVH 11 |
| 830 | |
| 831 | /* Mono surround channel.*/ |
| 832 | #define PCM_CHANNEL_MS 12 |
| 833 | |
| 834 | /* Front left of center. */ |
| 835 | #define PCM_CHANNEL_FLC 13 |
| 836 | |
| 837 | /* Front right of center. */ |
| 838 | #define PCM_CHANNEL_FRC 14 |
| 839 | |
| 840 | /* Rear left of center. */ |
| 841 | #define PCM_CHANNEL_RLC 15 |
| 842 | |
| 843 | /* Rear right of center. */ |
| 844 | #define PCM_CHANNEL_RRC 16 |
| 845 | |
| 846 | #define PCM_FORMAT_MAX_NUM_CHANNEL 8 |
| 847 | |
Swaminathan Sathappan | 6f53088 | 2012-05-01 16:42:22 -0700 | [diff] [blame] | 848 | /* Maximum number of channels supported |
| 849 | * in ASM_ENCDEC_DEC_CHAN_MAP command |
| 850 | */ |
| 851 | #define MAX_CHAN_MAP_CHANNELS 16 |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 852 | /* |
| 853 | * Multiple-channel PCM decoder format block structure used in the |
| 854 | * #ASM_STREAM_CMD_OPEN_WRITE command. |
| 855 | * The data must be in little-endian format. |
| 856 | */ |
| 857 | struct asm_multi_channel_pcm_fmt_blk { |
| 858 | |
| 859 | u16 num_channels; /* |
| 860 | * Number of channels. |
| 861 | * Supported values:1 to 8 |
| 862 | */ |
| 863 | |
| 864 | u16 bits_per_sample; /* |
| 865 | * Number of bits per sample per channel. |
| 866 | * Supported values: 16, 24 When used for |
| 867 | * playback, the client must send 24-bit |
| 868 | * samples packed in 32-bit words. The |
| 869 | * 24-bit samples must be placed in the most |
| 870 | * significant 24 bits of the 32-bit word. When |
| 871 | * used for recording, the aDSP sends 24-bit |
| 872 | * samples packed in 32-bit words. The 24-bit |
| 873 | * samples are placed in the most significant |
| 874 | * 24 bits of the 32-bit word. |
| 875 | */ |
| 876 | |
| 877 | u32 sample_rate; /* |
| 878 | * Number of samples per second |
| 879 | * (in Hertz). Supported values: |
| 880 | * 2000 to 48000 |
| 881 | */ |
| 882 | |
| 883 | u16 is_signed; /* |
| 884 | * Flag that indicates the samples |
| 885 | * are signed (1). |
| 886 | */ |
| 887 | |
| 888 | u16 is_interleaved; /* |
| 889 | * Flag that indicates whether the channels are |
| 890 | * de-interleaved (0) or interleaved (1). |
| 891 | * Interleaved format means corresponding |
| 892 | * samples from the left and right channels are |
| 893 | * interleaved within the buffer. |
| 894 | * De-interleaved format means samples from |
| 895 | * each channel are contiguous in the buffer. |
| 896 | * The samples from one channel immediately |
| 897 | * follow those of the previous channel. |
| 898 | */ |
| 899 | |
| 900 | u8 channel_mapping[8]; /* |
| 901 | * Supported values: |
| 902 | * PCM_CHANNEL_NULL, PCM_CHANNEL_FL, |
| 903 | * PCM_CHANNEL_FR, PCM_CHANNEL_FC, |
| 904 | * PCM_CHANNEL_LS, PCM_CHANNEL_RS, |
| 905 | * PCM_CHANNEL_LFE, PCM_CHANNEL_CS, |
| 906 | * PCM_CHANNEL_LB, PCM_CHANNEL_RB, |
| 907 | * PCM_CHANNEL_TS, PCM_CHANNEL_CVH, |
| 908 | * PCM_CHANNEL_MS, PCM_CHANNEL_FLC, |
| 909 | * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC, |
| 910 | * PCM_CHANNEL_RRC. |
| 911 | * Channel[i] mapping describes channel I. Each |
| 912 | * element i of the array describes channel I |
| 913 | * inside the buffer where I < num_channels. |
| 914 | * An unused channel is set to zero. |
| 915 | */ |
| 916 | }; |
| 917 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 918 | struct asm_adpcm_cfg { |
| 919 | u16 ch_cfg; |
| 920 | u16 bits_per_sample; |
| 921 | u32 sample_rate; |
| 922 | u32 block_size; |
| 923 | }; |
| 924 | |
| 925 | struct asm_yadpcm_cfg { |
| 926 | u16 ch_cfg; |
| 927 | u16 bits_per_sample; |
| 928 | u32 sample_rate; |
| 929 | }; |
| 930 | |
| 931 | struct asm_midi_cfg { |
| 932 | u32 nMode; |
| 933 | }; |
| 934 | |
| 935 | struct asm_wma_cfg { |
| 936 | u16 format_tag; |
| 937 | u16 ch_cfg; |
| 938 | u32 sample_rate; |
| 939 | u32 avg_bytes_per_sec; |
| 940 | u16 block_align; |
| 941 | u16 valid_bits_per_sample; |
| 942 | u32 ch_mask; |
| 943 | u16 encode_opt; |
| 944 | u16 adv_encode_opt; |
| 945 | u32 adv_encode_opt2; |
| 946 | u32 drc_peak_ref; |
| 947 | u32 drc_peak_target; |
| 948 | u32 drc_ave_ref; |
| 949 | u32 drc_ave_target; |
| 950 | }; |
| 951 | |
| 952 | struct asm_wmapro_cfg { |
| 953 | u16 format_tag; |
| 954 | u16 ch_cfg; |
| 955 | u32 sample_rate; |
| 956 | u32 avg_bytes_per_sec; |
| 957 | u16 block_align; |
| 958 | u16 valid_bits_per_sample; |
| 959 | u32 ch_mask; |
| 960 | u16 encode_opt; |
| 961 | u16 adv_encode_opt; |
| 962 | u32 adv_encode_opt2; |
| 963 | u32 drc_peak_ref; |
| 964 | u32 drc_peak_target; |
| 965 | u32 drc_ave_ref; |
| 966 | u32 drc_ave_target; |
| 967 | }; |
| 968 | |
| 969 | struct asm_aac_cfg { |
| 970 | u16 format; |
| 971 | u16 aot; |
| 972 | u16 ep_config; |
| 973 | u16 section_data_resilience; |
| 974 | u16 scalefactor_data_resilience; |
| 975 | u16 spectral_data_resilience; |
| 976 | u16 ch_cfg; |
| 977 | u16 reserved; |
| 978 | u32 sample_rate; |
| 979 | }; |
| 980 | |
| 981 | struct asm_flac_cfg { |
| 982 | u16 stream_info_present; |
| 983 | u16 min_blk_size; |
| 984 | u16 max_blk_size; |
| 985 | u16 ch_cfg; |
| 986 | u16 sample_size; |
| 987 | u16 sample_rate; |
| 988 | u16 md5_sum; |
| 989 | u32 ext_sample_rate; |
| 990 | u32 min_frame_size; |
| 991 | u32 max_frame_size; |
| 992 | }; |
| 993 | |
| 994 | struct asm_vorbis_cfg { |
| 995 | u32 ch_cfg; |
| 996 | u32 bit_rate; |
| 997 | u32 min_bit_rate; |
| 998 | u32 max_bit_rate; |
| 999 | u16 bit_depth_pcm_sample; |
| 1000 | u16 bit_stream_format; |
| 1001 | }; |
| 1002 | |
| 1003 | struct asm_aac_read_cfg { |
| 1004 | u32 bitrate; |
| 1005 | u32 enc_mode; |
| 1006 | u16 format; |
| 1007 | u16 ch_cfg; |
| 1008 | u32 sample_rate; |
| 1009 | }; |
| 1010 | |
| 1011 | struct asm_amrnb_read_cfg { |
| 1012 | u16 mode; |
| 1013 | u16 dtx_mode; |
| 1014 | }; |
| 1015 | |
Alex Wong | 2caeecc | 2011-10-28 10:52:15 +0530 | [diff] [blame] | 1016 | struct asm_amrwb_read_cfg { |
| 1017 | u16 mode; |
| 1018 | u16 dtx_mode; |
| 1019 | }; |
| 1020 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1021 | struct asm_evrc_read_cfg { |
| 1022 | u16 max_rate; |
| 1023 | u16 min_rate; |
| 1024 | u16 rate_modulation_cmd; |
| 1025 | u16 reserved; |
| 1026 | }; |
| 1027 | |
| 1028 | struct asm_qcelp13_read_cfg { |
| 1029 | u16 max_rate; |
| 1030 | u16 min_rate; |
| 1031 | u16 reduced_rate_level; |
| 1032 | u16 rate_modulation_cmd; |
| 1033 | }; |
| 1034 | |
| 1035 | struct asm_sbc_read_cfg { |
| 1036 | u32 subband; |
| 1037 | u32 block_len; |
| 1038 | u32 ch_mode; |
| 1039 | u32 alloc_method; |
| 1040 | u32 bit_rate; |
| 1041 | u32 sample_rate; |
| 1042 | }; |
| 1043 | |
| 1044 | struct asm_sbc_bitrate { |
| 1045 | u32 bitrate; |
| 1046 | }; |
| 1047 | |
| 1048 | struct asm_immed_decode { |
| 1049 | u32 mode; |
| 1050 | }; |
| 1051 | |
| 1052 | struct asm_sbr_ps { |
| 1053 | u32 enable; |
| 1054 | }; |
| 1055 | |
Swaminathan Sathappan | 70765cd | 2011-07-19 18:42:47 -0700 | [diff] [blame] | 1056 | struct asm_dual_mono { |
| 1057 | u16 sce_left; |
| 1058 | u16 sce_right; |
| 1059 | }; |
| 1060 | |
Swaminathan Sathappan | 6f53088 | 2012-05-01 16:42:22 -0700 | [diff] [blame] | 1061 | struct asm_dec_chan_map { |
| 1062 | u32 num_channels; /* Number of decoder output |
| 1063 | * channels. A value of 0 |
| 1064 | * indicates native channel |
| 1065 | * mapping, which is valid |
| 1066 | * only for NT mode. This |
| 1067 | * means the output of the |
| 1068 | * decoder is to be preserved |
| 1069 | * as is. |
| 1070 | */ |
| 1071 | |
| 1072 | u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size |
| 1073 | * num_channels. It can grow |
| 1074 | * till MAX_CHAN_MAP_CHANNELS. |
| 1075 | * Channel[i] mapping |
| 1076 | * describes channel I inside |
| 1077 | * the decoder output buffer. |
| 1078 | * Valid channel mapping |
| 1079 | * values are to be present at |
| 1080 | * the beginning of the array. |
| 1081 | * All remaining elements of |
| 1082 | * the array are to be filled |
| 1083 | * with PCM_CHANNEL_NULL. |
| 1084 | */ |
| 1085 | }; |
| 1086 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1087 | struct asm_encode_cfg_blk { |
| 1088 | u32 frames_per_buf; |
| 1089 | u32 format_id; |
| 1090 | u32 cfg_size; |
| 1091 | union { |
| 1092 | struct asm_pcm_cfg pcm; |
| 1093 | struct asm_aac_read_cfg aac; |
| 1094 | struct asm_amrnb_read_cfg amrnb; |
| 1095 | struct asm_evrc_read_cfg evrc; |
| 1096 | struct asm_qcelp13_read_cfg qcelp13; |
| 1097 | struct asm_sbc_read_cfg sbc; |
Alex Wong | 2caeecc | 2011-10-28 10:52:15 +0530 | [diff] [blame] | 1098 | struct asm_amrwb_read_cfg amrwb; |
Mingming Yin | 647e9ea | 2012-03-17 19:56:10 -0700 | [diff] [blame] | 1099 | struct asm_multi_channel_pcm_fmt_blk mpcm; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1100 | } __attribute__((packed)) cfg; |
| 1101 | }; |
| 1102 | |
| 1103 | struct asm_frame_meta_info { |
| 1104 | u32 offset_to_frame; |
| 1105 | u32 frame_size; |
| 1106 | u32 encoded_pcm_samples; |
| 1107 | u32 msw_ts; |
| 1108 | u32 lsw_ts; |
| 1109 | u32 nflags; |
| 1110 | }; |
| 1111 | |
| 1112 | /* Stream level commands */ |
| 1113 | #define ASM_STREAM_CMD_OPEN_READ 0x00010BCB |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 1114 | #define ASM_STREAM_CMD_OPEN_READ_V2_1 0x00010DB2 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1115 | struct asm_stream_cmd_open_read { |
| 1116 | struct apr_hdr hdr; |
| 1117 | u32 uMode; |
| 1118 | u32 src_endpoint; |
| 1119 | u32 pre_proc_top; |
| 1120 | u32 format; |
| 1121 | } __attribute__((packed)); |
| 1122 | |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 1123 | struct asm_stream_cmd_open_read_v2_1 { |
| 1124 | struct apr_hdr hdr; |
| 1125 | u32 uMode; |
| 1126 | u32 src_endpoint; |
| 1127 | u32 pre_proc_top; |
| 1128 | u32 format; |
| 1129 | u16 bits_per_sample; |
| 1130 | u16 reserved; |
| 1131 | } __packed; |
| 1132 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1133 | /* Supported formats */ |
| 1134 | #define LINEAR_PCM 0x00010BE5 |
| 1135 | #define DTMF 0x00010BE6 |
| 1136 | #define ADPCM 0x00010BE7 |
| 1137 | #define YADPCM 0x00010BE8 |
| 1138 | #define MP3 0x00010BE9 |
Bharath Ramachandramurthy | 4f71d50 | 2011-10-23 19:45:22 -0700 | [diff] [blame] | 1139 | #define MPEG4_AAC 0x00010BEA |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1140 | #define AMRNB_FS 0x00010BEB |
Alex Wong | 2caeecc | 2011-10-28 10:52:15 +0530 | [diff] [blame] | 1141 | #define AMRWB_FS 0x00010BEC |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1142 | #define V13K_FS 0x00010BED |
| 1143 | #define EVRC_FS 0x00010BEE |
| 1144 | #define EVRCB_FS 0x00010BEF |
| 1145 | #define EVRCWB_FS 0x00010BF0 |
| 1146 | #define MIDI 0x00010BF1 |
| 1147 | #define SBC 0x00010BF2 |
| 1148 | #define WMA_V10PRO 0x00010BF3 |
| 1149 | #define WMA_V9 0x00010BF4 |
| 1150 | #define AMR_WB_PLUS 0x00010BF5 |
| 1151 | #define AC3_DECODER 0x00010BF6 |
Santosh Mardi | 2332120 | 2012-03-22 04:33:25 +0530 | [diff] [blame] | 1152 | #define EAC3_DECODER 0x00010C3C |
| 1153 | #define DTS 0x00010D88 |
Srikanth Uyyala | 66f781a | 2012-06-13 23:23:25 +0530 | [diff] [blame] | 1154 | #define DTS_LBR 0x00010DBB |
Santosh Mardi | 2332120 | 2012-03-22 04:33:25 +0530 | [diff] [blame] | 1155 | #define ATRAC 0x00010D89 |
| 1156 | #define MAT 0x00010D8A |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1157 | #define G711_ALAW_FS 0x00010BF7 |
| 1158 | #define G711_MLAW_FS 0x00010BF8 |
| 1159 | #define G711_PCM_FS 0x00010BF9 |
Bharath Ramachandramurthy | 4f71d50 | 2011-10-23 19:45:22 -0700 | [diff] [blame] | 1160 | #define MPEG4_MULTI_AAC 0x00010D86 |
Baruch Eruchimovitch | e9cbfc1 | 2011-10-09 19:47:08 +0200 | [diff] [blame] | 1161 | #define US_POINT_EPOS_FORMAT 0x00012310 |
| 1162 | #define US_RAW_FORMAT 0x0001127C |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 1163 | #define MULTI_CHANNEL_PCM 0x00010C66 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1164 | |
| 1165 | #define ASM_ENCDEC_SBCRATE 0x00010C13 |
| 1166 | #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14 |
| 1167 | #define ASM_ENCDEC_CFG_BLK 0x00010C2C |
| 1168 | |
| 1169 | #define ASM_ENCDEC_SBCRATE 0x00010C13 |
| 1170 | #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14 |
| 1171 | #define ASM_ENCDEC_CFG_BLK 0x00010C2C |
| 1172 | |
Subhash Chandra Bose Naripeddy | 8f84689 | 2012-06-12 11:29:18 -0700 | [diff] [blame] | 1173 | #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95 |
| 1174 | struct asm_stream_cmd_open_read_compressed { |
| 1175 | struct apr_hdr hdr; |
| 1176 | u32 uMode; |
| 1177 | u32 frame_per_buf; |
| 1178 | } __packed; |
| 1179 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1180 | #define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 1181 | #define ASM_STREAM_CMD_OPEN_WRITE_V2_1 0x00010DB1 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1182 | struct asm_stream_cmd_open_write { |
| 1183 | struct apr_hdr hdr; |
| 1184 | u32 uMode; |
| 1185 | u16 sink_endpoint; |
| 1186 | u16 stream_handle; |
| 1187 | u32 post_proc_top; |
| 1188 | u32 format; |
| 1189 | } __attribute__((packed)); |
| 1190 | |
Santosh Mardi | 2332120 | 2012-03-22 04:33:25 +0530 | [diff] [blame] | 1191 | #define IEC_61937_MASK 0x00000001 |
| 1192 | #define IEC_60958_MASK 0x00000002 |
| 1193 | |
| 1194 | #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84 |
| 1195 | struct asm_stream_cmd_open_write_compressed { |
| 1196 | struct apr_hdr hdr; |
| 1197 | u32 flags; |
| 1198 | u32 format; |
| 1199 | } __packed; |
| 1200 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1201 | #define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC |
| 1202 | |
| 1203 | struct asm_stream_cmd_open_read_write { |
| 1204 | struct apr_hdr hdr; |
| 1205 | u32 uMode; |
| 1206 | u32 post_proc_top; |
| 1207 | u32 write_format; |
| 1208 | u32 read_format; |
| 1209 | } __attribute__((packed)); |
| 1210 | |
Santosh Mardi | 2332120 | 2012-03-22 04:33:25 +0530 | [diff] [blame] | 1211 | #define ADM_CMD_CONNECT_AFE_PORT 0x00010320 |
Santosh Mardi | d176079 | 2012-06-12 16:23:19 +0530 | [diff] [blame] | 1212 | #define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321 |
Santosh Mardi | 2332120 | 2012-03-22 04:33:25 +0530 | [diff] [blame] | 1213 | |
| 1214 | struct adm_cmd_connect_afe_port { |
| 1215 | struct apr_hdr hdr; |
| 1216 | u8 mode; /*mode represent the interface is for RX or TX*/ |
| 1217 | u8 session_id; /*ASM session ID*/ |
| 1218 | u16 afe_port_id; |
| 1219 | } __packed; |
| 1220 | |
Subhash Chandra Bose Naripeddy | 8f84689 | 2012-06-12 11:29:18 -0700 | [diff] [blame] | 1221 | #define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332 |
| 1222 | |
| 1223 | struct adm_cmd_connect_afe_port_v2 { |
| 1224 | struct apr_hdr hdr; |
| 1225 | u8 mode; /*mode represent the interface is for RX or TX*/ |
| 1226 | u8 session_id; /*ASM session ID*/ |
| 1227 | u16 afe_port_id; |
| 1228 | u32 num_channels; |
| 1229 | u32 sampleing_rate; |
| 1230 | } __packed; |
| 1231 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1232 | #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10 |
| 1233 | #define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11 |
| 1234 | #define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C |
| 1235 | #define ASM_ENABLE_SBR_PS 0x00010C63 |
Swaminathan Sathappan | 70765cd | 2011-07-19 18:42:47 -0700 | [diff] [blame] | 1236 | #define ASM_CONFIGURE_DUAL_MONO 0x00010C64 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1237 | struct asm_stream_cmd_encdec_cfg_blk{ |
| 1238 | struct apr_hdr hdr; |
| 1239 | u32 param_id; |
| 1240 | u32 param_size; |
| 1241 | struct asm_encode_cfg_blk enc_blk; |
| 1242 | } __attribute__((packed)); |
| 1243 | |
| 1244 | struct asm_stream_cmd_encdec_sbc_bitrate{ |
| 1245 | struct apr_hdr hdr; |
| 1246 | u32 param_id; |
| 1247 | struct asm_sbc_bitrate sbc_bitrate; |
| 1248 | } __attribute__((packed)); |
| 1249 | |
| 1250 | struct asm_stream_cmd_encdec_immed_decode{ |
| 1251 | struct apr_hdr hdr; |
| 1252 | u32 param_id; |
| 1253 | u32 param_size; |
| 1254 | struct asm_immed_decode dec; |
| 1255 | } __attribute__((packed)); |
| 1256 | |
| 1257 | struct asm_stream_cmd_encdec_sbr{ |
| 1258 | struct apr_hdr hdr; |
| 1259 | u32 param_id; |
| 1260 | u32 param_size; |
| 1261 | struct asm_sbr_ps sbr_ps; |
| 1262 | } __attribute__((packed)); |
| 1263 | |
Swaminathan Sathappan | 70765cd | 2011-07-19 18:42:47 -0700 | [diff] [blame] | 1264 | struct asm_stream_cmd_encdec_dualmono { |
| 1265 | struct apr_hdr hdr; |
| 1266 | u32 param_id; |
| 1267 | u32 param_size; |
| 1268 | struct asm_dual_mono channel_map; |
| 1269 | } __packed; |
| 1270 | |
Swaminathan Sathappan | 6f53088 | 2012-05-01 16:42:22 -0700 | [diff] [blame] | 1271 | #define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82 |
| 1272 | struct asm_stream_cmd_encdec_channelmap { |
| 1273 | struct apr_hdr hdr; |
| 1274 | u32 param_id; |
| 1275 | u32 param_size; |
| 1276 | struct asm_dec_chan_map chan_map; |
| 1277 | } __packed; |
| 1278 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1279 | #define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A |
| 1280 | struct asm_stream_cmd_adjust_samples{ |
| 1281 | struct apr_hdr hdr; |
| 1282 | u16 nsamples; |
| 1283 | u16 reserved; |
| 1284 | } __attribute__((packed)); |
| 1285 | |
| 1286 | #define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9 |
| 1287 | struct asm_stream_cmd_tap_popp_pcm{ |
| 1288 | struct apr_hdr hdr; |
| 1289 | u16 enable; |
| 1290 | u16 reserved; |
| 1291 | u32 module_id; |
| 1292 | } __attribute__((packed)); |
| 1293 | |
| 1294 | /* Session Level commands */ |
| 1295 | #define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32 |
| 1296 | struct asm_stream_cmd_memory_map{ |
| 1297 | struct apr_hdr hdr; |
| 1298 | u32 buf_add; |
| 1299 | u32 buf_size; |
| 1300 | u16 mempool_id; |
| 1301 | u16 reserved; |
| 1302 | } __attribute__((packed)); |
| 1303 | |
| 1304 | #define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33 |
| 1305 | struct asm_stream_cmd_memory_unmap{ |
| 1306 | struct apr_hdr hdr; |
| 1307 | u32 buf_add; |
| 1308 | } __attribute__((packed)); |
| 1309 | |
| 1310 | #define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45 |
| 1311 | struct asm_memory_map_regions{ |
| 1312 | u32 phys; |
| 1313 | u32 buf_size; |
| 1314 | } __attribute__((packed)); |
| 1315 | |
| 1316 | struct asm_stream_cmd_memory_map_regions{ |
| 1317 | struct apr_hdr hdr; |
| 1318 | u16 mempool_id; |
| 1319 | u16 nregions; |
| 1320 | } __attribute__((packed)); |
| 1321 | |
| 1322 | #define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46 |
| 1323 | struct asm_memory_unmap_regions{ |
| 1324 | u32 phys; |
| 1325 | } __attribute__((packed)); |
| 1326 | |
| 1327 | struct asm_stream_cmd_memory_unmap_regions{ |
| 1328 | struct apr_hdr hdr; |
| 1329 | u16 nregions; |
| 1330 | u16 reserved; |
| 1331 | } __attribute__((packed)); |
| 1332 | |
| 1333 | #define ASM_SESSION_CMD_RUN 0x00010BD2 |
| 1334 | struct asm_stream_cmd_run{ |
| 1335 | struct apr_hdr hdr; |
| 1336 | u32 flags; |
| 1337 | u32 msw_ts; |
| 1338 | u32 lsw_ts; |
| 1339 | } __attribute__((packed)); |
| 1340 | |
| 1341 | /* Session level events */ |
| 1342 | #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5 |
| 1343 | struct asm_stream_cmd_reg_rx_underflow_event{ |
| 1344 | struct apr_hdr hdr; |
| 1345 | u16 enable; |
| 1346 | u16 reserved; |
| 1347 | } __attribute__((packed)); |
| 1348 | |
| 1349 | #define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6 |
| 1350 | struct asm_stream_cmd_reg_tx_overflow_event{ |
| 1351 | struct apr_hdr hdr; |
| 1352 | u16 enable; |
| 1353 | u16 reserved; |
| 1354 | } __attribute__((packed)); |
| 1355 | |
| 1356 | /* Data Path commands */ |
| 1357 | #define ASM_DATA_CMD_WRITE 0x00010BD9 |
| 1358 | struct asm_stream_cmd_write{ |
| 1359 | struct apr_hdr hdr; |
| 1360 | u32 buf_add; |
| 1361 | u32 avail_bytes; |
| 1362 | u32 uid; |
| 1363 | u32 msw_ts; |
| 1364 | u32 lsw_ts; |
| 1365 | u32 uflags; |
| 1366 | } __attribute__((packed)); |
| 1367 | |
| 1368 | #define ASM_DATA_CMD_READ 0x00010BDA |
| 1369 | struct asm_stream_cmd_read{ |
| 1370 | struct apr_hdr hdr; |
| 1371 | u32 buf_add; |
| 1372 | u32 buf_size; |
| 1373 | u32 uid; |
| 1374 | } __attribute__((packed)); |
| 1375 | |
Subhash Chandra Bose Naripeddy | 694b7d9 | 2012-06-20 20:46:13 -0700 | [diff] [blame] | 1376 | #define ASM_DATA_CMD_READ_COMPRESSED 0x00010DBC |
| 1377 | struct asm_stream_cmd_read_compressed { |
| 1378 | struct apr_hdr hdr; |
| 1379 | u32 buf_add; |
| 1380 | u32 buf_size; |
| 1381 | u32 uid; |
| 1382 | } __packed; |
| 1383 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1384 | #define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC |
Deepa Madiregama | 55cbf78 | 2011-09-10 05:44:39 +0530 | [diff] [blame] | 1385 | #define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1386 | struct asm_stream_media_format_update{ |
| 1387 | struct apr_hdr hdr; |
| 1388 | u32 format; |
| 1389 | u32 cfg_size; |
| 1390 | union { |
| 1391 | struct asm_pcm_cfg pcm_cfg; |
| 1392 | struct asm_adpcm_cfg adpcm_cfg; |
| 1393 | struct asm_yadpcm_cfg yadpcm_cfg; |
| 1394 | struct asm_midi_cfg midi_cfg; |
| 1395 | struct asm_wma_cfg wma_cfg; |
| 1396 | struct asm_wmapro_cfg wmapro_cfg; |
| 1397 | struct asm_aac_cfg aac_cfg; |
| 1398 | struct asm_flac_cfg flac_cfg; |
| 1399 | struct asm_vorbis_cfg vorbis_cfg; |
Kiran Kandi | 5e809b0 | 2012-01-31 00:24:33 -0800 | [diff] [blame] | 1400 | struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1401 | } __attribute__((packed)) write_cfg; |
| 1402 | } __attribute__((packed)); |
| 1403 | |
| 1404 | |
| 1405 | /* Command Responses */ |
| 1406 | #define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12 |
| 1407 | struct asm_stream_cmdrsp_get_readwrite_param{ |
| 1408 | struct apr_hdr hdr; |
| 1409 | u32 status; |
| 1410 | u32 param_id; |
| 1411 | u16 param_size; |
| 1412 | u16 padding; |
| 1413 | union { |
| 1414 | struct asm_sbc_bitrate sbc_bitrate; |
| 1415 | struct asm_immed_decode aac_dec; |
| 1416 | } __attribute__((packed)) read_write_cfg; |
| 1417 | } __attribute__((packed)); |
| 1418 | |
| 1419 | |
| 1420 | #define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8 |
| 1421 | struct asm_stream_cmdrsp_get_session_time{ |
| 1422 | struct apr_hdr hdr; |
| 1423 | u32 status; |
| 1424 | u32 msw_ts; |
| 1425 | u32 lsw_ts; |
| 1426 | } __attribute__((packed)); |
| 1427 | |
| 1428 | #define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF |
| 1429 | struct asm_data_event_write_done{ |
| 1430 | u32 buf_add; |
| 1431 | u32 status; |
| 1432 | } __attribute__((packed)); |
| 1433 | |
| 1434 | #define ASM_DATA_EVENT_READ_DONE 0x00010BE0 |
| 1435 | struct asm_data_event_read_done{ |
| 1436 | u32 status; |
| 1437 | u32 buffer_add; |
| 1438 | u32 enc_frame_size; |
| 1439 | u32 offset; |
| 1440 | u32 msw_ts; |
| 1441 | u32 lsw_ts; |
| 1442 | u32 flags; |
| 1443 | u32 num_frames; |
| 1444 | u32 id; |
| 1445 | } __attribute__((packed)); |
| 1446 | |
Subhash Chandra Bose Naripeddy | 694b7d9 | 2012-06-20 20:46:13 -0700 | [diff] [blame] | 1447 | #define ASM_DATA_EVENT_READ_COMPRESSED_DONE 0x00010DBD |
| 1448 | struct asm_data_event_read_compressed_done { |
| 1449 | u32 status; |
| 1450 | u32 buffer_add; |
| 1451 | u32 enc_frame_size; |
| 1452 | u32 offset; |
| 1453 | u32 msw_ts; |
| 1454 | u32 lsw_ts; |
| 1455 | u32 flags; |
| 1456 | u32 num_frames; |
| 1457 | u32 id; |
| 1458 | } __packed; |
| 1459 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1460 | #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65 |
| 1461 | struct asm_data_event_sr_cm_change_notify { |
| 1462 | u32 sample_rate; |
| 1463 | u16 no_of_channels; |
| 1464 | u16 reserved; |
| 1465 | u8 channel_map[8]; |
| 1466 | } __packed; |
| 1467 | |
| 1468 | /* service level events */ |
| 1469 | |
| 1470 | #define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B |
| 1471 | struct asm_svc_cmdrsp_get_strm_handles{ |
| 1472 | struct apr_hdr hdr; |
| 1473 | u32 num_handles; |
| 1474 | u32 stream_handles; |
| 1475 | } __attribute__((packed)); |
| 1476 | |
| 1477 | |
| 1478 | #define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A |
| 1479 | struct asm_svc_cmdrsp_get_wallclock_time{ |
| 1480 | struct apr_hdr hdr; |
| 1481 | u32 status; |
| 1482 | u32 msw_ts; |
| 1483 | u32 lsw_ts; |
| 1484 | } __attribute__((packed)); |
| 1485 | |
| 1486 | /* |
| 1487 | * Error code |
| 1488 | */ |
| 1489 | #define ADSP_EOK 0x00000000 /* Success / completed / no errors. */ |
| 1490 | #define ADSP_EFAILED 0x00000001 /* General failure. */ |
| 1491 | #define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */ |
| 1492 | #define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */ |
| 1493 | #define ADSP_EVERSION 0x00000004 /* Unsupported version. */ |
| 1494 | #define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */ |
| 1495 | #define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */ |
| 1496 | #define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */ |
| 1497 | #define ADSP_EHANDLE 0x00000008 /* Invalid handle. */ |
| 1498 | #define ADSP_EALREADY 0x00000009 /* Operation is already processed. */ |
| 1499 | #define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/ |
| 1500 | #define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/ |
| 1501 | #define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or |
| 1502 | processed. */ |
| 1503 | #define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */ |
| 1504 | #define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/ |
| 1505 | #define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention |
| 1506 | to complete. */ |
| 1507 | #define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate |
| 1508 | intervention to complete. */ |
| 1509 | #define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */ |
| 1510 | #define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/ |
| 1511 | |
Sriranjan Srikantam | 22bee8b | 2012-05-31 15:21:53 -0700 | [diff] [blame] | 1512 | /* SRS TRUMEDIA start */ |
| 1513 | #define SRS_ID_GLOBAL 0x00000001 |
| 1514 | #define SRS_ID_WOWHD 0x00000002 |
| 1515 | #define SRS_ID_CSHP 0x00000003 |
| 1516 | #define SRS_ID_HPF 0x00000004 |
| 1517 | #define SRS_ID_PEQ 0x00000005 |
| 1518 | #define SRS_ID_HL 0x00000006 |
| 1519 | |
| 1520 | #define SRS_CMD_UPLOAD 0x7FFF0000 |
| 1521 | #define SRS_PARAM_INDEX_MASK 0x80000000 |
| 1522 | #define SRS_PARAM_OFFSET_MASK 0x3FFF0000 |
| 1523 | #define SRS_PARAM_VALUE_MASK 0x0000FFFF |
| 1524 | |
| 1525 | struct srs_trumedia_params_GLOBAL { |
| 1526 | uint8_t v1; |
| 1527 | uint8_t v2; |
| 1528 | uint8_t v3; |
| 1529 | uint8_t v4; |
| 1530 | uint8_t v5; |
| 1531 | uint8_t v6; |
| 1532 | uint8_t v7; |
| 1533 | uint8_t v8; |
| 1534 | } __packed; |
| 1535 | |
| 1536 | struct srs_trumedia_params_WOWHD { |
| 1537 | uint32_t v1; |
| 1538 | uint16_t v2; |
| 1539 | uint16_t v3; |
| 1540 | uint16_t v4; |
| 1541 | uint16_t v5; |
| 1542 | uint16_t v6; |
| 1543 | uint16_t v7; |
| 1544 | uint16_t v8; |
| 1545 | uint16_t v____A1; |
| 1546 | uint32_t v9; |
| 1547 | uint16_t v10; |
| 1548 | uint16_t v11; |
| 1549 | uint32_t v12[16]; |
| 1550 | } __packed; |
| 1551 | |
| 1552 | struct srs_trumedia_params_CSHP { |
| 1553 | uint32_t v1; |
| 1554 | uint16_t v2; |
| 1555 | uint16_t v3; |
| 1556 | uint16_t v4; |
| 1557 | uint16_t v5; |
| 1558 | uint16_t v6; |
| 1559 | uint16_t v____A1; |
| 1560 | uint32_t v7; |
| 1561 | uint16_t v8; |
| 1562 | uint16_t v9; |
| 1563 | uint32_t v10[16]; |
| 1564 | } __packed; |
| 1565 | |
| 1566 | struct srs_trumedia_params_HPF { |
| 1567 | uint32_t v1; |
| 1568 | uint32_t v2[26]; |
| 1569 | } __packed; |
| 1570 | |
| 1571 | struct srs_trumedia_params_PEQ { |
| 1572 | uint32_t v1; |
| 1573 | uint16_t v2; |
| 1574 | uint16_t v3; |
| 1575 | uint16_t v4; |
| 1576 | uint16_t v____A1; |
| 1577 | uint32_t v5[26]; |
| 1578 | uint32_t v6[26]; |
| 1579 | } __packed; |
| 1580 | |
| 1581 | struct srs_trumedia_params_HL { |
| 1582 | uint16_t v1; |
| 1583 | uint16_t v2; |
| 1584 | uint16_t v3; |
| 1585 | uint16_t v____A1; |
| 1586 | int32_t v4; |
| 1587 | uint32_t v5; |
| 1588 | uint16_t v6; |
| 1589 | uint16_t v____A2; |
| 1590 | uint32_t v7; |
| 1591 | } __packed; |
| 1592 | |
| 1593 | struct srs_trumedia_params { |
| 1594 | struct srs_trumedia_params_GLOBAL global; |
| 1595 | struct srs_trumedia_params_WOWHD wowhd; |
| 1596 | struct srs_trumedia_params_CSHP cshp; |
| 1597 | struct srs_trumedia_params_HPF hpf; |
| 1598 | struct srs_trumedia_params_PEQ peq; |
| 1599 | struct srs_trumedia_params_HL hl; |
| 1600 | } __packed; |
| 1601 | int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params); |
| 1602 | /* SRS TruMedia end */ |
| 1603 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1604 | #endif /*_APR_AUDIO_H_*/ |