OSDN Git Service

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