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