blob: 9126bbb7217d10461c9735371b802b96852a6a1b [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
522
523#define ASM_MAX_EQ_BANDS 12
524
525struct asm_eq_band {
526 u32 band_idx; /* The band index, 0 .. 11 */
527 u32 filter_type; /* Filter band type */
528 u32 center_freq_hz; /* Filter band center frequency */
529 u32 filter_gain; /* Filter band initial gain (dB) */
530 /* Range is +12 dB to -12 dB with 1dB increments. */
531 u32 q_factor;
532} __attribute__ ((packed));
533
534struct asm_equalizer_params {
535 u32 enable;
536 u32 num_bands;
537 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
538} __attribute__ ((packed));
539
540struct asm_master_gain_params {
541 u16 master_gain;
542 u16 padding;
543} __attribute__ ((packed));
544
545struct asm_lrchannel_gain_params {
546 u16 left_gain;
547 u16 right_gain;
548} __attribute__ ((packed));
549
550struct asm_mute_params {
551 u32 muteflag;
552} __attribute__ ((packed));
553
554struct asm_softvolume_params {
555 u32 period;
556 u32 step;
557 u32 rampingcurve;
558} __attribute__ ((packed));
559
560struct asm_softpause_params {
561 u32 enable;
562 u32 period;
563 u32 step;
564 u32 rampingcurve;
565} __packed;
566
567struct asm_pp_param_data_hdr {
568 u32 module_id;
569 u32 param_id;
570 u16 param_size;
571 u16 reserved;
572} __attribute__ ((packed));
573
574struct asm_pp_params_command {
575 struct apr_hdr hdr;
576 u32 *payload;
577 u32 payload_size;
578 struct asm_pp_param_data_hdr params;
579} __attribute__ ((packed));
580
581#define EQUALIZER_MODULE_ID 0x00010c27
582#define EQUALIZER_PARAM_ID 0x00010c28
583
584#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
585#define MASTER_GAIN_PARAM_ID 0x00010bff
586#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
587#define MUTE_CONFIG_PARAM_ID 0x00010c01
588#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700589#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700590
591#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
592#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
593#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
594
595#define MBADRC_MODULE_ID 0x00010c06
596#define MBADRC_ENABLE_PARAM_ID 0x00010c07
597#define MBADRC_CONFIG_PARAM_ID 0x00010c08
598
599
600#define ADM_CMD_SET_PARAMS 0x00010306
601#define ADM_CMD_GET_PARAMS 0x0001030B
602#define ADM_CMDRSP_GET_PARAMS 0x0001030C
603struct adm_set_params_command {
604 struct apr_hdr hdr;
605 u32 payload;
606 u32 payload_size;
607} __attribute__ ((packed));
608
609
610#define ADM_CMD_TAP_COPP_PCM 0x00010307
611struct adm_tap_copp_pcm_command {
612 struct apr_hdr hdr;
613} __attribute__ ((packed));
614
615
616/* QDSP6 to Client messages
617*/
618#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
619struct adm_get_copp_handles_respond {
620 struct apr_hdr hdr;
621 u32 handles;
622 u32 copp_id;
623} __attribute__ ((packed));
624
625#define ADM_CMDRSP_COPP_OPEN 0x0001030A
626struct adm_copp_open_respond {
627 u32 status;
628 u16 copp_id;
629 u16 reserved;
630} __attribute__ ((packed));
631
632#define ASM_STREAM_PRIORITY_NORMAL 0
633#define ASM_STREAM_PRIORITY_LOW 1
634#define ASM_STREAM_PRIORITY_HIGH 2
635#define ASM_STREAM_PRIORITY_RESERVED 3
636
637#define ASM_END_POINT_DEVICE_MATRIX 0
638#define ASM_END_POINT_STREAM 1
639
640#define AAC_ENC_MODE_AAC_LC 0x02
641#define AAC_ENC_MODE_AAC_P 0x05
642#define AAC_ENC_MODE_EAAC_P 0x1D
643
644#define ASM_STREAM_CMD_CLOSE 0x00010BCD
645#define ASM_STREAM_CMD_FLUSH 0x00010BCE
646#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
647#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
648#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
649#define ASM_SESSION_CMD_PAUSE 0x00010BD3
650#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
651#define ASM_DATA_CMD_EOS 0x00010BDB
652#define ASM_DATA_EVENT_EOS 0x00010BDD
653
654#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
655#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
656
657#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
658#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
659#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
660#define ASM_DATA_CMDRSP_EOS 0x00010C1C
661
662/* ASM Data structures */
663
664/* common declarations */
665struct asm_pcm_cfg {
666 u16 ch_cfg;
667 u16 bits_per_sample;
668 u32 sample_rate;
669 u16 is_signed;
670 u16 interleaved;
671};
672
673struct asm_adpcm_cfg {
674 u16 ch_cfg;
675 u16 bits_per_sample;
676 u32 sample_rate;
677 u32 block_size;
678};
679
680struct asm_yadpcm_cfg {
681 u16 ch_cfg;
682 u16 bits_per_sample;
683 u32 sample_rate;
684};
685
686struct asm_midi_cfg {
687 u32 nMode;
688};
689
690struct asm_wma_cfg {
691 u16 format_tag;
692 u16 ch_cfg;
693 u32 sample_rate;
694 u32 avg_bytes_per_sec;
695 u16 block_align;
696 u16 valid_bits_per_sample;
697 u32 ch_mask;
698 u16 encode_opt;
699 u16 adv_encode_opt;
700 u32 adv_encode_opt2;
701 u32 drc_peak_ref;
702 u32 drc_peak_target;
703 u32 drc_ave_ref;
704 u32 drc_ave_target;
705};
706
707struct asm_wmapro_cfg {
708 u16 format_tag;
709 u16 ch_cfg;
710 u32 sample_rate;
711 u32 avg_bytes_per_sec;
712 u16 block_align;
713 u16 valid_bits_per_sample;
714 u32 ch_mask;
715 u16 encode_opt;
716 u16 adv_encode_opt;
717 u32 adv_encode_opt2;
718 u32 drc_peak_ref;
719 u32 drc_peak_target;
720 u32 drc_ave_ref;
721 u32 drc_ave_target;
722};
723
724struct asm_aac_cfg {
725 u16 format;
726 u16 aot;
727 u16 ep_config;
728 u16 section_data_resilience;
729 u16 scalefactor_data_resilience;
730 u16 spectral_data_resilience;
731 u16 ch_cfg;
732 u16 reserved;
733 u32 sample_rate;
734};
735
736struct asm_flac_cfg {
737 u16 stream_info_present;
738 u16 min_blk_size;
739 u16 max_blk_size;
740 u16 ch_cfg;
741 u16 sample_size;
742 u16 sample_rate;
743 u16 md5_sum;
744 u32 ext_sample_rate;
745 u32 min_frame_size;
746 u32 max_frame_size;
747};
748
749struct asm_vorbis_cfg {
750 u32 ch_cfg;
751 u32 bit_rate;
752 u32 min_bit_rate;
753 u32 max_bit_rate;
754 u16 bit_depth_pcm_sample;
755 u16 bit_stream_format;
756};
757
758struct asm_aac_read_cfg {
759 u32 bitrate;
760 u32 enc_mode;
761 u16 format;
762 u16 ch_cfg;
763 u32 sample_rate;
764};
765
766struct asm_amrnb_read_cfg {
767 u16 mode;
768 u16 dtx_mode;
769};
770
Alex Wong2caeecc2011-10-28 10:52:15 +0530771struct asm_amrwb_read_cfg {
772 u16 mode;
773 u16 dtx_mode;
774};
775
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700776struct asm_evrc_read_cfg {
777 u16 max_rate;
778 u16 min_rate;
779 u16 rate_modulation_cmd;
780 u16 reserved;
781};
782
783struct asm_qcelp13_read_cfg {
784 u16 max_rate;
785 u16 min_rate;
786 u16 reduced_rate_level;
787 u16 rate_modulation_cmd;
788};
789
790struct asm_sbc_read_cfg {
791 u32 subband;
792 u32 block_len;
793 u32 ch_mode;
794 u32 alloc_method;
795 u32 bit_rate;
796 u32 sample_rate;
797};
798
799struct asm_sbc_bitrate {
800 u32 bitrate;
801};
802
803struct asm_immed_decode {
804 u32 mode;
805};
806
807struct asm_sbr_ps {
808 u32 enable;
809};
810
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700811struct asm_dual_mono {
812 u16 sce_left;
813 u16 sce_right;
814};
815
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700816struct asm_encode_cfg_blk {
817 u32 frames_per_buf;
818 u32 format_id;
819 u32 cfg_size;
820 union {
821 struct asm_pcm_cfg pcm;
822 struct asm_aac_read_cfg aac;
823 struct asm_amrnb_read_cfg amrnb;
824 struct asm_evrc_read_cfg evrc;
825 struct asm_qcelp13_read_cfg qcelp13;
826 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +0530827 struct asm_amrwb_read_cfg amrwb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700828 } __attribute__((packed)) cfg;
829};
830
831struct asm_frame_meta_info {
832 u32 offset_to_frame;
833 u32 frame_size;
834 u32 encoded_pcm_samples;
835 u32 msw_ts;
836 u32 lsw_ts;
837 u32 nflags;
838};
839
840/* Stream level commands */
841#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
842struct asm_stream_cmd_open_read {
843 struct apr_hdr hdr;
844 u32 uMode;
845 u32 src_endpoint;
846 u32 pre_proc_top;
847 u32 format;
848} __attribute__((packed));
849
850/* Supported formats */
851#define LINEAR_PCM 0x00010BE5
852#define DTMF 0x00010BE6
853#define ADPCM 0x00010BE7
854#define YADPCM 0x00010BE8
855#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700856#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +0530858#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859#define V13K_FS 0x00010BED
860#define EVRC_FS 0x00010BEE
861#define EVRCB_FS 0x00010BEF
862#define EVRCWB_FS 0x00010BF0
863#define MIDI 0x00010BF1
864#define SBC 0x00010BF2
865#define WMA_V10PRO 0x00010BF3
866#define WMA_V9 0x00010BF4
867#define AMR_WB_PLUS 0x00010BF5
868#define AC3_DECODER 0x00010BF6
869#define G711_ALAW_FS 0x00010BF7
870#define G711_MLAW_FS 0x00010BF8
871#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -0700872#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +0200873#define US_POINT_EPOS_FORMAT 0x00012310
874#define US_RAW_FORMAT 0x0001127C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875
876#define ASM_ENCDEC_SBCRATE 0x00010C13
877#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
878#define ASM_ENCDEC_CFG_BLK 0x00010C2C
879
880#define ASM_ENCDEC_SBCRATE 0x00010C13
881#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
882#define ASM_ENCDEC_CFG_BLK 0x00010C2C
883
884#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
885struct asm_stream_cmd_open_write {
886 struct apr_hdr hdr;
887 u32 uMode;
888 u16 sink_endpoint;
889 u16 stream_handle;
890 u32 post_proc_top;
891 u32 format;
892} __attribute__((packed));
893
894#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
895
896struct asm_stream_cmd_open_read_write {
897 struct apr_hdr hdr;
898 u32 uMode;
899 u32 post_proc_top;
900 u32 write_format;
901 u32 read_format;
902} __attribute__((packed));
903
904#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
905#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
906#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
907#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700908#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909struct asm_stream_cmd_encdec_cfg_blk{
910 struct apr_hdr hdr;
911 u32 param_id;
912 u32 param_size;
913 struct asm_encode_cfg_blk enc_blk;
914} __attribute__((packed));
915
916struct asm_stream_cmd_encdec_sbc_bitrate{
917 struct apr_hdr hdr;
918 u32 param_id;
919 struct asm_sbc_bitrate sbc_bitrate;
920} __attribute__((packed));
921
922struct asm_stream_cmd_encdec_immed_decode{
923 struct apr_hdr hdr;
924 u32 param_id;
925 u32 param_size;
926 struct asm_immed_decode dec;
927} __attribute__((packed));
928
929struct asm_stream_cmd_encdec_sbr{
930 struct apr_hdr hdr;
931 u32 param_id;
932 u32 param_size;
933 struct asm_sbr_ps sbr_ps;
934} __attribute__((packed));
935
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -0700936struct asm_stream_cmd_encdec_dualmono {
937 struct apr_hdr hdr;
938 u32 param_id;
939 u32 param_size;
940 struct asm_dual_mono channel_map;
941} __packed;
942
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700943#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
944struct asm_stream_cmd_adjust_samples{
945 struct apr_hdr hdr;
946 u16 nsamples;
947 u16 reserved;
948} __attribute__((packed));
949
950#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
951struct asm_stream_cmd_tap_popp_pcm{
952 struct apr_hdr hdr;
953 u16 enable;
954 u16 reserved;
955 u32 module_id;
956} __attribute__((packed));
957
958/* Session Level commands */
959#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
960struct asm_stream_cmd_memory_map{
961 struct apr_hdr hdr;
962 u32 buf_add;
963 u32 buf_size;
964 u16 mempool_id;
965 u16 reserved;
966} __attribute__((packed));
967
968#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
969struct asm_stream_cmd_memory_unmap{
970 struct apr_hdr hdr;
971 u32 buf_add;
972} __attribute__((packed));
973
974#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
975struct asm_memory_map_regions{
976 u32 phys;
977 u32 buf_size;
978} __attribute__((packed));
979
980struct asm_stream_cmd_memory_map_regions{
981 struct apr_hdr hdr;
982 u16 mempool_id;
983 u16 nregions;
984} __attribute__((packed));
985
986#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
987struct asm_memory_unmap_regions{
988 u32 phys;
989} __attribute__((packed));
990
991struct asm_stream_cmd_memory_unmap_regions{
992 struct apr_hdr hdr;
993 u16 nregions;
994 u16 reserved;
995} __attribute__((packed));
996
997#define ASM_SESSION_CMD_RUN 0x00010BD2
998struct asm_stream_cmd_run{
999 struct apr_hdr hdr;
1000 u32 flags;
1001 u32 msw_ts;
1002 u32 lsw_ts;
1003} __attribute__((packed));
1004
1005/* Session level events */
1006#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1007struct asm_stream_cmd_reg_rx_underflow_event{
1008 struct apr_hdr hdr;
1009 u16 enable;
1010 u16 reserved;
1011} __attribute__((packed));
1012
1013#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1014struct asm_stream_cmd_reg_tx_overflow_event{
1015 struct apr_hdr hdr;
1016 u16 enable;
1017 u16 reserved;
1018} __attribute__((packed));
1019
1020/* Data Path commands */
1021#define ASM_DATA_CMD_WRITE 0x00010BD9
1022struct asm_stream_cmd_write{
1023 struct apr_hdr hdr;
1024 u32 buf_add;
1025 u32 avail_bytes;
1026 u32 uid;
1027 u32 msw_ts;
1028 u32 lsw_ts;
1029 u32 uflags;
1030} __attribute__((packed));
1031
1032#define ASM_DATA_CMD_READ 0x00010BDA
1033struct asm_stream_cmd_read{
1034 struct apr_hdr hdr;
1035 u32 buf_add;
1036 u32 buf_size;
1037 u32 uid;
1038} __attribute__((packed));
1039
1040#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301041#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001042struct asm_stream_media_format_update{
1043 struct apr_hdr hdr;
1044 u32 format;
1045 u32 cfg_size;
1046 union {
1047 struct asm_pcm_cfg pcm_cfg;
1048 struct asm_adpcm_cfg adpcm_cfg;
1049 struct asm_yadpcm_cfg yadpcm_cfg;
1050 struct asm_midi_cfg midi_cfg;
1051 struct asm_wma_cfg wma_cfg;
1052 struct asm_wmapro_cfg wmapro_cfg;
1053 struct asm_aac_cfg aac_cfg;
1054 struct asm_flac_cfg flac_cfg;
1055 struct asm_vorbis_cfg vorbis_cfg;
1056 } __attribute__((packed)) write_cfg;
1057} __attribute__((packed));
1058
1059
1060/* Command Responses */
1061#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1062struct asm_stream_cmdrsp_get_readwrite_param{
1063 struct apr_hdr hdr;
1064 u32 status;
1065 u32 param_id;
1066 u16 param_size;
1067 u16 padding;
1068 union {
1069 struct asm_sbc_bitrate sbc_bitrate;
1070 struct asm_immed_decode aac_dec;
1071 } __attribute__((packed)) read_write_cfg;
1072} __attribute__((packed));
1073
1074
1075#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1076struct asm_stream_cmdrsp_get_session_time{
1077 struct apr_hdr hdr;
1078 u32 status;
1079 u32 msw_ts;
1080 u32 lsw_ts;
1081} __attribute__((packed));
1082
1083#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1084struct asm_data_event_write_done{
1085 u32 buf_add;
1086 u32 status;
1087} __attribute__((packed));
1088
1089#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1090struct asm_data_event_read_done{
1091 u32 status;
1092 u32 buffer_add;
1093 u32 enc_frame_size;
1094 u32 offset;
1095 u32 msw_ts;
1096 u32 lsw_ts;
1097 u32 flags;
1098 u32 num_frames;
1099 u32 id;
1100} __attribute__((packed));
1101
1102#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1103struct asm_data_event_sr_cm_change_notify {
1104 u32 sample_rate;
1105 u16 no_of_channels;
1106 u16 reserved;
1107 u8 channel_map[8];
1108} __packed;
1109
1110/* service level events */
1111
1112#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1113struct asm_svc_cmdrsp_get_strm_handles{
1114 struct apr_hdr hdr;
1115 u32 num_handles;
1116 u32 stream_handles;
1117} __attribute__((packed));
1118
1119
1120#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1121struct asm_svc_cmdrsp_get_wallclock_time{
1122 struct apr_hdr hdr;
1123 u32 status;
1124 u32 msw_ts;
1125 u32 lsw_ts;
1126} __attribute__((packed));
1127
1128/*
1129 * Error code
1130*/
1131#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1132#define ADSP_EFAILED 0x00000001 /* General failure. */
1133#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1134#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1135#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1136#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1137#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1138#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1139#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1140#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1141#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1142#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1143#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1144 processed. */
1145#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1146#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1147#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1148 to complete. */
1149#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1150 intervention to complete. */
1151#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1152#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1153
1154#endif /*_APR_AUDIO_H_*/