blob: 51bb21648db2db7a80ae887b90ecad1ff81dd871 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 *
Amal Paul6e0f7982013-02-21 19:36:35 -08003 * Copyright (c) 2010-2013, The Linux Foundation. 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
Patrick Lai48da1492012-07-04 20:48:24 -0700405struct afe_param_payload_base {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700406 u32 module_id;
407 u32 param_id;
408 u16 param_size;
409 u16 reserved;
Patrick Lai48da1492012-07-04 20:48:24 -0700410} __packed;
411
412struct afe_param_payload {
413 struct afe_param_payload_base base;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414 union {
415 struct afe_param_sidetone_gain sidetone_gain;
416 struct afe_param_sampling_rate sampling_rate;
417 struct afe_param_channels channels;
418 struct afe_param_loopback_gain loopback_gain;
Neema Shetty74131ac2012-05-09 13:35:26 -0700419 struct afe_param_loopback_cfg loopback_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700420 } __attribute__((packed)) param;
421} __attribute__ ((packed));
422
423#define AFE_PORT_CMD_SET_PARAM 0x000100dc
424
425struct afe_port_cmd_set_param {
426 struct apr_hdr hdr;
427 u16 port_id;
428 u16 payload_size;
429 u32 payload_address;
430 struct afe_param_payload payload;
431} __attribute__ ((packed));
432
Ben Rombergerb7603232011-11-23 17:16:27 -0800433struct afe_port_cmd_set_param_no_payload {
434 struct apr_hdr hdr;
435 u16 port_id;
436 u16 payload_size;
437 u32 payload_address;
438} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700439
440#define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
441struct afe_get_active_ports_rsp {
442 u16 num_ports;
443 u16 port_id;
444} __attribute__ ((packed));
445
446
447#define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
448struct afe_get_active_handles_rsp {
449 u16 port_id;
450 u16 num_handles;
451 u16 mode; /* 0, voice rx */
452 /* 1, voice tx */
453 /* 2, audio rx */
454 /* 3, audio tx */
455 u16 handle;
456} __attribute__ ((packed));
457
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530458#define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
459struct afe_cmd_memory_map {
460 struct apr_hdr hdr;
461 u32 phy_addr;
462 u32 mem_sz;
463 u16 mem_id;
464 u16 rsvd;
465} __packed;
466
467#define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
468struct afe_cmd_memory_unmap {
469 struct apr_hdr hdr;
470 u32 phy_addr;
471} __packed;
472
473#define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
474struct afe_cmd_reg_rtport {
475 struct apr_hdr hdr;
476 u16 port_id;
477 u16 rsvd;
478} __packed;
479
480#define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
481struct afe_cmd_unreg_rtport {
482 struct apr_hdr hdr;
483 u16 port_id;
484 u16 rsvd;
485} __packed;
486
487#define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
488struct afe_cmd_rtport_wr {
489 struct apr_hdr hdr;
490 u16 port_id;
491 u16 rsvd;
492 u32 buf_addr;
493 u32 bytes_avail;
494} __packed;
495
496#define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3
497struct afe_cmd_rtport_rd {
498 struct apr_hdr hdr;
499 u16 port_id;
500 u16 rsvd;
501 u32 buf_addr;
502 u32 bytes_avail;
503} __packed;
504
505#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
506
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507#define ADM_MAX_COPPS 5
508
509#define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
510struct adm_get_copp_handles_command {
511 struct apr_hdr hdr;
512} __attribute__ ((packed));
513
514#define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
515struct adm_routings_session {
516 u16 id;
517 u16 num_copps;
518 u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
519} __packed;
520
521struct adm_routings_command {
522 struct apr_hdr hdr;
523 u32 path; /* 0 = Rx, 1 Tx */
524 u32 num_sessions;
525 struct adm_routings_session session[8];
526} __attribute__ ((packed));
527
528
529#define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
530struct adm_ramp_gain {
531 struct apr_hdr hdr;
532 u16 session_id;
533 u16 copp_id;
534 u16 initial_gain;
535 u16 gain_increment;
536 u16 ramp_duration;
537 u16 reserved;
538} __attribute__ ((packed));
539
540struct adm_ramp_gains_command {
541 struct apr_hdr hdr;
542 u32 id;
543 u32 num_gains;
544 struct adm_ramp_gain gains[ADM_MAX_COPPS];
545} __attribute__ ((packed));
546
547
548#define ADM_CMD_COPP_OPEN 0x00010304
549struct adm_copp_open_command {
550 struct apr_hdr hdr;
551 u16 flags;
552 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
553 u16 endpoint_id1;
554 u16 endpoint_id2;
555 u32 topology_id;
556 u16 channel_config;
557 u16 reserved;
558 u32 rate;
559} __attribute__ ((packed));
560
561#define ADM_CMD_COPP_CLOSE 0x00010305
562
Kiran Kandi5e809b02012-01-31 00:24:33 -0800563#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700564#define ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3 0x00010333
Kiran Kandi5e809b02012-01-31 00:24:33 -0800565struct adm_multi_ch_copp_open_command {
566 struct apr_hdr hdr;
567 u16 flags;
568 u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
569 u16 endpoint_id1;
570 u16 endpoint_id2;
571 u32 topology_id;
572 u16 channel_config;
573 u16 reserved;
574 u32 rate;
575 u8 dev_channel_mapping[8];
576} __packed;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577#define ADM_CMD_MEMORY_MAP 0x00010C30
578struct adm_cmd_memory_map{
579 struct apr_hdr hdr;
580 u32 buf_add;
581 u32 buf_size;
582 u16 mempool_id;
583 u16 reserved;
584} __attribute__((packed));
585
586#define ADM_CMD_MEMORY_UNMAP 0x00010C31
587struct adm_cmd_memory_unmap{
588 struct apr_hdr hdr;
589 u32 buf_add;
590} __attribute__((packed));
591
592#define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
593struct adm_memory_map_regions{
594 u32 phys;
595 u32 buf_size;
596} __attribute__((packed));
597
598struct adm_cmd_memory_map_regions{
599 struct apr_hdr hdr;
600 u16 mempool_id;
601 u16 nregions;
602} __attribute__((packed));
603
604#define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
605struct adm_memory_unmap_regions{
606 u32 phys;
607} __attribute__((packed));
608
609struct adm_cmd_memory_unmap_regions{
610 struct apr_hdr hdr;
611 u16 nregions;
612 u16 reserved;
613} __attribute__((packed));
614
615#define DEFAULT_COPP_TOPOLOGY 0x00010be3
616#define DEFAULT_POPP_TOPOLOGY 0x00010be4
617#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
618#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
Jayasena Sangaraboina0fc197d2011-12-09 13:20:33 -0800619#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700621#define LOWLATENCY_POPP_TOPOLOGY 0x00010C68
622#define LOWLATENCY_COPP_TOPOLOGY 0x00010312
623#define PCM_BITS_PER_SAMPLE 16
624
625#define ASM_OPEN_WRITE_PERF_MODE_BIT (1<<28)
626#define ASM_OPEN_READ_PERF_MODE_BIT (1<<29)
627#define ADM_MULTI_CH_COPP_OPEN_PERF_MODE_BIT (1<<13)
628
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -0700629/* SRS TRUMEDIA GUIDS */
630/* topology */
631#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
632/* module */
633#define SRS_TRUMEDIA_MODULE_ID 0x10005010
634/* parameters */
635#define SRS_TRUMEDIA_PARAMS 0x10005011
636#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
637#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
638#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
639#define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015
640#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
641
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642#define ASM_MAX_EQ_BANDS 12
643
644struct asm_eq_band {
645 u32 band_idx; /* The band index, 0 .. 11 */
646 u32 filter_type; /* Filter band type */
647 u32 center_freq_hz; /* Filter band center frequency */
648 u32 filter_gain; /* Filter band initial gain (dB) */
649 /* Range is +12 dB to -12 dB with 1dB increments. */
650 u32 q_factor;
651} __attribute__ ((packed));
652
653struct asm_equalizer_params {
654 u32 enable;
655 u32 num_bands;
656 struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
657} __attribute__ ((packed));
658
659struct asm_master_gain_params {
660 u16 master_gain;
661 u16 padding;
662} __attribute__ ((packed));
663
664struct asm_lrchannel_gain_params {
665 u16 left_gain;
666 u16 right_gain;
667} __attribute__ ((packed));
668
669struct asm_mute_params {
670 u32 muteflag;
671} __attribute__ ((packed));
672
673struct asm_softvolume_params {
674 u32 period;
675 u32 step;
676 u32 rampingcurve;
677} __attribute__ ((packed));
678
679struct asm_softpause_params {
680 u32 enable;
681 u32 period;
682 u32 step;
683 u32 rampingcurve;
684} __packed;
685
686struct asm_pp_param_data_hdr {
687 u32 module_id;
688 u32 param_id;
689 u16 param_size;
690 u16 reserved;
691} __attribute__ ((packed));
692
693struct asm_pp_params_command {
694 struct apr_hdr hdr;
695 u32 *payload;
696 u32 payload_size;
697 struct asm_pp_param_data_hdr params;
698} __attribute__ ((packed));
699
700#define EQUALIZER_MODULE_ID 0x00010c27
701#define EQUALIZER_PARAM_ID 0x00010c28
702
703#define VOLUME_CONTROL_MODULE_ID 0x00010bfe
704#define MASTER_GAIN_PARAM_ID 0x00010bff
705#define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
706#define MUTE_CONFIG_PARAM_ID 0x00010c01
707#define SOFT_PAUSE_PARAM_ID 0x00010D6A
Swaminathan Sathappanb0021cd2011-08-31 15:20:12 -0700708#define SOFT_VOLUME_PARAM_ID 0x00010C29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700709
710#define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
711#define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
712#define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
713
714#define MBADRC_MODULE_ID 0x00010c06
715#define MBADRC_ENABLE_PARAM_ID 0x00010c07
716#define MBADRC_CONFIG_PARAM_ID 0x00010c08
717
718
719#define ADM_CMD_SET_PARAMS 0x00010306
720#define ADM_CMD_GET_PARAMS 0x0001030B
721#define ADM_CMDRSP_GET_PARAMS 0x0001030C
722struct adm_set_params_command {
723 struct apr_hdr hdr;
724 u32 payload;
725 u32 payload_size;
726} __attribute__ ((packed));
727
728
729#define ADM_CMD_TAP_COPP_PCM 0x00010307
730struct adm_tap_copp_pcm_command {
731 struct apr_hdr hdr;
732} __attribute__ ((packed));
733
734
735/* QDSP6 to Client messages
736*/
737#define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
738struct adm_get_copp_handles_respond {
739 struct apr_hdr hdr;
740 u32 handles;
741 u32 copp_id;
742} __attribute__ ((packed));
743
744#define ADM_CMDRSP_COPP_OPEN 0x0001030A
745struct adm_copp_open_respond {
746 u32 status;
747 u16 copp_id;
748 u16 reserved;
749} __attribute__ ((packed));
750
Kiran Kandi5e809b02012-01-31 00:24:33 -0800751#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -0700752#define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN_V3 0x00010334
Kiran Kandi5e809b02012-01-31 00:24:33 -0800753
754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755#define ASM_STREAM_PRIORITY_NORMAL 0
756#define ASM_STREAM_PRIORITY_LOW 1
757#define ASM_STREAM_PRIORITY_HIGH 2
758#define ASM_STREAM_PRIORITY_RESERVED 3
759
760#define ASM_END_POINT_DEVICE_MATRIX 0
761#define ASM_END_POINT_STREAM 1
762
763#define AAC_ENC_MODE_AAC_LC 0x02
764#define AAC_ENC_MODE_AAC_P 0x05
765#define AAC_ENC_MODE_EAAC_P 0x1D
766
767#define ASM_STREAM_CMD_CLOSE 0x00010BCD
768#define ASM_STREAM_CMD_FLUSH 0x00010BCE
769#define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
770#define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
771#define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
772#define ASM_SESSION_CMD_PAUSE 0x00010BD3
773#define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
774#define ASM_DATA_CMD_EOS 0x00010BDB
775#define ASM_DATA_EVENT_EOS 0x00010BDD
776
777#define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
778#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
779
780#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
781#define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
782#define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
783#define ASM_DATA_CMDRSP_EOS 0x00010C1C
784
785/* ASM Data structures */
786
787/* common declarations */
788struct asm_pcm_cfg {
789 u16 ch_cfg;
790 u16 bits_per_sample;
791 u32 sample_rate;
792 u16 is_signed;
793 u16 interleaved;
794};
795
Kiran Kandi5e809b02012-01-31 00:24:33 -0800796#define PCM_CHANNEL_NULL 0
797
798/* Front left channel. */
799#define PCM_CHANNEL_FL 1
800
801/* Front right channel. */
802#define PCM_CHANNEL_FR 2
803
804/* Front center channel. */
805#define PCM_CHANNEL_FC 3
806
807/* Left surround channel.*/
808#define PCM_CHANNEL_LS 4
809
810/* Right surround channel.*/
811#define PCM_CHANNEL_RS 5
812
813/* Low frequency effect channel. */
814#define PCM_CHANNEL_LFE 6
815
816/* Center surround channel; Rear center channel. */
817#define PCM_CHANNEL_CS 7
818
819/* Left back channel; Rear left channel. */
820#define PCM_CHANNEL_LB 8
821
822/* Right back channel; Rear right channel. */
823#define PCM_CHANNEL_RB 9
824
825/* Top surround channel. */
826#define PCM_CHANNEL_TS 10
827
828/* Center vertical height channel.*/
829#define PCM_CHANNEL_CVH 11
830
831/* Mono surround channel.*/
832#define PCM_CHANNEL_MS 12
833
834/* Front left of center. */
835#define PCM_CHANNEL_FLC 13
836
837/* Front right of center. */
838#define PCM_CHANNEL_FRC 14
839
840/* Rear left of center. */
841#define PCM_CHANNEL_RLC 15
842
843/* Rear right of center. */
844#define PCM_CHANNEL_RRC 16
845
846#define PCM_FORMAT_MAX_NUM_CHANNEL 8
847
Swaminathan Sathappan6f530882012-05-01 16:42:22 -0700848/* Maximum number of channels supported
849 * in ASM_ENCDEC_DEC_CHAN_MAP command
850 */
851#define MAX_CHAN_MAP_CHANNELS 16
Kiran Kandi5e809b02012-01-31 00:24:33 -0800852/*
853 * Multiple-channel PCM decoder format block structure used in the
854 * #ASM_STREAM_CMD_OPEN_WRITE command.
855 * The data must be in little-endian format.
856 */
857struct asm_multi_channel_pcm_fmt_blk {
858
859 u16 num_channels; /*
860 * Number of channels.
861 * Supported values:1 to 8
862 */
863
864 u16 bits_per_sample; /*
865 * Number of bits per sample per channel.
866 * Supported values: 16, 24 When used for
867 * playback, the client must send 24-bit
868 * samples packed in 32-bit words. The
869 * 24-bit samples must be placed in the most
870 * significant 24 bits of the 32-bit word. When
871 * used for recording, the aDSP sends 24-bit
872 * samples packed in 32-bit words. The 24-bit
873 * samples are placed in the most significant
874 * 24 bits of the 32-bit word.
875 */
876
877 u32 sample_rate; /*
878 * Number of samples per second
879 * (in Hertz). Supported values:
880 * 2000 to 48000
881 */
882
883 u16 is_signed; /*
884 * Flag that indicates the samples
885 * are signed (1).
886 */
887
888 u16 is_interleaved; /*
889 * Flag that indicates whether the channels are
890 * de-interleaved (0) or interleaved (1).
891 * Interleaved format means corresponding
892 * samples from the left and right channels are
893 * interleaved within the buffer.
894 * De-interleaved format means samples from
895 * each channel are contiguous in the buffer.
896 * The samples from one channel immediately
897 * follow those of the previous channel.
898 */
899
900 u8 channel_mapping[8]; /*
901 * Supported values:
902 * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
903 * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
904 * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
905 * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
906 * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
907 * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
908 * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
909 * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
910 * PCM_CHANNEL_RRC.
911 * Channel[i] mapping describes channel I. Each
912 * element i of the array describes channel I
913 * inside the buffer where I < num_channels.
914 * An unused channel is set to zero.
915 */
916};
917
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918struct asm_adpcm_cfg {
919 u16 ch_cfg;
920 u16 bits_per_sample;
921 u32 sample_rate;
922 u32 block_size;
923};
924
925struct asm_yadpcm_cfg {
926 u16 ch_cfg;
927 u16 bits_per_sample;
928 u32 sample_rate;
929};
930
931struct asm_midi_cfg {
932 u32 nMode;
933};
934
935struct asm_wma_cfg {
936 u16 format_tag;
937 u16 ch_cfg;
938 u32 sample_rate;
939 u32 avg_bytes_per_sec;
940 u16 block_align;
941 u16 valid_bits_per_sample;
942 u32 ch_mask;
943 u16 encode_opt;
944 u16 adv_encode_opt;
945 u32 adv_encode_opt2;
946 u32 drc_peak_ref;
947 u32 drc_peak_target;
948 u32 drc_ave_ref;
949 u32 drc_ave_target;
950};
951
952struct asm_wmapro_cfg {
953 u16 format_tag;
954 u16 ch_cfg;
955 u32 sample_rate;
956 u32 avg_bytes_per_sec;
957 u16 block_align;
958 u16 valid_bits_per_sample;
959 u32 ch_mask;
960 u16 encode_opt;
961 u16 adv_encode_opt;
962 u32 adv_encode_opt2;
963 u32 drc_peak_ref;
964 u32 drc_peak_target;
965 u32 drc_ave_ref;
966 u32 drc_ave_target;
967};
968
969struct asm_aac_cfg {
970 u16 format;
971 u16 aot;
972 u16 ep_config;
973 u16 section_data_resilience;
974 u16 scalefactor_data_resilience;
975 u16 spectral_data_resilience;
976 u16 ch_cfg;
977 u16 reserved;
978 u32 sample_rate;
979};
980
Ajit Khare43fd8832012-08-07 13:19:44 -0700981struct asm_amrwbplus_cfg {
982 u32 size_bytes;
983 u32 version;
984 u32 num_channels;
985 u32 amr_band_mode;
986 u32 amr_dtx_mode;
987 u32 amr_frame_fmt;
988 u32 amr_lsf_idx;
989};
990
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700991struct asm_flac_cfg {
992 u16 stream_info_present;
993 u16 min_blk_size;
994 u16 max_blk_size;
995 u16 ch_cfg;
996 u16 sample_size;
997 u16 sample_rate;
998 u16 md5_sum;
999 u32 ext_sample_rate;
1000 u32 min_frame_size;
1001 u32 max_frame_size;
1002};
1003
1004struct asm_vorbis_cfg {
1005 u32 ch_cfg;
1006 u32 bit_rate;
1007 u32 min_bit_rate;
1008 u32 max_bit_rate;
1009 u16 bit_depth_pcm_sample;
1010 u16 bit_stream_format;
1011};
1012
1013struct asm_aac_read_cfg {
1014 u32 bitrate;
1015 u32 enc_mode;
1016 u16 format;
1017 u16 ch_cfg;
1018 u32 sample_rate;
1019};
1020
1021struct asm_amrnb_read_cfg {
1022 u16 mode;
1023 u16 dtx_mode;
1024};
1025
Alex Wong2caeecc2011-10-28 10:52:15 +05301026struct asm_amrwb_read_cfg {
1027 u16 mode;
1028 u16 dtx_mode;
1029};
1030
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001031struct asm_evrc_read_cfg {
1032 u16 max_rate;
1033 u16 min_rate;
1034 u16 rate_modulation_cmd;
1035 u16 reserved;
1036};
1037
1038struct asm_qcelp13_read_cfg {
1039 u16 max_rate;
1040 u16 min_rate;
1041 u16 reduced_rate_level;
1042 u16 rate_modulation_cmd;
1043};
1044
1045struct asm_sbc_read_cfg {
1046 u32 subband;
1047 u32 block_len;
1048 u32 ch_mode;
1049 u32 alloc_method;
1050 u32 bit_rate;
1051 u32 sample_rate;
1052};
1053
1054struct asm_sbc_bitrate {
1055 u32 bitrate;
1056};
1057
1058struct asm_immed_decode {
1059 u32 mode;
1060};
1061
1062struct asm_sbr_ps {
1063 u32 enable;
1064};
1065
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001066struct asm_dual_mono {
1067 u16 sce_left;
1068 u16 sce_right;
1069};
1070
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001071struct asm_dec_chan_map {
1072 u32 num_channels; /* Number of decoder output
1073 * channels. A value of 0
1074 * indicates native channel
1075 * mapping, which is valid
1076 * only for NT mode. This
1077 * means the output of the
1078 * decoder is to be preserved
1079 * as is.
1080 */
1081
1082 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
1083 * num_channels. It can grow
1084 * till MAX_CHAN_MAP_CHANNELS.
1085 * Channel[i] mapping
1086 * describes channel I inside
1087 * the decoder output buffer.
1088 * Valid channel mapping
1089 * values are to be present at
1090 * the beginning of the array.
1091 * All remaining elements of
1092 * the array are to be filled
1093 * with PCM_CHANNEL_NULL.
1094 */
1095};
1096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001097struct asm_encode_cfg_blk {
1098 u32 frames_per_buf;
1099 u32 format_id;
1100 u32 cfg_size;
1101 union {
1102 struct asm_pcm_cfg pcm;
1103 struct asm_aac_read_cfg aac;
1104 struct asm_amrnb_read_cfg amrnb;
1105 struct asm_evrc_read_cfg evrc;
1106 struct asm_qcelp13_read_cfg qcelp13;
1107 struct asm_sbc_read_cfg sbc;
Alex Wong2caeecc2011-10-28 10:52:15 +05301108 struct asm_amrwb_read_cfg amrwb;
Mingming Yin647e9ea2012-03-17 19:56:10 -07001109 struct asm_multi_channel_pcm_fmt_blk mpcm;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001110 } __attribute__((packed)) cfg;
1111};
1112
1113struct asm_frame_meta_info {
1114 u32 offset_to_frame;
1115 u32 frame_size;
1116 u32 encoded_pcm_samples;
1117 u32 msw_ts;
1118 u32 lsw_ts;
1119 u32 nflags;
1120};
1121
1122/* Stream level commands */
1123#define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001124#define ASM_STREAM_CMD_OPEN_READ_V2_1 0x00010DB2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001125struct asm_stream_cmd_open_read {
1126 struct apr_hdr hdr;
1127 u32 uMode;
1128 u32 src_endpoint;
1129 u32 pre_proc_top;
1130 u32 format;
1131} __attribute__((packed));
1132
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001133struct asm_stream_cmd_open_read_v2_1 {
1134 struct apr_hdr hdr;
1135 u32 uMode;
1136 u32 src_endpoint;
1137 u32 pre_proc_top;
1138 u32 format;
1139 u16 bits_per_sample;
1140 u16 reserved;
1141} __packed;
1142
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001143/* Supported formats */
1144#define LINEAR_PCM 0x00010BE5
1145#define DTMF 0x00010BE6
1146#define ADPCM 0x00010BE7
1147#define YADPCM 0x00010BE8
1148#define MP3 0x00010BE9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001149#define MPEG4_AAC 0x00010BEA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001150#define AMRNB_FS 0x00010BEB
Alex Wong2caeecc2011-10-28 10:52:15 +05301151#define AMRWB_FS 0x00010BEC
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001152#define V13K_FS 0x00010BED
1153#define EVRC_FS 0x00010BEE
1154#define EVRCB_FS 0x00010BEF
1155#define EVRCWB_FS 0x00010BF0
1156#define MIDI 0x00010BF1
1157#define SBC 0x00010BF2
1158#define WMA_V10PRO 0x00010BF3
1159#define WMA_V9 0x00010BF4
1160#define AMR_WB_PLUS 0x00010BF5
1161#define AC3_DECODER 0x00010BF6
Santosh Mardi23321202012-03-22 04:33:25 +05301162#define EAC3_DECODER 0x00010C3C
1163#define DTS 0x00010D88
Srikanth Uyyala66f781a2012-06-13 23:23:25 +05301164#define DTS_LBR 0x00010DBB
Santosh Mardi23321202012-03-22 04:33:25 +05301165#define ATRAC 0x00010D89
1166#define MAT 0x00010D8A
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001167#define G711_ALAW_FS 0x00010BF7
1168#define G711_MLAW_FS 0x00010BF8
1169#define G711_PCM_FS 0x00010BF9
Bharath Ramachandramurthy4f71d502011-10-23 19:45:22 -07001170#define MPEG4_MULTI_AAC 0x00010D86
Baruch Eruchimovitche9cbfc12011-10-09 19:47:08 +02001171#define US_POINT_EPOS_FORMAT 0x00012310
1172#define US_RAW_FORMAT 0x0001127C
Kiran Kandi5e809b02012-01-31 00:24:33 -08001173#define MULTI_CHANNEL_PCM 0x00010C66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001174
1175#define ASM_ENCDEC_SBCRATE 0x00010C13
1176#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1177#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1178
1179#define ASM_ENCDEC_SBCRATE 0x00010C13
1180#define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
1181#define ASM_ENCDEC_CFG_BLK 0x00010C2C
1182
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001183#define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
1184struct asm_stream_cmd_open_read_compressed {
1185 struct apr_hdr hdr;
1186 u32 uMode;
1187 u32 frame_per_buf;
1188} __packed;
1189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001190#define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07001191#define ASM_STREAM_CMD_OPEN_WRITE_V2_1 0x00010DB1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001192struct asm_stream_cmd_open_write {
1193 struct apr_hdr hdr;
1194 u32 uMode;
1195 u16 sink_endpoint;
1196 u16 stream_handle;
1197 u32 post_proc_top;
1198 u32 format;
1199} __attribute__((packed));
1200
Santosh Mardi23321202012-03-22 04:33:25 +05301201#define IEC_61937_MASK 0x00000001
1202#define IEC_60958_MASK 0x00000002
1203
1204#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
1205struct asm_stream_cmd_open_write_compressed {
1206 struct apr_hdr hdr;
1207 u32 flags;
1208 u32 format;
1209} __packed;
1210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001211#define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
1212
1213struct asm_stream_cmd_open_read_write {
1214 struct apr_hdr hdr;
1215 u32 uMode;
1216 u32 post_proc_top;
1217 u32 write_format;
1218 u32 read_format;
1219} __attribute__((packed));
1220
Santosh Mardi23321202012-03-22 04:33:25 +05301221#define ADM_CMD_CONNECT_AFE_PORT 0x00010320
Santosh Mardid1760792012-06-12 16:23:19 +05301222#define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321
Santosh Mardi23321202012-03-22 04:33:25 +05301223
1224struct adm_cmd_connect_afe_port {
1225 struct apr_hdr hdr;
1226 u8 mode; /*mode represent the interface is for RX or TX*/
1227 u8 session_id; /*ASM session ID*/
1228 u16 afe_port_id;
1229} __packed;
1230
Subhash Chandra Bose Naripeddy8f846892012-06-12 11:29:18 -07001231#define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332
1232
1233struct adm_cmd_connect_afe_port_v2 {
1234 struct apr_hdr hdr;
1235 u8 mode; /*mode represent the interface is for RX or TX*/
1236 u8 session_id; /*ASM session ID*/
1237 u16 afe_port_id;
1238 u32 num_channels;
1239 u32 sampleing_rate;
1240} __packed;
1241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001242#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
1243#define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
1244#define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
1245#define ASM_ENABLE_SBR_PS 0x00010C63
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001246#define ASM_CONFIGURE_DUAL_MONO 0x00010C64
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001247struct asm_stream_cmd_encdec_cfg_blk{
1248 struct apr_hdr hdr;
1249 u32 param_id;
1250 u32 param_size;
1251 struct asm_encode_cfg_blk enc_blk;
1252} __attribute__((packed));
1253
1254struct asm_stream_cmd_encdec_sbc_bitrate{
1255 struct apr_hdr hdr;
1256 u32 param_id;
1257 struct asm_sbc_bitrate sbc_bitrate;
1258} __attribute__((packed));
1259
1260struct asm_stream_cmd_encdec_immed_decode{
1261 struct apr_hdr hdr;
1262 u32 param_id;
1263 u32 param_size;
1264 struct asm_immed_decode dec;
1265} __attribute__((packed));
1266
1267struct asm_stream_cmd_encdec_sbr{
1268 struct apr_hdr hdr;
1269 u32 param_id;
1270 u32 param_size;
1271 struct asm_sbr_ps sbr_ps;
1272} __attribute__((packed));
1273
Swaminathan Sathappan70765cd2011-07-19 18:42:47 -07001274struct asm_stream_cmd_encdec_dualmono {
1275 struct apr_hdr hdr;
1276 u32 param_id;
1277 u32 param_size;
1278 struct asm_dual_mono channel_map;
1279} __packed;
1280
Amal Paul6e0f7982013-02-21 19:36:35 -08001281#define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG 0x00010DD8
1282
1283/* Structure for AAC decoder stereo coefficient setting. */
1284
1285struct asm_aac_stereo_mix_coeff_selection_param {
1286 struct apr_hdr hdr;
1287 u32 param_id;
1288 u32 param_size;
1289 u32 aac_stereo_mix_coeff_flag;
1290} __packed;
1291
Swaminathan Sathappan6f530882012-05-01 16:42:22 -07001292#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
1293struct asm_stream_cmd_encdec_channelmap {
1294 struct apr_hdr hdr;
1295 u32 param_id;
1296 u32 param_size;
1297 struct asm_dec_chan_map chan_map;
1298} __packed;
1299
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300#define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
1301struct asm_stream_cmd_adjust_samples{
1302 struct apr_hdr hdr;
1303 u16 nsamples;
1304 u16 reserved;
1305} __attribute__((packed));
1306
1307#define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
1308struct asm_stream_cmd_tap_popp_pcm{
1309 struct apr_hdr hdr;
1310 u16 enable;
1311 u16 reserved;
1312 u32 module_id;
1313} __attribute__((packed));
1314
1315/* Session Level commands */
1316#define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
1317struct asm_stream_cmd_memory_map{
1318 struct apr_hdr hdr;
1319 u32 buf_add;
1320 u32 buf_size;
1321 u16 mempool_id;
1322 u16 reserved;
1323} __attribute__((packed));
1324
1325#define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
1326struct asm_stream_cmd_memory_unmap{
1327 struct apr_hdr hdr;
1328 u32 buf_add;
1329} __attribute__((packed));
1330
1331#define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
1332struct asm_memory_map_regions{
1333 u32 phys;
1334 u32 buf_size;
1335} __attribute__((packed));
1336
1337struct asm_stream_cmd_memory_map_regions{
1338 struct apr_hdr hdr;
1339 u16 mempool_id;
1340 u16 nregions;
1341} __attribute__((packed));
1342
1343#define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
1344struct asm_memory_unmap_regions{
1345 u32 phys;
1346} __attribute__((packed));
1347
1348struct asm_stream_cmd_memory_unmap_regions{
1349 struct apr_hdr hdr;
1350 u16 nregions;
1351 u16 reserved;
1352} __attribute__((packed));
1353
1354#define ASM_SESSION_CMD_RUN 0x00010BD2
1355struct asm_stream_cmd_run{
1356 struct apr_hdr hdr;
1357 u32 flags;
1358 u32 msw_ts;
1359 u32 lsw_ts;
1360} __attribute__((packed));
1361
1362/* Session level events */
1363#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
1364struct asm_stream_cmd_reg_rx_underflow_event{
1365 struct apr_hdr hdr;
1366 u16 enable;
1367 u16 reserved;
1368} __attribute__((packed));
1369
1370#define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
1371struct asm_stream_cmd_reg_tx_overflow_event{
1372 struct apr_hdr hdr;
1373 u16 enable;
1374 u16 reserved;
1375} __attribute__((packed));
1376
1377/* Data Path commands */
1378#define ASM_DATA_CMD_WRITE 0x00010BD9
1379struct asm_stream_cmd_write{
1380 struct apr_hdr hdr;
1381 u32 buf_add;
1382 u32 avail_bytes;
1383 u32 uid;
1384 u32 msw_ts;
1385 u32 lsw_ts;
1386 u32 uflags;
1387} __attribute__((packed));
1388
1389#define ASM_DATA_CMD_READ 0x00010BDA
1390struct asm_stream_cmd_read{
1391 struct apr_hdr hdr;
1392 u32 buf_add;
1393 u32 buf_size;
1394 u32 uid;
1395} __attribute__((packed));
1396
Subhash Chandra Bose Naripeddy418393f2012-08-17 17:00:25 -07001397#define ASM_DATA_CMD_READ_COMPRESSED 0x00010DBF
Subhash Chandra Bose Naripeddy694b7d92012-06-20 20:46:13 -07001398struct asm_stream_cmd_read_compressed {
1399 struct apr_hdr hdr;
1400 u32 buf_add;
1401 u32 buf_size;
1402 u32 uid;
1403} __packed;
1404
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405#define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
Deepa Madiregama55cbf782011-09-10 05:44:39 +05301406#define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407struct asm_stream_media_format_update{
1408 struct apr_hdr hdr;
1409 u32 format;
1410 u32 cfg_size;
1411 union {
1412 struct asm_pcm_cfg pcm_cfg;
1413 struct asm_adpcm_cfg adpcm_cfg;
1414 struct asm_yadpcm_cfg yadpcm_cfg;
1415 struct asm_midi_cfg midi_cfg;
1416 struct asm_wma_cfg wma_cfg;
1417 struct asm_wmapro_cfg wmapro_cfg;
1418 struct asm_aac_cfg aac_cfg;
1419 struct asm_flac_cfg flac_cfg;
1420 struct asm_vorbis_cfg vorbis_cfg;
Kiran Kandi5e809b02012-01-31 00:24:33 -08001421 struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
Ajit Khare43fd8832012-08-07 13:19:44 -07001422 struct asm_amrwbplus_cfg amrwbplus_cfg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423 } __attribute__((packed)) write_cfg;
1424} __attribute__((packed));
1425
1426
1427/* Command Responses */
1428#define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
1429struct asm_stream_cmdrsp_get_readwrite_param{
1430 struct apr_hdr hdr;
1431 u32 status;
1432 u32 param_id;
1433 u16 param_size;
1434 u16 padding;
1435 union {
1436 struct asm_sbc_bitrate sbc_bitrate;
1437 struct asm_immed_decode aac_dec;
1438 } __attribute__((packed)) read_write_cfg;
1439} __attribute__((packed));
1440
1441
1442#define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
1443struct asm_stream_cmdrsp_get_session_time{
1444 struct apr_hdr hdr;
1445 u32 status;
1446 u32 msw_ts;
1447 u32 lsw_ts;
1448} __attribute__((packed));
1449
1450#define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
1451struct asm_data_event_write_done{
1452 u32 buf_add;
1453 u32 status;
1454} __attribute__((packed));
1455
1456#define ASM_DATA_EVENT_READ_DONE 0x00010BE0
1457struct asm_data_event_read_done{
1458 u32 status;
1459 u32 buffer_add;
1460 u32 enc_frame_size;
1461 u32 offset;
1462 u32 msw_ts;
1463 u32 lsw_ts;
1464 u32 flags;
1465 u32 num_frames;
1466 u32 id;
1467} __attribute__((packed));
1468
Subhash Chandra Bose Naripeddy418393f2012-08-17 17:00:25 -07001469#define ASM_DATA_EVENT_READ_COMPRESSED_DONE 0x00010DC0
Subhash Chandra Bose Naripeddy694b7d92012-06-20 20:46:13 -07001470struct asm_data_event_read_compressed_done {
1471 u32 status;
1472 u32 buffer_add;
1473 u32 enc_frame_size;
1474 u32 offset;
1475 u32 msw_ts;
1476 u32 lsw_ts;
1477 u32 flags;
1478 u32 num_frames;
1479 u32 id;
1480} __packed;
1481
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
1483struct asm_data_event_sr_cm_change_notify {
1484 u32 sample_rate;
1485 u16 no_of_channels;
1486 u16 reserved;
1487 u8 channel_map[8];
1488} __packed;
1489
1490/* service level events */
1491
1492#define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
1493struct asm_svc_cmdrsp_get_strm_handles{
1494 struct apr_hdr hdr;
1495 u32 num_handles;
1496 u32 stream_handles;
1497} __attribute__((packed));
1498
1499
1500#define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
1501struct asm_svc_cmdrsp_get_wallclock_time{
1502 struct apr_hdr hdr;
1503 u32 status;
1504 u32 msw_ts;
1505 u32 lsw_ts;
1506} __attribute__((packed));
1507
1508/*
1509 * Error code
1510*/
1511#define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
1512#define ADSP_EFAILED 0x00000001 /* General failure. */
1513#define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
1514#define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
1515#define ADSP_EVERSION 0x00000004 /* Unsupported version. */
1516#define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
1517#define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
1518#define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
1519#define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
1520#define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
1521#define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
1522#define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
1523#define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
1524 processed. */
1525#define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
1526#define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
1527#define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
1528 to complete. */
1529#define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
1530 intervention to complete. */
1531#define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
1532#define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
1533
Sriranjan Srikantam22bee8b2012-05-31 15:21:53 -07001534/* SRS TRUMEDIA start */
1535#define SRS_ID_GLOBAL 0x00000001
1536#define SRS_ID_WOWHD 0x00000002
1537#define SRS_ID_CSHP 0x00000003
1538#define SRS_ID_HPF 0x00000004
1539#define SRS_ID_PEQ 0x00000005
1540#define SRS_ID_HL 0x00000006
1541
1542#define SRS_CMD_UPLOAD 0x7FFF0000
1543#define SRS_PARAM_INDEX_MASK 0x80000000
1544#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
1545#define SRS_PARAM_VALUE_MASK 0x0000FFFF
1546
1547struct srs_trumedia_params_GLOBAL {
1548 uint8_t v1;
1549 uint8_t v2;
1550 uint8_t v3;
1551 uint8_t v4;
1552 uint8_t v5;
1553 uint8_t v6;
1554 uint8_t v7;
1555 uint8_t v8;
1556} __packed;
1557
1558struct srs_trumedia_params_WOWHD {
1559 uint32_t v1;
1560 uint16_t v2;
1561 uint16_t v3;
1562 uint16_t v4;
1563 uint16_t v5;
1564 uint16_t v6;
1565 uint16_t v7;
1566 uint16_t v8;
1567 uint16_t v____A1;
1568 uint32_t v9;
1569 uint16_t v10;
1570 uint16_t v11;
1571 uint32_t v12[16];
1572} __packed;
1573
1574struct srs_trumedia_params_CSHP {
1575 uint32_t v1;
1576 uint16_t v2;
1577 uint16_t v3;
1578 uint16_t v4;
1579 uint16_t v5;
1580 uint16_t v6;
1581 uint16_t v____A1;
1582 uint32_t v7;
1583 uint16_t v8;
1584 uint16_t v9;
1585 uint32_t v10[16];
1586} __packed;
1587
1588struct srs_trumedia_params_HPF {
1589 uint32_t v1;
1590 uint32_t v2[26];
1591} __packed;
1592
1593struct srs_trumedia_params_PEQ {
1594 uint32_t v1;
1595 uint16_t v2;
1596 uint16_t v3;
1597 uint16_t v4;
1598 uint16_t v____A1;
1599 uint32_t v5[26];
1600 uint32_t v6[26];
1601} __packed;
1602
1603struct srs_trumedia_params_HL {
1604 uint16_t v1;
1605 uint16_t v2;
1606 uint16_t v3;
1607 uint16_t v____A1;
1608 int32_t v4;
1609 uint32_t v5;
1610 uint16_t v6;
1611 uint16_t v____A2;
1612 uint32_t v7;
1613} __packed;
1614
1615struct srs_trumedia_params {
1616 struct srs_trumedia_params_GLOBAL global;
1617 struct srs_trumedia_params_WOWHD wowhd;
1618 struct srs_trumedia_params_CSHP cshp;
1619 struct srs_trumedia_params_HPF hpf;
1620 struct srs_trumedia_params_PEQ peq;
1621 struct srs_trumedia_params_HL hl;
1622} __packed;
1623int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params);
1624/* SRS TruMedia end */
1625
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001626#endif /*_APR_AUDIO_H_*/