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