blob: 9459f71e5c467d3c953f268c617c4f0281188db5 [file] [log] [blame]
Vikram Pandurangad3b58cc2017-09-27 12:17:36 -07001/* Copyright (c) 2012-2017, 2019, The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#ifndef __Q6_ASM_V2_H__
13#define __Q6_ASM_V2_H__
14
Laxminath Kasam605b42f2017-08-01 22:02:15 +053015#include <ipc/apr.h>
16#include <dsp/rtac.h>
17#include <dsp/apr_audio-v2.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053018#include <linux/list.h>
19#include <linux/msm_ion.h>
20
21#define IN 0x000
22#define OUT 0x001
23#define CH_MODE_MONO 0x001
24#define CH_MODE_STEREO 0x002
25
26#define FORMAT_LINEAR_PCM 0x0000
27#define FORMAT_DTMF 0x0001
28#define FORMAT_ADPCM 0x0002
29#define FORMAT_YADPCM 0x0003
30#define FORMAT_MP3 0x0004
31#define FORMAT_MPEG4_AAC 0x0005
32#define FORMAT_AMRNB 0x0006
33#define FORMAT_AMRWB 0x0007
34#define FORMAT_V13K 0x0008
35#define FORMAT_EVRC 0x0009
36#define FORMAT_EVRCB 0x000a
37#define FORMAT_EVRCWB 0x000b
38#define FORMAT_MIDI 0x000c
39#define FORMAT_SBC 0x000d
40#define FORMAT_WMA_V10PRO 0x000e
41#define FORMAT_WMA_V9 0x000f
42#define FORMAT_AMR_WB_PLUS 0x0010
43#define FORMAT_MPEG4_MULTI_AAC 0x0011
44#define FORMAT_MULTI_CHANNEL_LINEAR_PCM 0x0012
45#define FORMAT_AC3 0x0013
46#define FORMAT_EAC3 0x0014
47#define FORMAT_MP2 0x0015
48#define FORMAT_FLAC 0x0016
49#define FORMAT_ALAC 0x0017
50#define FORMAT_VORBIS 0x0018
51#define FORMAT_APE 0x0019
52#define FORMAT_G711_ALAW_FS 0x001a
53#define FORMAT_G711_MLAW_FS 0x001b
54#define FORMAT_DTS 0x001c
55#define FORMAT_DSD 0x001d
56#define FORMAT_APTX 0x001e
57#define FORMAT_GEN_COMPR 0x001f
58#define FORMAT_TRUEHD 0x0020
59#define FORMAT_IEC61937 0x0021
60
61#define ENCDEC_SBCBITRATE 0x0001
62#define ENCDEC_IMMEDIATE_DECODE 0x0002
63#define ENCDEC_CFG_BLK 0x0003
64
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +053065#define ENC_CFG_ID_NONE 0x0000
66
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053067#define CMD_PAUSE 0x0001
68#define CMD_FLUSH 0x0002
69#define CMD_EOS 0x0003
70#define CMD_CLOSE 0x0004
71#define CMD_OUT_FLUSH 0x0005
72#define CMD_SUSPEND 0x0006
73
74/* bit 0:1 represents priority of stream */
75#define STREAM_PRIORITY_NORMAL 0x0000
76#define STREAM_PRIORITY_LOW 0x0001
77#define STREAM_PRIORITY_HIGH 0x0002
78
79/* bit 4 represents META enable of encoded data buffer */
80#define BUFFER_META_ENABLE 0x0010
81
82/* bit 5 represents timestamp */
83/* bit 5 - 0 -- ASM_DATA_EVENT_READ_DONE will have relative time-stamp*/
84/* bit 5 - 1 -- ASM_DATA_EVENT_READ_DONE will have absolute time-stamp*/
85#define ABSOLUTE_TIMESTAMP_ENABLE 0x0020
86
87/* Enable Sample_Rate/Channel_Mode notification event from Decoder */
88#define SR_CM_NOTIFY_ENABLE 0x0004
89
90#define TUN_WRITE_IO_MODE 0x0008 /* tunnel read write mode */
91#define TUN_READ_IO_MODE 0x0004 /* tunnel read write mode */
92#define SYNC_IO_MODE 0x0001
93#define ASYNC_IO_MODE 0x0002
94#define COMPRESSED_IO 0x0040
95#define COMPRESSED_STREAM_IO 0x0080
96#define NT_MODE 0x0400
97
98#define NO_TIMESTAMP 0xFF00
99#define SET_TIMESTAMP 0x0000
100
101#define SOFT_PAUSE_ENABLE 1
102#define SOFT_PAUSE_DISABLE 0
103
104#define ASM_ACTIVE_STREAMS_ALLOWED 0x8
105/* Control session is used for mapping calibration memory */
106#define ASM_CONTROL_SESSION (ASM_ACTIVE_STREAMS_ALLOWED + 1)
107
108#define ASM_SHIFT_GAPLESS_MODE_FLAG 31
109#define ASM_SHIFT_LAST_BUFFER_FLAG 30
110
111#define ASM_LITTLE_ENDIAN 0
112#define ASM_BIG_ENDIAN 1
113
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530114#define ADSP_ASM_API_VERSION_V2 2
115
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530116/* PCM_MEDIA_FORMAT_Version */
117enum {
118 PCM_MEDIA_FORMAT_V2 = 0,
119 PCM_MEDIA_FORMAT_V3,
120 PCM_MEDIA_FORMAT_V4,
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530121 PCM_MEDIA_FORMAT_V5,
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530122};
123
124/* PCM format modes in DSP */
125enum {
126 DEFAULT_QF = 0,
127 Q15 = 15,
128 Q23 = 23,
129 Q31 = 31,
130};
131
132/* payload structure bytes */
133#define READDONE_IDX_STATUS 0
134#define READDONE_IDX_BUFADD_LSW 1
135#define READDONE_IDX_BUFADD_MSW 2
136#define READDONE_IDX_MEMMAP_HDL 3
137#define READDONE_IDX_SIZE 4
138#define READDONE_IDX_OFFSET 5
139#define READDONE_IDX_LSW_TS 6
140#define READDONE_IDX_MSW_TS 7
141#define READDONE_IDX_FLAGS 8
142#define READDONE_IDX_NUMFRAMES 9
143#define READDONE_IDX_SEQ_ID 10
144
145#define SOFT_PAUSE_PERIOD 30 /* ramp up/down for 30ms */
146#define SOFT_PAUSE_STEP 0 /* Step value 0ms or 0us */
147enum {
148 SOFT_PAUSE_CURVE_LINEAR = 0,
149 SOFT_PAUSE_CURVE_EXP,
150 SOFT_PAUSE_CURVE_LOG,
151};
152
153#define SOFT_VOLUME_PERIOD 30 /* ramp up/down for 30ms */
154#define SOFT_VOLUME_STEP 0 /* Step value 0ms or 0us */
155enum {
156 SOFT_VOLUME_CURVE_LINEAR = 0,
157 SOFT_VOLUME_CURVE_EXP,
158 SOFT_VOLUME_CURVE_LOG,
159};
160
161#define SOFT_VOLUME_INSTANCE_1 1
162#define SOFT_VOLUME_INSTANCE_2 2
163
164typedef void (*app_cb)(uint32_t opcode, uint32_t token,
165 uint32_t *payload, void *priv);
166
167struct audio_buffer {
168 dma_addr_t phys;
169 void *data;
170 uint32_t used;
171 uint32_t size;/* size of buffer */
172 uint32_t actual_size; /* actual number of bytes read by DSP */
173 struct ion_handle *handle;
174 struct ion_client *client;
175};
176
177struct audio_aio_write_param {
178 phys_addr_t paddr;
179 uint32_t len;
180 uint32_t uid;
181 uint32_t lsw_ts;
182 uint32_t msw_ts;
183 uint32_t flags;
184 uint32_t metadata_len;
185 uint32_t last_buffer;
186};
187
188struct audio_aio_read_param {
189 phys_addr_t paddr;
190 uint32_t len;
191 uint32_t uid;
192 uint32_t flags;/*meta data flags*/
193};
194
195struct audio_port_data {
196 struct audio_buffer *buf;
197 uint32_t max_buf_cnt;
198 uint32_t dsp_buf;
199 uint32_t cpu_buf;
200 struct list_head mem_map_handle;
201 uint32_t tmp_hdl;
202 /* read or write locks */
203 struct mutex lock;
204 spinlock_t dsp_lock;
205};
206
207struct shared_io_config {
208 uint32_t format;
209 uint16_t bits_per_sample;
210 uint32_t rate;
211 uint32_t channels;
212 uint16_t sample_word_size;
213 uint32_t bufsz;
214 uint32_t bufcnt;
215};
216
217struct audio_client {
218 int session;
219 app_cb cb;
220 atomic_t cmd_state;
221 atomic_t cmd_state_pp;
222 /* Relative or absolute TS */
223 atomic_t time_flag;
224 atomic_t nowait_cmd_cnt;
225 atomic_t mem_state;
226 void *priv;
227 uint32_t io_mode;
228 uint64_t time_stamp;
229 struct apr_svc *apr;
230 struct apr_svc *mmap_apr;
231 struct apr_svc *apr2;
232 struct mutex cmd_lock;
233 /* idx:1 out port, 0: in port*/
234 struct audio_port_data port[2];
235 wait_queue_head_t cmd_wait;
236 wait_queue_head_t time_wait;
237 wait_queue_head_t mem_wait;
238 int perf_mode;
239 int stream_id;
240 struct device *dev;
241 int topology;
242 int app_type;
243 /* audio cache operations fptr*/
244 int (*fptr_cache_ops)(struct audio_buffer *abuff, int cache_op);
245 atomic_t unmap_cb_success;
246 atomic_t reset;
247 /* holds latest DSP pipeline delay */
248 uint32_t path_delay;
249 /* shared io */
250 struct audio_buffer shared_pos_buf;
251 struct shared_io_config config;
252};
253
Vikram Pandurangad3b58cc2017-09-27 12:17:36 -0700254struct q6asm_cal_info {
255 int topology_id;
256 int app_type;
257};
258
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530259void q6asm_audio_client_free(struct audio_client *ac);
260
261struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv);
262
263struct audio_client *q6asm_get_audio_client(int session_id);
264
265int q6asm_audio_client_buf_alloc(unsigned int dir/* 1:Out,0:In */,
266 struct audio_client *ac,
267 unsigned int bufsz,
268 uint32_t bufcnt);
269int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir
270 /* 1:Out,0:In */,
271 struct audio_client *ac,
272 unsigned int bufsz,
273 unsigned int bufcnt);
274
275int q6asm_audio_client_buf_free_contiguous(unsigned int dir,
276 struct audio_client *ac);
277
278int q6asm_open_read(struct audio_client *ac, uint32_t format
279 /*, uint16_t bits_per_sample*/);
280
281int q6asm_open_read_v2(struct audio_client *ac, uint32_t format,
282 uint16_t bits_per_sample);
283
284int q6asm_open_read_v3(struct audio_client *ac, uint32_t format,
285 uint16_t bits_per_sample);
286
287int q6asm_open_read_v4(struct audio_client *ac, uint32_t format,
288 uint16_t bits_per_sample, bool ts_mode);
289
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530290int q6asm_open_read_v5(struct audio_client *ac, uint32_t format,
291 uint16_t bits_per_sample, bool ts_mode,
292 uint32_t enc_cfg_id);
293
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530294int q6asm_open_write(struct audio_client *ac, uint32_t format
295 /*, uint16_t bits_per_sample*/);
296
297int q6asm_open_write_v2(struct audio_client *ac, uint32_t format,
298 uint16_t bits_per_sample);
299
300int q6asm_open_shared_io(struct audio_client *ac,
301 struct shared_io_config *c, int dir);
302
303int q6asm_open_write_v3(struct audio_client *ac, uint32_t format,
304 uint16_t bits_per_sample);
305
306int q6asm_open_write_v4(struct audio_client *ac, uint32_t format,
307 uint16_t bits_per_sample);
308
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530309int q6asm_open_write_v5(struct audio_client *ac, uint32_t format,
310 uint16_t bits_per_sample);
311
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530312int q6asm_stream_open_write_v2(struct audio_client *ac, uint32_t format,
313 uint16_t bits_per_sample, int32_t stream_id,
314 bool is_gapless_mode);
315
316int q6asm_stream_open_write_v3(struct audio_client *ac, uint32_t format,
317 uint16_t bits_per_sample, int32_t stream_id,
318 bool is_gapless_mode);
319
320int q6asm_stream_open_write_v4(struct audio_client *ac, uint32_t format,
321 uint16_t bits_per_sample, int32_t stream_id,
322 bool is_gapless_mode);
323
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530324int q6asm_stream_open_write_v5(struct audio_client *ac, uint32_t format,
325 uint16_t bits_per_sample, int32_t stream_id,
326 bool is_gapless_mode);
327
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530328int q6asm_open_write_compressed(struct audio_client *ac, uint32_t format,
329 uint32_t passthrough_flag);
330
331int q6asm_open_read_write(struct audio_client *ac,
332 uint32_t rd_format,
333 uint32_t wr_format);
334
335int q6asm_open_read_write_v2(struct audio_client *ac, uint32_t rd_format,
336 uint32_t wr_format, bool is_meta_data_mode,
337 uint32_t bits_per_sample, bool overwrite_topology,
338 int topology);
339
340int q6asm_open_loopback_v2(struct audio_client *ac,
341 uint16_t bits_per_sample);
342
343int q6asm_open_transcode_loopback(struct audio_client *ac,
344 uint16_t bits_per_sample, uint32_t source_format,
345 uint32_t sink_format);
346
347int q6asm_write(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
348 uint32_t lsw_ts, uint32_t flags);
349int q6asm_write_nolock(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
350 uint32_t lsw_ts, uint32_t flags);
351
352int q6asm_async_write(struct audio_client *ac,
353 struct audio_aio_write_param *param);
354
355int q6asm_async_read(struct audio_client *ac,
356 struct audio_aio_read_param *param);
357
358int q6asm_read(struct audio_client *ac);
359int q6asm_read_v2(struct audio_client *ac, uint32_t len);
360int q6asm_read_nolock(struct audio_client *ac);
361
362int q6asm_memory_map(struct audio_client *ac, phys_addr_t buf_add,
363 int dir, uint32_t bufsz, uint32_t bufcnt);
364
365int q6asm_memory_unmap(struct audio_client *ac, phys_addr_t buf_add,
366 int dir);
367
368struct audio_buffer *q6asm_shared_io_buf(struct audio_client *ac, int dir);
369
370int q6asm_shared_io_free(struct audio_client *ac, int dir);
371
372int q6asm_get_shared_pos(struct audio_client *ac, uint32_t *si, uint32_t *msw,
373 uint32_t *lsw);
374
375int q6asm_map_rtac_block(struct rtac_cal_block_data *cal_block);
376
377int q6asm_unmap_rtac_block(uint32_t *mem_map_handle);
378
379int q6asm_send_cal(struct audio_client *ac);
380
381int q6asm_run(struct audio_client *ac, uint32_t flags,
382 uint32_t msw_ts, uint32_t lsw_ts);
383
384int q6asm_run_nowait(struct audio_client *ac, uint32_t flags,
385 uint32_t msw_ts, uint32_t lsw_ts);
386
387int q6asm_stream_run_nowait(struct audio_client *ac, uint32_t flags,
388 uint32_t msw_ts, uint32_t lsw_ts, uint32_t stream_id);
389
390int q6asm_reg_tx_overflow(struct audio_client *ac, uint16_t enable);
391
392int q6asm_reg_rx_underflow(struct audio_client *ac, uint16_t enable);
393
394int q6asm_cmd(struct audio_client *ac, int cmd);
395
396int q6asm_stream_cmd(struct audio_client *ac, int cmd, uint32_t stream_id);
397
398int q6asm_cmd_nowait(struct audio_client *ac, int cmd);
399
400int q6asm_stream_cmd_nowait(struct audio_client *ac, int cmd,
401 uint32_t stream_id);
402
403void *q6asm_is_cpu_buf_avail(int dir, struct audio_client *ac,
404 uint32_t *size, uint32_t *idx);
405
406int q6asm_cpu_buf_release(int dir, struct audio_client *ac);
407
408void *q6asm_is_cpu_buf_avail_nolock(int dir, struct audio_client *ac,
409 uint32_t *size, uint32_t *idx);
410
411int q6asm_is_dsp_buf_avail(int dir, struct audio_client *ac);
412
413/* File format specific configurations to be added below */
414
415int q6asm_enc_cfg_blk_aac(struct audio_client *ac,
416 uint32_t frames_per_buf,
417 uint32_t sample_rate, uint32_t channels,
418 uint32_t bit_rate,
419 uint32_t mode, uint32_t format);
420
421int q6asm_enc_cfg_blk_g711(struct audio_client *ac,
422 uint32_t frames_per_buf,
423 uint32_t sample_rate);
424
425int q6asm_enc_cfg_blk_pcm(struct audio_client *ac,
426 uint32_t rate, uint32_t channels);
427
428int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac,
429 uint32_t rate, uint32_t channels,
430 uint16_t bits_per_sample,
431 bool use_default_chmap, bool use_back_flavor,
432 u8 *channel_map);
433
434int q6asm_enc_cfg_blk_pcm_v3(struct audio_client *ac,
435 uint32_t rate, uint32_t channels,
436 uint16_t bits_per_sample, bool use_default_chmap,
437 bool use_back_flavor, u8 *channel_map,
438 uint16_t sample_word_size);
439
440int q6asm_enc_cfg_blk_pcm_v4(struct audio_client *ac,
441 uint32_t rate, uint32_t channels,
442 uint16_t bits_per_sample, bool use_default_chmap,
443 bool use_back_flavor, u8 *channel_map,
444 uint16_t sample_word_size, uint16_t endianness,
445 uint16_t mode);
446
447int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
448 uint32_t rate, uint32_t channels,
449 uint16_t bits_per_sample);
450
451int q6asm_enc_cfg_blk_pcm_format_support_v3(struct audio_client *ac,
452 uint32_t rate, uint32_t channels,
453 uint16_t bits_per_sample,
454 uint16_t sample_word_size);
455
456int q6asm_enc_cfg_blk_pcm_format_support_v4(struct audio_client *ac,
457 uint32_t rate, uint32_t channels,
458 uint16_t bits_per_sample,
459 uint16_t sample_word_size,
460 uint16_t endianness,
461 uint16_t mode);
462
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530463int q6asm_enc_cfg_blk_pcm_format_support_v5(struct audio_client *ac,
464 uint32_t rate, uint32_t channels,
465 uint16_t bits_per_sample,
466 uint16_t sample_word_size,
467 uint16_t endianness,
468 uint16_t mode);
469
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530470int q6asm_set_encdec_chan_map(struct audio_client *ac,
471 uint32_t num_channels);
472
473int q6asm_enc_cfg_blk_pcm_native(struct audio_client *ac,
474 uint32_t rate, uint32_t channels);
475
476int q6asm_enable_sbrps(struct audio_client *ac,
477 uint32_t sbr_ps);
478
479int q6asm_cfg_dual_mono_aac(struct audio_client *ac,
480 uint16_t sce_left, uint16_t sce_right);
481
482int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff);
483
484int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf,
485 uint16_t min_rate, uint16_t max_rate,
486 uint16_t reduced_rate_level, uint16_t rate_modulation_cmd);
487
488int q6asm_enc_cfg_blk_evrc(struct audio_client *ac, uint32_t frames_per_buf,
489 uint16_t min_rate, uint16_t max_rate,
490 uint16_t rate_modulation_cmd);
491
492int q6asm_enc_cfg_blk_amrnb(struct audio_client *ac, uint32_t frames_per_buf,
493 uint16_t band_mode, uint16_t dtx_enable);
494
495int q6asm_enc_cfg_blk_amrwb(struct audio_client *ac, uint32_t frames_per_buf,
496 uint16_t band_mode, uint16_t dtx_enable);
497
498int q6asm_media_format_block_pcm(struct audio_client *ac,
499 uint32_t rate, uint32_t channels);
500
501int q6asm_media_format_block_pcm_format_support(struct audio_client *ac,
502 uint32_t rate, uint32_t channels,
503 uint16_t bits_per_sample);
504
505int q6asm_media_format_block_pcm_format_support_v2(struct audio_client *ac,
506 uint32_t rate, uint32_t channels,
507 uint16_t bits_per_sample, int stream_id,
508 bool use_default_chmap, char *channel_map);
509
510int q6asm_media_format_block_pcm_format_support_v3(struct audio_client *ac,
511 uint32_t rate,
512 uint32_t channels,
513 uint16_t bits_per_sample,
514 int stream_id,
515 bool use_default_chmap,
516 char *channel_map,
517 uint16_t sample_word_size);
518
519int q6asm_media_format_block_pcm_format_support_v4(struct audio_client *ac,
520 uint32_t rate,
521 uint32_t channels,
522 uint16_t bits_per_sample,
523 int stream_id,
524 bool use_default_chmap,
525 char *channel_map,
526 uint16_t sample_word_size,
527 uint16_t endianness,
528 uint16_t mode);
529
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530530int q6asm_media_format_block_pcm_format_support_v5(struct audio_client *ac,
531 uint32_t rate,
532 uint32_t channels,
533 uint16_t bits_per_sample,
534 int stream_id,
535 bool use_default_chmap,
536 char *channel_map,
537 uint16_t sample_word_size,
538 uint16_t endianness,
539 uint16_t mode);
540
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530541int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
542 uint32_t rate, uint32_t channels,
543 bool use_default_chmap, char *channel_map);
544
545int q6asm_media_format_block_multi_ch_pcm_v2(
546 struct audio_client *ac,
547 uint32_t rate, uint32_t channels,
548 bool use_default_chmap, char *channel_map,
549 uint16_t bits_per_sample);
550int q6asm_media_format_block_gen_compr(
551 struct audio_client *ac,
552 uint32_t rate, uint32_t channels,
553 bool use_default_chmap, char *channel_map,
554 uint16_t bits_per_sample);
555
556int q6asm_media_format_block_iec(
557 struct audio_client *ac,
558 uint32_t rate, uint32_t channels);
559
560int q6asm_media_format_block_multi_ch_pcm_v3(struct audio_client *ac,
561 uint32_t rate, uint32_t channels,
562 bool use_default_chmap,
563 char *channel_map,
564 uint16_t bits_per_sample,
565 uint16_t sample_word_size);
566
567int q6asm_media_format_block_multi_ch_pcm_v4(struct audio_client *ac,
568 uint32_t rate, uint32_t channels,
569 bool use_default_chmap,
570 char *channel_map,
571 uint16_t bits_per_sample,
572 uint16_t sample_word_size,
573 uint16_t endianness,
574 uint16_t mode);
575
Dhanalakshmi Siddaniff8d0d92019-12-05 15:20:23 +0530576int q6asm_media_format_block_multi_ch_pcm_v5(struct audio_client *ac,
577 uint32_t rate, uint32_t channels,
578 bool use_default_chmap,
579 char *channel_map,
580 uint16_t bits_per_sample,
581 uint16_t sample_word_size,
582 uint16_t endianness,
583 uint16_t mode);
584
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530585int q6asm_media_format_block_aac(struct audio_client *ac,
586 struct asm_aac_cfg *cfg);
587
588int q6asm_stream_media_format_block_aac(struct audio_client *ac,
589 struct asm_aac_cfg *cfg, int stream_id);
590
591int q6asm_media_format_block_multi_aac(struct audio_client *ac,
592 struct asm_aac_cfg *cfg);
593
594int q6asm_media_format_block_wma(struct audio_client *ac,
595 void *cfg, int stream_id);
596
597int q6asm_media_format_block_wmapro(struct audio_client *ac,
598 void *cfg, int stream_id);
599
600int q6asm_media_format_block_amrwbplus(struct audio_client *ac,
601 struct asm_amrwbplus_cfg *cfg);
602
603int q6asm_stream_media_format_block_flac(struct audio_client *ac,
604 struct asm_flac_cfg *cfg, int stream_id);
605
606int q6asm_media_format_block_alac(struct audio_client *ac,
607 struct asm_alac_cfg *cfg, int stream_id);
608
609int q6asm_media_format_block_g711(struct audio_client *ac,
610 struct asm_g711_dec_cfg *cfg, int stream_id);
611
612int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
613 struct asm_vorbis_cfg *cfg, int stream_id);
614
615int q6asm_media_format_block_ape(struct audio_client *ac,
616 struct asm_ape_cfg *cfg, int stream_id);
617
618int q6asm_media_format_block_dsd(struct audio_client *ac,
619 struct asm_dsd_cfg *cfg, int stream_id);
620
621int q6asm_stream_media_format_block_aptx_dec(struct audio_client *ac,
622 uint32_t sr, int stream_id);
623
624int q6asm_ds1_set_endp_params(struct audio_client *ac,
625 int param_id, int param_value);
626
627/* Send stream based end params */
628int q6asm_ds1_set_stream_endp_params(struct audio_client *ac, int param_id,
629 int param_value, int stream_id);
630
631/* PP specific */
632int q6asm_equalizer(struct audio_client *ac, void *eq);
633
634/* Send Volume Command */
635int q6asm_set_volume(struct audio_client *ac, int volume);
636
637/* Send Volume Command */
638int q6asm_set_volume_v2(struct audio_client *ac, int volume, int instance);
639
640/* DTS Eagle Params */
641int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, uint32_t size,
642 void *data, struct param_outband *po, int m_id);
643int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, uint32_t size,
644 void *data, struct param_outband *po, int m_id);
645
646/* Send aptx decoder BT address */
647int q6asm_set_aptx_dec_bt_addr(struct audio_client *ac,
648 struct aptx_dec_bt_addr_cfg *cfg);
649
650/* Set SoftPause Params */
651int q6asm_set_softpause(struct audio_client *ac,
652 struct asm_softpause_params *param);
653
654/* Set Softvolume Params */
655int q6asm_set_softvolume(struct audio_client *ac,
656 struct asm_softvolume_params *param);
657
658/* Set Softvolume Params */
659int q6asm_set_softvolume_v2(struct audio_client *ac,
660 struct asm_softvolume_params *param, int instance);
661
662/* Send left-right channel gain */
663int q6asm_set_lrgain(struct audio_client *ac, int left_gain, int right_gain);
664
665/* Send multi channel gain */
666int q6asm_set_multich_gain(struct audio_client *ac, uint32_t channels,
667 uint32_t *gains, uint8_t *ch_map, bool use_default);
668
669/* Enable Mute/unmute flag */
670int q6asm_set_mute(struct audio_client *ac, int muteflag);
671
672int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp);
673
674int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp);
675
676int q6asm_send_audio_effects_params(struct audio_client *ac, char *params,
677 uint32_t params_length);
678
679int q6asm_send_stream_cmd(struct audio_client *ac,
680 struct msm_adsp_event_data *data);
681
682int q6asm_send_ion_fd(struct audio_client *ac, int fd);
683
684int q6asm_send_rtic_event_ack(struct audio_client *ac,
685 void *param, uint32_t params_length);
686
687/* Client can set the IO mode to either AIO/SIO mode */
688int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode);
689
690/* Get Service ID for APR communication */
691int q6asm_get_apr_service_id(int session_id);
692
693/* Common format block without any payload */
694int q6asm_media_format_block(struct audio_client *ac, uint32_t format);
695
696/* Send the meta data to remove initial and trailing silence */
697int q6asm_send_meta_data(struct audio_client *ac, uint32_t initial_samples,
698 uint32_t trailing_samples);
699
700/* Send the stream meta data to remove initial and trailing silence */
701int q6asm_stream_send_meta_data(struct audio_client *ac, uint32_t stream_id,
702 uint32_t initial_samples, uint32_t trailing_samples);
703
704int q6asm_get_asm_topology(int session_id);
705int q6asm_get_asm_app_type(int session_id);
706
707int q6asm_send_mtmx_strtr_window(struct audio_client *ac,
708 struct asm_session_mtmx_strtr_param_window_v2_t *window_param,
709 uint32_t param_id);
710
711/* Configure DSP render mode */
712int q6asm_send_mtmx_strtr_render_mode(struct audio_client *ac,
713 uint32_t render_mode);
714
715/* Configure DSP clock recovery mode */
716int q6asm_send_mtmx_strtr_clk_rec_mode(struct audio_client *ac,
717 uint32_t clk_rec_mode);
718
719/* Enable adjust session clock in DSP */
720int q6asm_send_mtmx_strtr_enable_adjust_session_clock(struct audio_client *ac,
721 bool enable);
722
723/* Retrieve the current DSP path delay */
724int q6asm_get_path_delay(struct audio_client *ac);
725
726/* Helper functions to retrieve data from token */
727uint8_t q6asm_get_buf_index_from_token(uint32_t token);
728uint8_t q6asm_get_stream_id_from_token(uint32_t token);
729
730/* Adjust session clock in DSP */
731int q6asm_adjust_session_clock(struct audio_client *ac,
732 uint32_t adjust_time_lsw,
733 uint32_t adjust_time_msw);
734#endif /* __Q6_ASM_H__ */