blob: 3b85d57e92ac921335453d5148d274fdff6f7b16 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 *
Ben Rombergerb7603232011-11-23 17:16:27 -08003 * Copyright (c) 2010-2012, Code Aurora Forum. 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
307union afe_port_config {
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800308 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700315} __attribute__((packed));
316
317struct 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
324struct 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
334struct afe_param_sidetone_gain {
335 u16 gain;
336 u16 reserved;
337} __attribute__ ((packed));
338
339#define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
340struct afe_param_sampling_rate {
341 u32 sampling_rate;
342} __attribute__ ((packed));
343
344
345#define AFE_PARAM_ID_CHANNELS 0x00010302
346struct afe_param_channels {
347 u16 channels;
348 u16 reserved;
349} __attribute__ ((packed));
350
351
352#define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
353struct afe_param_loopback_gain {
354 u16 gain;
355 u16 reserved;
356} __attribute__ ((packed));
357
Neema Shetty74131ac2012-05-09 13:35:26 -0700358/* 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*/
365enum {
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
378struct 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700401
402#define AFE_MODULE_ID_PORT_INFO 0x00010200
Neema Shetty74131ac2012-05-09 13:35:26 -0700403/* Module ID for the loopback-related parameters. */
404#define AFE_MODULE_LOOPBACK 0x00010205
Patrick Lai48da1492012-07-04 20:48:24 -0700405struct afe_param_payload_base {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700406 u32 module_id;
407 u32 param_id;
408 u16 param_size;
409 u16 reserved;
Patrick Lai48da1492012-07-04 20:48:24 -0700410} __packed;
411
412struct afe_param_payload {
413 struct afe_param_payload_base base;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414 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 Shetty74131ac2012-05-09 13:35:26 -0700419 struct afe_param_loopback_cfg loopback_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700420 } __attribute__((packed)) param;
421} __attribute__ ((packed));
422
423#define AFE_PORT_CMD_SET_PARAM 0x000100dc
424
425struct 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 Rombergerb7603232011-11-23 17:16:27 -0800433struct 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700439
440#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
441struct 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
448struct 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 Kasam32657ec2011-08-01 19:26:57 +0530458#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
459struct 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
468struct afe_cmd_memory_unmap {
469 struct apr_hdr hdr;
470 u32 phy_addr;
471} __packed;
472
473#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
474struct 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
481struct 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
488struct 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
497struct 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 Huntsman3f2bc4d2011-08-16 17:27:22 -0700507#define ADM_MAX_COPPS 5
508
509#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
510struct adm_get_copp_handles_command {
511 struct apr_hdr hdr;
512} __attribute__ ((packed));
513
514#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
515struct 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
521struct 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
530struct 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
540struct 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
549struct 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 Kandi5e809b02012-01-31 00:24:33 -0800563#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310
564struct adm_multi_ch_copp_open_command {
565 struct apr_hdr hdr;
566 u16 flags;
567 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
568 u16 endpoint_id1;
569 u16 endpoint_id2;
570 u32 topology_id;
571 u16 channel_config;
572 u16 reserved;
573 u32 rate;
574 u8 dev_channel_mapping[8];
575} __packed;
576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577#define ADM_CMD_MEMORY_MAP 0x00010C30
578struct 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
587struct 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
593struct adm_memory_map_regions{
594 u32 phys;
595 u32 buf_size;
596} __attribute__((packed));
597
598struct 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
605struct adm_memory_unmap_regions{
606 u32 phys;
607} __attribute__((packed));
608
609struct 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 Sangaraboina0fc197d2011-12-09 13:20:33 -0800619#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -0700621/* SRS TRUMEDIA GUIDS */
622/* topology */
623#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
624/* module */
625#define SRS_TRUMEDIA_MODULE_ID 0x10005010
626/* parameters */
627#define SRS_TRUMEDIA_PARAMS 0x10005011
628#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
629#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
630#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
631#define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015
632#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634#define ASM_MAX_EQ_BANDS 12
635
636struct asm_eq_band {
637 u32 band_idx; /* The band index, 0 .. 11 */
638 u32 filter_type; /* Filter band type */
639 u32 center_freq_hz; /* Filter band center frequency */
640 u32 filter_gain; /* Filter band initial gain (dB) */
641 /* Range is +12 dB to -12 dB with 1dB increments. */
642 u32 q_factor;
643} __attribute__ ((packed));
644
645struct asm_equalizer_params {
646 u32 enable;
647 u32 num_bands;
648 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
649} __attribute__ ((packed));
650
651struct asm_master_gain_params {
652 u16 master_gain;
653 u16 padding;
654} __attribute__ ((packed));
655
656struct asm_lrchannel_gain_params {
657 u16 left_gain;
658 u16 right_gain;
659} __attribute__ ((packed));
660
661struct asm_mute_params {
662 u32 muteflag;
663} __attribute__ ((packed));
664
665struct asm_softvolume_params {
666 u32 period;
667 u32 step;
668 u32 rampingcurve;
669} __attribute__ ((packed));
670
671struct asm_softpause_params {
672 u32 enable;
673 u32 period;
674 u32 step;
675 u32 rampingcurve;
676} __packed;
677
678struct asm_pp_param_data_hdr {
679 u32 module_id;
680 u32 param_id;
681 u16 param_size;
682 u16 reserved;
683} __attribute__ ((packed));
684
685struct asm_pp_params_command {
686 struct apr_hdr hdr;
687 u32 *payload;
688 u32 payload_size;
689 struct asm_pp_param_data_hdr params;
690} __attribute__ ((packed));
691
692#define EQUALIZER_MODULE_ID 0x00010c27
693#define EQUALIZER_PARAM_ID 0x00010c28
694
695#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
696#define MASTER_GAIN_PARAM_ID 0x00010bff
697#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
698#define MUTE_CONFIG_PARAM_ID 0x00010c01
699#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700700#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700701
702#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
703#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
704#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
705
706#define MBADRC_MODULE_ID 0x00010c06
707#define MBADRC_ENABLE_PARAM_ID 0x00010c07
708#define MBADRC_CONFIG_PARAM_ID 0x00010c08
709
710
711#define ADM_CMD_SET_PARAMS 0x00010306
712#define ADM_CMD_GET_PARAMS 0x0001030B
713#define ADM_CMDRSP_GET_PARAMS 0x0001030C
714struct adm_set_params_command {
715 struct apr_hdr hdr;
716 u32 payload;
717 u32 payload_size;
718} __attribute__ ((packed));
719
720
721#define ADM_CMD_TAP_COPP_PCM 0x00010307
722struct adm_tap_copp_pcm_command {
723 struct apr_hdr hdr;
724} __attribute__ ((packed));
725
726
727/* QDSP6 to Client messages
728*/
729#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
730struct adm_get_copp_handles_respond {
731 struct apr_hdr hdr;
732 u32 handles;
733 u32 copp_id;
734} __attribute__ ((packed));
735
736#define ADM_CMDRSP_COPP_OPEN 0x0001030A
737struct adm_copp_open_respond {
738 u32 status;
739 u16 copp_id;
740 u16 reserved;
741} __attribute__ ((packed));
742
Kiran Kandi5e809b02012-01-31 00:24:33 -0800743#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
744
745
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746#define ASM_STREAM_PRIORITY_NORMAL 0
747#define ASM_STREAM_PRIORITY_LOW 1
748#define ASM_STREAM_PRIORITY_HIGH 2
749#define ASM_STREAM_PRIORITY_RESERVED 3
750
751#define ASM_END_POINT_DEVICE_MATRIX 0
752#define ASM_END_POINT_STREAM 1
753
754#define AAC_ENC_MODE_AAC_LC 0x02
755#define AAC_ENC_MODE_AAC_P 0x05
756#define AAC_ENC_MODE_EAAC_P 0x1D
757
758#define ASM_STREAM_CMD_CLOSE 0x00010BCD
759#define ASM_STREAM_CMD_FLUSH 0x00010BCE
760#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
761#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
762#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
763#define ASM_SESSION_CMD_PAUSE 0x00010BD3
764#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
765#define ASM_DATA_CMD_EOS 0x00010BDB
766#define ASM_DATA_EVENT_EOS 0x00010BDD
767
768#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
769#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
770
771#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
772#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
773#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
774#define ASM_DATA_CMDRSP_EOS 0x00010C1C
775
776/* ASM Data structures */
777
778/* common declarations */
779struct asm_pcm_cfg {
780 u16 ch_cfg;
781 u16 bits_per_sample;
782 u32 sample_rate;
783 u16 is_signed;
784 u16 interleaved;
785};
786
Kiran Kandi5e809b02012-01-31 00:24:33 -0800787#define PCM_CHANNEL_NULL 0
788
789/* Front left channel. */
790#define PCM_CHANNEL_FL 1
791
792/* Front right channel. */
793#define PCM_CHANNEL_FR 2
794
795/* Front center channel. */
796#define PCM_CHANNEL_FC 3
797
798/* Left surround channel.*/
799#define PCM_CHANNEL_LS 4
800
801/* Right surround channel.*/
802#define PCM_CHANNEL_RS 5
803
804/* Low frequency effect channel. */
805#define PCM_CHANNEL_LFE 6
806
807/* Center surround channel; Rear center channel. */
808#define PCM_CHANNEL_CS 7
809
810/* Left back channel; Rear left channel. */
811#define PCM_CHANNEL_LB 8
812
813/* Right back channel; Rear right channel. */
814#define PCM_CHANNEL_RB 9
815
816/* Top surround channel. */
817#define PCM_CHANNEL_TS 10
818
819/* Center vertical height channel.*/
820#define PCM_CHANNEL_CVH 11
821
822/* Mono surround channel.*/
823#define PCM_CHANNEL_MS 12
824
825/* Front left of center. */
826#define PCM_CHANNEL_FLC 13
827
828/* Front right of center. */
829#define PCM_CHANNEL_FRC 14
830
831/* Rear left of center. */
832#define PCM_CHANNEL_RLC 15
833
834/* Rear right of center. */
835#define PCM_CHANNEL_RRC 16
836
837#define PCM_FORMAT_MAX_NUM_CHANNEL 8
838
Swaminathan Sathappan6f530882012-05-01 16:42:22 -0700839/* Maximum number of channels supported
840 * in ASM_ENCDEC_DEC_CHAN_MAP command
841 */
842#define MAX_CHAN_MAP_CHANNELS 16
Kiran Kandi5e809b02012-01-31 00:24:33 -0800843/*
844 * Multiple-channel PCM decoder format block structure used in the
845 * #ASM_STREAM_CMD_OPEN_WRITE command.
846 * The data must be in little-endian format.
847 */
848struct asm_multi_channel_pcm_fmt_blk {
849
850 u16 num_channels; /*
851 * Number of channels.
852 * Supported values:1 to 8
853 */
854
855 u16 bits_per_sample; /*
856 * Number of bits per sample per channel.
857 * Supported values: 16, 24 When used for
858 * playback, the client must send 24-bit
859 * samples packed in 32-bit words. The
860 * 24-bit samples must be placed in the most
861 * significant 24 bits of the 32-bit word. When
862 * used for recording, the aDSP sends 24-bit
863 * samples packed in 32-bit words. The 24-bit
864 * samples are placed in the most significant
865 * 24 bits of the 32-bit word.
866 */
867
868 u32 sample_rate; /*
869 * Number of samples per second
870 * (in Hertz). Supported values:
871 * 2000 to 48000
872 */
873
874 u16 is_signed; /*
875 * Flag that indicates the samples
876 * are signed (1).
877 */
878
879 u16 is_interleaved; /*
880 * Flag that indicates whether the channels are
881 * de-interleaved (0) or interleaved (1).
882 * Interleaved format means corresponding
883 * samples from the left and right channels are
884 * interleaved within the buffer.
885 * De-interleaved format means samples from
886 * each channel are contiguous in the buffer.
887 * The samples from one channel immediately
888 * follow those of the previous channel.
889 */
890
891 u8 channel_mapping[8]; /*
892 * Supported values:
893 * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
894 * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
895 * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
896 * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
897 * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
898 * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
899 * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
900 * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
901 * PCM_CHANNEL_RRC.
902 * Channel[i] mapping describes channel I. Each
903 * element i of the array describes channel I
904 * inside the buffer where I < num_channels.
905 * An unused channel is set to zero.
906 */
907};
908
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909struct asm_adpcm_cfg {
910 u16 ch_cfg;
911 u16 bits_per_sample;
912 u32 sample_rate;
913 u32 block_size;
914};
915
916struct asm_yadpcm_cfg {
917 u16 ch_cfg;
918 u16 bits_per_sample;
919 u32 sample_rate;
920};
921
922struct asm_midi_cfg {
923 u32 nMode;
924};
925
926struct asm_wma_cfg {
927 u16 format_tag;
928 u16 ch_cfg;
929 u32 sample_rate;
930 u32 avg_bytes_per_sec;
931 u16 block_align;
932 u16 valid_bits_per_sample;
933 u32 ch_mask;
934 u16 encode_opt;
935 u16 adv_encode_opt;
936 u32 adv_encode_opt2;
937 u32 drc_peak_ref;
938 u32 drc_peak_target;
939 u32 drc_ave_ref;
940 u32 drc_ave_target;
941};
942
943struct asm_wmapro_cfg {
944 u16 format_tag;
945 u16 ch_cfg;
946 u32 sample_rate;
947 u32 avg_bytes_per_sec;
948 u16 block_align;
949 u16 valid_bits_per_sample;
950 u32 ch_mask;
951 u16 encode_opt;
952 u16 adv_encode_opt;
953 u32 adv_encode_opt2;
954 u32 drc_peak_ref;
955 u32 drc_peak_target;
956 u32 drc_ave_ref;
957 u32 drc_ave_target;
958};
959
960struct asm_aac_cfg {
961 u16 format;
962 u16 aot;
963 u16 ep_config;
964 u16 section_data_resilience;
965 u16 scalefactor_data_resilience;
966 u16 spectral_data_resilience;
967 u16 ch_cfg;
968 u16 reserved;
969 u32 sample_rate;
970};
971
972struct asm_flac_cfg {
973 u16 stream_info_present;
974 u16 min_blk_size;
975 u16 max_blk_size;
976 u16 ch_cfg;
977 u16 sample_size;
978 u16 sample_rate;
979 u16 md5_sum;
980 u32 ext_sample_rate;
981 u32 min_frame_size;
982 u32 max_frame_size;
983};
984
985struct asm_vorbis_cfg {
986 u32 ch_cfg;
987 u32 bit_rate;
988 u32 min_bit_rate;
989 u32 max_bit_rate;
990 u16 bit_depth_pcm_sample;
991 u16 bit_stream_format;
992};
993
994struct asm_aac_read_cfg {
995 u32 bitrate;
996 u32 enc_mode;
997 u16 format;
998 u16 ch_cfg;
999 u32 sample_rate;
1000};
1001
1002struct asm_amrnb_read_cfg {
1003 u16 mode;
1004 u16 dtx_mode;
1005};
1006
Alex Wong2caeecc2011-10-28 10:52:15 +05301007struct asm_amrwb_read_cfg {
1008 u16 mode;
1009 u16 dtx_mode;
1010};
1011
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012struct asm_evrc_read_cfg {
1013 u16 max_rate;
1014 u16 min_rate;
1015 u16 rate_modulation_cmd;
1016 u16 reserved;
1017};
1018
1019struct asm_qcelp13_read_cfg {
1020 u16 max_rate;
1021 u16 min_rate;
1022 u16 reduced_rate_level;
1023 u16 rate_modulation_cmd;
1024};
1025
1026struct asm_sbc_read_cfg {
1027 u32 subband;
1028 u32 block_len;
1029 u32 ch_mode;
1030 u32 alloc_method;
1031 u32 bit_rate;
1032 u32 sample_rate;
1033};
1034
1035struct asm_sbc_bitrate {
1036 u32 bitrate;
1037};
1038
1039struct asm_immed_decode {
1040 u32 mode;
1041};
1042
1043struct asm_sbr_ps {
1044 u32 enable;
1045};
1046
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001047struct asm_dual_mono {
1048 u16 sce_left;
1049 u16 sce_right;
1050};
1051
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001052struct asm_dec_chan_map {
1053 u32 num_channels; /* Number of decoder output
1054 * channels. A value of 0
1055 * indicates native channel
1056 * mapping, which is valid
1057 * only for NT mode. This
1058 * means the output of the
1059 * decoder is to be preserved
1060 * as is.
1061 */
1062
1063 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
1064 * num_channels. It can grow
1065 * till MAX_CHAN_MAP_CHANNELS.
1066 * Channel[i] mapping
1067 * describes channel I inside
1068 * the decoder output buffer.
1069 * Valid channel mapping
1070 * values are to be present at
1071 * the beginning of the array.
1072 * All remaining elements of
1073 * the array are to be filled
1074 * with PCM_CHANNEL_NULL.
1075 */
1076};
1077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078struct asm_encode_cfg_blk {
1079 u32 frames_per_buf;
1080 u32 format_id;
1081 u32 cfg_size;
1082 union {
1083 struct asm_pcm_cfg pcm;
1084 struct asm_aac_read_cfg aac;
1085 struct asm_amrnb_read_cfg amrnb;
1086 struct asm_evrc_read_cfg evrc;
1087 struct asm_qcelp13_read_cfg qcelp13;
1088 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +05301089 struct asm_amrwb_read_cfg amrwb;
Mingming Yin647e9ea2012-03-17 19:56:10 -07001090 struct asm_multi_channel_pcm_fmt_blk mpcm;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 } __attribute__((packed)) cfg;
1092};
1093
1094struct asm_frame_meta_info {
1095 u32 offset_to_frame;
1096 u32 frame_size;
1097 u32 encoded_pcm_samples;
1098 u32 msw_ts;
1099 u32 lsw_ts;
1100 u32 nflags;
1101};
1102
1103/* Stream level commands */
1104#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
1105struct asm_stream_cmd_open_read {
1106 struct apr_hdr hdr;
1107 u32 uMode;
1108 u32 src_endpoint;
1109 u32 pre_proc_top;
1110 u32 format;
1111} __attribute__((packed));
1112
1113/* Supported formats */
1114#define LINEAR_PCM 0x00010BE5
1115#define DTMF 0x00010BE6
1116#define ADPCM 0x00010BE7
1117#define YADPCM 0x00010BE8
1118#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001119#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001120#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +05301121#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001122#define V13K_FS 0x00010BED
1123#define EVRC_FS 0x00010BEE
1124#define EVRCB_FS 0x00010BEF
1125#define EVRCWB_FS 0x00010BF0
1126#define MIDI 0x00010BF1
1127#define SBC 0x00010BF2
1128#define WMA_V10PRO 0x00010BF3
1129#define WMA_V9 0x00010BF4
1130#define AMR_WB_PLUS 0x00010BF5
1131#define AC3_DECODER 0x00010BF6
Santosh Mardi23321202012-03-22 04:33:25 +05301132#define EAC3_DECODER 0x00010C3C
1133#define DTS 0x00010D88
Srikanth Uyyala66f781a2012-06-13 23:23:25 +05301134#define DTS_LBR 0x00010DBB
Santosh Mardi23321202012-03-22 04:33:25 +05301135#define ATRAC 0x00010D89
1136#define MAT 0x00010D8A
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001137#define G711_ALAW_FS 0x00010BF7
1138#define G711_MLAW_FS 0x00010BF8
1139#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001140#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +02001141#define US_POINT_EPOS_FORMAT 0x00012310
1142#define US_RAW_FORMAT 0x0001127C
Kiran Kandi5e809b02012-01-31 00:24:33 -08001143#define MULTI_CHANNEL_PCM 0x00010C66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001144
1145#define ASM_ENCDEC_SBCRATE 0x00010C13
1146#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1147#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1148
1149#define ASM_ENCDEC_SBCRATE 0x00010C13
1150#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1151#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1152
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001153#define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
1154struct asm_stream_cmd_open_read_compressed {
1155 struct apr_hdr hdr;
1156 u32 uMode;
1157 u32 frame_per_buf;
1158} __packed;
1159
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001160#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
1161struct asm_stream_cmd_open_write {
1162 struct apr_hdr hdr;
1163 u32 uMode;
1164 u16 sink_endpoint;
1165 u16 stream_handle;
1166 u32 post_proc_top;
1167 u32 format;
1168} __attribute__((packed));
1169
Santosh Mardi23321202012-03-22 04:33:25 +05301170#define IEC_61937_MASK 0x00000001
1171#define IEC_60958_MASK 0x00000002
1172
1173#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
1174struct asm_stream_cmd_open_write_compressed {
1175 struct apr_hdr hdr;
1176 u32 flags;
1177 u32 format;
1178} __packed;
1179
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001180#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
1181
1182struct asm_stream_cmd_open_read_write {
1183 struct apr_hdr hdr;
1184 u32 uMode;
1185 u32 post_proc_top;
1186 u32 write_format;
1187 u32 read_format;
1188} __attribute__((packed));
1189
Santosh Mardi23321202012-03-22 04:33:25 +05301190#define ADM_CMD_CONNECT_AFE_PORT 0x00010320
Santosh Mardid1760792012-06-12 16:23:19 +05301191#define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321
Santosh Mardi23321202012-03-22 04:33:25 +05301192
1193struct adm_cmd_connect_afe_port {
1194 struct apr_hdr hdr;
1195 u8 mode; /*mode represent the interface is for RX or TX*/
1196 u8 session_id; /*ASM session ID*/
1197 u16 afe_port_id;
1198} __packed;
1199
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001200#define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332
1201
1202struct adm_cmd_connect_afe_port_v2 {
1203 struct apr_hdr hdr;
1204 u8 mode; /*mode represent the interface is for RX or TX*/
1205 u8 session_id; /*ASM session ID*/
1206 u16 afe_port_id;
1207 u32 num_channels;
1208 u32 sampleing_rate;
1209} __packed;
1210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001211#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
1212#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
1213#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
1214#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001215#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001216struct asm_stream_cmd_encdec_cfg_blk{
1217 struct apr_hdr hdr;
1218 u32 param_id;
1219 u32 param_size;
1220 struct asm_encode_cfg_blk enc_blk;
1221} __attribute__((packed));
1222
1223struct asm_stream_cmd_encdec_sbc_bitrate{
1224 struct apr_hdr hdr;
1225 u32 param_id;
1226 struct asm_sbc_bitrate sbc_bitrate;
1227} __attribute__((packed));
1228
1229struct asm_stream_cmd_encdec_immed_decode{
1230 struct apr_hdr hdr;
1231 u32 param_id;
1232 u32 param_size;
1233 struct asm_immed_decode dec;
1234} __attribute__((packed));
1235
1236struct asm_stream_cmd_encdec_sbr{
1237 struct apr_hdr hdr;
1238 u32 param_id;
1239 u32 param_size;
1240 struct asm_sbr_ps sbr_ps;
1241} __attribute__((packed));
1242
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001243struct asm_stream_cmd_encdec_dualmono {
1244 struct apr_hdr hdr;
1245 u32 param_id;
1246 u32 param_size;
1247 struct asm_dual_mono channel_map;
1248} __packed;
1249
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001250#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
1251struct asm_stream_cmd_encdec_channelmap {
1252 struct apr_hdr hdr;
1253 u32 param_id;
1254 u32 param_size;
1255 struct asm_dec_chan_map chan_map;
1256} __packed;
1257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
1259struct asm_stream_cmd_adjust_samples{
1260 struct apr_hdr hdr;
1261 u16 nsamples;
1262 u16 reserved;
1263} __attribute__((packed));
1264
1265#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
1266struct asm_stream_cmd_tap_popp_pcm{
1267 struct apr_hdr hdr;
1268 u16 enable;
1269 u16 reserved;
1270 u32 module_id;
1271} __attribute__((packed));
1272
1273/* Session Level commands */
1274#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
1275struct asm_stream_cmd_memory_map{
1276 struct apr_hdr hdr;
1277 u32 buf_add;
1278 u32 buf_size;
1279 u16 mempool_id;
1280 u16 reserved;
1281} __attribute__((packed));
1282
1283#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
1284struct asm_stream_cmd_memory_unmap{
1285 struct apr_hdr hdr;
1286 u32 buf_add;
1287} __attribute__((packed));
1288
1289#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
1290struct asm_memory_map_regions{
1291 u32 phys;
1292 u32 buf_size;
1293} __attribute__((packed));
1294
1295struct asm_stream_cmd_memory_map_regions{
1296 struct apr_hdr hdr;
1297 u16 mempool_id;
1298 u16 nregions;
1299} __attribute__((packed));
1300
1301#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
1302struct asm_memory_unmap_regions{
1303 u32 phys;
1304} __attribute__((packed));
1305
1306struct asm_stream_cmd_memory_unmap_regions{
1307 struct apr_hdr hdr;
1308 u16 nregions;
1309 u16 reserved;
1310} __attribute__((packed));
1311
1312#define ASM_SESSION_CMD_RUN 0x00010BD2
1313struct asm_stream_cmd_run{
1314 struct apr_hdr hdr;
1315 u32 flags;
1316 u32 msw_ts;
1317 u32 lsw_ts;
1318} __attribute__((packed));
1319
1320/* Session level events */
1321#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1322struct asm_stream_cmd_reg_rx_underflow_event{
1323 struct apr_hdr hdr;
1324 u16 enable;
1325 u16 reserved;
1326} __attribute__((packed));
1327
1328#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1329struct asm_stream_cmd_reg_tx_overflow_event{
1330 struct apr_hdr hdr;
1331 u16 enable;
1332 u16 reserved;
1333} __attribute__((packed));
1334
1335/* Data Path commands */
1336#define ASM_DATA_CMD_WRITE 0x00010BD9
1337struct asm_stream_cmd_write{
1338 struct apr_hdr hdr;
1339 u32 buf_add;
1340 u32 avail_bytes;
1341 u32 uid;
1342 u32 msw_ts;
1343 u32 lsw_ts;
1344 u32 uflags;
1345} __attribute__((packed));
1346
1347#define ASM_DATA_CMD_READ 0x00010BDA
1348struct asm_stream_cmd_read{
1349 struct apr_hdr hdr;
1350 u32 buf_add;
1351 u32 buf_size;
1352 u32 uid;
1353} __attribute__((packed));
1354
1355#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301356#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357struct asm_stream_media_format_update{
1358 struct apr_hdr hdr;
1359 u32 format;
1360 u32 cfg_size;
1361 union {
1362 struct asm_pcm_cfg pcm_cfg;
1363 struct asm_adpcm_cfg adpcm_cfg;
1364 struct asm_yadpcm_cfg yadpcm_cfg;
1365 struct asm_midi_cfg midi_cfg;
1366 struct asm_wma_cfg wma_cfg;
1367 struct asm_wmapro_cfg wmapro_cfg;
1368 struct asm_aac_cfg aac_cfg;
1369 struct asm_flac_cfg flac_cfg;
1370 struct asm_vorbis_cfg vorbis_cfg;
Kiran Kandi5e809b02012-01-31 00:24:33 -08001371 struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372 } __attribute__((packed)) write_cfg;
1373} __attribute__((packed));
1374
1375
1376/* Command Responses */
1377#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1378struct asm_stream_cmdrsp_get_readwrite_param{
1379 struct apr_hdr hdr;
1380 u32 status;
1381 u32 param_id;
1382 u16 param_size;
1383 u16 padding;
1384 union {
1385 struct asm_sbc_bitrate sbc_bitrate;
1386 struct asm_immed_decode aac_dec;
1387 } __attribute__((packed)) read_write_cfg;
1388} __attribute__((packed));
1389
1390
1391#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1392struct asm_stream_cmdrsp_get_session_time{
1393 struct apr_hdr hdr;
1394 u32 status;
1395 u32 msw_ts;
1396 u32 lsw_ts;
1397} __attribute__((packed));
1398
1399#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1400struct asm_data_event_write_done{
1401 u32 buf_add;
1402 u32 status;
1403} __attribute__((packed));
1404
1405#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1406struct asm_data_event_read_done{
1407 u32 status;
1408 u32 buffer_add;
1409 u32 enc_frame_size;
1410 u32 offset;
1411 u32 msw_ts;
1412 u32 lsw_ts;
1413 u32 flags;
1414 u32 num_frames;
1415 u32 id;
1416} __attribute__((packed));
1417
1418#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1419struct asm_data_event_sr_cm_change_notify {
1420 u32 sample_rate;
1421 u16 no_of_channels;
1422 u16 reserved;
1423 u8 channel_map[8];
1424} __packed;
1425
1426/* service level events */
1427
1428#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1429struct asm_svc_cmdrsp_get_strm_handles{
1430 struct apr_hdr hdr;
1431 u32 num_handles;
1432 u32 stream_handles;
1433} __attribute__((packed));
1434
1435
1436#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1437struct asm_svc_cmdrsp_get_wallclock_time{
1438 struct apr_hdr hdr;
1439 u32 status;
1440 u32 msw_ts;
1441 u32 lsw_ts;
1442} __attribute__((packed));
1443
1444/*
1445 * Error code
1446*/
1447#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1448#define ADSP_EFAILED 0x00000001 /* General failure. */
1449#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1450#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1451#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1452#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1453#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1454#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1455#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1456#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1457#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1458#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1459#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1460 processed. */
1461#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1462#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1463#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1464 to complete. */
1465#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1466 intervention to complete. */
1467#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1468#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1469
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -07001470/* SRS TRUMEDIA start */
1471#define SRS_ID_GLOBAL 0x00000001
1472#define SRS_ID_WOWHD 0x00000002
1473#define SRS_ID_CSHP 0x00000003
1474#define SRS_ID_HPF 0x00000004
1475#define SRS_ID_PEQ 0x00000005
1476#define SRS_ID_HL 0x00000006
1477
1478#define SRS_CMD_UPLOAD 0x7FFF0000
1479#define SRS_PARAM_INDEX_MASK 0x80000000
1480#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
1481#define SRS_PARAM_VALUE_MASK 0x0000FFFF
1482
1483struct srs_trumedia_params_GLOBAL {
1484 uint8_t v1;
1485 uint8_t v2;
1486 uint8_t v3;
1487 uint8_t v4;
1488 uint8_t v5;
1489 uint8_t v6;
1490 uint8_t v7;
1491 uint8_t v8;
1492} __packed;
1493
1494struct srs_trumedia_params_WOWHD {
1495 uint32_t v1;
1496 uint16_t v2;
1497 uint16_t v3;
1498 uint16_t v4;
1499 uint16_t v5;
1500 uint16_t v6;
1501 uint16_t v7;
1502 uint16_t v8;
1503 uint16_t v____A1;
1504 uint32_t v9;
1505 uint16_t v10;
1506 uint16_t v11;
1507 uint32_t v12[16];
1508} __packed;
1509
1510struct srs_trumedia_params_CSHP {
1511 uint32_t v1;
1512 uint16_t v2;
1513 uint16_t v3;
1514 uint16_t v4;
1515 uint16_t v5;
1516 uint16_t v6;
1517 uint16_t v____A1;
1518 uint32_t v7;
1519 uint16_t v8;
1520 uint16_t v9;
1521 uint32_t v10[16];
1522} __packed;
1523
1524struct srs_trumedia_params_HPF {
1525 uint32_t v1;
1526 uint32_t v2[26];
1527} __packed;
1528
1529struct srs_trumedia_params_PEQ {
1530 uint32_t v1;
1531 uint16_t v2;
1532 uint16_t v3;
1533 uint16_t v4;
1534 uint16_t v____A1;
1535 uint32_t v5[26];
1536 uint32_t v6[26];
1537} __packed;
1538
1539struct srs_trumedia_params_HL {
1540 uint16_t v1;
1541 uint16_t v2;
1542 uint16_t v3;
1543 uint16_t v____A1;
1544 int32_t v4;
1545 uint32_t v5;
1546 uint16_t v6;
1547 uint16_t v____A2;
1548 uint32_t v7;
1549} __packed;
1550
1551struct srs_trumedia_params {
1552 struct srs_trumedia_params_GLOBAL global;
1553 struct srs_trumedia_params_WOWHD wowhd;
1554 struct srs_trumedia_params_CSHP cshp;
1555 struct srs_trumedia_params_HPF hpf;
1556 struct srs_trumedia_params_PEQ peq;
1557 struct srs_trumedia_params_HL hl;
1558} __packed;
1559int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params);
1560/* SRS TruMedia end */
1561
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001562#endif /*_APR_AUDIO_H_*/