blob: f303c6273a7371e1b06d48e8fd2f70901d053315 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 *
Amal Paul6e0f7982013-02-21 19:36:35 -08003 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 *
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 Kasam32657ec2011-08-01 19:26:57 +053060#define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */
61#define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */
Shiv Maliyappanahallia416ee22012-06-01 16:02:35 -070062#define SECONDARY_PCM_RX 12 /* index = 32 */
63#define SECONDARY_PCM_TX 13 /* index = 33 */
64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065
66#define AFE_PORT_INVALID 0xFFFF
Joonwoo Parkc924f3e2012-04-11 19:25:03 -070067#define SLIMBUS_EXTPROC_RX AFE_PORT_INVALID
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068
69#define AFE_PORT_CMD_START 0x000100ca
Laxminath Kasam32657ec2011-08-01 19:26:57 +053070
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 Huntsman3f2bc4d2011-08-16 17:27:22 -070076struct 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
84struct 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
91struct 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
98struct 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
115struct 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
133struct 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
142struct 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
154struct 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
179struct 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
196enum {
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
213struct 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 Wanga36f2882012-04-02 19:45:26 -0700231 u16 format; /* don't touch this field if it is not for */
232 /* AFE_PORT_CMD_I2S_CONFIG opcode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233} __attribute__ ((packed));
234
235struct 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 Kandi5e809b02012-01-31 00:24:33 -0800242 /* HDMI_non_Linear = 1 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243} __attribute__ ((packed));
244
245
Kiran Kandi5e809b02012-01-31 00:24:33 -0800246struct 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700254/* 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
259struct 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 Ramachandramurthy9c79f132011-11-28 11:18:57 -0800280struct 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 Kasam32657ec2011-08-01 19:26:57 +0530290struct 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700301
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800302#define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
303#define AFE_PORT_AUDIO_SLIM_SCH_CONFIG 0x000100e4
Kiran Kandi5e809b02012-01-31 00:24:33 -0800304#define AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG 0x000100D9
Kuirong Wanga36f2882012-04-02 19:45:26 -0700305#define AFE_PORT_CMD_I2S_CONFIG 0x000100E7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306
Srikanth Katta88928532013-11-15 15:38:14 +0530307#define AFE_PARAM_ID_DEVICE_HW_DELAY 0x00010243
308#define AFE_API_VERSION_DEVICE_HW_DELAY 0x1
309
310struct afe_param_id_device_hw_delay_cfg {
311 uint32_t device_hw_delay_minor_version;
312 uint32_t delay_in_us;
313} __packed;
314
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315union afe_port_config {
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800316 struct afe_port_pcm_cfg pcm;
317 struct afe_port_mi2s_cfg mi2s;
318 struct afe_port_hdmi_cfg hdmi;
319 struct afe_port_hdmi_multi_ch_cfg hdmi_multi_ch;
320 struct afe_port_slimbus_cfg slimbus;
321 struct afe_port_slimbus_sch_cfg slim_sch;
322 struct afe_port_rtproxy_cfg rtproxy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323} __attribute__((packed));
324
325struct afe_audioif_config_command {
326 struct apr_hdr hdr;
327 u16 port_id;
328 union afe_port_config port;
329} __attribute__ ((packed));
330
331#define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
332struct afe_codec_loopback_command {
333 u16 port_inf; /* Primary i2s = 0 */
334 /* PCM = 2 */
335 /* Secondary i2s = 4 */
336 /* Mi2s = 6 */
337 u16 enable; /* 0, disable. 1, enable */
338} __attribute__ ((packed));
339
340
341#define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300
342struct afe_param_sidetone_gain {
343 u16 gain;
344 u16 reserved;
345} __attribute__ ((packed));
346
347#define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
348struct afe_param_sampling_rate {
349 u32 sampling_rate;
350} __attribute__ ((packed));
351
352
353#define AFE_PARAM_ID_CHANNELS 0x00010302
354struct afe_param_channels {
355 u16 channels;
356 u16 reserved;
357} __attribute__ ((packed));
358
359
360#define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
361struct afe_param_loopback_gain {
362 u16 gain;
363 u16 reserved;
364} __attribute__ ((packed));
365
Neema Shetty74131ac2012-05-09 13:35:26 -0700366/* Parameter ID used to configure and enable/disable the loopback path. The
367 * difference with respect to the existing API, AFE_PORT_CMD_LOOPBACK, is that
368 * it allows Rx port to be configured as source port in loopback path. Port-id
369 * in AFE_PORT_CMD_SET_PARAM cmd is the source port whcih can be Tx or Rx port.
370 * In addition, we can configure the type of routing mode to handle different
371 * use cases.
372*/
373enum {
374 /* Regular loopback from source to destination port */
375 LB_MODE_DEFAULT = 1,
376 /* Sidetone feed from Tx source to Rx destination port */
377 LB_MODE_SIDETONE,
378 /* Echo canceller reference, voice + audio + DTMF */
379 LB_MODE_EC_REF_VOICE_AUDIO,
380 /* Echo canceller reference, voice alone */
381 LB_MODE_EC_REF_VOICE
382};
383
384#define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B
385#define AFE_API_VERSION_LOOPBACK_CONFIG 0x1
386struct afe_param_loopback_cfg {
387 /* Minor version used for tracking the version of the configuration
388 * interface.
389 */
390 uint32_t loopback_cfg_minor_version;
391
392 /* Destination Port Id. */
393 uint16_t dst_port_id;
394
395 /* Specifies data path type from src to dest port. Supported values:
396 * LB_MODE_DEFAULT
397 * LB_MODE_SIDETONE
398 * LB_MODE_EC_REF_VOICE_AUDIO
399 * LB_MODE_EC_REF_VOICE
400 */
401 uint16_t routing_mode;
402
403 /* Specifies whether to enable (1) or disable (0) an AFE loopback. */
404 uint16_t enable;
405
406 /* Reserved for 32-bit alignment. This field must be set to 0. */
407 uint16_t reserved;
408} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700409
410#define AFE_MODULE_ID_PORT_INFO 0x00010200
Neema Shetty74131ac2012-05-09 13:35:26 -0700411/* Module ID for the loopback-related parameters. */
412#define AFE_MODULE_LOOPBACK 0x00010205
Patrick Lai48da1492012-07-04 20:48:24 -0700413struct afe_param_payload_base {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414 u32 module_id;
415 u32 param_id;
416 u16 param_size;
417 u16 reserved;
Patrick Lai48da1492012-07-04 20:48:24 -0700418} __packed;
419
420struct afe_param_payload {
421 struct afe_param_payload_base base;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700422 union {
423 struct afe_param_sidetone_gain sidetone_gain;
424 struct afe_param_sampling_rate sampling_rate;
425 struct afe_param_channels channels;
426 struct afe_param_loopback_gain loopback_gain;
Neema Shetty74131ac2012-05-09 13:35:26 -0700427 struct afe_param_loopback_cfg loopback_cfg;
Srikanth Katta88928532013-11-15 15:38:14 +0530428 struct afe_param_id_device_hw_delay_cfg hw_delay;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700429 } __attribute__((packed)) param;
430} __attribute__ ((packed));
431
432#define AFE_PORT_CMD_SET_PARAM 0x000100dc
433
434struct afe_port_cmd_set_param {
435 struct apr_hdr hdr;
436 u16 port_id;
437 u16 payload_size;
438 u32 payload_address;
439 struct afe_param_payload payload;
440} __attribute__ ((packed));
441
Ben Rombergerb7603232011-11-23 17:16:27 -0800442struct afe_port_cmd_set_param_no_payload {
443 struct apr_hdr hdr;
444 u16 port_id;
445 u16 payload_size;
446 u32 payload_address;
447} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700448
449#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
450struct afe_get_active_ports_rsp {
451 u16 num_ports;
452 u16 port_id;
453} __attribute__ ((packed));
454
455
456#define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
457struct afe_get_active_handles_rsp {
458 u16 port_id;
459 u16 num_handles;
460 u16 mode; /* 0, voice rx */
461 /* 1, voice tx */
462 /* 2, audio rx */
463 /* 3, audio tx */
464 u16 handle;
465} __attribute__ ((packed));
466
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530467#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
468struct afe_cmd_memory_map {
469 struct apr_hdr hdr;
470 u32 phy_addr;
471 u32 mem_sz;
472 u16 mem_id;
473 u16 rsvd;
474} __packed;
475
476#define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
477struct afe_cmd_memory_unmap {
478 struct apr_hdr hdr;
479 u32 phy_addr;
480} __packed;
481
482#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
483struct afe_cmd_reg_rtport {
484 struct apr_hdr hdr;
485 u16 port_id;
486 u16 rsvd;
487} __packed;
488
489#define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
490struct afe_cmd_unreg_rtport {
491 struct apr_hdr hdr;
492 u16 port_id;
493 u16 rsvd;
494} __packed;
495
496#define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
497struct afe_cmd_rtport_wr {
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_SERVICE_CMD_RTPORT_RD 0x000100E3
506struct afe_cmd_rtport_rd {
507 struct apr_hdr hdr;
508 u16 port_id;
509 u16 rsvd;
510 u32 buf_addr;
511 u32 bytes_avail;
512} __packed;
513
514#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
515
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516#define ADM_MAX_COPPS 5
517
518#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
519struct adm_get_copp_handles_command {
520 struct apr_hdr hdr;
521} __attribute__ ((packed));
522
523#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
524struct adm_routings_session {
525 u16 id;
526 u16 num_copps;
527 u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
528} __packed;
529
530struct adm_routings_command {
531 struct apr_hdr hdr;
532 u32 path; /* 0 = Rx, 1 Tx */
533 u32 num_sessions;
534 struct adm_routings_session session[8];
535} __attribute__ ((packed));
536
537
538#define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
539struct adm_ramp_gain {
540 struct apr_hdr hdr;
541 u16 session_id;
542 u16 copp_id;
543 u16 initial_gain;
544 u16 gain_increment;
545 u16 ramp_duration;
546 u16 reserved;
547} __attribute__ ((packed));
548
549struct adm_ramp_gains_command {
550 struct apr_hdr hdr;
551 u32 id;
552 u32 num_gains;
553 struct adm_ramp_gain gains[ADM_MAX_COPPS];
554} __attribute__ ((packed));
555
556
557#define ADM_CMD_COPP_OPEN 0x00010304
558struct adm_copp_open_command {
559 struct apr_hdr hdr;
560 u16 flags;
561 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
562 u16 endpoint_id1;
563 u16 endpoint_id2;
564 u32 topology_id;
565 u16 channel_config;
566 u16 reserved;
567 u32 rate;
568} __attribute__ ((packed));
569
570#define ADM_CMD_COPP_CLOSE 0x00010305
571
Kiran Kandi5e809b02012-01-31 00:24:33 -0800572#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700573#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3 0x00010333
Kiran Kandi5e809b02012-01-31 00:24:33 -0800574struct adm_multi_ch_copp_open_command {
575 struct apr_hdr hdr;
576 u16 flags;
577 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
578 u16 endpoint_id1;
579 u16 endpoint_id2;
580 u32 topology_id;
581 u16 channel_config;
582 u16 reserved;
583 u32 rate;
584 u8 dev_channel_mapping[8];
585} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700586#define ADM_CMD_MEMORY_MAP 0x00010C30
587struct adm_cmd_memory_map{
588 struct apr_hdr hdr;
589 u32 buf_add;
590 u32 buf_size;
591 u16 mempool_id;
592 u16 reserved;
593} __attribute__((packed));
594
595#define ADM_CMD_MEMORY_UNMAP 0x00010C31
596struct adm_cmd_memory_unmap{
597 struct apr_hdr hdr;
598 u32 buf_add;
599} __attribute__((packed));
600
601#define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
602struct adm_memory_map_regions{
603 u32 phys;
604 u32 buf_size;
605} __attribute__((packed));
606
607struct adm_cmd_memory_map_regions{
608 struct apr_hdr hdr;
609 u16 mempool_id;
610 u16 nregions;
611} __attribute__((packed));
612
613#define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
614struct adm_memory_unmap_regions{
615 u32 phys;
616} __attribute__((packed));
617
618struct adm_cmd_memory_unmap_regions{
619 struct apr_hdr hdr;
620 u16 nregions;
621 u16 reserved;
622} __attribute__((packed));
623
624#define DEFAULT_COPP_TOPOLOGY 0x00010be3
625#define DEFAULT_POPP_TOPOLOGY 0x00010be4
626#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
627#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
Jayasena Sangaraboina0fc197d2011-12-09 13:20:33 -0800628#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700629
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700630#define LOWLATENCY_POPP_TOPOLOGY 0x00010C68
631#define LOWLATENCY_COPP_TOPOLOGY 0x00010312
632#define PCM_BITS_PER_SAMPLE 16
633
634#define ASM_OPEN_WRITE_PERF_MODE_BIT (1<<28)
635#define ASM_OPEN_READ_PERF_MODE_BIT (1<<29)
636#define ADM_MULTI_CH_COPP_OPEN_PERF_MODE_BIT (1<<13)
637
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -0700638/* SRS TRUMEDIA GUIDS */
639/* topology */
640#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
641/* module */
642#define SRS_TRUMEDIA_MODULE_ID 0x10005010
643/* parameters */
644#define SRS_TRUMEDIA_PARAMS 0x10005011
645#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
646#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
647#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
648#define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015
649#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
650
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651#define ASM_MAX_EQ_BANDS 12
652
653struct asm_eq_band {
654 u32 band_idx; /* The band index, 0 .. 11 */
655 u32 filter_type; /* Filter band type */
656 u32 center_freq_hz; /* Filter band center frequency */
657 u32 filter_gain; /* Filter band initial gain (dB) */
658 /* Range is +12 dB to -12 dB with 1dB increments. */
659 u32 q_factor;
660} __attribute__ ((packed));
661
662struct asm_equalizer_params {
663 u32 enable;
664 u32 num_bands;
665 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
666} __attribute__ ((packed));
667
668struct asm_master_gain_params {
669 u16 master_gain;
670 u16 padding;
671} __attribute__ ((packed));
672
673struct asm_lrchannel_gain_params {
674 u16 left_gain;
675 u16 right_gain;
676} __attribute__ ((packed));
677
678struct asm_mute_params {
679 u32 muteflag;
680} __attribute__ ((packed));
681
682struct asm_softvolume_params {
683 u32 period;
684 u32 step;
685 u32 rampingcurve;
686} __attribute__ ((packed));
687
688struct asm_softpause_params {
689 u32 enable;
690 u32 period;
691 u32 step;
692 u32 rampingcurve;
693} __packed;
694
695struct asm_pp_param_data_hdr {
696 u32 module_id;
697 u32 param_id;
698 u16 param_size;
699 u16 reserved;
700} __attribute__ ((packed));
701
702struct asm_pp_params_command {
703 struct apr_hdr hdr;
704 u32 *payload;
705 u32 payload_size;
706 struct asm_pp_param_data_hdr params;
707} __attribute__ ((packed));
708
709#define EQUALIZER_MODULE_ID 0x00010c27
710#define EQUALIZER_PARAM_ID 0x00010c28
711
712#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
713#define MASTER_GAIN_PARAM_ID 0x00010bff
714#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
715#define MUTE_CONFIG_PARAM_ID 0x00010c01
716#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700717#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718
719#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
720#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
721#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
722
723#define MBADRC_MODULE_ID 0x00010c06
724#define MBADRC_ENABLE_PARAM_ID 0x00010c07
725#define MBADRC_CONFIG_PARAM_ID 0x00010c08
726
727
728#define ADM_CMD_SET_PARAMS 0x00010306
729#define ADM_CMD_GET_PARAMS 0x0001030B
730#define ADM_CMDRSP_GET_PARAMS 0x0001030C
731struct adm_set_params_command {
732 struct apr_hdr hdr;
733 u32 payload;
734 u32 payload_size;
735} __attribute__ ((packed));
736
737
738#define ADM_CMD_TAP_COPP_PCM 0x00010307
739struct adm_tap_copp_pcm_command {
740 struct apr_hdr hdr;
741} __attribute__ ((packed));
742
743
744/* QDSP6 to Client messages
745*/
746#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
747struct adm_get_copp_handles_respond {
748 struct apr_hdr hdr;
749 u32 handles;
750 u32 copp_id;
751} __attribute__ ((packed));
752
753#define ADM_CMDRSP_COPP_OPEN 0x0001030A
754struct adm_copp_open_respond {
755 u32 status;
756 u16 copp_id;
757 u16 reserved;
758} __attribute__ ((packed));
759
Kiran Kandi5e809b02012-01-31 00:24:33 -0800760#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700761#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN_V3 0x00010334
Kiran Kandi5e809b02012-01-31 00:24:33 -0800762
763
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700764#define ASM_STREAM_PRIORITY_NORMAL 0
765#define ASM_STREAM_PRIORITY_LOW 1
766#define ASM_STREAM_PRIORITY_HIGH 2
767#define ASM_STREAM_PRIORITY_RESERVED 3
768
769#define ASM_END_POINT_DEVICE_MATRIX 0
770#define ASM_END_POINT_STREAM 1
771
772#define AAC_ENC_MODE_AAC_LC 0x02
773#define AAC_ENC_MODE_AAC_P 0x05
774#define AAC_ENC_MODE_EAAC_P 0x1D
775
776#define ASM_STREAM_CMD_CLOSE 0x00010BCD
777#define ASM_STREAM_CMD_FLUSH 0x00010BCE
778#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
779#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
780#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
781#define ASM_SESSION_CMD_PAUSE 0x00010BD3
782#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
783#define ASM_DATA_CMD_EOS 0x00010BDB
784#define ASM_DATA_EVENT_EOS 0x00010BDD
785
786#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
787#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
788
789#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
790#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
791#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
792#define ASM_DATA_CMDRSP_EOS 0x00010C1C
793
794/* ASM Data structures */
795
796/* common declarations */
797struct asm_pcm_cfg {
798 u16 ch_cfg;
799 u16 bits_per_sample;
800 u32 sample_rate;
801 u16 is_signed;
802 u16 interleaved;
803};
804
Kiran Kandi5e809b02012-01-31 00:24:33 -0800805#define PCM_CHANNEL_NULL 0
806
807/* Front left channel. */
808#define PCM_CHANNEL_FL 1
809
810/* Front right channel. */
811#define PCM_CHANNEL_FR 2
812
813/* Front center channel. */
814#define PCM_CHANNEL_FC 3
815
816/* Left surround channel.*/
817#define PCM_CHANNEL_LS 4
818
819/* Right surround channel.*/
820#define PCM_CHANNEL_RS 5
821
822/* Low frequency effect channel. */
823#define PCM_CHANNEL_LFE 6
824
825/* Center surround channel; Rear center channel. */
826#define PCM_CHANNEL_CS 7
827
828/* Left back channel; Rear left channel. */
829#define PCM_CHANNEL_LB 8
830
831/* Right back channel; Rear right channel. */
832#define PCM_CHANNEL_RB 9
833
834/* Top surround channel. */
835#define PCM_CHANNEL_TS 10
836
837/* Center vertical height channel.*/
838#define PCM_CHANNEL_CVH 11
839
840/* Mono surround channel.*/
841#define PCM_CHANNEL_MS 12
842
843/* Front left of center. */
844#define PCM_CHANNEL_FLC 13
845
846/* Front right of center. */
847#define PCM_CHANNEL_FRC 14
848
849/* Rear left of center. */
850#define PCM_CHANNEL_RLC 15
851
852/* Rear right of center. */
853#define PCM_CHANNEL_RRC 16
854
855#define PCM_FORMAT_MAX_NUM_CHANNEL 8
856
Swaminathan Sathappan6f530882012-05-01 16:42:22 -0700857/* Maximum number of channels supported
858 * in ASM_ENCDEC_DEC_CHAN_MAP command
859 */
860#define MAX_CHAN_MAP_CHANNELS 16
Kiran Kandi5e809b02012-01-31 00:24:33 -0800861/*
862 * Multiple-channel PCM decoder format block structure used in the
863 * #ASM_STREAM_CMD_OPEN_WRITE command.
864 * The data must be in little-endian format.
865 */
866struct asm_multi_channel_pcm_fmt_blk {
867
868 u16 num_channels; /*
869 * Number of channels.
870 * Supported values:1 to 8
871 */
872
873 u16 bits_per_sample; /*
874 * Number of bits per sample per channel.
875 * Supported values: 16, 24 When used for
876 * playback, the client must send 24-bit
877 * samples packed in 32-bit words. The
878 * 24-bit samples must be placed in the most
879 * significant 24 bits of the 32-bit word. When
880 * used for recording, the aDSP sends 24-bit
881 * samples packed in 32-bit words. The 24-bit
882 * samples are placed in the most significant
883 * 24 bits of the 32-bit word.
884 */
885
886 u32 sample_rate; /*
887 * Number of samples per second
888 * (in Hertz). Supported values:
889 * 2000 to 48000
890 */
891
892 u16 is_signed; /*
893 * Flag that indicates the samples
894 * are signed (1).
895 */
896
897 u16 is_interleaved; /*
898 * Flag that indicates whether the channels are
899 * de-interleaved (0) or interleaved (1).
900 * Interleaved format means corresponding
901 * samples from the left and right channels are
902 * interleaved within the buffer.
903 * De-interleaved format means samples from
904 * each channel are contiguous in the buffer.
905 * The samples from one channel immediately
906 * follow those of the previous channel.
907 */
908
909 u8 channel_mapping[8]; /*
910 * Supported values:
911 * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
912 * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
913 * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
914 * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
915 * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
916 * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
917 * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
918 * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
919 * PCM_CHANNEL_RRC.
920 * Channel[i] mapping describes channel I. Each
921 * element i of the array describes channel I
922 * inside the buffer where I < num_channels.
923 * An unused channel is set to zero.
924 */
925};
926
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927struct asm_adpcm_cfg {
928 u16 ch_cfg;
929 u16 bits_per_sample;
930 u32 sample_rate;
931 u32 block_size;
932};
933
934struct asm_yadpcm_cfg {
935 u16 ch_cfg;
936 u16 bits_per_sample;
937 u32 sample_rate;
938};
939
940struct asm_midi_cfg {
941 u32 nMode;
942};
943
944struct asm_wma_cfg {
945 u16 format_tag;
946 u16 ch_cfg;
947 u32 sample_rate;
948 u32 avg_bytes_per_sec;
949 u16 block_align;
950 u16 valid_bits_per_sample;
951 u32 ch_mask;
952 u16 encode_opt;
953 u16 adv_encode_opt;
954 u32 adv_encode_opt2;
955 u32 drc_peak_ref;
956 u32 drc_peak_target;
957 u32 drc_ave_ref;
958 u32 drc_ave_target;
959};
960
961struct asm_wmapro_cfg {
962 u16 format_tag;
963 u16 ch_cfg;
964 u32 sample_rate;
965 u32 avg_bytes_per_sec;
966 u16 block_align;
967 u16 valid_bits_per_sample;
968 u32 ch_mask;
969 u16 encode_opt;
970 u16 adv_encode_opt;
971 u32 adv_encode_opt2;
972 u32 drc_peak_ref;
973 u32 drc_peak_target;
974 u32 drc_ave_ref;
975 u32 drc_ave_target;
976};
977
978struct asm_aac_cfg {
979 u16 format;
980 u16 aot;
981 u16 ep_config;
982 u16 section_data_resilience;
983 u16 scalefactor_data_resilience;
984 u16 spectral_data_resilience;
985 u16 ch_cfg;
986 u16 reserved;
987 u32 sample_rate;
988};
989
Ajit Khare43fd8832012-08-07 13:19:44 -0700990struct asm_amrwbplus_cfg {
991 u32 size_bytes;
992 u32 version;
993 u32 num_channels;
994 u32 amr_band_mode;
995 u32 amr_dtx_mode;
996 u32 amr_frame_fmt;
997 u32 amr_lsf_idx;
998};
999
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001000struct asm_flac_cfg {
1001 u16 stream_info_present;
1002 u16 min_blk_size;
1003 u16 max_blk_size;
1004 u16 ch_cfg;
1005 u16 sample_size;
1006 u16 sample_rate;
1007 u16 md5_sum;
1008 u32 ext_sample_rate;
1009 u32 min_frame_size;
1010 u32 max_frame_size;
1011};
1012
1013struct asm_vorbis_cfg {
1014 u32 ch_cfg;
1015 u32 bit_rate;
1016 u32 min_bit_rate;
1017 u32 max_bit_rate;
1018 u16 bit_depth_pcm_sample;
1019 u16 bit_stream_format;
1020};
1021
1022struct asm_aac_read_cfg {
1023 u32 bitrate;
1024 u32 enc_mode;
1025 u16 format;
1026 u16 ch_cfg;
1027 u32 sample_rate;
1028};
1029
1030struct asm_amrnb_read_cfg {
1031 u16 mode;
1032 u16 dtx_mode;
1033};
1034
Alex Wong2caeecc2011-10-28 10:52:15 +05301035struct asm_amrwb_read_cfg {
1036 u16 mode;
1037 u16 dtx_mode;
1038};
1039
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001040struct asm_evrc_read_cfg {
1041 u16 max_rate;
1042 u16 min_rate;
1043 u16 rate_modulation_cmd;
1044 u16 reserved;
1045};
1046
1047struct asm_qcelp13_read_cfg {
1048 u16 max_rate;
1049 u16 min_rate;
1050 u16 reduced_rate_level;
1051 u16 rate_modulation_cmd;
1052};
1053
1054struct asm_sbc_read_cfg {
1055 u32 subband;
1056 u32 block_len;
1057 u32 ch_mode;
1058 u32 alloc_method;
1059 u32 bit_rate;
1060 u32 sample_rate;
1061};
1062
1063struct asm_sbc_bitrate {
1064 u32 bitrate;
1065};
1066
1067struct asm_immed_decode {
1068 u32 mode;
1069};
1070
1071struct asm_sbr_ps {
1072 u32 enable;
1073};
1074
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001075struct asm_dual_mono {
1076 u16 sce_left;
1077 u16 sce_right;
1078};
1079
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001080struct asm_dec_chan_map {
1081 u32 num_channels; /* Number of decoder output
1082 * channels. A value of 0
1083 * indicates native channel
1084 * mapping, which is valid
1085 * only for NT mode. This
1086 * means the output of the
1087 * decoder is to be preserved
1088 * as is.
1089 */
1090
1091 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
1092 * num_channels. It can grow
1093 * till MAX_CHAN_MAP_CHANNELS.
1094 * Channel[i] mapping
1095 * describes channel I inside
1096 * the decoder output buffer.
1097 * Valid channel mapping
1098 * values are to be present at
1099 * the beginning of the array.
1100 * All remaining elements of
1101 * the array are to be filled
1102 * with PCM_CHANNEL_NULL.
1103 */
1104};
1105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001106struct asm_encode_cfg_blk {
1107 u32 frames_per_buf;
1108 u32 format_id;
1109 u32 cfg_size;
1110 union {
1111 struct asm_pcm_cfg pcm;
1112 struct asm_aac_read_cfg aac;
1113 struct asm_amrnb_read_cfg amrnb;
1114 struct asm_evrc_read_cfg evrc;
1115 struct asm_qcelp13_read_cfg qcelp13;
1116 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +05301117 struct asm_amrwb_read_cfg amrwb;
Mingming Yin647e9ea2012-03-17 19:56:10 -07001118 struct asm_multi_channel_pcm_fmt_blk mpcm;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001119 } __attribute__((packed)) cfg;
1120};
1121
1122struct asm_frame_meta_info {
1123 u32 offset_to_frame;
1124 u32 frame_size;
1125 u32 encoded_pcm_samples;
1126 u32 msw_ts;
1127 u32 lsw_ts;
1128 u32 nflags;
1129};
1130
1131/* Stream level commands */
1132#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001133#define ASM_STREAM_CMD_OPEN_READ_V2_1 0x00010DB2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001134struct asm_stream_cmd_open_read {
1135 struct apr_hdr hdr;
1136 u32 uMode;
1137 u32 src_endpoint;
1138 u32 pre_proc_top;
1139 u32 format;
1140} __attribute__((packed));
1141
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001142struct asm_stream_cmd_open_read_v2_1 {
1143 struct apr_hdr hdr;
1144 u32 uMode;
1145 u32 src_endpoint;
1146 u32 pre_proc_top;
1147 u32 format;
1148 u16 bits_per_sample;
1149 u16 reserved;
1150} __packed;
1151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001152/* Supported formats */
1153#define LINEAR_PCM 0x00010BE5
1154#define DTMF 0x00010BE6
1155#define ADPCM 0x00010BE7
1156#define YADPCM 0x00010BE8
1157#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001158#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +05301160#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001161#define V13K_FS 0x00010BED
1162#define EVRC_FS 0x00010BEE
1163#define EVRCB_FS 0x00010BEF
1164#define EVRCWB_FS 0x00010BF0
1165#define MIDI 0x00010BF1
1166#define SBC 0x00010BF2
1167#define WMA_V10PRO 0x00010BF3
1168#define WMA_V9 0x00010BF4
1169#define AMR_WB_PLUS 0x00010BF5
1170#define AC3_DECODER 0x00010BF6
Santosh Mardi23321202012-03-22 04:33:25 +05301171#define EAC3_DECODER 0x00010C3C
1172#define DTS 0x00010D88
Srikanth Uyyala66f781a2012-06-13 23:23:25 +05301173#define DTS_LBR 0x00010DBB
Santosh Mardi23321202012-03-22 04:33:25 +05301174#define ATRAC 0x00010D89
1175#define MAT 0x00010D8A
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176#define G711_ALAW_FS 0x00010BF7
1177#define G711_MLAW_FS 0x00010BF8
1178#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001179#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +02001180#define US_POINT_EPOS_FORMAT 0x00012310
1181#define US_RAW_FORMAT 0x0001127C
Kiran Kandi5e809b02012-01-31 00:24:33 -08001182#define MULTI_CHANNEL_PCM 0x00010C66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001183
1184#define ASM_ENCDEC_SBCRATE 0x00010C13
1185#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1186#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1187
1188#define ASM_ENCDEC_SBCRATE 0x00010C13
1189#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1190#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1191
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001192#define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
1193struct asm_stream_cmd_open_read_compressed {
1194 struct apr_hdr hdr;
1195 u32 uMode;
1196 u32 frame_per_buf;
1197} __packed;
1198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001199#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001200#define ASM_STREAM_CMD_OPEN_WRITE_V2_1 0x00010DB1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001201struct asm_stream_cmd_open_write {
1202 struct apr_hdr hdr;
1203 u32 uMode;
1204 u16 sink_endpoint;
1205 u16 stream_handle;
1206 u32 post_proc_top;
1207 u32 format;
1208} __attribute__((packed));
1209
Santosh Mardi23321202012-03-22 04:33:25 +05301210#define IEC_61937_MASK 0x00000001
1211#define IEC_60958_MASK 0x00000002
1212
1213#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
1214struct asm_stream_cmd_open_write_compressed {
1215 struct apr_hdr hdr;
1216 u32 flags;
1217 u32 format;
1218} __packed;
1219
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001220#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
1221
1222struct asm_stream_cmd_open_read_write {
1223 struct apr_hdr hdr;
1224 u32 uMode;
1225 u32 post_proc_top;
1226 u32 write_format;
1227 u32 read_format;
1228} __attribute__((packed));
1229
Laxminath Kasam20824502013-01-07 14:33:56 +05301230#define ASM_STREAM_CMD_OPEN_LOOPBACK 0x00010D6E
1231struct asm_stream_cmd_open_loopback {
1232 struct apr_hdr hdr;
1233 u32 mode_flags;
1234/* Mode flags.
1235 * Bit 0-31: reserved; client should set these bits to 0
1236 */
1237 u16 src_endpointype;
1238 /* Endpoint type. 0 = Tx Matrix */
1239 u16 sink_endpointype;
1240 /* Endpoint type. 0 = Rx Matrix */
1241 u32 postprocopo_id;
1242/* Postprocessor topology ID. Specifies the topology of
1243 * postprocessing algorithms.
1244 */
1245} __packed;
1246
Santosh Mardi23321202012-03-22 04:33:25 +05301247#define ADM_CMD_CONNECT_AFE_PORT 0x00010320
Santosh Mardid1760792012-06-12 16:23:19 +05301248#define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321
Santosh Mardi23321202012-03-22 04:33:25 +05301249
1250struct adm_cmd_connect_afe_port {
1251 struct apr_hdr hdr;
1252 u8 mode; /*mode represent the interface is for RX or TX*/
1253 u8 session_id; /*ASM session ID*/
1254 u16 afe_port_id;
1255} __packed;
1256
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001257#define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332
1258
1259struct adm_cmd_connect_afe_port_v2 {
1260 struct apr_hdr hdr;
1261 u8 mode; /*mode represent the interface is for RX or TX*/
1262 u8 session_id; /*ASM session ID*/
1263 u16 afe_port_id;
1264 u32 num_channels;
1265 u32 sampleing_rate;
1266} __packed;
1267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001268#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
1269#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
1270#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
1271#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001272#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001273struct asm_stream_cmd_encdec_cfg_blk{
1274 struct apr_hdr hdr;
1275 u32 param_id;
1276 u32 param_size;
1277 struct asm_encode_cfg_blk enc_blk;
1278} __attribute__((packed));
1279
1280struct asm_stream_cmd_encdec_sbc_bitrate{
1281 struct apr_hdr hdr;
1282 u32 param_id;
1283 struct asm_sbc_bitrate sbc_bitrate;
1284} __attribute__((packed));
1285
1286struct asm_stream_cmd_encdec_immed_decode{
1287 struct apr_hdr hdr;
1288 u32 param_id;
1289 u32 param_size;
1290 struct asm_immed_decode dec;
1291} __attribute__((packed));
1292
1293struct asm_stream_cmd_encdec_sbr{
1294 struct apr_hdr hdr;
1295 u32 param_id;
1296 u32 param_size;
1297 struct asm_sbr_ps sbr_ps;
1298} __attribute__((packed));
1299
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001300struct asm_stream_cmd_encdec_dualmono {
1301 struct apr_hdr hdr;
1302 u32 param_id;
1303 u32 param_size;
1304 struct asm_dual_mono channel_map;
1305} __packed;
1306
Amal Paul6e0f7982013-02-21 19:36:35 -08001307#define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG 0x00010DD8
1308
1309/* Structure for AAC decoder stereo coefficient setting. */
1310
1311struct asm_aac_stereo_mix_coeff_selection_param {
1312 struct apr_hdr hdr;
1313 u32 param_id;
1314 u32 param_size;
1315 u32 aac_stereo_mix_coeff_flag;
1316} __packed;
1317
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001318#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
1319struct asm_stream_cmd_encdec_channelmap {
1320 struct apr_hdr hdr;
1321 u32 param_id;
1322 u32 param_size;
1323 struct asm_dec_chan_map chan_map;
1324} __packed;
1325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
1327struct asm_stream_cmd_adjust_samples{
1328 struct apr_hdr hdr;
1329 u16 nsamples;
1330 u16 reserved;
1331} __attribute__((packed));
1332
1333#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
1334struct asm_stream_cmd_tap_popp_pcm{
1335 struct apr_hdr hdr;
1336 u16 enable;
1337 u16 reserved;
1338 u32 module_id;
1339} __attribute__((packed));
1340
1341/* Session Level commands */
1342#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
1343struct asm_stream_cmd_memory_map{
1344 struct apr_hdr hdr;
1345 u32 buf_add;
1346 u32 buf_size;
1347 u16 mempool_id;
1348 u16 reserved;
1349} __attribute__((packed));
1350
1351#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
1352struct asm_stream_cmd_memory_unmap{
1353 struct apr_hdr hdr;
1354 u32 buf_add;
1355} __attribute__((packed));
1356
1357#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
1358struct asm_memory_map_regions{
1359 u32 phys;
1360 u32 buf_size;
1361} __attribute__((packed));
1362
1363struct asm_stream_cmd_memory_map_regions{
1364 struct apr_hdr hdr;
1365 u16 mempool_id;
1366 u16 nregions;
1367} __attribute__((packed));
1368
1369#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
1370struct asm_memory_unmap_regions{
1371 u32 phys;
1372} __attribute__((packed));
1373
1374struct asm_stream_cmd_memory_unmap_regions{
1375 struct apr_hdr hdr;
1376 u16 nregions;
1377 u16 reserved;
1378} __attribute__((packed));
1379
1380#define ASM_SESSION_CMD_RUN 0x00010BD2
1381struct asm_stream_cmd_run{
1382 struct apr_hdr hdr;
1383 u32 flags;
1384 u32 msw_ts;
1385 u32 lsw_ts;
1386} __attribute__((packed));
1387
1388/* Session level events */
1389#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1390struct asm_stream_cmd_reg_rx_underflow_event{
1391 struct apr_hdr hdr;
1392 u16 enable;
1393 u16 reserved;
1394} __attribute__((packed));
1395
1396#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1397struct asm_stream_cmd_reg_tx_overflow_event{
1398 struct apr_hdr hdr;
1399 u16 enable;
1400 u16 reserved;
1401} __attribute__((packed));
1402
1403/* Data Path commands */
1404#define ASM_DATA_CMD_WRITE 0x00010BD9
1405struct asm_stream_cmd_write{
1406 struct apr_hdr hdr;
1407 u32 buf_add;
1408 u32 avail_bytes;
1409 u32 uid;
1410 u32 msw_ts;
1411 u32 lsw_ts;
1412 u32 uflags;
1413} __attribute__((packed));
1414
1415#define ASM_DATA_CMD_READ 0x00010BDA
1416struct asm_stream_cmd_read{
1417 struct apr_hdr hdr;
1418 u32 buf_add;
1419 u32 buf_size;
1420 u32 uid;
1421} __attribute__((packed));
1422
Subhash Chandra Bose Naripeddy418393f2012-08-17 17:00:25 -07001423#define ASM_DATA_CMD_READ_COMPRESSED 0x00010DBF
Subhash Chandra Bose Naripeddy694b7d92012-06-20 20:46:13 -07001424struct asm_stream_cmd_read_compressed {
1425 struct apr_hdr hdr;
1426 u32 buf_add;
1427 u32 buf_size;
1428 u32 uid;
1429} __packed;
1430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301432#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433struct asm_stream_media_format_update{
1434 struct apr_hdr hdr;
1435 u32 format;
1436 u32 cfg_size;
1437 union {
1438 struct asm_pcm_cfg pcm_cfg;
1439 struct asm_adpcm_cfg adpcm_cfg;
1440 struct asm_yadpcm_cfg yadpcm_cfg;
1441 struct asm_midi_cfg midi_cfg;
1442 struct asm_wma_cfg wma_cfg;
1443 struct asm_wmapro_cfg wmapro_cfg;
1444 struct asm_aac_cfg aac_cfg;
1445 struct asm_flac_cfg flac_cfg;
1446 struct asm_vorbis_cfg vorbis_cfg;
Kiran Kandi5e809b02012-01-31 00:24:33 -08001447 struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
Ajit Khare43fd8832012-08-07 13:19:44 -07001448 struct asm_amrwbplus_cfg amrwbplus_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449 } __attribute__((packed)) write_cfg;
1450} __attribute__((packed));
1451
1452
1453/* Command Responses */
1454#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1455struct asm_stream_cmdrsp_get_readwrite_param{
1456 struct apr_hdr hdr;
1457 u32 status;
1458 u32 param_id;
1459 u16 param_size;
1460 u16 padding;
1461 union {
1462 struct asm_sbc_bitrate sbc_bitrate;
1463 struct asm_immed_decode aac_dec;
1464 } __attribute__((packed)) read_write_cfg;
1465} __attribute__((packed));
1466
1467
1468#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1469struct asm_stream_cmdrsp_get_session_time{
1470 struct apr_hdr hdr;
1471 u32 status;
1472 u32 msw_ts;
1473 u32 lsw_ts;
1474} __attribute__((packed));
1475
1476#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1477struct asm_data_event_write_done{
1478 u32 buf_add;
1479 u32 status;
1480} __attribute__((packed));
1481
1482#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1483struct asm_data_event_read_done{
1484 u32 status;
1485 u32 buffer_add;
1486 u32 enc_frame_size;
1487 u32 offset;
1488 u32 msw_ts;
1489 u32 lsw_ts;
1490 u32 flags;
1491 u32 num_frames;
1492 u32 id;
1493} __attribute__((packed));
1494
Subhash Chandra Bose Naripeddy418393f2012-08-17 17:00:25 -07001495#define ASM_DATA_EVENT_READ_COMPRESSED_DONE 0x00010DC0
Subhash Chandra Bose Naripeddy694b7d92012-06-20 20:46:13 -07001496struct asm_data_event_read_compressed_done {
1497 u32 status;
1498 u32 buffer_add;
1499 u32 enc_frame_size;
1500 u32 offset;
1501 u32 msw_ts;
1502 u32 lsw_ts;
1503 u32 flags;
1504 u32 num_frames;
1505 u32 id;
1506} __packed;
1507
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1509struct asm_data_event_sr_cm_change_notify {
1510 u32 sample_rate;
1511 u16 no_of_channels;
1512 u16 reserved;
1513 u8 channel_map[8];
1514} __packed;
1515
1516/* service level events */
1517
1518#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1519struct asm_svc_cmdrsp_get_strm_handles{
1520 struct apr_hdr hdr;
1521 u32 num_handles;
1522 u32 stream_handles;
1523} __attribute__((packed));
1524
1525
1526#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1527struct asm_svc_cmdrsp_get_wallclock_time{
1528 struct apr_hdr hdr;
1529 u32 status;
1530 u32 msw_ts;
1531 u32 lsw_ts;
1532} __attribute__((packed));
1533
1534/*
1535 * Error code
1536*/
1537#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1538#define ADSP_EFAILED 0x00000001 /* General failure. */
1539#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1540#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1541#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1542#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1543#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1544#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1545#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1546#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1547#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1548#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1549#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1550 processed. */
1551#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1552#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1553#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1554 to complete. */
1555#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1556 intervention to complete. */
1557#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1558#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1559
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -07001560/* SRS TRUMEDIA start */
1561#define SRS_ID_GLOBAL 0x00000001
1562#define SRS_ID_WOWHD 0x00000002
1563#define SRS_ID_CSHP 0x00000003
1564#define SRS_ID_HPF 0x00000004
1565#define SRS_ID_PEQ 0x00000005
1566#define SRS_ID_HL 0x00000006
1567
1568#define SRS_CMD_UPLOAD 0x7FFF0000
1569#define SRS_PARAM_INDEX_MASK 0x80000000
1570#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
1571#define SRS_PARAM_VALUE_MASK 0x0000FFFF
1572
1573struct srs_trumedia_params_GLOBAL {
1574 uint8_t v1;
1575 uint8_t v2;
1576 uint8_t v3;
1577 uint8_t v4;
1578 uint8_t v5;
1579 uint8_t v6;
1580 uint8_t v7;
1581 uint8_t v8;
1582} __packed;
1583
1584struct srs_trumedia_params_WOWHD {
1585 uint32_t v1;
1586 uint16_t v2;
1587 uint16_t v3;
1588 uint16_t v4;
1589 uint16_t v5;
1590 uint16_t v6;
1591 uint16_t v7;
1592 uint16_t v8;
1593 uint16_t v____A1;
1594 uint32_t v9;
1595 uint16_t v10;
1596 uint16_t v11;
1597 uint32_t v12[16];
1598} __packed;
1599
1600struct srs_trumedia_params_CSHP {
1601 uint32_t v1;
1602 uint16_t v2;
1603 uint16_t v3;
1604 uint16_t v4;
1605 uint16_t v5;
1606 uint16_t v6;
1607 uint16_t v____A1;
1608 uint32_t v7;
1609 uint16_t v8;
1610 uint16_t v9;
1611 uint32_t v10[16];
1612} __packed;
1613
1614struct srs_trumedia_params_HPF {
1615 uint32_t v1;
1616 uint32_t v2[26];
1617} __packed;
1618
1619struct srs_trumedia_params_PEQ {
1620 uint32_t v1;
1621 uint16_t v2;
1622 uint16_t v3;
1623 uint16_t v4;
1624 uint16_t v____A1;
1625 uint32_t v5[26];
1626 uint32_t v6[26];
1627} __packed;
1628
1629struct srs_trumedia_params_HL {
1630 uint16_t v1;
1631 uint16_t v2;
1632 uint16_t v3;
1633 uint16_t v____A1;
1634 int32_t v4;
1635 uint32_t v5;
1636 uint16_t v6;
1637 uint16_t v____A2;
1638 uint32_t v7;
1639} __packed;
1640
1641struct srs_trumedia_params {
1642 struct srs_trumedia_params_GLOBAL global;
1643 struct srs_trumedia_params_WOWHD wowhd;
1644 struct srs_trumedia_params_CSHP cshp;
1645 struct srs_trumedia_params_HPF hpf;
1646 struct srs_trumedia_params_PEQ peq;
1647 struct srs_trumedia_params_HL hl;
1648} __packed;
1649int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params);
1650/* SRS TruMedia end */
1651
Laxminath Kasam20824502013-01-07 14:33:56 +05301652/* SRS Studio Sound 3D start */
1653#define SRS_ID_SS3D_GLOBAL 0x00000001
1654#define SRS_ID_SS3D_CTRL 0x00000002
1655#define SRS_ID_SS3D_FILTER 0x00000003
1656
1657struct srs_SS3D_params_GLOBAL {
1658 uint8_t v1;
1659 uint8_t v2;
1660 uint8_t v3;
1661 uint8_t v4;
1662 uint8_t v5;
1663 uint8_t v6;
1664 uint8_t v7;
1665 uint8_t v8;
1666} __packed;
1667
1668struct srs_SS3D_ctrl_params {
1669 uint8_t v[236];
1670} __packed;
1671
1672struct srs_SS3D_filter_params {
1673 uint8_t v[28 + 2752];
1674} __packed;
1675
1676struct srs_SS3D_params {
1677 struct srs_SS3D_params_GLOBAL global;
1678 struct srs_SS3D_ctrl_params ss3d;
1679 struct srs_SS3D_filter_params ss3d_f;
1680} __packed;
1681
1682int srs_ss3d_open(int port_id, int srs_tech_id, void *srs_params);
1683/* SRS Studio Sound 3D end */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684#endif /*_APR_AUDIO_H_*/