blob: 798ed89f4448c04ede8f756dbbfd7b42c9a248dc [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001
2/*
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _APR_AUDIO_H_
18#define _APR_AUDIO_H_
19
20/* ASM opcodes without APR payloads*/
21#include <mach/qdsp6v2/apr.h>
22
23/*
24 * Audio Front End (AFE)
25 */
26
27/* Port ID. Update afe_get_port_index when a new port is added here. */
28#define PRIMARY_I2S_RX 0 /* index = 0 */
29#define PRIMARY_I2S_TX 1 /* index = 1 */
30#define PCM_RX 2 /* index = 2 */
31#define PCM_TX 3 /* index = 3 */
32#define SECONDARY_I2S_RX 4 /* index = 4 */
33#define SECONDARY_I2S_TX 5 /* index = 5 */
34#define MI2S_RX 6 /* index = 6 */
35#define MI2S_TX 7 /* index = 7 */
36#define HDMI_RX 8 /* index = 8 */
37#define RSVD_2 9 /* index = 9 */
38#define RSVD_3 10 /* index = 10 */
39#define DIGI_MIC_TX 11 /* index = 11 */
40#define VOICE_RECORD_RX 0x8003 /* index = 12 */
41#define VOICE_RECORD_TX 0x8004 /* index = 13 */
42#define VOICE_PLAYBACK_TX 0x8005 /* index = 14 */
43
44/* Slimbus Multi channel port id pool */
45#define SLIMBUS_0_RX 0x4000 /* index = 15 */
46#define SLIMBUS_0_TX 0x4001 /* index = 16 */
47#define SLIMBUS_1_RX 0x4002 /* index = 17 */
48#define SLIMBUS_1_TX 0x4003 /* index = 18 */
49#define SLIMBUS_2_RX 0x4004
50#define SLIMBUS_2_TX 0x4005
51#define SLIMBUS_3_RX 0x4006
52#define SLIMBUS_3_TX 0x4007
53#define SLIMBUS_4_RX 0x4008
54#define SLIMBUS_4_TX 0x4009 /* index = 24 */
55
56#define INT_BT_SCO_RX 0x3000 /* index = 25 */
57#define INT_BT_SCO_TX 0x3001 /* index = 26 */
58#define INT_BT_A2DP_RX 0x3002 /* index = 27 */
59#define INT_FM_RX 0x3004 /* index = 28 */
60#define INT_FM_TX 0x3005 /* index = 29 */
Laxminath Kasam32657ec2011-08-01 19:26:57 +053061#define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */
62#define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063
64#define AFE_PORT_INVALID 0xFFFF
65
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 */
228 u16 reserved;
229} __attribute__ ((packed));
230
231struct afe_port_hdmi_cfg {
232 u16 bitwidth; /* 16,24,32 */
233 u16 channel_mode; /* HDMI Stereo = 0 */
234 /* HDMI_3Point1 (4-ch) = 1 */
235 /* HDMI_5Point1 (6-ch) = 2 */
236 /* HDMI_6Point1 (8-ch) = 3 */
237 u16 data_type; /* HDMI_Linear = 0 */
238 /* HDMI_non_Linaer = 1 */
239} __attribute__ ((packed));
240
241
242/* Slimbus Device Ids */
243#define AFE_SLIMBUS_DEVICE_1 0x0
244#define AFE_SLIMBUS_DEVICE_2 0x1
245#define AFE_PORT_MAX_AUDIO_CHAN_CNT 16
246
247struct afe_port_slimbus_cfg {
248 u16 slimbus_dev_id; /* SLIMBUS Device id.*/
249
250 u16 slave_dev_pgd_la; /* Slave ported generic device
251 * logical address.
252 */
253 u16 slave_dev_intfdev_la; /* Slave interface device logical
254 * address.
255 */
256 u16 bit_width; /** bit width of the samples, 16, 24.*/
257
258 u16 data_format; /** data format.*/
259
260 u16 num_channels; /** Number of channels.*/
261
262 /** Slave port mapping for respective channels.*/
263 u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
264
265 u16 reserved;
266} __packed;
267
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530268struct afe_port_rtproxy_cfg {
269 u16 bitwidth; /* 16,24,32 */
270 u16 interleaved; /* interleaved = 1 */
271 /* Noninterleaved = 0 */
272 u16 frame_sz; /* 5ms buffers = 160bytes */
273 u16 jitter; /* 10ms of jitter = 320 */
274 u16 lw_mark; /* Low watermark in bytes for triggering event*/
275 u16 hw_mark; /* High watermark bytes for triggering event*/
276 u16 rsvd;
277 int num_ch; /* 1 to 8 */
278} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279
280#define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
281
282union afe_port_config {
283 struct afe_port_pcm_cfg pcm;
284 struct afe_port_mi2s_cfg mi2s;
285 struct afe_port_hdmi_cfg hdmi;
286 struct afe_port_slimbus_cfg slimbus;
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530287 struct afe_port_rtproxy_cfg rtproxy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288} __attribute__((packed));
289
290struct afe_audioif_config_command {
291 struct apr_hdr hdr;
292 u16 port_id;
293 union afe_port_config port;
294} __attribute__ ((packed));
295
296#define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
297struct afe_codec_loopback_command {
298 u16 port_inf; /* Primary i2s = 0 */
299 /* PCM = 2 */
300 /* Secondary i2s = 4 */
301 /* Mi2s = 6 */
302 u16 enable; /* 0, disable. 1, enable */
303} __attribute__ ((packed));
304
305
306#define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300
307struct afe_param_sidetone_gain {
308 u16 gain;
309 u16 reserved;
310} __attribute__ ((packed));
311
312#define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
313struct afe_param_sampling_rate {
314 u32 sampling_rate;
315} __attribute__ ((packed));
316
317
318#define AFE_PARAM_ID_CHANNELS 0x00010302
319struct afe_param_channels {
320 u16 channels;
321 u16 reserved;
322} __attribute__ ((packed));
323
324
325#define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
326struct afe_param_loopback_gain {
327 u16 gain;
328 u16 reserved;
329} __attribute__ ((packed));
330
331
332#define AFE_MODULE_ID_PORT_INFO 0x00010200
333struct afe_param_payload {
334 u32 module_id;
335 u32 param_id;
336 u16 param_size;
337 u16 reserved;
338 union {
339 struct afe_param_sidetone_gain sidetone_gain;
340 struct afe_param_sampling_rate sampling_rate;
341 struct afe_param_channels channels;
342 struct afe_param_loopback_gain loopback_gain;
343 } __attribute__((packed)) param;
344} __attribute__ ((packed));
345
346#define AFE_PORT_CMD_SET_PARAM 0x000100dc
347
348struct afe_port_cmd_set_param {
349 struct apr_hdr hdr;
350 u16 port_id;
351 u16 payload_size;
352 u32 payload_address;
353 struct afe_param_payload payload;
354} __attribute__ ((packed));
355
356
357#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
358struct afe_get_active_ports_rsp {
359 u16 num_ports;
360 u16 port_id;
361} __attribute__ ((packed));
362
363
364#define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
365struct afe_get_active_handles_rsp {
366 u16 port_id;
367 u16 num_handles;
368 u16 mode; /* 0, voice rx */
369 /* 1, voice tx */
370 /* 2, audio rx */
371 /* 3, audio tx */
372 u16 handle;
373} __attribute__ ((packed));
374
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530375#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
376struct afe_cmd_memory_map {
377 struct apr_hdr hdr;
378 u32 phy_addr;
379 u32 mem_sz;
380 u16 mem_id;
381 u16 rsvd;
382} __packed;
383
384#define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
385struct afe_cmd_memory_unmap {
386 struct apr_hdr hdr;
387 u32 phy_addr;
388} __packed;
389
390#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
391struct afe_cmd_reg_rtport {
392 struct apr_hdr hdr;
393 u16 port_id;
394 u16 rsvd;
395} __packed;
396
397#define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
398struct afe_cmd_unreg_rtport {
399 struct apr_hdr hdr;
400 u16 port_id;
401 u16 rsvd;
402} __packed;
403
404#define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
405struct afe_cmd_rtport_wr {
406 struct apr_hdr hdr;
407 u16 port_id;
408 u16 rsvd;
409 u32 buf_addr;
410 u32 bytes_avail;
411} __packed;
412
413#define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3
414struct afe_cmd_rtport_rd {
415 struct apr_hdr hdr;
416 u16 port_id;
417 u16 rsvd;
418 u32 buf_addr;
419 u32 bytes_avail;
420} __packed;
421
422#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700424#define ADM_MAX_COPPS 5
425
426#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
427struct adm_get_copp_handles_command {
428 struct apr_hdr hdr;
429} __attribute__ ((packed));
430
431#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
432struct adm_routings_session {
433 u16 id;
434 u16 num_copps;
435 u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
436} __packed;
437
438struct adm_routings_command {
439 struct apr_hdr hdr;
440 u32 path; /* 0 = Rx, 1 Tx */
441 u32 num_sessions;
442 struct adm_routings_session session[8];
443} __attribute__ ((packed));
444
445
446#define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
447struct adm_ramp_gain {
448 struct apr_hdr hdr;
449 u16 session_id;
450 u16 copp_id;
451 u16 initial_gain;
452 u16 gain_increment;
453 u16 ramp_duration;
454 u16 reserved;
455} __attribute__ ((packed));
456
457struct adm_ramp_gains_command {
458 struct apr_hdr hdr;
459 u32 id;
460 u32 num_gains;
461 struct adm_ramp_gain gains[ADM_MAX_COPPS];
462} __attribute__ ((packed));
463
464
465#define ADM_CMD_COPP_OPEN 0x00010304
466struct adm_copp_open_command {
467 struct apr_hdr hdr;
468 u16 flags;
469 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
470 u16 endpoint_id1;
471 u16 endpoint_id2;
472 u32 topology_id;
473 u16 channel_config;
474 u16 reserved;
475 u32 rate;
476} __attribute__ ((packed));
477
478#define ADM_CMD_COPP_CLOSE 0x00010305
479
480#define ADM_CMD_MEMORY_MAP 0x00010C30
481struct adm_cmd_memory_map{
482 struct apr_hdr hdr;
483 u32 buf_add;
484 u32 buf_size;
485 u16 mempool_id;
486 u16 reserved;
487} __attribute__((packed));
488
489#define ADM_CMD_MEMORY_UNMAP 0x00010C31
490struct adm_cmd_memory_unmap{
491 struct apr_hdr hdr;
492 u32 buf_add;
493} __attribute__((packed));
494
495#define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
496struct adm_memory_map_regions{
497 u32 phys;
498 u32 buf_size;
499} __attribute__((packed));
500
501struct adm_cmd_memory_map_regions{
502 struct apr_hdr hdr;
503 u16 mempool_id;
504 u16 nregions;
505} __attribute__((packed));
506
507#define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
508struct adm_memory_unmap_regions{
509 u32 phys;
510} __attribute__((packed));
511
512struct adm_cmd_memory_unmap_regions{
513 struct apr_hdr hdr;
514 u16 nregions;
515 u16 reserved;
516} __attribute__((packed));
517
518#define DEFAULT_COPP_TOPOLOGY 0x00010be3
519#define DEFAULT_POPP_TOPOLOGY 0x00010be4
520#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
521#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
Jayasena Sangaraboina0fc197d2011-12-09 13:20:33 -0800522#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523
524#define ASM_MAX_EQ_BANDS 12
525
526struct asm_eq_band {
527 u32 band_idx; /* The band index, 0 .. 11 */
528 u32 filter_type; /* Filter band type */
529 u32 center_freq_hz; /* Filter band center frequency */
530 u32 filter_gain; /* Filter band initial gain (dB) */
531 /* Range is +12 dB to -12 dB with 1dB increments. */
532 u32 q_factor;
533} __attribute__ ((packed));
534
535struct asm_equalizer_params {
536 u32 enable;
537 u32 num_bands;
538 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
539} __attribute__ ((packed));
540
541struct asm_master_gain_params {
542 u16 master_gain;
543 u16 padding;
544} __attribute__ ((packed));
545
546struct asm_lrchannel_gain_params {
547 u16 left_gain;
548 u16 right_gain;
549} __attribute__ ((packed));
550
551struct asm_mute_params {
552 u32 muteflag;
553} __attribute__ ((packed));
554
555struct asm_softvolume_params {
556 u32 period;
557 u32 step;
558 u32 rampingcurve;
559} __attribute__ ((packed));
560
561struct asm_softpause_params {
562 u32 enable;
563 u32 period;
564 u32 step;
565 u32 rampingcurve;
566} __packed;
567
568struct asm_pp_param_data_hdr {
569 u32 module_id;
570 u32 param_id;
571 u16 param_size;
572 u16 reserved;
573} __attribute__ ((packed));
574
575struct asm_pp_params_command {
576 struct apr_hdr hdr;
577 u32 *payload;
578 u32 payload_size;
579 struct asm_pp_param_data_hdr params;
580} __attribute__ ((packed));
581
582#define EQUALIZER_MODULE_ID 0x00010c27
583#define EQUALIZER_PARAM_ID 0x00010c28
584
585#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
586#define MASTER_GAIN_PARAM_ID 0x00010bff
587#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
588#define MUTE_CONFIG_PARAM_ID 0x00010c01
589#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700590#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591
592#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
593#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
594#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
595
596#define MBADRC_MODULE_ID 0x00010c06
597#define MBADRC_ENABLE_PARAM_ID 0x00010c07
598#define MBADRC_CONFIG_PARAM_ID 0x00010c08
599
600
601#define ADM_CMD_SET_PARAMS 0x00010306
602#define ADM_CMD_GET_PARAMS 0x0001030B
603#define ADM_CMDRSP_GET_PARAMS 0x0001030C
604struct adm_set_params_command {
605 struct apr_hdr hdr;
606 u32 payload;
607 u32 payload_size;
608} __attribute__ ((packed));
609
610
611#define ADM_CMD_TAP_COPP_PCM 0x00010307
612struct adm_tap_copp_pcm_command {
613 struct apr_hdr hdr;
614} __attribute__ ((packed));
615
616
617/* QDSP6 to Client messages
618*/
619#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
620struct adm_get_copp_handles_respond {
621 struct apr_hdr hdr;
622 u32 handles;
623 u32 copp_id;
624} __attribute__ ((packed));
625
626#define ADM_CMDRSP_COPP_OPEN 0x0001030A
627struct adm_copp_open_respond {
628 u32 status;
629 u16 copp_id;
630 u16 reserved;
631} __attribute__ ((packed));
632
633#define ASM_STREAM_PRIORITY_NORMAL 0
634#define ASM_STREAM_PRIORITY_LOW 1
635#define ASM_STREAM_PRIORITY_HIGH 2
636#define ASM_STREAM_PRIORITY_RESERVED 3
637
638#define ASM_END_POINT_DEVICE_MATRIX 0
639#define ASM_END_POINT_STREAM 1
640
641#define AAC_ENC_MODE_AAC_LC 0x02
642#define AAC_ENC_MODE_AAC_P 0x05
643#define AAC_ENC_MODE_EAAC_P 0x1D
644
645#define ASM_STREAM_CMD_CLOSE 0x00010BCD
646#define ASM_STREAM_CMD_FLUSH 0x00010BCE
647#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
648#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
649#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
650#define ASM_SESSION_CMD_PAUSE 0x00010BD3
651#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
652#define ASM_DATA_CMD_EOS 0x00010BDB
653#define ASM_DATA_EVENT_EOS 0x00010BDD
654
655#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
656#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
657
658#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
659#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
660#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
661#define ASM_DATA_CMDRSP_EOS 0x00010C1C
662
663/* ASM Data structures */
664
665/* common declarations */
666struct asm_pcm_cfg {
667 u16 ch_cfg;
668 u16 bits_per_sample;
669 u32 sample_rate;
670 u16 is_signed;
671 u16 interleaved;
672};
673
674struct asm_adpcm_cfg {
675 u16 ch_cfg;
676 u16 bits_per_sample;
677 u32 sample_rate;
678 u32 block_size;
679};
680
681struct asm_yadpcm_cfg {
682 u16 ch_cfg;
683 u16 bits_per_sample;
684 u32 sample_rate;
685};
686
687struct asm_midi_cfg {
688 u32 nMode;
689};
690
691struct asm_wma_cfg {
692 u16 format_tag;
693 u16 ch_cfg;
694 u32 sample_rate;
695 u32 avg_bytes_per_sec;
696 u16 block_align;
697 u16 valid_bits_per_sample;
698 u32 ch_mask;
699 u16 encode_opt;
700 u16 adv_encode_opt;
701 u32 adv_encode_opt2;
702 u32 drc_peak_ref;
703 u32 drc_peak_target;
704 u32 drc_ave_ref;
705 u32 drc_ave_target;
706};
707
708struct asm_wmapro_cfg {
709 u16 format_tag;
710 u16 ch_cfg;
711 u32 sample_rate;
712 u32 avg_bytes_per_sec;
713 u16 block_align;
714 u16 valid_bits_per_sample;
715 u32 ch_mask;
716 u16 encode_opt;
717 u16 adv_encode_opt;
718 u32 adv_encode_opt2;
719 u32 drc_peak_ref;
720 u32 drc_peak_target;
721 u32 drc_ave_ref;
722 u32 drc_ave_target;
723};
724
725struct asm_aac_cfg {
726 u16 format;
727 u16 aot;
728 u16 ep_config;
729 u16 section_data_resilience;
730 u16 scalefactor_data_resilience;
731 u16 spectral_data_resilience;
732 u16 ch_cfg;
733 u16 reserved;
734 u32 sample_rate;
735};
736
737struct asm_flac_cfg {
738 u16 stream_info_present;
739 u16 min_blk_size;
740 u16 max_blk_size;
741 u16 ch_cfg;
742 u16 sample_size;
743 u16 sample_rate;
744 u16 md5_sum;
745 u32 ext_sample_rate;
746 u32 min_frame_size;
747 u32 max_frame_size;
748};
749
750struct asm_vorbis_cfg {
751 u32 ch_cfg;
752 u32 bit_rate;
753 u32 min_bit_rate;
754 u32 max_bit_rate;
755 u16 bit_depth_pcm_sample;
756 u16 bit_stream_format;
757};
758
759struct asm_aac_read_cfg {
760 u32 bitrate;
761 u32 enc_mode;
762 u16 format;
763 u16 ch_cfg;
764 u32 sample_rate;
765};
766
767struct asm_amrnb_read_cfg {
768 u16 mode;
769 u16 dtx_mode;
770};
771
Alex Wong2caeecc2011-10-28 10:52:15 +0530772struct asm_amrwb_read_cfg {
773 u16 mode;
774 u16 dtx_mode;
775};
776
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700777struct asm_evrc_read_cfg {
778 u16 max_rate;
779 u16 min_rate;
780 u16 rate_modulation_cmd;
781 u16 reserved;
782};
783
784struct asm_qcelp13_read_cfg {
785 u16 max_rate;
786 u16 min_rate;
787 u16 reduced_rate_level;
788 u16 rate_modulation_cmd;
789};
790
791struct asm_sbc_read_cfg {
792 u32 subband;
793 u32 block_len;
794 u32 ch_mode;
795 u32 alloc_method;
796 u32 bit_rate;
797 u32 sample_rate;
798};
799
800struct asm_sbc_bitrate {
801 u32 bitrate;
802};
803
804struct asm_immed_decode {
805 u32 mode;
806};
807
808struct asm_sbr_ps {
809 u32 enable;
810};
811
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700812struct asm_dual_mono {
813 u16 sce_left;
814 u16 sce_right;
815};
816
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700817struct asm_encode_cfg_blk {
818 u32 frames_per_buf;
819 u32 format_id;
820 u32 cfg_size;
821 union {
822 struct asm_pcm_cfg pcm;
823 struct asm_aac_read_cfg aac;
824 struct asm_amrnb_read_cfg amrnb;
825 struct asm_evrc_read_cfg evrc;
826 struct asm_qcelp13_read_cfg qcelp13;
827 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +0530828 struct asm_amrwb_read_cfg amrwb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700829 } __attribute__((packed)) cfg;
830};
831
832struct asm_frame_meta_info {
833 u32 offset_to_frame;
834 u32 frame_size;
835 u32 encoded_pcm_samples;
836 u32 msw_ts;
837 u32 lsw_ts;
838 u32 nflags;
839};
840
841/* Stream level commands */
842#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
843struct asm_stream_cmd_open_read {
844 struct apr_hdr hdr;
845 u32 uMode;
846 u32 src_endpoint;
847 u32 pre_proc_top;
848 u32 format;
849} __attribute__((packed));
850
851/* Supported formats */
852#define LINEAR_PCM 0x00010BE5
853#define DTMF 0x00010BE6
854#define ADPCM 0x00010BE7
855#define YADPCM 0x00010BE8
856#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700857#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +0530859#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700860#define V13K_FS 0x00010BED
861#define EVRC_FS 0x00010BEE
862#define EVRCB_FS 0x00010BEF
863#define EVRCWB_FS 0x00010BF0
864#define MIDI 0x00010BF1
865#define SBC 0x00010BF2
866#define WMA_V10PRO 0x00010BF3
867#define WMA_V9 0x00010BF4
868#define AMR_WB_PLUS 0x00010BF5
869#define AC3_DECODER 0x00010BF6
870#define G711_ALAW_FS 0x00010BF7
871#define G711_MLAW_FS 0x00010BF8
872#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700873#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +0200874#define US_POINT_EPOS_FORMAT 0x00012310
875#define US_RAW_FORMAT 0x0001127C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876
877#define ASM_ENCDEC_SBCRATE 0x00010C13
878#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
879#define ASM_ENCDEC_CFG_BLK 0x00010C2C
880
881#define ASM_ENCDEC_SBCRATE 0x00010C13
882#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
883#define ASM_ENCDEC_CFG_BLK 0x00010C2C
884
885#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
886struct asm_stream_cmd_open_write {
887 struct apr_hdr hdr;
888 u32 uMode;
889 u16 sink_endpoint;
890 u16 stream_handle;
891 u32 post_proc_top;
892 u32 format;
893} __attribute__((packed));
894
895#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
896
897struct asm_stream_cmd_open_read_write {
898 struct apr_hdr hdr;
899 u32 uMode;
900 u32 post_proc_top;
901 u32 write_format;
902 u32 read_format;
903} __attribute__((packed));
904
905#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
906#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
907#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
908#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700909#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700910struct asm_stream_cmd_encdec_cfg_blk{
911 struct apr_hdr hdr;
912 u32 param_id;
913 u32 param_size;
914 struct asm_encode_cfg_blk enc_blk;
915} __attribute__((packed));
916
917struct asm_stream_cmd_encdec_sbc_bitrate{
918 struct apr_hdr hdr;
919 u32 param_id;
920 struct asm_sbc_bitrate sbc_bitrate;
921} __attribute__((packed));
922
923struct asm_stream_cmd_encdec_immed_decode{
924 struct apr_hdr hdr;
925 u32 param_id;
926 u32 param_size;
927 struct asm_immed_decode dec;
928} __attribute__((packed));
929
930struct asm_stream_cmd_encdec_sbr{
931 struct apr_hdr hdr;
932 u32 param_id;
933 u32 param_size;
934 struct asm_sbr_ps sbr_ps;
935} __attribute__((packed));
936
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700937struct asm_stream_cmd_encdec_dualmono {
938 struct apr_hdr hdr;
939 u32 param_id;
940 u32 param_size;
941 struct asm_dual_mono channel_map;
942} __packed;
943
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700944#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
945struct asm_stream_cmd_adjust_samples{
946 struct apr_hdr hdr;
947 u16 nsamples;
948 u16 reserved;
949} __attribute__((packed));
950
951#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
952struct asm_stream_cmd_tap_popp_pcm{
953 struct apr_hdr hdr;
954 u16 enable;
955 u16 reserved;
956 u32 module_id;
957} __attribute__((packed));
958
959/* Session Level commands */
960#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
961struct asm_stream_cmd_memory_map{
962 struct apr_hdr hdr;
963 u32 buf_add;
964 u32 buf_size;
965 u16 mempool_id;
966 u16 reserved;
967} __attribute__((packed));
968
969#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
970struct asm_stream_cmd_memory_unmap{
971 struct apr_hdr hdr;
972 u32 buf_add;
973} __attribute__((packed));
974
975#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
976struct asm_memory_map_regions{
977 u32 phys;
978 u32 buf_size;
979} __attribute__((packed));
980
981struct asm_stream_cmd_memory_map_regions{
982 struct apr_hdr hdr;
983 u16 mempool_id;
984 u16 nregions;
985} __attribute__((packed));
986
987#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
988struct asm_memory_unmap_regions{
989 u32 phys;
990} __attribute__((packed));
991
992struct asm_stream_cmd_memory_unmap_regions{
993 struct apr_hdr hdr;
994 u16 nregions;
995 u16 reserved;
996} __attribute__((packed));
997
998#define ASM_SESSION_CMD_RUN 0x00010BD2
999struct asm_stream_cmd_run{
1000 struct apr_hdr hdr;
1001 u32 flags;
1002 u32 msw_ts;
1003 u32 lsw_ts;
1004} __attribute__((packed));
1005
1006/* Session level events */
1007#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1008struct asm_stream_cmd_reg_rx_underflow_event{
1009 struct apr_hdr hdr;
1010 u16 enable;
1011 u16 reserved;
1012} __attribute__((packed));
1013
1014#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1015struct asm_stream_cmd_reg_tx_overflow_event{
1016 struct apr_hdr hdr;
1017 u16 enable;
1018 u16 reserved;
1019} __attribute__((packed));
1020
1021/* Data Path commands */
1022#define ASM_DATA_CMD_WRITE 0x00010BD9
1023struct asm_stream_cmd_write{
1024 struct apr_hdr hdr;
1025 u32 buf_add;
1026 u32 avail_bytes;
1027 u32 uid;
1028 u32 msw_ts;
1029 u32 lsw_ts;
1030 u32 uflags;
1031} __attribute__((packed));
1032
1033#define ASM_DATA_CMD_READ 0x00010BDA
1034struct asm_stream_cmd_read{
1035 struct apr_hdr hdr;
1036 u32 buf_add;
1037 u32 buf_size;
1038 u32 uid;
1039} __attribute__((packed));
1040
1041#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301042#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001043struct asm_stream_media_format_update{
1044 struct apr_hdr hdr;
1045 u32 format;
1046 u32 cfg_size;
1047 union {
1048 struct asm_pcm_cfg pcm_cfg;
1049 struct asm_adpcm_cfg adpcm_cfg;
1050 struct asm_yadpcm_cfg yadpcm_cfg;
1051 struct asm_midi_cfg midi_cfg;
1052 struct asm_wma_cfg wma_cfg;
1053 struct asm_wmapro_cfg wmapro_cfg;
1054 struct asm_aac_cfg aac_cfg;
1055 struct asm_flac_cfg flac_cfg;
1056 struct asm_vorbis_cfg vorbis_cfg;
1057 } __attribute__((packed)) write_cfg;
1058} __attribute__((packed));
1059
1060
1061/* Command Responses */
1062#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1063struct asm_stream_cmdrsp_get_readwrite_param{
1064 struct apr_hdr hdr;
1065 u32 status;
1066 u32 param_id;
1067 u16 param_size;
1068 u16 padding;
1069 union {
1070 struct asm_sbc_bitrate sbc_bitrate;
1071 struct asm_immed_decode aac_dec;
1072 } __attribute__((packed)) read_write_cfg;
1073} __attribute__((packed));
1074
1075
1076#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1077struct asm_stream_cmdrsp_get_session_time{
1078 struct apr_hdr hdr;
1079 u32 status;
1080 u32 msw_ts;
1081 u32 lsw_ts;
1082} __attribute__((packed));
1083
1084#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1085struct asm_data_event_write_done{
1086 u32 buf_add;
1087 u32 status;
1088} __attribute__((packed));
1089
1090#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1091struct asm_data_event_read_done{
1092 u32 status;
1093 u32 buffer_add;
1094 u32 enc_frame_size;
1095 u32 offset;
1096 u32 msw_ts;
1097 u32 lsw_ts;
1098 u32 flags;
1099 u32 num_frames;
1100 u32 id;
1101} __attribute__((packed));
1102
1103#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1104struct asm_data_event_sr_cm_change_notify {
1105 u32 sample_rate;
1106 u16 no_of_channels;
1107 u16 reserved;
1108 u8 channel_map[8];
1109} __packed;
1110
1111/* service level events */
1112
1113#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1114struct asm_svc_cmdrsp_get_strm_handles{
1115 struct apr_hdr hdr;
1116 u32 num_handles;
1117 u32 stream_handles;
1118} __attribute__((packed));
1119
1120
1121#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1122struct asm_svc_cmdrsp_get_wallclock_time{
1123 struct apr_hdr hdr;
1124 u32 status;
1125 u32 msw_ts;
1126 u32 lsw_ts;
1127} __attribute__((packed));
1128
1129/*
1130 * Error code
1131*/
1132#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1133#define ADSP_EFAILED 0x00000001 /* General failure. */
1134#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1135#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1136#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1137#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1138#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1139#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1140#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1141#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1142#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1143#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1144#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1145 processed. */
1146#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1147#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1148#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1149 to complete. */
1150#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1151 intervention to complete. */
1152#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1153#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1154
1155#endif /*_APR_AUDIO_H_*/