blob: 134d044f277577b898d8dc3d25feed252583eb31 [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
614#define ASM_MAX_EQ_BANDS 12
615
616struct asm_eq_band {
617 u32 band_idx; /* The band index, 0 .. 11 */
618 u32 filter_type; /* Filter band type */
619 u32 center_freq_hz; /* Filter band center frequency */
620 u32 filter_gain; /* Filter band initial gain (dB) */
621 /* Range is +12 dB to -12 dB with 1dB increments. */
622 u32 q_factor;
623} __attribute__ ((packed));
624
625struct asm_equalizer_params {
626 u32 enable;
627 u32 num_bands;
628 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
629} __attribute__ ((packed));
630
631struct asm_master_gain_params {
632 u16 master_gain;
633 u16 padding;
634} __attribute__ ((packed));
635
636struct asm_lrchannel_gain_params {
637 u16 left_gain;
638 u16 right_gain;
639} __attribute__ ((packed));
640
641struct asm_mute_params {
642 u32 muteflag;
643} __attribute__ ((packed));
644
645struct asm_softvolume_params {
646 u32 period;
647 u32 step;
648 u32 rampingcurve;
649} __attribute__ ((packed));
650
651struct asm_softpause_params {
652 u32 enable;
653 u32 period;
654 u32 step;
655 u32 rampingcurve;
656} __packed;
657
658struct asm_pp_param_data_hdr {
659 u32 module_id;
660 u32 param_id;
661 u16 param_size;
662 u16 reserved;
663} __attribute__ ((packed));
664
665struct asm_pp_params_command {
666 struct apr_hdr hdr;
667 u32 *payload;
668 u32 payload_size;
669 struct asm_pp_param_data_hdr params;
670} __attribute__ ((packed));
671
672#define EQUALIZER_MODULE_ID 0x00010c27
673#define EQUALIZER_PARAM_ID 0x00010c28
674
675#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
676#define MASTER_GAIN_PARAM_ID 0x00010bff
677#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
678#define MUTE_CONFIG_PARAM_ID 0x00010c01
679#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700680#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681
682#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
683#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
684#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
685
686#define MBADRC_MODULE_ID 0x00010c06
687#define MBADRC_ENABLE_PARAM_ID 0x00010c07
688#define MBADRC_CONFIG_PARAM_ID 0x00010c08
689
690
691#define ADM_CMD_SET_PARAMS 0x00010306
692#define ADM_CMD_GET_PARAMS 0x0001030B
693#define ADM_CMDRSP_GET_PARAMS 0x0001030C
694struct adm_set_params_command {
695 struct apr_hdr hdr;
696 u32 payload;
697 u32 payload_size;
698} __attribute__ ((packed));
699
700
701#define ADM_CMD_TAP_COPP_PCM 0x00010307
702struct adm_tap_copp_pcm_command {
703 struct apr_hdr hdr;
704} __attribute__ ((packed));
705
706
707/* QDSP6 to Client messages
708*/
709#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
710struct adm_get_copp_handles_respond {
711 struct apr_hdr hdr;
712 u32 handles;
713 u32 copp_id;
714} __attribute__ ((packed));
715
716#define ADM_CMDRSP_COPP_OPEN 0x0001030A
717struct adm_copp_open_respond {
718 u32 status;
719 u16 copp_id;
720 u16 reserved;
721} __attribute__ ((packed));
722
Kiran Kandi5e809b02012-01-31 00:24:33 -0800723#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
724
725
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700726#define ASM_STREAM_PRIORITY_NORMAL 0
727#define ASM_STREAM_PRIORITY_LOW 1
728#define ASM_STREAM_PRIORITY_HIGH 2
729#define ASM_STREAM_PRIORITY_RESERVED 3
730
731#define ASM_END_POINT_DEVICE_MATRIX 0
732#define ASM_END_POINT_STREAM 1
733
734#define AAC_ENC_MODE_AAC_LC 0x02
735#define AAC_ENC_MODE_AAC_P 0x05
736#define AAC_ENC_MODE_EAAC_P 0x1D
737
738#define ASM_STREAM_CMD_CLOSE 0x00010BCD
739#define ASM_STREAM_CMD_FLUSH 0x00010BCE
740#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
741#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
742#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
743#define ASM_SESSION_CMD_PAUSE 0x00010BD3
744#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
745#define ASM_DATA_CMD_EOS 0x00010BDB
746#define ASM_DATA_EVENT_EOS 0x00010BDD
747
748#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
749#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
750
751#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
752#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
753#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
754#define ASM_DATA_CMDRSP_EOS 0x00010C1C
755
756/* ASM Data structures */
757
758/* common declarations */
759struct asm_pcm_cfg {
760 u16 ch_cfg;
761 u16 bits_per_sample;
762 u32 sample_rate;
763 u16 is_signed;
764 u16 interleaved;
765};
766
Kiran Kandi5e809b02012-01-31 00:24:33 -0800767#define PCM_CHANNEL_NULL 0
768
769/* Front left channel. */
770#define PCM_CHANNEL_FL 1
771
772/* Front right channel. */
773#define PCM_CHANNEL_FR 2
774
775/* Front center channel. */
776#define PCM_CHANNEL_FC 3
777
778/* Left surround channel.*/
779#define PCM_CHANNEL_LS 4
780
781/* Right surround channel.*/
782#define PCM_CHANNEL_RS 5
783
784/* Low frequency effect channel. */
785#define PCM_CHANNEL_LFE 6
786
787/* Center surround channel; Rear center channel. */
788#define PCM_CHANNEL_CS 7
789
790/* Left back channel; Rear left channel. */
791#define PCM_CHANNEL_LB 8
792
793/* Right back channel; Rear right channel. */
794#define PCM_CHANNEL_RB 9
795
796/* Top surround channel. */
797#define PCM_CHANNEL_TS 10
798
799/* Center vertical height channel.*/
800#define PCM_CHANNEL_CVH 11
801
802/* Mono surround channel.*/
803#define PCM_CHANNEL_MS 12
804
805/* Front left of center. */
806#define PCM_CHANNEL_FLC 13
807
808/* Front right of center. */
809#define PCM_CHANNEL_FRC 14
810
811/* Rear left of center. */
812#define PCM_CHANNEL_RLC 15
813
814/* Rear right of center. */
815#define PCM_CHANNEL_RRC 16
816
817#define PCM_FORMAT_MAX_NUM_CHANNEL 8
818
Swaminathan Sathappan6f530882012-05-01 16:42:22 -0700819/* Maximum number of channels supported
820 * in ASM_ENCDEC_DEC_CHAN_MAP command
821 */
822#define MAX_CHAN_MAP_CHANNELS 16
Kiran Kandi5e809b02012-01-31 00:24:33 -0800823/*
824 * Multiple-channel PCM decoder format block structure used in the
825 * #ASM_STREAM_CMD_OPEN_WRITE command.
826 * The data must be in little-endian format.
827 */
828struct asm_multi_channel_pcm_fmt_blk {
829
830 u16 num_channels; /*
831 * Number of channels.
832 * Supported values:1 to 8
833 */
834
835 u16 bits_per_sample; /*
836 * Number of bits per sample per channel.
837 * Supported values: 16, 24 When used for
838 * playback, the client must send 24-bit
839 * samples packed in 32-bit words. The
840 * 24-bit samples must be placed in the most
841 * significant 24 bits of the 32-bit word. When
842 * used for recording, the aDSP sends 24-bit
843 * samples packed in 32-bit words. The 24-bit
844 * samples are placed in the most significant
845 * 24 bits of the 32-bit word.
846 */
847
848 u32 sample_rate; /*
849 * Number of samples per second
850 * (in Hertz). Supported values:
851 * 2000 to 48000
852 */
853
854 u16 is_signed; /*
855 * Flag that indicates the samples
856 * are signed (1).
857 */
858
859 u16 is_interleaved; /*
860 * Flag that indicates whether the channels are
861 * de-interleaved (0) or interleaved (1).
862 * Interleaved format means corresponding
863 * samples from the left and right channels are
864 * interleaved within the buffer.
865 * De-interleaved format means samples from
866 * each channel are contiguous in the buffer.
867 * The samples from one channel immediately
868 * follow those of the previous channel.
869 */
870
871 u8 channel_mapping[8]; /*
872 * Supported values:
873 * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
874 * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
875 * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
876 * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
877 * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
878 * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
879 * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
880 * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
881 * PCM_CHANNEL_RRC.
882 * Channel[i] mapping describes channel I. Each
883 * element i of the array describes channel I
884 * inside the buffer where I < num_channels.
885 * An unused channel is set to zero.
886 */
887};
888
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700889struct asm_adpcm_cfg {
890 u16 ch_cfg;
891 u16 bits_per_sample;
892 u32 sample_rate;
893 u32 block_size;
894};
895
896struct asm_yadpcm_cfg {
897 u16 ch_cfg;
898 u16 bits_per_sample;
899 u32 sample_rate;
900};
901
902struct asm_midi_cfg {
903 u32 nMode;
904};
905
906struct asm_wma_cfg {
907 u16 format_tag;
908 u16 ch_cfg;
909 u32 sample_rate;
910 u32 avg_bytes_per_sec;
911 u16 block_align;
912 u16 valid_bits_per_sample;
913 u32 ch_mask;
914 u16 encode_opt;
915 u16 adv_encode_opt;
916 u32 adv_encode_opt2;
917 u32 drc_peak_ref;
918 u32 drc_peak_target;
919 u32 drc_ave_ref;
920 u32 drc_ave_target;
921};
922
923struct asm_wmapro_cfg {
924 u16 format_tag;
925 u16 ch_cfg;
926 u32 sample_rate;
927 u32 avg_bytes_per_sec;
928 u16 block_align;
929 u16 valid_bits_per_sample;
930 u32 ch_mask;
931 u16 encode_opt;
932 u16 adv_encode_opt;
933 u32 adv_encode_opt2;
934 u32 drc_peak_ref;
935 u32 drc_peak_target;
936 u32 drc_ave_ref;
937 u32 drc_ave_target;
938};
939
940struct asm_aac_cfg {
941 u16 format;
942 u16 aot;
943 u16 ep_config;
944 u16 section_data_resilience;
945 u16 scalefactor_data_resilience;
946 u16 spectral_data_resilience;
947 u16 ch_cfg;
948 u16 reserved;
949 u32 sample_rate;
950};
951
952struct asm_flac_cfg {
953 u16 stream_info_present;
954 u16 min_blk_size;
955 u16 max_blk_size;
956 u16 ch_cfg;
957 u16 sample_size;
958 u16 sample_rate;
959 u16 md5_sum;
960 u32 ext_sample_rate;
961 u32 min_frame_size;
962 u32 max_frame_size;
963};
964
965struct asm_vorbis_cfg {
966 u32 ch_cfg;
967 u32 bit_rate;
968 u32 min_bit_rate;
969 u32 max_bit_rate;
970 u16 bit_depth_pcm_sample;
971 u16 bit_stream_format;
972};
973
974struct asm_aac_read_cfg {
975 u32 bitrate;
976 u32 enc_mode;
977 u16 format;
978 u16 ch_cfg;
979 u32 sample_rate;
980};
981
982struct asm_amrnb_read_cfg {
983 u16 mode;
984 u16 dtx_mode;
985};
986
Alex Wong2caeecc2011-10-28 10:52:15 +0530987struct asm_amrwb_read_cfg {
988 u16 mode;
989 u16 dtx_mode;
990};
991
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700992struct asm_evrc_read_cfg {
993 u16 max_rate;
994 u16 min_rate;
995 u16 rate_modulation_cmd;
996 u16 reserved;
997};
998
999struct asm_qcelp13_read_cfg {
1000 u16 max_rate;
1001 u16 min_rate;
1002 u16 reduced_rate_level;
1003 u16 rate_modulation_cmd;
1004};
1005
1006struct asm_sbc_read_cfg {
1007 u32 subband;
1008 u32 block_len;
1009 u32 ch_mode;
1010 u32 alloc_method;
1011 u32 bit_rate;
1012 u32 sample_rate;
1013};
1014
1015struct asm_sbc_bitrate {
1016 u32 bitrate;
1017};
1018
1019struct asm_immed_decode {
1020 u32 mode;
1021};
1022
1023struct asm_sbr_ps {
1024 u32 enable;
1025};
1026
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001027struct asm_dual_mono {
1028 u16 sce_left;
1029 u16 sce_right;
1030};
1031
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001032struct asm_dec_chan_map {
1033 u32 num_channels; /* Number of decoder output
1034 * channels. A value of 0
1035 * indicates native channel
1036 * mapping, which is valid
1037 * only for NT mode. This
1038 * means the output of the
1039 * decoder is to be preserved
1040 * as is.
1041 */
1042
1043 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
1044 * num_channels. It can grow
1045 * till MAX_CHAN_MAP_CHANNELS.
1046 * Channel[i] mapping
1047 * describes channel I inside
1048 * the decoder output buffer.
1049 * Valid channel mapping
1050 * values are to be present at
1051 * the beginning of the array.
1052 * All remaining elements of
1053 * the array are to be filled
1054 * with PCM_CHANNEL_NULL.
1055 */
1056};
1057
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001058struct asm_encode_cfg_blk {
1059 u32 frames_per_buf;
1060 u32 format_id;
1061 u32 cfg_size;
1062 union {
1063 struct asm_pcm_cfg pcm;
1064 struct asm_aac_read_cfg aac;
1065 struct asm_amrnb_read_cfg amrnb;
1066 struct asm_evrc_read_cfg evrc;
1067 struct asm_qcelp13_read_cfg qcelp13;
1068 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +05301069 struct asm_amrwb_read_cfg amrwb;
Mingming Yin647e9ea2012-03-17 19:56:10 -07001070 struct asm_multi_channel_pcm_fmt_blk mpcm;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001071 } __attribute__((packed)) cfg;
1072};
1073
1074struct asm_frame_meta_info {
1075 u32 offset_to_frame;
1076 u32 frame_size;
1077 u32 encoded_pcm_samples;
1078 u32 msw_ts;
1079 u32 lsw_ts;
1080 u32 nflags;
1081};
1082
1083/* Stream level commands */
1084#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
1085struct asm_stream_cmd_open_read {
1086 struct apr_hdr hdr;
1087 u32 uMode;
1088 u32 src_endpoint;
1089 u32 pre_proc_top;
1090 u32 format;
1091} __attribute__((packed));
1092
1093/* Supported formats */
1094#define LINEAR_PCM 0x00010BE5
1095#define DTMF 0x00010BE6
1096#define ADPCM 0x00010BE7
1097#define YADPCM 0x00010BE8
1098#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001099#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001100#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +05301101#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001102#define V13K_FS 0x00010BED
1103#define EVRC_FS 0x00010BEE
1104#define EVRCB_FS 0x00010BEF
1105#define EVRCWB_FS 0x00010BF0
1106#define MIDI 0x00010BF1
1107#define SBC 0x00010BF2
1108#define WMA_V10PRO 0x00010BF3
1109#define WMA_V9 0x00010BF4
1110#define AMR_WB_PLUS 0x00010BF5
1111#define AC3_DECODER 0x00010BF6
Santosh Mardi23321202012-03-22 04:33:25 +05301112#define EAC3_DECODER 0x00010C3C
1113#define DTS 0x00010D88
1114#define ATRAC 0x00010D89
1115#define MAT 0x00010D8A
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001116#define G711_ALAW_FS 0x00010BF7
1117#define G711_MLAW_FS 0x00010BF8
1118#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001119#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +02001120#define US_POINT_EPOS_FORMAT 0x00012310
1121#define US_RAW_FORMAT 0x0001127C
Kiran Kandi5e809b02012-01-31 00:24:33 -08001122#define MULTI_CHANNEL_PCM 0x00010C66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123
1124#define ASM_ENCDEC_SBCRATE 0x00010C13
1125#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1126#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1127
1128#define ASM_ENCDEC_SBCRATE 0x00010C13
1129#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1130#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1131
1132#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
1133struct asm_stream_cmd_open_write {
1134 struct apr_hdr hdr;
1135 u32 uMode;
1136 u16 sink_endpoint;
1137 u16 stream_handle;
1138 u32 post_proc_top;
1139 u32 format;
1140} __attribute__((packed));
1141
Santosh Mardi23321202012-03-22 04:33:25 +05301142#define IEC_61937_MASK 0x00000001
1143#define IEC_60958_MASK 0x00000002
1144
1145#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
1146struct asm_stream_cmd_open_write_compressed {
1147 struct apr_hdr hdr;
1148 u32 flags;
1149 u32 format;
1150} __packed;
1151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001152#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
1153
1154struct asm_stream_cmd_open_read_write {
1155 struct apr_hdr hdr;
1156 u32 uMode;
1157 u32 post_proc_top;
1158 u32 write_format;
1159 u32 read_format;
1160} __attribute__((packed));
1161
Santosh Mardi23321202012-03-22 04:33:25 +05301162#define ADM_CMD_CONNECT_AFE_PORT 0x00010320
1163
1164struct adm_cmd_connect_afe_port {
1165 struct apr_hdr hdr;
1166 u8 mode; /*mode represent the interface is for RX or TX*/
1167 u8 session_id; /*ASM session ID*/
1168 u16 afe_port_id;
1169} __packed;
1170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001171#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
1172#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
1173#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
1174#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001175#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176struct asm_stream_cmd_encdec_cfg_blk{
1177 struct apr_hdr hdr;
1178 u32 param_id;
1179 u32 param_size;
1180 struct asm_encode_cfg_blk enc_blk;
1181} __attribute__((packed));
1182
1183struct asm_stream_cmd_encdec_sbc_bitrate{
1184 struct apr_hdr hdr;
1185 u32 param_id;
1186 struct asm_sbc_bitrate sbc_bitrate;
1187} __attribute__((packed));
1188
1189struct asm_stream_cmd_encdec_immed_decode{
1190 struct apr_hdr hdr;
1191 u32 param_id;
1192 u32 param_size;
1193 struct asm_immed_decode dec;
1194} __attribute__((packed));
1195
1196struct asm_stream_cmd_encdec_sbr{
1197 struct apr_hdr hdr;
1198 u32 param_id;
1199 u32 param_size;
1200 struct asm_sbr_ps sbr_ps;
1201} __attribute__((packed));
1202
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001203struct asm_stream_cmd_encdec_dualmono {
1204 struct apr_hdr hdr;
1205 u32 param_id;
1206 u32 param_size;
1207 struct asm_dual_mono channel_map;
1208} __packed;
1209
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001210#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
1211struct asm_stream_cmd_encdec_channelmap {
1212 struct apr_hdr hdr;
1213 u32 param_id;
1214 u32 param_size;
1215 struct asm_dec_chan_map chan_map;
1216} __packed;
1217
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001218#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
1219struct asm_stream_cmd_adjust_samples{
1220 struct apr_hdr hdr;
1221 u16 nsamples;
1222 u16 reserved;
1223} __attribute__((packed));
1224
1225#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
1226struct asm_stream_cmd_tap_popp_pcm{
1227 struct apr_hdr hdr;
1228 u16 enable;
1229 u16 reserved;
1230 u32 module_id;
1231} __attribute__((packed));
1232
1233/* Session Level commands */
1234#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
1235struct asm_stream_cmd_memory_map{
1236 struct apr_hdr hdr;
1237 u32 buf_add;
1238 u32 buf_size;
1239 u16 mempool_id;
1240 u16 reserved;
1241} __attribute__((packed));
1242
1243#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
1244struct asm_stream_cmd_memory_unmap{
1245 struct apr_hdr hdr;
1246 u32 buf_add;
1247} __attribute__((packed));
1248
1249#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
1250struct asm_memory_map_regions{
1251 u32 phys;
1252 u32 buf_size;
1253} __attribute__((packed));
1254
1255struct asm_stream_cmd_memory_map_regions{
1256 struct apr_hdr hdr;
1257 u16 mempool_id;
1258 u16 nregions;
1259} __attribute__((packed));
1260
1261#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
1262struct asm_memory_unmap_regions{
1263 u32 phys;
1264} __attribute__((packed));
1265
1266struct asm_stream_cmd_memory_unmap_regions{
1267 struct apr_hdr hdr;
1268 u16 nregions;
1269 u16 reserved;
1270} __attribute__((packed));
1271
1272#define ASM_SESSION_CMD_RUN 0x00010BD2
1273struct asm_stream_cmd_run{
1274 struct apr_hdr hdr;
1275 u32 flags;
1276 u32 msw_ts;
1277 u32 lsw_ts;
1278} __attribute__((packed));
1279
1280/* Session level events */
1281#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1282struct asm_stream_cmd_reg_rx_underflow_event{
1283 struct apr_hdr hdr;
1284 u16 enable;
1285 u16 reserved;
1286} __attribute__((packed));
1287
1288#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1289struct asm_stream_cmd_reg_tx_overflow_event{
1290 struct apr_hdr hdr;
1291 u16 enable;
1292 u16 reserved;
1293} __attribute__((packed));
1294
1295/* Data Path commands */
1296#define ASM_DATA_CMD_WRITE 0x00010BD9
1297struct asm_stream_cmd_write{
1298 struct apr_hdr hdr;
1299 u32 buf_add;
1300 u32 avail_bytes;
1301 u32 uid;
1302 u32 msw_ts;
1303 u32 lsw_ts;
1304 u32 uflags;
1305} __attribute__((packed));
1306
1307#define ASM_DATA_CMD_READ 0x00010BDA
1308struct asm_stream_cmd_read{
1309 struct apr_hdr hdr;
1310 u32 buf_add;
1311 u32 buf_size;
1312 u32 uid;
1313} __attribute__((packed));
1314
1315#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301316#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317struct asm_stream_media_format_update{
1318 struct apr_hdr hdr;
1319 u32 format;
1320 u32 cfg_size;
1321 union {
1322 struct asm_pcm_cfg pcm_cfg;
1323 struct asm_adpcm_cfg adpcm_cfg;
1324 struct asm_yadpcm_cfg yadpcm_cfg;
1325 struct asm_midi_cfg midi_cfg;
1326 struct asm_wma_cfg wma_cfg;
1327 struct asm_wmapro_cfg wmapro_cfg;
1328 struct asm_aac_cfg aac_cfg;
1329 struct asm_flac_cfg flac_cfg;
1330 struct asm_vorbis_cfg vorbis_cfg;
Kiran Kandi5e809b02012-01-31 00:24:33 -08001331 struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332 } __attribute__((packed)) write_cfg;
1333} __attribute__((packed));
1334
1335
1336/* Command Responses */
1337#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1338struct asm_stream_cmdrsp_get_readwrite_param{
1339 struct apr_hdr hdr;
1340 u32 status;
1341 u32 param_id;
1342 u16 param_size;
1343 u16 padding;
1344 union {
1345 struct asm_sbc_bitrate sbc_bitrate;
1346 struct asm_immed_decode aac_dec;
1347 } __attribute__((packed)) read_write_cfg;
1348} __attribute__((packed));
1349
1350
1351#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1352struct asm_stream_cmdrsp_get_session_time{
1353 struct apr_hdr hdr;
1354 u32 status;
1355 u32 msw_ts;
1356 u32 lsw_ts;
1357} __attribute__((packed));
1358
1359#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1360struct asm_data_event_write_done{
1361 u32 buf_add;
1362 u32 status;
1363} __attribute__((packed));
1364
1365#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1366struct asm_data_event_read_done{
1367 u32 status;
1368 u32 buffer_add;
1369 u32 enc_frame_size;
1370 u32 offset;
1371 u32 msw_ts;
1372 u32 lsw_ts;
1373 u32 flags;
1374 u32 num_frames;
1375 u32 id;
1376} __attribute__((packed));
1377
1378#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1379struct asm_data_event_sr_cm_change_notify {
1380 u32 sample_rate;
1381 u16 no_of_channels;
1382 u16 reserved;
1383 u8 channel_map[8];
1384} __packed;
1385
1386/* service level events */
1387
1388#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1389struct asm_svc_cmdrsp_get_strm_handles{
1390 struct apr_hdr hdr;
1391 u32 num_handles;
1392 u32 stream_handles;
1393} __attribute__((packed));
1394
1395
1396#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1397struct asm_svc_cmdrsp_get_wallclock_time{
1398 struct apr_hdr hdr;
1399 u32 status;
1400 u32 msw_ts;
1401 u32 lsw_ts;
1402} __attribute__((packed));
1403
1404/*
1405 * Error code
1406*/
1407#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1408#define ADSP_EFAILED 0x00000001 /* General failure. */
1409#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1410#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1411#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1412#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1413#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1414#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1415#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1416#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1417#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1418#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1419#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1420 processed. */
1421#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1422#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1423#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1424 to complete. */
1425#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1426 intervention to complete. */
1427#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1428#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1429
1430#endif /*_APR_AUDIO_H_*/