blob: 30f1a7c16ec39e2612e6533b19e8ce1775b386f4 [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
64
65#define AFE_PORT_CMD_START 0x000100ca
Laxminath Kasam32657ec2011-08-01 19:26:57 +053066
67#define AFE_EVENT_RTPORT_START 0
68#define AFE_EVENT_RTPORT_STOP 1
69#define AFE_EVENT_RTPORT_LOW_WM 2
70#define AFE_EVENT_RTPORT_HI_WM 3
71
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072struct afe_port_start_command {
73 struct apr_hdr hdr;
74 u16 port_id;
75 u16 gain; /* Q13 */
76 u32 sample_rate; /* 8 , 16, 48khz */
77} __attribute__ ((packed));
78
79#define AFE_PORT_CMD_STOP 0x000100cb
80struct afe_port_stop_command {
81 struct apr_hdr hdr;
82 u16 port_id;
83 u16 reserved;
84} __attribute__ ((packed));
85
86#define AFE_PORT_CMD_APPLY_GAIN 0x000100cc
87struct afe_port_gain_command {
88 struct apr_hdr hdr;
89 u16 port_id;
90 u16 gain;/* Q13 */
91} __attribute__ ((packed));
92
93#define AFE_PORT_CMD_SIDETONE_CTL 0x000100cd
94struct afe_port_sidetone_command {
95 struct apr_hdr hdr;
96 u16 rx_port_id; /* Primary i2s tx = 1 */
97 /* PCM tx = 3 */
98 /* Secondary i2s tx = 5 */
99 /* Mi2s tx = 7 */
100 /* Digital mic tx = 11 */
101 u16 tx_port_id; /* Primary i2s rx = 0 */
102 /* PCM rx = 2 */
103 /* Secondary i2s rx = 4 */
104 /* Mi2S rx = 6 */
105 /* HDMI rx = 8 */
106 u16 gain; /* Q13 */
107 u16 enable; /* 1 = enable, 0 = disable */
108} __attribute__ ((packed));
109
110#define AFE_PORT_CMD_LOOPBACK 0x000100ce
111struct afe_loopback_command {
112 struct apr_hdr hdr;
113 u16 tx_port_id; /* Primary i2s rx = 0 */
114 /* PCM rx = 2 */
115 /* Secondary i2s rx = 4 */
116 /* Mi2S rx = 6 */
117 /* HDMI rx = 8 */
118 u16 rx_port_id; /* Primary i2s tx = 1 */
119 /* PCM tx = 3 */
120 /* Secondary i2s tx = 5 */
121 /* Mi2s tx = 7 */
122 /* Digital mic tx = 11 */
123 u16 mode; /* Default -1, DSP will conver
124 the tx to rx format */
125 u16 enable; /* 1 = enable, 0 = disable */
126} __attribute__ ((packed));
127
128#define AFE_PSEUDOPORT_CMD_START 0x000100cf
129struct afe_pseudoport_start_command {
130 struct apr_hdr hdr;
131 u16 port_id; /* Pseudo Port 1 = 0x8000 */
132 /* Pseudo Port 2 = 0x8001 */
133 /* Pseudo Port 3 = 0x8002 */
134 u16 timing; /* FTRT = 0 , AVTimer = 1, */
135} __attribute__ ((packed));
136
137#define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
138struct afe_pseudoport_stop_command {
139 struct apr_hdr hdr;
140 u16 port_id; /* Pseudo Port 1 = 0x8000 */
141 /* Pseudo Port 2 = 0x8001 */
142 /* Pseudo Port 3 = 0x8002 */
143 u16 reserved;
144} __attribute__ ((packed));
145
146#define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1
147
148
149#define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2
150struct afe_get_active_handles_command {
151 struct apr_hdr hdr;
152 u16 port_id;
153 u16 reserved;
154} __attribute__ ((packed));
155
156#define AFE_PCM_CFG_MODE_PCM 0x0
157#define AFE_PCM_CFG_MODE_AUX 0x1
158#define AFE_PCM_CFG_SYNC_EXT 0x0
159#define AFE_PCM_CFG_SYNC_INT 0x1
160#define AFE_PCM_CFG_FRM_8BPF 0x0
161#define AFE_PCM_CFG_FRM_16BPF 0x1
162#define AFE_PCM_CFG_FRM_32BPF 0x2
163#define AFE_PCM_CFG_FRM_64BPF 0x3
164#define AFE_PCM_CFG_FRM_128BPF 0x4
165#define AFE_PCM_CFG_FRM_256BPF 0x5
166#define AFE_PCM_CFG_QUANT_ALAW_NOPAD 0x0
167#define AFE_PCM_CFG_QUANT_MULAW_NOPAD 0x1
168#define AFE_PCM_CFG_QUANT_LINEAR_NOPAD 0x2
169#define AFE_PCM_CFG_QUANT_ALAW_PAD 0x3
170#define AFE_PCM_CFG_QUANT_MULAW_PAD 0x4
171#define AFE_PCM_CFG_QUANT_LINEAR_PAD 0x5
172#define AFE_PCM_CFG_CDATAOE_MASTER 0x0
173#define AFE_PCM_CFG_CDATAOE_SHARE 0x1
174
175struct afe_port_pcm_cfg {
176 u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */
177 u16 sync; /* external = 0 , internal = 1 */
178 u16 frame; /* 8 bpf = 0 */
179 /* 16 bpf = 1 */
180 /* 32 bpf = 2 */
181 /* 64 bpf = 3 */
182 /* 128 bpf = 4 */
183 /* 256 bpf = 5 */
184 u16 quant;
185 u16 slot; /* Slot for PCM stream , 0 - 31 */
186 u16 data; /* 0, PCM block is the only master */
187 /* 1, PCM block is shares to driver data out signal */
188 /* other master */
189 u16 reserved;
190} __attribute__ ((packed));
191
192enum {
193 AFE_I2S_SD0 = 1,
194 AFE_I2S_SD1,
195 AFE_I2S_SD2,
196 AFE_I2S_SD3,
197 AFE_I2S_QUAD01,
198 AFE_I2S_QUAD23,
199 AFE_I2S_6CHS,
200 AFE_I2S_8CHS,
201};
202
203#define AFE_MI2S_MONO 0
204#define AFE_MI2S_STEREO 3
205#define AFE_MI2S_4CHANNELS 4
206#define AFE_MI2S_6CHANNELS 6
207#define AFE_MI2S_8CHANNELS 8
208
209struct afe_port_mi2s_cfg {
210 u16 bitwidth; /* 16,24,32 */
211 u16 line; /* Called ChannelMode in documentation */
212 /* i2s_sd0 = 1 */
213 /* i2s_sd1 = 2 */
214 /* i2s_sd2 = 3 */
215 /* i2s_sd3 = 4 */
216 /* i2s_quad01 = 5 */
217 /* i2s_quad23 = 6 */
218 /* i2s_6chs = 7 */
219 /* i2s_8chs = 8 */
220 u16 channel; /* Called MonoStereo in documentation */
221 /* i2s mono = 0 */
222 /* i2s mono right = 1 */
223 /* i2s mono left = 2 */
224 /* i2s stereo = 3 */
225 u16 ws; /* 0, word select signal from external source */
226 /* 1, word select signal from internal source */
227 u16 reserved;
228} __attribute__ ((packed));
229
230struct afe_port_hdmi_cfg {
231 u16 bitwidth; /* 16,24,32 */
232 u16 channel_mode; /* HDMI Stereo = 0 */
233 /* HDMI_3Point1 (4-ch) = 1 */
234 /* HDMI_5Point1 (6-ch) = 2 */
235 /* HDMI_6Point1 (8-ch) = 3 */
236 u16 data_type; /* HDMI_Linear = 0 */
237 /* HDMI_non_Linaer = 1 */
238} __attribute__ ((packed));
239
240
241/* Slimbus Device Ids */
242#define AFE_SLIMBUS_DEVICE_1 0x0
243#define AFE_SLIMBUS_DEVICE_2 0x1
244#define AFE_PORT_MAX_AUDIO_CHAN_CNT 16
245
246struct afe_port_slimbus_cfg {
247 u16 slimbus_dev_id; /* SLIMBUS Device id.*/
248
249 u16 slave_dev_pgd_la; /* Slave ported generic device
250 * logical address.
251 */
252 u16 slave_dev_intfdev_la; /* Slave interface device logical
253 * address.
254 */
255 u16 bit_width; /** bit width of the samples, 16, 24.*/
256
257 u16 data_format; /** data format.*/
258
259 u16 num_channels; /** Number of channels.*/
260
261 /** Slave port mapping for respective channels.*/
262 u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
263
264 u16 reserved;
265} __packed;
266
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530267struct afe_port_rtproxy_cfg {
268 u16 bitwidth; /* 16,24,32 */
269 u16 interleaved; /* interleaved = 1 */
270 /* Noninterleaved = 0 */
271 u16 frame_sz; /* 5ms buffers = 160bytes */
272 u16 jitter; /* 10ms of jitter = 320 */
273 u16 lw_mark; /* Low watermark in bytes for triggering event*/
274 u16 hw_mark; /* High watermark bytes for triggering event*/
275 u16 rsvd;
276 int num_ch; /* 1 to 8 */
277} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278
279#define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
280
281union afe_port_config {
282 struct afe_port_pcm_cfg pcm;
283 struct afe_port_mi2s_cfg mi2s;
284 struct afe_port_hdmi_cfg hdmi;
285 struct afe_port_slimbus_cfg slimbus;
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530286 struct afe_port_rtproxy_cfg rtproxy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700287} __attribute__((packed));
288
289struct afe_audioif_config_command {
290 struct apr_hdr hdr;
291 u16 port_id;
292 union afe_port_config port;
293} __attribute__ ((packed));
294
295#define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
296struct afe_codec_loopback_command {
297 u16 port_inf; /* Primary i2s = 0 */
298 /* PCM = 2 */
299 /* Secondary i2s = 4 */
300 /* Mi2s = 6 */
301 u16 enable; /* 0, disable. 1, enable */
302} __attribute__ ((packed));
303
304
305#define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300
306struct afe_param_sidetone_gain {
307 u16 gain;
308 u16 reserved;
309} __attribute__ ((packed));
310
311#define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
312struct afe_param_sampling_rate {
313 u32 sampling_rate;
314} __attribute__ ((packed));
315
316
317#define AFE_PARAM_ID_CHANNELS 0x00010302
318struct afe_param_channels {
319 u16 channels;
320 u16 reserved;
321} __attribute__ ((packed));
322
323
324#define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
325struct afe_param_loopback_gain {
326 u16 gain;
327 u16 reserved;
328} __attribute__ ((packed));
329
330
331#define AFE_MODULE_ID_PORT_INFO 0x00010200
332struct afe_param_payload {
333 u32 module_id;
334 u32 param_id;
335 u16 param_size;
336 u16 reserved;
337 union {
338 struct afe_param_sidetone_gain sidetone_gain;
339 struct afe_param_sampling_rate sampling_rate;
340 struct afe_param_channels channels;
341 struct afe_param_loopback_gain loopback_gain;
342 } __attribute__((packed)) param;
343} __attribute__ ((packed));
344
345#define AFE_PORT_CMD_SET_PARAM 0x000100dc
346
347struct afe_port_cmd_set_param {
348 struct apr_hdr hdr;
349 u16 port_id;
350 u16 payload_size;
351 u32 payload_address;
352 struct afe_param_payload payload;
353} __attribute__ ((packed));
354
Ben Rombergerb7603232011-11-23 17:16:27 -0800355struct afe_port_cmd_set_param_no_payload {
356 struct apr_hdr hdr;
357 u16 port_id;
358 u16 payload_size;
359 u32 payload_address;
360} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700361
362#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
363struct afe_get_active_ports_rsp {
364 u16 num_ports;
365 u16 port_id;
366} __attribute__ ((packed));
367
368
369#define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
370struct afe_get_active_handles_rsp {
371 u16 port_id;
372 u16 num_handles;
373 u16 mode; /* 0, voice rx */
374 /* 1, voice tx */
375 /* 2, audio rx */
376 /* 3, audio tx */
377 u16 handle;
378} __attribute__ ((packed));
379
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530380#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
381struct afe_cmd_memory_map {
382 struct apr_hdr hdr;
383 u32 phy_addr;
384 u32 mem_sz;
385 u16 mem_id;
386 u16 rsvd;
387} __packed;
388
389#define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
390struct afe_cmd_memory_unmap {
391 struct apr_hdr hdr;
392 u32 phy_addr;
393} __packed;
394
395#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
396struct afe_cmd_reg_rtport {
397 struct apr_hdr hdr;
398 u16 port_id;
399 u16 rsvd;
400} __packed;
401
402#define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
403struct afe_cmd_unreg_rtport {
404 struct apr_hdr hdr;
405 u16 port_id;
406 u16 rsvd;
407} __packed;
408
409#define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
410struct afe_cmd_rtport_wr {
411 struct apr_hdr hdr;
412 u16 port_id;
413 u16 rsvd;
414 u32 buf_addr;
415 u32 bytes_avail;
416} __packed;
417
418#define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3
419struct afe_cmd_rtport_rd {
420 struct apr_hdr hdr;
421 u16 port_id;
422 u16 rsvd;
423 u32 buf_addr;
424 u32 bytes_avail;
425} __packed;
426
427#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
428
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700429#define ADM_MAX_COPPS 5
430
431#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
432struct adm_get_copp_handles_command {
433 struct apr_hdr hdr;
434} __attribute__ ((packed));
435
436#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
437struct adm_routings_session {
438 u16 id;
439 u16 num_copps;
440 u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
441} __packed;
442
443struct adm_routings_command {
444 struct apr_hdr hdr;
445 u32 path; /* 0 = Rx, 1 Tx */
446 u32 num_sessions;
447 struct adm_routings_session session[8];
448} __attribute__ ((packed));
449
450
451#define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
452struct adm_ramp_gain {
453 struct apr_hdr hdr;
454 u16 session_id;
455 u16 copp_id;
456 u16 initial_gain;
457 u16 gain_increment;
458 u16 ramp_duration;
459 u16 reserved;
460} __attribute__ ((packed));
461
462struct adm_ramp_gains_command {
463 struct apr_hdr hdr;
464 u32 id;
465 u32 num_gains;
466 struct adm_ramp_gain gains[ADM_MAX_COPPS];
467} __attribute__ ((packed));
468
469
470#define ADM_CMD_COPP_OPEN 0x00010304
471struct adm_copp_open_command {
472 struct apr_hdr hdr;
473 u16 flags;
474 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
475 u16 endpoint_id1;
476 u16 endpoint_id2;
477 u32 topology_id;
478 u16 channel_config;
479 u16 reserved;
480 u32 rate;
481} __attribute__ ((packed));
482
483#define ADM_CMD_COPP_CLOSE 0x00010305
484
485#define ADM_CMD_MEMORY_MAP 0x00010C30
486struct adm_cmd_memory_map{
487 struct apr_hdr hdr;
488 u32 buf_add;
489 u32 buf_size;
490 u16 mempool_id;
491 u16 reserved;
492} __attribute__((packed));
493
494#define ADM_CMD_MEMORY_UNMAP 0x00010C31
495struct adm_cmd_memory_unmap{
496 struct apr_hdr hdr;
497 u32 buf_add;
498} __attribute__((packed));
499
500#define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
501struct adm_memory_map_regions{
502 u32 phys;
503 u32 buf_size;
504} __attribute__((packed));
505
506struct adm_cmd_memory_map_regions{
507 struct apr_hdr hdr;
508 u16 mempool_id;
509 u16 nregions;
510} __attribute__((packed));
511
512#define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
513struct adm_memory_unmap_regions{
514 u32 phys;
515} __attribute__((packed));
516
517struct adm_cmd_memory_unmap_regions{
518 struct apr_hdr hdr;
519 u16 nregions;
520 u16 reserved;
521} __attribute__((packed));
522
523#define DEFAULT_COPP_TOPOLOGY 0x00010be3
524#define DEFAULT_POPP_TOPOLOGY 0x00010be4
525#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
526#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
Jayasena Sangaraboina0fc197d2011-12-09 13:20:33 -0800527#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700528
529#define ASM_MAX_EQ_BANDS 12
530
531struct asm_eq_band {
532 u32 band_idx; /* The band index, 0 .. 11 */
533 u32 filter_type; /* Filter band type */
534 u32 center_freq_hz; /* Filter band center frequency */
535 u32 filter_gain; /* Filter band initial gain (dB) */
536 /* Range is +12 dB to -12 dB with 1dB increments. */
537 u32 q_factor;
538} __attribute__ ((packed));
539
540struct asm_equalizer_params {
541 u32 enable;
542 u32 num_bands;
543 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
544} __attribute__ ((packed));
545
546struct asm_master_gain_params {
547 u16 master_gain;
548 u16 padding;
549} __attribute__ ((packed));
550
551struct asm_lrchannel_gain_params {
552 u16 left_gain;
553 u16 right_gain;
554} __attribute__ ((packed));
555
556struct asm_mute_params {
557 u32 muteflag;
558} __attribute__ ((packed));
559
560struct asm_softvolume_params {
561 u32 period;
562 u32 step;
563 u32 rampingcurve;
564} __attribute__ ((packed));
565
566struct asm_softpause_params {
567 u32 enable;
568 u32 period;
569 u32 step;
570 u32 rampingcurve;
571} __packed;
572
573struct asm_pp_param_data_hdr {
574 u32 module_id;
575 u32 param_id;
576 u16 param_size;
577 u16 reserved;
578} __attribute__ ((packed));
579
580struct asm_pp_params_command {
581 struct apr_hdr hdr;
582 u32 *payload;
583 u32 payload_size;
584 struct asm_pp_param_data_hdr params;
585} __attribute__ ((packed));
586
587#define EQUALIZER_MODULE_ID 0x00010c27
588#define EQUALIZER_PARAM_ID 0x00010c28
589
590#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
591#define MASTER_GAIN_PARAM_ID 0x00010bff
592#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
593#define MUTE_CONFIG_PARAM_ID 0x00010c01
594#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700595#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596
597#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
598#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
599#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
600
601#define MBADRC_MODULE_ID 0x00010c06
602#define MBADRC_ENABLE_PARAM_ID 0x00010c07
603#define MBADRC_CONFIG_PARAM_ID 0x00010c08
604
605
606#define ADM_CMD_SET_PARAMS 0x00010306
607#define ADM_CMD_GET_PARAMS 0x0001030B
608#define ADM_CMDRSP_GET_PARAMS 0x0001030C
609struct adm_set_params_command {
610 struct apr_hdr hdr;
611 u32 payload;
612 u32 payload_size;
613} __attribute__ ((packed));
614
615
616#define ADM_CMD_TAP_COPP_PCM 0x00010307
617struct adm_tap_copp_pcm_command {
618 struct apr_hdr hdr;
619} __attribute__ ((packed));
620
621
622/* QDSP6 to Client messages
623*/
624#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
625struct adm_get_copp_handles_respond {
626 struct apr_hdr hdr;
627 u32 handles;
628 u32 copp_id;
629} __attribute__ ((packed));
630
631#define ADM_CMDRSP_COPP_OPEN 0x0001030A
632struct adm_copp_open_respond {
633 u32 status;
634 u16 copp_id;
635 u16 reserved;
636} __attribute__ ((packed));
637
638#define ASM_STREAM_PRIORITY_NORMAL 0
639#define ASM_STREAM_PRIORITY_LOW 1
640#define ASM_STREAM_PRIORITY_HIGH 2
641#define ASM_STREAM_PRIORITY_RESERVED 3
642
643#define ASM_END_POINT_DEVICE_MATRIX 0
644#define ASM_END_POINT_STREAM 1
645
646#define AAC_ENC_MODE_AAC_LC 0x02
647#define AAC_ENC_MODE_AAC_P 0x05
648#define AAC_ENC_MODE_EAAC_P 0x1D
649
650#define ASM_STREAM_CMD_CLOSE 0x00010BCD
651#define ASM_STREAM_CMD_FLUSH 0x00010BCE
652#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
653#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
654#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
655#define ASM_SESSION_CMD_PAUSE 0x00010BD3
656#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
657#define ASM_DATA_CMD_EOS 0x00010BDB
658#define ASM_DATA_EVENT_EOS 0x00010BDD
659
660#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
661#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
662
663#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
664#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
665#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
666#define ASM_DATA_CMDRSP_EOS 0x00010C1C
667
668/* ASM Data structures */
669
670/* common declarations */
671struct asm_pcm_cfg {
672 u16 ch_cfg;
673 u16 bits_per_sample;
674 u32 sample_rate;
675 u16 is_signed;
676 u16 interleaved;
677};
678
679struct asm_adpcm_cfg {
680 u16 ch_cfg;
681 u16 bits_per_sample;
682 u32 sample_rate;
683 u32 block_size;
684};
685
686struct asm_yadpcm_cfg {
687 u16 ch_cfg;
688 u16 bits_per_sample;
689 u32 sample_rate;
690};
691
692struct asm_midi_cfg {
693 u32 nMode;
694};
695
696struct asm_wma_cfg {
697 u16 format_tag;
698 u16 ch_cfg;
699 u32 sample_rate;
700 u32 avg_bytes_per_sec;
701 u16 block_align;
702 u16 valid_bits_per_sample;
703 u32 ch_mask;
704 u16 encode_opt;
705 u16 adv_encode_opt;
706 u32 adv_encode_opt2;
707 u32 drc_peak_ref;
708 u32 drc_peak_target;
709 u32 drc_ave_ref;
710 u32 drc_ave_target;
711};
712
713struct asm_wmapro_cfg {
714 u16 format_tag;
715 u16 ch_cfg;
716 u32 sample_rate;
717 u32 avg_bytes_per_sec;
718 u16 block_align;
719 u16 valid_bits_per_sample;
720 u32 ch_mask;
721 u16 encode_opt;
722 u16 adv_encode_opt;
723 u32 adv_encode_opt2;
724 u32 drc_peak_ref;
725 u32 drc_peak_target;
726 u32 drc_ave_ref;
727 u32 drc_ave_target;
728};
729
730struct asm_aac_cfg {
731 u16 format;
732 u16 aot;
733 u16 ep_config;
734 u16 section_data_resilience;
735 u16 scalefactor_data_resilience;
736 u16 spectral_data_resilience;
737 u16 ch_cfg;
738 u16 reserved;
739 u32 sample_rate;
740};
741
742struct asm_flac_cfg {
743 u16 stream_info_present;
744 u16 min_blk_size;
745 u16 max_blk_size;
746 u16 ch_cfg;
747 u16 sample_size;
748 u16 sample_rate;
749 u16 md5_sum;
750 u32 ext_sample_rate;
751 u32 min_frame_size;
752 u32 max_frame_size;
753};
754
755struct asm_vorbis_cfg {
756 u32 ch_cfg;
757 u32 bit_rate;
758 u32 min_bit_rate;
759 u32 max_bit_rate;
760 u16 bit_depth_pcm_sample;
761 u16 bit_stream_format;
762};
763
764struct asm_aac_read_cfg {
765 u32 bitrate;
766 u32 enc_mode;
767 u16 format;
768 u16 ch_cfg;
769 u32 sample_rate;
770};
771
772struct asm_amrnb_read_cfg {
773 u16 mode;
774 u16 dtx_mode;
775};
776
Alex Wong2caeecc2011-10-28 10:52:15 +0530777struct asm_amrwb_read_cfg {
778 u16 mode;
779 u16 dtx_mode;
780};
781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700782struct asm_evrc_read_cfg {
783 u16 max_rate;
784 u16 min_rate;
785 u16 rate_modulation_cmd;
786 u16 reserved;
787};
788
789struct asm_qcelp13_read_cfg {
790 u16 max_rate;
791 u16 min_rate;
792 u16 reduced_rate_level;
793 u16 rate_modulation_cmd;
794};
795
796struct asm_sbc_read_cfg {
797 u32 subband;
798 u32 block_len;
799 u32 ch_mode;
800 u32 alloc_method;
801 u32 bit_rate;
802 u32 sample_rate;
803};
804
805struct asm_sbc_bitrate {
806 u32 bitrate;
807};
808
809struct asm_immed_decode {
810 u32 mode;
811};
812
813struct asm_sbr_ps {
814 u32 enable;
815};
816
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700817struct asm_dual_mono {
818 u16 sce_left;
819 u16 sce_right;
820};
821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700822struct asm_encode_cfg_blk {
823 u32 frames_per_buf;
824 u32 format_id;
825 u32 cfg_size;
826 union {
827 struct asm_pcm_cfg pcm;
828 struct asm_aac_read_cfg aac;
829 struct asm_amrnb_read_cfg amrnb;
830 struct asm_evrc_read_cfg evrc;
831 struct asm_qcelp13_read_cfg qcelp13;
832 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +0530833 struct asm_amrwb_read_cfg amrwb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700834 } __attribute__((packed)) cfg;
835};
836
837struct asm_frame_meta_info {
838 u32 offset_to_frame;
839 u32 frame_size;
840 u32 encoded_pcm_samples;
841 u32 msw_ts;
842 u32 lsw_ts;
843 u32 nflags;
844};
845
846/* Stream level commands */
847#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
848struct asm_stream_cmd_open_read {
849 struct apr_hdr hdr;
850 u32 uMode;
851 u32 src_endpoint;
852 u32 pre_proc_top;
853 u32 format;
854} __attribute__((packed));
855
856/* Supported formats */
857#define LINEAR_PCM 0x00010BE5
858#define DTMF 0x00010BE6
859#define ADPCM 0x00010BE7
860#define YADPCM 0x00010BE8
861#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700862#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +0530864#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865#define V13K_FS 0x00010BED
866#define EVRC_FS 0x00010BEE
867#define EVRCB_FS 0x00010BEF
868#define EVRCWB_FS 0x00010BF0
869#define MIDI 0x00010BF1
870#define SBC 0x00010BF2
871#define WMA_V10PRO 0x00010BF3
872#define WMA_V9 0x00010BF4
873#define AMR_WB_PLUS 0x00010BF5
874#define AC3_DECODER 0x00010BF6
875#define G711_ALAW_FS 0x00010BF7
876#define G711_MLAW_FS 0x00010BF8
877#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700878#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +0200879#define US_POINT_EPOS_FORMAT 0x00012310
880#define US_RAW_FORMAT 0x0001127C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700881
882#define ASM_ENCDEC_SBCRATE 0x00010C13
883#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
884#define ASM_ENCDEC_CFG_BLK 0x00010C2C
885
886#define ASM_ENCDEC_SBCRATE 0x00010C13
887#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
888#define ASM_ENCDEC_CFG_BLK 0x00010C2C
889
890#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
891struct asm_stream_cmd_open_write {
892 struct apr_hdr hdr;
893 u32 uMode;
894 u16 sink_endpoint;
895 u16 stream_handle;
896 u32 post_proc_top;
897 u32 format;
898} __attribute__((packed));
899
900#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
901
902struct asm_stream_cmd_open_read_write {
903 struct apr_hdr hdr;
904 u32 uMode;
905 u32 post_proc_top;
906 u32 write_format;
907 u32 read_format;
908} __attribute__((packed));
909
910#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
911#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
912#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
913#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700914#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915struct asm_stream_cmd_encdec_cfg_blk{
916 struct apr_hdr hdr;
917 u32 param_id;
918 u32 param_size;
919 struct asm_encode_cfg_blk enc_blk;
920} __attribute__((packed));
921
922struct asm_stream_cmd_encdec_sbc_bitrate{
923 struct apr_hdr hdr;
924 u32 param_id;
925 struct asm_sbc_bitrate sbc_bitrate;
926} __attribute__((packed));
927
928struct asm_stream_cmd_encdec_immed_decode{
929 struct apr_hdr hdr;
930 u32 param_id;
931 u32 param_size;
932 struct asm_immed_decode dec;
933} __attribute__((packed));
934
935struct asm_stream_cmd_encdec_sbr{
936 struct apr_hdr hdr;
937 u32 param_id;
938 u32 param_size;
939 struct asm_sbr_ps sbr_ps;
940} __attribute__((packed));
941
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700942struct asm_stream_cmd_encdec_dualmono {
943 struct apr_hdr hdr;
944 u32 param_id;
945 u32 param_size;
946 struct asm_dual_mono channel_map;
947} __packed;
948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
950struct asm_stream_cmd_adjust_samples{
951 struct apr_hdr hdr;
952 u16 nsamples;
953 u16 reserved;
954} __attribute__((packed));
955
956#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
957struct asm_stream_cmd_tap_popp_pcm{
958 struct apr_hdr hdr;
959 u16 enable;
960 u16 reserved;
961 u32 module_id;
962} __attribute__((packed));
963
964/* Session Level commands */
965#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
966struct asm_stream_cmd_memory_map{
967 struct apr_hdr hdr;
968 u32 buf_add;
969 u32 buf_size;
970 u16 mempool_id;
971 u16 reserved;
972} __attribute__((packed));
973
974#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
975struct asm_stream_cmd_memory_unmap{
976 struct apr_hdr hdr;
977 u32 buf_add;
978} __attribute__((packed));
979
980#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
981struct asm_memory_map_regions{
982 u32 phys;
983 u32 buf_size;
984} __attribute__((packed));
985
986struct asm_stream_cmd_memory_map_regions{
987 struct apr_hdr hdr;
988 u16 mempool_id;
989 u16 nregions;
990} __attribute__((packed));
991
992#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
993struct asm_memory_unmap_regions{
994 u32 phys;
995} __attribute__((packed));
996
997struct asm_stream_cmd_memory_unmap_regions{
998 struct apr_hdr hdr;
999 u16 nregions;
1000 u16 reserved;
1001} __attribute__((packed));
1002
1003#define ASM_SESSION_CMD_RUN 0x00010BD2
1004struct asm_stream_cmd_run{
1005 struct apr_hdr hdr;
1006 u32 flags;
1007 u32 msw_ts;
1008 u32 lsw_ts;
1009} __attribute__((packed));
1010
1011/* Session level events */
1012#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1013struct asm_stream_cmd_reg_rx_underflow_event{
1014 struct apr_hdr hdr;
1015 u16 enable;
1016 u16 reserved;
1017} __attribute__((packed));
1018
1019#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1020struct asm_stream_cmd_reg_tx_overflow_event{
1021 struct apr_hdr hdr;
1022 u16 enable;
1023 u16 reserved;
1024} __attribute__((packed));
1025
1026/* Data Path commands */
1027#define ASM_DATA_CMD_WRITE 0x00010BD9
1028struct asm_stream_cmd_write{
1029 struct apr_hdr hdr;
1030 u32 buf_add;
1031 u32 avail_bytes;
1032 u32 uid;
1033 u32 msw_ts;
1034 u32 lsw_ts;
1035 u32 uflags;
1036} __attribute__((packed));
1037
1038#define ASM_DATA_CMD_READ 0x00010BDA
1039struct asm_stream_cmd_read{
1040 struct apr_hdr hdr;
1041 u32 buf_add;
1042 u32 buf_size;
1043 u32 uid;
1044} __attribute__((packed));
1045
1046#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301047#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001048struct asm_stream_media_format_update{
1049 struct apr_hdr hdr;
1050 u32 format;
1051 u32 cfg_size;
1052 union {
1053 struct asm_pcm_cfg pcm_cfg;
1054 struct asm_adpcm_cfg adpcm_cfg;
1055 struct asm_yadpcm_cfg yadpcm_cfg;
1056 struct asm_midi_cfg midi_cfg;
1057 struct asm_wma_cfg wma_cfg;
1058 struct asm_wmapro_cfg wmapro_cfg;
1059 struct asm_aac_cfg aac_cfg;
1060 struct asm_flac_cfg flac_cfg;
1061 struct asm_vorbis_cfg vorbis_cfg;
1062 } __attribute__((packed)) write_cfg;
1063} __attribute__((packed));
1064
1065
1066/* Command Responses */
1067#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1068struct asm_stream_cmdrsp_get_readwrite_param{
1069 struct apr_hdr hdr;
1070 u32 status;
1071 u32 param_id;
1072 u16 param_size;
1073 u16 padding;
1074 union {
1075 struct asm_sbc_bitrate sbc_bitrate;
1076 struct asm_immed_decode aac_dec;
1077 } __attribute__((packed)) read_write_cfg;
1078} __attribute__((packed));
1079
1080
1081#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1082struct asm_stream_cmdrsp_get_session_time{
1083 struct apr_hdr hdr;
1084 u32 status;
1085 u32 msw_ts;
1086 u32 lsw_ts;
1087} __attribute__((packed));
1088
1089#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1090struct asm_data_event_write_done{
1091 u32 buf_add;
1092 u32 status;
1093} __attribute__((packed));
1094
1095#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1096struct asm_data_event_read_done{
1097 u32 status;
1098 u32 buffer_add;
1099 u32 enc_frame_size;
1100 u32 offset;
1101 u32 msw_ts;
1102 u32 lsw_ts;
1103 u32 flags;
1104 u32 num_frames;
1105 u32 id;
1106} __attribute__((packed));
1107
1108#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1109struct asm_data_event_sr_cm_change_notify {
1110 u32 sample_rate;
1111 u16 no_of_channels;
1112 u16 reserved;
1113 u8 channel_map[8];
1114} __packed;
1115
1116/* service level events */
1117
1118#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1119struct asm_svc_cmdrsp_get_strm_handles{
1120 struct apr_hdr hdr;
1121 u32 num_handles;
1122 u32 stream_handles;
1123} __attribute__((packed));
1124
1125
1126#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1127struct asm_svc_cmdrsp_get_wallclock_time{
1128 struct apr_hdr hdr;
1129 u32 status;
1130 u32 msw_ts;
1131 u32 lsw_ts;
1132} __attribute__((packed));
1133
1134/*
1135 * Error code
1136*/
1137#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1138#define ADSP_EFAILED 0x00000001 /* General failure. */
1139#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1140#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1141#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1142#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1143#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1144#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1145#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1146#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1147#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1148#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1149#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1150 processed. */
1151#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1152#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1153#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1154 to complete. */
1155#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1156 intervention to complete. */
1157#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1158#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1159
1160#endif /*_APR_AUDIO_H_*/