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