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