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