blob: ec8d73e0d0c659c78eed7edf2feb08127e6c613b [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 *
Ben Rombergerb7603232011-11-23 17:16:27 -08003 * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _APR_AUDIO_H_
17#define _APR_AUDIO_H_
18
19/* ASM opcodes without APR payloads*/
20#include <mach/qdsp6v2/apr.h>
21
22/*
23 * Audio Front End (AFE)
24 */
25
26/* Port ID. Update afe_get_port_index when a new port is added here. */
27#define PRIMARY_I2S_RX 0 /* index = 0 */
28#define PRIMARY_I2S_TX 1 /* index = 1 */
29#define PCM_RX 2 /* index = 2 */
30#define PCM_TX 3 /* index = 3 */
31#define SECONDARY_I2S_RX 4 /* index = 4 */
32#define SECONDARY_I2S_TX 5 /* index = 5 */
33#define MI2S_RX 6 /* index = 6 */
34#define MI2S_TX 7 /* index = 7 */
35#define HDMI_RX 8 /* index = 8 */
36#define RSVD_2 9 /* index = 9 */
37#define RSVD_3 10 /* index = 10 */
38#define DIGI_MIC_TX 11 /* index = 11 */
39#define VOICE_RECORD_RX 0x8003 /* index = 12 */
40#define VOICE_RECORD_TX 0x8004 /* index = 13 */
41#define VOICE_PLAYBACK_TX 0x8005 /* index = 14 */
42
43/* Slimbus Multi channel port id pool */
44#define SLIMBUS_0_RX 0x4000 /* index = 15 */
45#define SLIMBUS_0_TX 0x4001 /* index = 16 */
46#define SLIMBUS_1_RX 0x4002 /* index = 17 */
47#define SLIMBUS_1_TX 0x4003 /* index = 18 */
48#define SLIMBUS_2_RX 0x4004
49#define SLIMBUS_2_TX 0x4005
50#define SLIMBUS_3_RX 0x4006
51#define SLIMBUS_3_TX 0x4007
52#define SLIMBUS_4_RX 0x4008
53#define SLIMBUS_4_TX 0x4009 /* index = 24 */
54
55#define INT_BT_SCO_RX 0x3000 /* index = 25 */
56#define INT_BT_SCO_TX 0x3001 /* index = 26 */
57#define INT_BT_A2DP_RX 0x3002 /* index = 27 */
58#define INT_FM_RX 0x3004 /* index = 28 */
59#define INT_FM_TX 0x3005 /* index = 29 */
Laxminath Kasam32657ec2011-08-01 19:26:57 +053060#define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */
61#define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */
Shiv Maliyappanahallia416ee22012-06-01 16:02:35 -070062#define SECONDARY_PCM_RX 12 /* index = 32 */
63#define SECONDARY_PCM_TX 13 /* index = 33 */
64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065
66#define AFE_PORT_INVALID 0xFFFF
Joonwoo Parkc924f3e2012-04-11 19:25:03 -070067#define SLIMBUS_EXTPROC_RX AFE_PORT_INVALID
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068
69#define AFE_PORT_CMD_START 0x000100ca
Laxminath Kasam32657ec2011-08-01 19:26:57 +053070
71#define AFE_EVENT_RTPORT_START 0
72#define AFE_EVENT_RTPORT_STOP 1
73#define AFE_EVENT_RTPORT_LOW_WM 2
74#define AFE_EVENT_RTPORT_HI_WM 3
75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076struct afe_port_start_command {
77 struct apr_hdr hdr;
78 u16 port_id;
79 u16 gain; /* Q13 */
80 u32 sample_rate; /* 8 , 16, 48khz */
81} __attribute__ ((packed));
82
83#define AFE_PORT_CMD_STOP 0x000100cb
84struct afe_port_stop_command {
85 struct apr_hdr hdr;
86 u16 port_id;
87 u16 reserved;
88} __attribute__ ((packed));
89
90#define AFE_PORT_CMD_APPLY_GAIN 0x000100cc
91struct afe_port_gain_command {
92 struct apr_hdr hdr;
93 u16 port_id;
94 u16 gain;/* Q13 */
95} __attribute__ ((packed));
96
97#define AFE_PORT_CMD_SIDETONE_CTL 0x000100cd
98struct afe_port_sidetone_command {
99 struct apr_hdr hdr;
100 u16 rx_port_id; /* Primary i2s tx = 1 */
101 /* PCM tx = 3 */
102 /* Secondary i2s tx = 5 */
103 /* Mi2s tx = 7 */
104 /* Digital mic tx = 11 */
105 u16 tx_port_id; /* Primary i2s rx = 0 */
106 /* PCM rx = 2 */
107 /* Secondary i2s rx = 4 */
108 /* Mi2S rx = 6 */
109 /* HDMI rx = 8 */
110 u16 gain; /* Q13 */
111 u16 enable; /* 1 = enable, 0 = disable */
112} __attribute__ ((packed));
113
114#define AFE_PORT_CMD_LOOPBACK 0x000100ce
115struct afe_loopback_command {
116 struct apr_hdr hdr;
117 u16 tx_port_id; /* Primary i2s rx = 0 */
118 /* PCM rx = 2 */
119 /* Secondary i2s rx = 4 */
120 /* Mi2S rx = 6 */
121 /* HDMI rx = 8 */
122 u16 rx_port_id; /* Primary i2s tx = 1 */
123 /* PCM tx = 3 */
124 /* Secondary i2s tx = 5 */
125 /* Mi2s tx = 7 */
126 /* Digital mic tx = 11 */
127 u16 mode; /* Default -1, DSP will conver
128 the tx to rx format */
129 u16 enable; /* 1 = enable, 0 = disable */
130} __attribute__ ((packed));
131
132#define AFE_PSEUDOPORT_CMD_START 0x000100cf
133struct afe_pseudoport_start_command {
134 struct apr_hdr hdr;
135 u16 port_id; /* Pseudo Port 1 = 0x8000 */
136 /* Pseudo Port 2 = 0x8001 */
137 /* Pseudo Port 3 = 0x8002 */
138 u16 timing; /* FTRT = 0 , AVTimer = 1, */
139} __attribute__ ((packed));
140
141#define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
142struct afe_pseudoport_stop_command {
143 struct apr_hdr hdr;
144 u16 port_id; /* Pseudo Port 1 = 0x8000 */
145 /* Pseudo Port 2 = 0x8001 */
146 /* Pseudo Port 3 = 0x8002 */
147 u16 reserved;
148} __attribute__ ((packed));
149
150#define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1
151
152
153#define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2
154struct afe_get_active_handles_command {
155 struct apr_hdr hdr;
156 u16 port_id;
157 u16 reserved;
158} __attribute__ ((packed));
159
160#define AFE_PCM_CFG_MODE_PCM 0x0
161#define AFE_PCM_CFG_MODE_AUX 0x1
162#define AFE_PCM_CFG_SYNC_EXT 0x0
163#define AFE_PCM_CFG_SYNC_INT 0x1
164#define AFE_PCM_CFG_FRM_8BPF 0x0
165#define AFE_PCM_CFG_FRM_16BPF 0x1
166#define AFE_PCM_CFG_FRM_32BPF 0x2
167#define AFE_PCM_CFG_FRM_64BPF 0x3
168#define AFE_PCM_CFG_FRM_128BPF 0x4
169#define AFE_PCM_CFG_FRM_256BPF 0x5
170#define AFE_PCM_CFG_QUANT_ALAW_NOPAD 0x0
171#define AFE_PCM_CFG_QUANT_MULAW_NOPAD 0x1
172#define AFE_PCM_CFG_QUANT_LINEAR_NOPAD 0x2
173#define AFE_PCM_CFG_QUANT_ALAW_PAD 0x3
174#define AFE_PCM_CFG_QUANT_MULAW_PAD 0x4
175#define AFE_PCM_CFG_QUANT_LINEAR_PAD 0x5
176#define AFE_PCM_CFG_CDATAOE_MASTER 0x0
177#define AFE_PCM_CFG_CDATAOE_SHARE 0x1
178
179struct afe_port_pcm_cfg {
180 u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */
181 u16 sync; /* external = 0 , internal = 1 */
182 u16 frame; /* 8 bpf = 0 */
183 /* 16 bpf = 1 */
184 /* 32 bpf = 2 */
185 /* 64 bpf = 3 */
186 /* 128 bpf = 4 */
187 /* 256 bpf = 5 */
188 u16 quant;
189 u16 slot; /* Slot for PCM stream , 0 - 31 */
190 u16 data; /* 0, PCM block is the only master */
191 /* 1, PCM block is shares to driver data out signal */
192 /* other master */
193 u16 reserved;
194} __attribute__ ((packed));
195
196enum {
197 AFE_I2S_SD0 = 1,
198 AFE_I2S_SD1,
199 AFE_I2S_SD2,
200 AFE_I2S_SD3,
201 AFE_I2S_QUAD01,
202 AFE_I2S_QUAD23,
203 AFE_I2S_6CHS,
204 AFE_I2S_8CHS,
205};
206
207#define AFE_MI2S_MONO 0
208#define AFE_MI2S_STEREO 3
209#define AFE_MI2S_4CHANNELS 4
210#define AFE_MI2S_6CHANNELS 6
211#define AFE_MI2S_8CHANNELS 8
212
213struct afe_port_mi2s_cfg {
214 u16 bitwidth; /* 16,24,32 */
215 u16 line; /* Called ChannelMode in documentation */
216 /* i2s_sd0 = 1 */
217 /* i2s_sd1 = 2 */
218 /* i2s_sd2 = 3 */
219 /* i2s_sd3 = 4 */
220 /* i2s_quad01 = 5 */
221 /* i2s_quad23 = 6 */
222 /* i2s_6chs = 7 */
223 /* i2s_8chs = 8 */
224 u16 channel; /* Called MonoStereo in documentation */
225 /* i2s mono = 0 */
226 /* i2s mono right = 1 */
227 /* i2s mono left = 2 */
228 /* i2s stereo = 3 */
229 u16 ws; /* 0, word select signal from external source */
230 /* 1, word select signal from internal source */
Kuirong Wanga36f2882012-04-02 19:45:26 -0700231 u16 format; /* don't touch this field if it is not for */
232 /* AFE_PORT_CMD_I2S_CONFIG opcode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233} __attribute__ ((packed));
234
235struct afe_port_hdmi_cfg {
236 u16 bitwidth; /* 16,24,32 */
237 u16 channel_mode; /* HDMI Stereo = 0 */
238 /* HDMI_3Point1 (4-ch) = 1 */
239 /* HDMI_5Point1 (6-ch) = 2 */
240 /* HDMI_6Point1 (8-ch) = 3 */
241 u16 data_type; /* HDMI_Linear = 0 */
Kiran Kandi5e809b02012-01-31 00:24:33 -0800242 /* HDMI_non_Linear = 1 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243} __attribute__ ((packed));
244
245
Kiran Kandi5e809b02012-01-31 00:24:33 -0800246struct afe_port_hdmi_multi_ch_cfg {
247 u16 data_type; /* HDMI_Linear = 0 */
248 /* HDMI_non_Linear = 1 */
249 u16 channel_allocation; /* The default is 0 (Stereo) */
250 u16 reserved; /* must be set to 0 */
251} __packed;
252
253
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254/* Slimbus Device Ids */
255#define AFE_SLIMBUS_DEVICE_1 0x0
256#define AFE_SLIMBUS_DEVICE_2 0x1
257#define AFE_PORT_MAX_AUDIO_CHAN_CNT 16
258
259struct afe_port_slimbus_cfg {
260 u16 slimbus_dev_id; /* SLIMBUS Device id.*/
261
262 u16 slave_dev_pgd_la; /* Slave ported generic device
263 * logical address.
264 */
265 u16 slave_dev_intfdev_la; /* Slave interface device logical
266 * address.
267 */
268 u16 bit_width; /** bit width of the samples, 16, 24.*/
269
270 u16 data_format; /** data format.*/
271
272 u16 num_channels; /** Number of channels.*/
273
274 /** Slave port mapping for respective channels.*/
275 u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
276
277 u16 reserved;
278} __packed;
279
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800280struct afe_port_slimbus_sch_cfg {
281 u16 slimbus_dev_id; /* SLIMBUS Device id.*/
282 u16 bit_width; /** bit width of the samples, 16, 24.*/
283 u16 data_format; /** data format.*/
284 u16 num_channels; /** Number of channels.*/
285 u16 reserved;
286 /** Slave channel mapping for respective channels.*/
287 u8 slave_ch_mapping[8];
288} __packed;
289
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530290struct afe_port_rtproxy_cfg {
291 u16 bitwidth; /* 16,24,32 */
292 u16 interleaved; /* interleaved = 1 */
293 /* Noninterleaved = 0 */
294 u16 frame_sz; /* 5ms buffers = 160bytes */
295 u16 jitter; /* 10ms of jitter = 320 */
296 u16 lw_mark; /* Low watermark in bytes for triggering event*/
297 u16 hw_mark; /* High watermark bytes for triggering event*/
298 u16 rsvd;
299 int num_ch; /* 1 to 8 */
300} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800302#define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
303#define AFE_PORT_AUDIO_SLIM_SCH_CONFIG 0x000100e4
Kiran Kandi5e809b02012-01-31 00:24:33 -0800304#define AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG 0x000100D9
Kuirong Wanga36f2882012-04-02 19:45:26 -0700305#define AFE_PORT_CMD_I2S_CONFIG 0x000100E7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306
307union afe_port_config {
Bharath Ramachandramurthy9c79f132011-11-28 11:18:57 -0800308 struct afe_port_pcm_cfg pcm;
309 struct afe_port_mi2s_cfg mi2s;
310 struct afe_port_hdmi_cfg hdmi;
311 struct afe_port_hdmi_multi_ch_cfg hdmi_multi_ch;
312 struct afe_port_slimbus_cfg slimbus;
313 struct afe_port_slimbus_sch_cfg slim_sch;
314 struct afe_port_rtproxy_cfg rtproxy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315} __attribute__((packed));
316
317struct afe_audioif_config_command {
318 struct apr_hdr hdr;
319 u16 port_id;
320 union afe_port_config port;
321} __attribute__ ((packed));
322
323#define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
324struct afe_codec_loopback_command {
325 u16 port_inf; /* Primary i2s = 0 */
326 /* PCM = 2 */
327 /* Secondary i2s = 4 */
328 /* Mi2s = 6 */
329 u16 enable; /* 0, disable. 1, enable */
330} __attribute__ ((packed));
331
332
333#define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300
334struct afe_param_sidetone_gain {
335 u16 gain;
336 u16 reserved;
337} __attribute__ ((packed));
338
339#define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
340struct afe_param_sampling_rate {
341 u32 sampling_rate;
342} __attribute__ ((packed));
343
344
345#define AFE_PARAM_ID_CHANNELS 0x00010302
346struct afe_param_channels {
347 u16 channels;
348 u16 reserved;
349} __attribute__ ((packed));
350
351
352#define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
353struct afe_param_loopback_gain {
354 u16 gain;
355 u16 reserved;
356} __attribute__ ((packed));
357
Neema Shetty74131ac2012-05-09 13:35:26 -0700358/* Parameter ID used to configure and enable/disable the loopback path. The
359 * difference with respect to the existing API, AFE_PORT_CMD_LOOPBACK, is that
360 * it allows Rx port to be configured as source port in loopback path. Port-id
361 * in AFE_PORT_CMD_SET_PARAM cmd is the source port whcih can be Tx or Rx port.
362 * In addition, we can configure the type of routing mode to handle different
363 * use cases.
364*/
365enum {
366 /* Regular loopback from source to destination port */
367 LB_MODE_DEFAULT = 1,
368 /* Sidetone feed from Tx source to Rx destination port */
369 LB_MODE_SIDETONE,
370 /* Echo canceller reference, voice + audio + DTMF */
371 LB_MODE_EC_REF_VOICE_AUDIO,
372 /* Echo canceller reference, voice alone */
373 LB_MODE_EC_REF_VOICE
374};
375
376#define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B
377#define AFE_API_VERSION_LOOPBACK_CONFIG 0x1
378struct afe_param_loopback_cfg {
379 /* Minor version used for tracking the version of the configuration
380 * interface.
381 */
382 uint32_t loopback_cfg_minor_version;
383
384 /* Destination Port Id. */
385 uint16_t dst_port_id;
386
387 /* Specifies data path type from src to dest port. Supported values:
388 * LB_MODE_DEFAULT
389 * LB_MODE_SIDETONE
390 * LB_MODE_EC_REF_VOICE_AUDIO
391 * LB_MODE_EC_REF_VOICE
392 */
393 uint16_t routing_mode;
394
395 /* Specifies whether to enable (1) or disable (0) an AFE loopback. */
396 uint16_t enable;
397
398 /* Reserved for 32-bit alignment. This field must be set to 0. */
399 uint16_t reserved;
400} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700401
402#define AFE_MODULE_ID_PORT_INFO 0x00010200
Neema Shetty74131ac2012-05-09 13:35:26 -0700403/* Module ID for the loopback-related parameters. */
404#define AFE_MODULE_LOOPBACK 0x00010205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700405struct afe_param_payload {
406 u32 module_id;
407 u32 param_id;
408 u16 param_size;
409 u16 reserved;
410 union {
411 struct afe_param_sidetone_gain sidetone_gain;
412 struct afe_param_sampling_rate sampling_rate;
413 struct afe_param_channels channels;
414 struct afe_param_loopback_gain loopback_gain;
Neema Shetty74131ac2012-05-09 13:35:26 -0700415 struct afe_param_loopback_cfg loopback_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700416 } __attribute__((packed)) param;
417} __attribute__ ((packed));
418
419#define AFE_PORT_CMD_SET_PARAM 0x000100dc
420
421struct afe_port_cmd_set_param {
422 struct apr_hdr hdr;
423 u16 port_id;
424 u16 payload_size;
425 u32 payload_address;
426 struct afe_param_payload payload;
427} __attribute__ ((packed));
428
Ben Rombergerb7603232011-11-23 17:16:27 -0800429struct afe_port_cmd_set_param_no_payload {
430 struct apr_hdr hdr;
431 u16 port_id;
432 u16 payload_size;
433 u32 payload_address;
434} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435
436#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
437struct afe_get_active_ports_rsp {
438 u16 num_ports;
439 u16 port_id;
440} __attribute__ ((packed));
441
442
443#define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
444struct afe_get_active_handles_rsp {
445 u16 port_id;
446 u16 num_handles;
447 u16 mode; /* 0, voice rx */
448 /* 1, voice tx */
449 /* 2, audio rx */
450 /* 3, audio tx */
451 u16 handle;
452} __attribute__ ((packed));
453
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530454#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
455struct afe_cmd_memory_map {
456 struct apr_hdr hdr;
457 u32 phy_addr;
458 u32 mem_sz;
459 u16 mem_id;
460 u16 rsvd;
461} __packed;
462
463#define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
464struct afe_cmd_memory_unmap {
465 struct apr_hdr hdr;
466 u32 phy_addr;
467} __packed;
468
469#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
470struct afe_cmd_reg_rtport {
471 struct apr_hdr hdr;
472 u16 port_id;
473 u16 rsvd;
474} __packed;
475
476#define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
477struct afe_cmd_unreg_rtport {
478 struct apr_hdr hdr;
479 u16 port_id;
480 u16 rsvd;
481} __packed;
482
483#define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
484struct afe_cmd_rtport_wr {
485 struct apr_hdr hdr;
486 u16 port_id;
487 u16 rsvd;
488 u32 buf_addr;
489 u32 bytes_avail;
490} __packed;
491
492#define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3
493struct afe_cmd_rtport_rd {
494 struct apr_hdr hdr;
495 u16 port_id;
496 u16 rsvd;
497 u32 buf_addr;
498 u32 bytes_avail;
499} __packed;
500
501#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
502
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700503#define ADM_MAX_COPPS 5
504
505#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
506struct adm_get_copp_handles_command {
507 struct apr_hdr hdr;
508} __attribute__ ((packed));
509
510#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
511struct adm_routings_session {
512 u16 id;
513 u16 num_copps;
514 u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
515} __packed;
516
517struct adm_routings_command {
518 struct apr_hdr hdr;
519 u32 path; /* 0 = Rx, 1 Tx */
520 u32 num_sessions;
521 struct adm_routings_session session[8];
522} __attribute__ ((packed));
523
524
525#define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
526struct adm_ramp_gain {
527 struct apr_hdr hdr;
528 u16 session_id;
529 u16 copp_id;
530 u16 initial_gain;
531 u16 gain_increment;
532 u16 ramp_duration;
533 u16 reserved;
534} __attribute__ ((packed));
535
536struct adm_ramp_gains_command {
537 struct apr_hdr hdr;
538 u32 id;
539 u32 num_gains;
540 struct adm_ramp_gain gains[ADM_MAX_COPPS];
541} __attribute__ ((packed));
542
543
544#define ADM_CMD_COPP_OPEN 0x00010304
545struct adm_copp_open_command {
546 struct apr_hdr hdr;
547 u16 flags;
548 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
549 u16 endpoint_id1;
550 u16 endpoint_id2;
551 u32 topology_id;
552 u16 channel_config;
553 u16 reserved;
554 u32 rate;
555} __attribute__ ((packed));
556
557#define ADM_CMD_COPP_CLOSE 0x00010305
558
Kiran Kandi5e809b02012-01-31 00:24:33 -0800559#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310
560struct adm_multi_ch_copp_open_command {
561 struct apr_hdr hdr;
562 u16 flags;
563 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
564 u16 endpoint_id1;
565 u16 endpoint_id2;
566 u32 topology_id;
567 u16 channel_config;
568 u16 reserved;
569 u32 rate;
570 u8 dev_channel_mapping[8];
571} __packed;
572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573#define ADM_CMD_MEMORY_MAP 0x00010C30
574struct adm_cmd_memory_map{
575 struct apr_hdr hdr;
576 u32 buf_add;
577 u32 buf_size;
578 u16 mempool_id;
579 u16 reserved;
580} __attribute__((packed));
581
582#define ADM_CMD_MEMORY_UNMAP 0x00010C31
583struct adm_cmd_memory_unmap{
584 struct apr_hdr hdr;
585 u32 buf_add;
586} __attribute__((packed));
587
588#define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
589struct adm_memory_map_regions{
590 u32 phys;
591 u32 buf_size;
592} __attribute__((packed));
593
594struct adm_cmd_memory_map_regions{
595 struct apr_hdr hdr;
596 u16 mempool_id;
597 u16 nregions;
598} __attribute__((packed));
599
600#define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
601struct adm_memory_unmap_regions{
602 u32 phys;
603} __attribute__((packed));
604
605struct adm_cmd_memory_unmap_regions{
606 struct apr_hdr hdr;
607 u16 nregions;
608 u16 reserved;
609} __attribute__((packed));
610
611#define DEFAULT_COPP_TOPOLOGY 0x00010be3
612#define DEFAULT_POPP_TOPOLOGY 0x00010be4
613#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
614#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
Jayasena Sangaraboina0fc197d2011-12-09 13:20:33 -0800615#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -0700617/* SRS TRUMEDIA GUIDS */
618/* topology */
619#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
620/* module */
621#define SRS_TRUMEDIA_MODULE_ID 0x10005010
622/* parameters */
623#define SRS_TRUMEDIA_PARAMS 0x10005011
624#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
625#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
626#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
627#define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015
628#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
629
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700630#define ASM_MAX_EQ_BANDS 12
631
632struct asm_eq_band {
633 u32 band_idx; /* The band index, 0 .. 11 */
634 u32 filter_type; /* Filter band type */
635 u32 center_freq_hz; /* Filter band center frequency */
636 u32 filter_gain; /* Filter band initial gain (dB) */
637 /* Range is +12 dB to -12 dB with 1dB increments. */
638 u32 q_factor;
639} __attribute__ ((packed));
640
641struct asm_equalizer_params {
642 u32 enable;
643 u32 num_bands;
644 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
645} __attribute__ ((packed));
646
647struct asm_master_gain_params {
648 u16 master_gain;
649 u16 padding;
650} __attribute__ ((packed));
651
652struct asm_lrchannel_gain_params {
653 u16 left_gain;
654 u16 right_gain;
655} __attribute__ ((packed));
656
657struct asm_mute_params {
658 u32 muteflag;
659} __attribute__ ((packed));
660
661struct asm_softvolume_params {
662 u32 period;
663 u32 step;
664 u32 rampingcurve;
665} __attribute__ ((packed));
666
667struct asm_softpause_params {
668 u32 enable;
669 u32 period;
670 u32 step;
671 u32 rampingcurve;
672} __packed;
673
674struct asm_pp_param_data_hdr {
675 u32 module_id;
676 u32 param_id;
677 u16 param_size;
678 u16 reserved;
679} __attribute__ ((packed));
680
681struct asm_pp_params_command {
682 struct apr_hdr hdr;
683 u32 *payload;
684 u32 payload_size;
685 struct asm_pp_param_data_hdr params;
686} __attribute__ ((packed));
687
688#define EQUALIZER_MODULE_ID 0x00010c27
689#define EQUALIZER_PARAM_ID 0x00010c28
690
691#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
692#define MASTER_GAIN_PARAM_ID 0x00010bff
693#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
694#define MUTE_CONFIG_PARAM_ID 0x00010c01
695#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700696#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700697
698#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
699#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
700#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
701
702#define MBADRC_MODULE_ID 0x00010c06
703#define MBADRC_ENABLE_PARAM_ID 0x00010c07
704#define MBADRC_CONFIG_PARAM_ID 0x00010c08
705
706
707#define ADM_CMD_SET_PARAMS 0x00010306
708#define ADM_CMD_GET_PARAMS 0x0001030B
709#define ADM_CMDRSP_GET_PARAMS 0x0001030C
710struct adm_set_params_command {
711 struct apr_hdr hdr;
712 u32 payload;
713 u32 payload_size;
714} __attribute__ ((packed));
715
716
717#define ADM_CMD_TAP_COPP_PCM 0x00010307
718struct adm_tap_copp_pcm_command {
719 struct apr_hdr hdr;
720} __attribute__ ((packed));
721
722
723/* QDSP6 to Client messages
724*/
725#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
726struct adm_get_copp_handles_respond {
727 struct apr_hdr hdr;
728 u32 handles;
729 u32 copp_id;
730} __attribute__ ((packed));
731
732#define ADM_CMDRSP_COPP_OPEN 0x0001030A
733struct adm_copp_open_respond {
734 u32 status;
735 u16 copp_id;
736 u16 reserved;
737} __attribute__ ((packed));
738
Kiran Kandi5e809b02012-01-31 00:24:33 -0800739#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
740
741
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700742#define ASM_STREAM_PRIORITY_NORMAL 0
743#define ASM_STREAM_PRIORITY_LOW 1
744#define ASM_STREAM_PRIORITY_HIGH 2
745#define ASM_STREAM_PRIORITY_RESERVED 3
746
747#define ASM_END_POINT_DEVICE_MATRIX 0
748#define ASM_END_POINT_STREAM 1
749
750#define AAC_ENC_MODE_AAC_LC 0x02
751#define AAC_ENC_MODE_AAC_P 0x05
752#define AAC_ENC_MODE_EAAC_P 0x1D
753
754#define ASM_STREAM_CMD_CLOSE 0x00010BCD
755#define ASM_STREAM_CMD_FLUSH 0x00010BCE
756#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
757#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
758#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
759#define ASM_SESSION_CMD_PAUSE 0x00010BD3
760#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
761#define ASM_DATA_CMD_EOS 0x00010BDB
762#define ASM_DATA_EVENT_EOS 0x00010BDD
763
764#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
765#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
766
767#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
768#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
769#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
770#define ASM_DATA_CMDRSP_EOS 0x00010C1C
771
772/* ASM Data structures */
773
774/* common declarations */
775struct asm_pcm_cfg {
776 u16 ch_cfg;
777 u16 bits_per_sample;
778 u32 sample_rate;
779 u16 is_signed;
780 u16 interleaved;
781};
782
Kiran Kandi5e809b02012-01-31 00:24:33 -0800783#define PCM_CHANNEL_NULL 0
784
785/* Front left channel. */
786#define PCM_CHANNEL_FL 1
787
788/* Front right channel. */
789#define PCM_CHANNEL_FR 2
790
791/* Front center channel. */
792#define PCM_CHANNEL_FC 3
793
794/* Left surround channel.*/
795#define PCM_CHANNEL_LS 4
796
797/* Right surround channel.*/
798#define PCM_CHANNEL_RS 5
799
800/* Low frequency effect channel. */
801#define PCM_CHANNEL_LFE 6
802
803/* Center surround channel; Rear center channel. */
804#define PCM_CHANNEL_CS 7
805
806/* Left back channel; Rear left channel. */
807#define PCM_CHANNEL_LB 8
808
809/* Right back channel; Rear right channel. */
810#define PCM_CHANNEL_RB 9
811
812/* Top surround channel. */
813#define PCM_CHANNEL_TS 10
814
815/* Center vertical height channel.*/
816#define PCM_CHANNEL_CVH 11
817
818/* Mono surround channel.*/
819#define PCM_CHANNEL_MS 12
820
821/* Front left of center. */
822#define PCM_CHANNEL_FLC 13
823
824/* Front right of center. */
825#define PCM_CHANNEL_FRC 14
826
827/* Rear left of center. */
828#define PCM_CHANNEL_RLC 15
829
830/* Rear right of center. */
831#define PCM_CHANNEL_RRC 16
832
833#define PCM_FORMAT_MAX_NUM_CHANNEL 8
834
Swaminathan Sathappan6f530882012-05-01 16:42:22 -0700835/* Maximum number of channels supported
836 * in ASM_ENCDEC_DEC_CHAN_MAP command
837 */
838#define MAX_CHAN_MAP_CHANNELS 16
Kiran Kandi5e809b02012-01-31 00:24:33 -0800839/*
840 * Multiple-channel PCM decoder format block structure used in the
841 * #ASM_STREAM_CMD_OPEN_WRITE command.
842 * The data must be in little-endian format.
843 */
844struct asm_multi_channel_pcm_fmt_blk {
845
846 u16 num_channels; /*
847 * Number of channels.
848 * Supported values:1 to 8
849 */
850
851 u16 bits_per_sample; /*
852 * Number of bits per sample per channel.
853 * Supported values: 16, 24 When used for
854 * playback, the client must send 24-bit
855 * samples packed in 32-bit words. The
856 * 24-bit samples must be placed in the most
857 * significant 24 bits of the 32-bit word. When
858 * used for recording, the aDSP sends 24-bit
859 * samples packed in 32-bit words. The 24-bit
860 * samples are placed in the most significant
861 * 24 bits of the 32-bit word.
862 */
863
864 u32 sample_rate; /*
865 * Number of samples per second
866 * (in Hertz). Supported values:
867 * 2000 to 48000
868 */
869
870 u16 is_signed; /*
871 * Flag that indicates the samples
872 * are signed (1).
873 */
874
875 u16 is_interleaved; /*
876 * Flag that indicates whether the channels are
877 * de-interleaved (0) or interleaved (1).
878 * Interleaved format means corresponding
879 * samples from the left and right channels are
880 * interleaved within the buffer.
881 * De-interleaved format means samples from
882 * each channel are contiguous in the buffer.
883 * The samples from one channel immediately
884 * follow those of the previous channel.
885 */
886
887 u8 channel_mapping[8]; /*
888 * Supported values:
889 * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
890 * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
891 * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
892 * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
893 * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
894 * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
895 * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
896 * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
897 * PCM_CHANNEL_RRC.
898 * Channel[i] mapping describes channel I. Each
899 * element i of the array describes channel I
900 * inside the buffer where I < num_channels.
901 * An unused channel is set to zero.
902 */
903};
904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905struct asm_adpcm_cfg {
906 u16 ch_cfg;
907 u16 bits_per_sample;
908 u32 sample_rate;
909 u32 block_size;
910};
911
912struct asm_yadpcm_cfg {
913 u16 ch_cfg;
914 u16 bits_per_sample;
915 u32 sample_rate;
916};
917
918struct asm_midi_cfg {
919 u32 nMode;
920};
921
922struct asm_wma_cfg {
923 u16 format_tag;
924 u16 ch_cfg;
925 u32 sample_rate;
926 u32 avg_bytes_per_sec;
927 u16 block_align;
928 u16 valid_bits_per_sample;
929 u32 ch_mask;
930 u16 encode_opt;
931 u16 adv_encode_opt;
932 u32 adv_encode_opt2;
933 u32 drc_peak_ref;
934 u32 drc_peak_target;
935 u32 drc_ave_ref;
936 u32 drc_ave_target;
937};
938
939struct asm_wmapro_cfg {
940 u16 format_tag;
941 u16 ch_cfg;
942 u32 sample_rate;
943 u32 avg_bytes_per_sec;
944 u16 block_align;
945 u16 valid_bits_per_sample;
946 u32 ch_mask;
947 u16 encode_opt;
948 u16 adv_encode_opt;
949 u32 adv_encode_opt2;
950 u32 drc_peak_ref;
951 u32 drc_peak_target;
952 u32 drc_ave_ref;
953 u32 drc_ave_target;
954};
955
956struct asm_aac_cfg {
957 u16 format;
958 u16 aot;
959 u16 ep_config;
960 u16 section_data_resilience;
961 u16 scalefactor_data_resilience;
962 u16 spectral_data_resilience;
963 u16 ch_cfg;
964 u16 reserved;
965 u32 sample_rate;
966};
967
968struct asm_flac_cfg {
969 u16 stream_info_present;
970 u16 min_blk_size;
971 u16 max_blk_size;
972 u16 ch_cfg;
973 u16 sample_size;
974 u16 sample_rate;
975 u16 md5_sum;
976 u32 ext_sample_rate;
977 u32 min_frame_size;
978 u32 max_frame_size;
979};
980
981struct asm_vorbis_cfg {
982 u32 ch_cfg;
983 u32 bit_rate;
984 u32 min_bit_rate;
985 u32 max_bit_rate;
986 u16 bit_depth_pcm_sample;
987 u16 bit_stream_format;
988};
989
990struct asm_aac_read_cfg {
991 u32 bitrate;
992 u32 enc_mode;
993 u16 format;
994 u16 ch_cfg;
995 u32 sample_rate;
996};
997
998struct asm_amrnb_read_cfg {
999 u16 mode;
1000 u16 dtx_mode;
1001};
1002
Alex Wong2caeecc2011-10-28 10:52:15 +05301003struct asm_amrwb_read_cfg {
1004 u16 mode;
1005 u16 dtx_mode;
1006};
1007
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008struct asm_evrc_read_cfg {
1009 u16 max_rate;
1010 u16 min_rate;
1011 u16 rate_modulation_cmd;
1012 u16 reserved;
1013};
1014
1015struct asm_qcelp13_read_cfg {
1016 u16 max_rate;
1017 u16 min_rate;
1018 u16 reduced_rate_level;
1019 u16 rate_modulation_cmd;
1020};
1021
1022struct asm_sbc_read_cfg {
1023 u32 subband;
1024 u32 block_len;
1025 u32 ch_mode;
1026 u32 alloc_method;
1027 u32 bit_rate;
1028 u32 sample_rate;
1029};
1030
1031struct asm_sbc_bitrate {
1032 u32 bitrate;
1033};
1034
1035struct asm_immed_decode {
1036 u32 mode;
1037};
1038
1039struct asm_sbr_ps {
1040 u32 enable;
1041};
1042
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001043struct asm_dual_mono {
1044 u16 sce_left;
1045 u16 sce_right;
1046};
1047
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001048struct asm_dec_chan_map {
1049 u32 num_channels; /* Number of decoder output
1050 * channels. A value of 0
1051 * indicates native channel
1052 * mapping, which is valid
1053 * only for NT mode. This
1054 * means the output of the
1055 * decoder is to be preserved
1056 * as is.
1057 */
1058
1059 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
1060 * num_channels. It can grow
1061 * till MAX_CHAN_MAP_CHANNELS.
1062 * Channel[i] mapping
1063 * describes channel I inside
1064 * the decoder output buffer.
1065 * Valid channel mapping
1066 * values are to be present at
1067 * the beginning of the array.
1068 * All remaining elements of
1069 * the array are to be filled
1070 * with PCM_CHANNEL_NULL.
1071 */
1072};
1073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001074struct asm_encode_cfg_blk {
1075 u32 frames_per_buf;
1076 u32 format_id;
1077 u32 cfg_size;
1078 union {
1079 struct asm_pcm_cfg pcm;
1080 struct asm_aac_read_cfg aac;
1081 struct asm_amrnb_read_cfg amrnb;
1082 struct asm_evrc_read_cfg evrc;
1083 struct asm_qcelp13_read_cfg qcelp13;
1084 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +05301085 struct asm_amrwb_read_cfg amrwb;
Mingming Yin647e9ea2012-03-17 19:56:10 -07001086 struct asm_multi_channel_pcm_fmt_blk mpcm;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087 } __attribute__((packed)) cfg;
1088};
1089
1090struct asm_frame_meta_info {
1091 u32 offset_to_frame;
1092 u32 frame_size;
1093 u32 encoded_pcm_samples;
1094 u32 msw_ts;
1095 u32 lsw_ts;
1096 u32 nflags;
1097};
1098
1099/* Stream level commands */
1100#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
1101struct asm_stream_cmd_open_read {
1102 struct apr_hdr hdr;
1103 u32 uMode;
1104 u32 src_endpoint;
1105 u32 pre_proc_top;
1106 u32 format;
1107} __attribute__((packed));
1108
1109/* Supported formats */
1110#define LINEAR_PCM 0x00010BE5
1111#define DTMF 0x00010BE6
1112#define ADPCM 0x00010BE7
1113#define YADPCM 0x00010BE8
1114#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001115#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001116#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +05301117#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001118#define V13K_FS 0x00010BED
1119#define EVRC_FS 0x00010BEE
1120#define EVRCB_FS 0x00010BEF
1121#define EVRCWB_FS 0x00010BF0
1122#define MIDI 0x00010BF1
1123#define SBC 0x00010BF2
1124#define WMA_V10PRO 0x00010BF3
1125#define WMA_V9 0x00010BF4
1126#define AMR_WB_PLUS 0x00010BF5
1127#define AC3_DECODER 0x00010BF6
Santosh Mardi23321202012-03-22 04:33:25 +05301128#define EAC3_DECODER 0x00010C3C
1129#define DTS 0x00010D88
1130#define ATRAC 0x00010D89
1131#define MAT 0x00010D8A
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001132#define G711_ALAW_FS 0x00010BF7
1133#define G711_MLAW_FS 0x00010BF8
1134#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001135#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +02001136#define US_POINT_EPOS_FORMAT 0x00012310
1137#define US_RAW_FORMAT 0x0001127C
Kiran Kandi5e809b02012-01-31 00:24:33 -08001138#define MULTI_CHANNEL_PCM 0x00010C66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001139
1140#define ASM_ENCDEC_SBCRATE 0x00010C13
1141#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1142#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1143
1144#define ASM_ENCDEC_SBCRATE 0x00010C13
1145#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1146#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1147
1148#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
1149struct asm_stream_cmd_open_write {
1150 struct apr_hdr hdr;
1151 u32 uMode;
1152 u16 sink_endpoint;
1153 u16 stream_handle;
1154 u32 post_proc_top;
1155 u32 format;
1156} __attribute__((packed));
1157
Santosh Mardi23321202012-03-22 04:33:25 +05301158#define IEC_61937_MASK 0x00000001
1159#define IEC_60958_MASK 0x00000002
1160
1161#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
1162struct asm_stream_cmd_open_write_compressed {
1163 struct apr_hdr hdr;
1164 u32 flags;
1165 u32 format;
1166} __packed;
1167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001168#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
1169
1170struct asm_stream_cmd_open_read_write {
1171 struct apr_hdr hdr;
1172 u32 uMode;
1173 u32 post_proc_top;
1174 u32 write_format;
1175 u32 read_format;
1176} __attribute__((packed));
1177
Santosh Mardi23321202012-03-22 04:33:25 +05301178#define ADM_CMD_CONNECT_AFE_PORT 0x00010320
1179
1180struct adm_cmd_connect_afe_port {
1181 struct apr_hdr hdr;
1182 u8 mode; /*mode represent the interface is for RX or TX*/
1183 u8 session_id; /*ASM session ID*/
1184 u16 afe_port_id;
1185} __packed;
1186
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001187#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
1188#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
1189#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
1190#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001191#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001192struct asm_stream_cmd_encdec_cfg_blk{
1193 struct apr_hdr hdr;
1194 u32 param_id;
1195 u32 param_size;
1196 struct asm_encode_cfg_blk enc_blk;
1197} __attribute__((packed));
1198
1199struct asm_stream_cmd_encdec_sbc_bitrate{
1200 struct apr_hdr hdr;
1201 u32 param_id;
1202 struct asm_sbc_bitrate sbc_bitrate;
1203} __attribute__((packed));
1204
1205struct asm_stream_cmd_encdec_immed_decode{
1206 struct apr_hdr hdr;
1207 u32 param_id;
1208 u32 param_size;
1209 struct asm_immed_decode dec;
1210} __attribute__((packed));
1211
1212struct asm_stream_cmd_encdec_sbr{
1213 struct apr_hdr hdr;
1214 u32 param_id;
1215 u32 param_size;
1216 struct asm_sbr_ps sbr_ps;
1217} __attribute__((packed));
1218
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001219struct asm_stream_cmd_encdec_dualmono {
1220 struct apr_hdr hdr;
1221 u32 param_id;
1222 u32 param_size;
1223 struct asm_dual_mono channel_map;
1224} __packed;
1225
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001226#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
1227struct asm_stream_cmd_encdec_channelmap {
1228 struct apr_hdr hdr;
1229 u32 param_id;
1230 u32 param_size;
1231 struct asm_dec_chan_map chan_map;
1232} __packed;
1233
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001234#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
1235struct asm_stream_cmd_adjust_samples{
1236 struct apr_hdr hdr;
1237 u16 nsamples;
1238 u16 reserved;
1239} __attribute__((packed));
1240
1241#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
1242struct asm_stream_cmd_tap_popp_pcm{
1243 struct apr_hdr hdr;
1244 u16 enable;
1245 u16 reserved;
1246 u32 module_id;
1247} __attribute__((packed));
1248
1249/* Session Level commands */
1250#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
1251struct asm_stream_cmd_memory_map{
1252 struct apr_hdr hdr;
1253 u32 buf_add;
1254 u32 buf_size;
1255 u16 mempool_id;
1256 u16 reserved;
1257} __attribute__((packed));
1258
1259#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
1260struct asm_stream_cmd_memory_unmap{
1261 struct apr_hdr hdr;
1262 u32 buf_add;
1263} __attribute__((packed));
1264
1265#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
1266struct asm_memory_map_regions{
1267 u32 phys;
1268 u32 buf_size;
1269} __attribute__((packed));
1270
1271struct asm_stream_cmd_memory_map_regions{
1272 struct apr_hdr hdr;
1273 u16 mempool_id;
1274 u16 nregions;
1275} __attribute__((packed));
1276
1277#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
1278struct asm_memory_unmap_regions{
1279 u32 phys;
1280} __attribute__((packed));
1281
1282struct asm_stream_cmd_memory_unmap_regions{
1283 struct apr_hdr hdr;
1284 u16 nregions;
1285 u16 reserved;
1286} __attribute__((packed));
1287
1288#define ASM_SESSION_CMD_RUN 0x00010BD2
1289struct asm_stream_cmd_run{
1290 struct apr_hdr hdr;
1291 u32 flags;
1292 u32 msw_ts;
1293 u32 lsw_ts;
1294} __attribute__((packed));
1295
1296/* Session level events */
1297#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1298struct asm_stream_cmd_reg_rx_underflow_event{
1299 struct apr_hdr hdr;
1300 u16 enable;
1301 u16 reserved;
1302} __attribute__((packed));
1303
1304#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1305struct asm_stream_cmd_reg_tx_overflow_event{
1306 struct apr_hdr hdr;
1307 u16 enable;
1308 u16 reserved;
1309} __attribute__((packed));
1310
1311/* Data Path commands */
1312#define ASM_DATA_CMD_WRITE 0x00010BD9
1313struct asm_stream_cmd_write{
1314 struct apr_hdr hdr;
1315 u32 buf_add;
1316 u32 avail_bytes;
1317 u32 uid;
1318 u32 msw_ts;
1319 u32 lsw_ts;
1320 u32 uflags;
1321} __attribute__((packed));
1322
1323#define ASM_DATA_CMD_READ 0x00010BDA
1324struct asm_stream_cmd_read{
1325 struct apr_hdr hdr;
1326 u32 buf_add;
1327 u32 buf_size;
1328 u32 uid;
1329} __attribute__((packed));
1330
1331#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301332#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333struct asm_stream_media_format_update{
1334 struct apr_hdr hdr;
1335 u32 format;
1336 u32 cfg_size;
1337 union {
1338 struct asm_pcm_cfg pcm_cfg;
1339 struct asm_adpcm_cfg adpcm_cfg;
1340 struct asm_yadpcm_cfg yadpcm_cfg;
1341 struct asm_midi_cfg midi_cfg;
1342 struct asm_wma_cfg wma_cfg;
1343 struct asm_wmapro_cfg wmapro_cfg;
1344 struct asm_aac_cfg aac_cfg;
1345 struct asm_flac_cfg flac_cfg;
1346 struct asm_vorbis_cfg vorbis_cfg;
Kiran Kandi5e809b02012-01-31 00:24:33 -08001347 struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001348 } __attribute__((packed)) write_cfg;
1349} __attribute__((packed));
1350
1351
1352/* Command Responses */
1353#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1354struct asm_stream_cmdrsp_get_readwrite_param{
1355 struct apr_hdr hdr;
1356 u32 status;
1357 u32 param_id;
1358 u16 param_size;
1359 u16 padding;
1360 union {
1361 struct asm_sbc_bitrate sbc_bitrate;
1362 struct asm_immed_decode aac_dec;
1363 } __attribute__((packed)) read_write_cfg;
1364} __attribute__((packed));
1365
1366
1367#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1368struct asm_stream_cmdrsp_get_session_time{
1369 struct apr_hdr hdr;
1370 u32 status;
1371 u32 msw_ts;
1372 u32 lsw_ts;
1373} __attribute__((packed));
1374
1375#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1376struct asm_data_event_write_done{
1377 u32 buf_add;
1378 u32 status;
1379} __attribute__((packed));
1380
1381#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1382struct asm_data_event_read_done{
1383 u32 status;
1384 u32 buffer_add;
1385 u32 enc_frame_size;
1386 u32 offset;
1387 u32 msw_ts;
1388 u32 lsw_ts;
1389 u32 flags;
1390 u32 num_frames;
1391 u32 id;
1392} __attribute__((packed));
1393
1394#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1395struct asm_data_event_sr_cm_change_notify {
1396 u32 sample_rate;
1397 u16 no_of_channels;
1398 u16 reserved;
1399 u8 channel_map[8];
1400} __packed;
1401
1402/* service level events */
1403
1404#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1405struct asm_svc_cmdrsp_get_strm_handles{
1406 struct apr_hdr hdr;
1407 u32 num_handles;
1408 u32 stream_handles;
1409} __attribute__((packed));
1410
1411
1412#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1413struct asm_svc_cmdrsp_get_wallclock_time{
1414 struct apr_hdr hdr;
1415 u32 status;
1416 u32 msw_ts;
1417 u32 lsw_ts;
1418} __attribute__((packed));
1419
1420/*
1421 * Error code
1422*/
1423#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1424#define ADSP_EFAILED 0x00000001 /* General failure. */
1425#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1426#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1427#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1428#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1429#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1430#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1431#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1432#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1433#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1434#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1435#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1436 processed. */
1437#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1438#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1439#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1440 to complete. */
1441#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1442 intervention to complete. */
1443#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1444#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1445
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -07001446/* SRS TRUMEDIA start */
1447#define SRS_ID_GLOBAL 0x00000001
1448#define SRS_ID_WOWHD 0x00000002
1449#define SRS_ID_CSHP 0x00000003
1450#define SRS_ID_HPF 0x00000004
1451#define SRS_ID_PEQ 0x00000005
1452#define SRS_ID_HL 0x00000006
1453
1454#define SRS_CMD_UPLOAD 0x7FFF0000
1455#define SRS_PARAM_INDEX_MASK 0x80000000
1456#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
1457#define SRS_PARAM_VALUE_MASK 0x0000FFFF
1458
1459struct srs_trumedia_params_GLOBAL {
1460 uint8_t v1;
1461 uint8_t v2;
1462 uint8_t v3;
1463 uint8_t v4;
1464 uint8_t v5;
1465 uint8_t v6;
1466 uint8_t v7;
1467 uint8_t v8;
1468} __packed;
1469
1470struct srs_trumedia_params_WOWHD {
1471 uint32_t v1;
1472 uint16_t v2;
1473 uint16_t v3;
1474 uint16_t v4;
1475 uint16_t v5;
1476 uint16_t v6;
1477 uint16_t v7;
1478 uint16_t v8;
1479 uint16_t v____A1;
1480 uint32_t v9;
1481 uint16_t v10;
1482 uint16_t v11;
1483 uint32_t v12[16];
1484} __packed;
1485
1486struct srs_trumedia_params_CSHP {
1487 uint32_t v1;
1488 uint16_t v2;
1489 uint16_t v3;
1490 uint16_t v4;
1491 uint16_t v5;
1492 uint16_t v6;
1493 uint16_t v____A1;
1494 uint32_t v7;
1495 uint16_t v8;
1496 uint16_t v9;
1497 uint32_t v10[16];
1498} __packed;
1499
1500struct srs_trumedia_params_HPF {
1501 uint32_t v1;
1502 uint32_t v2[26];
1503} __packed;
1504
1505struct srs_trumedia_params_PEQ {
1506 uint32_t v1;
1507 uint16_t v2;
1508 uint16_t v3;
1509 uint16_t v4;
1510 uint16_t v____A1;
1511 uint32_t v5[26];
1512 uint32_t v6[26];
1513} __packed;
1514
1515struct srs_trumedia_params_HL {
1516 uint16_t v1;
1517 uint16_t v2;
1518 uint16_t v3;
1519 uint16_t v____A1;
1520 int32_t v4;
1521 uint32_t v5;
1522 uint16_t v6;
1523 uint16_t v____A2;
1524 uint32_t v7;
1525} __packed;
1526
1527struct srs_trumedia_params {
1528 struct srs_trumedia_params_GLOBAL global;
1529 struct srs_trumedia_params_WOWHD wowhd;
1530 struct srs_trumedia_params_CSHP cshp;
1531 struct srs_trumedia_params_HPF hpf;
1532 struct srs_trumedia_params_PEQ peq;
1533 struct srs_trumedia_params_HL hl;
1534} __packed;
1535int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params);
1536/* SRS TruMedia end */
1537
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538#endif /*_APR_AUDIO_H_*/