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