| .. | .. |
|---|
| 20 | 20 | #define ASM_CLIENT_EVENT_CMD_RUN_DONE 0x1008 |
|---|
| 21 | 21 | #define ASM_CLIENT_EVENT_DATA_WRITE_DONE 0x1009 |
|---|
| 22 | 22 | #define ASM_CLIENT_EVENT_DATA_READ_DONE 0x100a |
|---|
| 23 | +#define ASM_WRITE_TOKEN_MASK GENMASK(15, 0) |
|---|
| 24 | +#define ASM_WRITE_TOKEN_LEN_MASK GENMASK(31, 16) |
|---|
| 25 | +#define ASM_WRITE_TOKEN_LEN_SHIFT 16 |
|---|
| 23 | 26 | |
|---|
| 24 | 27 | enum { |
|---|
| 25 | 28 | LEGACY_PCM_MODE = 0, |
|---|
| .. | .. |
|---|
| 29 | 32 | }; |
|---|
| 30 | 33 | |
|---|
| 31 | 34 | #define MAX_SESSIONS 8 |
|---|
| 32 | | -#define NO_TIMESTAMP 0xFF00 |
|---|
| 33 | 35 | #define FORMAT_LINEAR_PCM 0x0000 |
|---|
| 36 | +#define ASM_LAST_BUFFER_FLAG BIT(30) |
|---|
| 37 | + |
|---|
| 38 | +struct q6asm_flac_cfg { |
|---|
| 39 | + u32 sample_rate; |
|---|
| 40 | + u32 ext_sample_rate; |
|---|
| 41 | + u32 min_frame_size; |
|---|
| 42 | + u32 max_frame_size; |
|---|
| 43 | + u16 stream_info_present; |
|---|
| 44 | + u16 min_blk_size; |
|---|
| 45 | + u16 max_blk_size; |
|---|
| 46 | + u16 ch_cfg; |
|---|
| 47 | + u16 sample_size; |
|---|
| 48 | + u16 md5_sum; |
|---|
| 49 | +}; |
|---|
| 50 | + |
|---|
| 51 | +struct q6asm_wma_cfg { |
|---|
| 52 | + u32 fmtag; |
|---|
| 53 | + u32 num_channels; |
|---|
| 54 | + u32 sample_rate; |
|---|
| 55 | + u32 bytes_per_sec; |
|---|
| 56 | + u32 block_align; |
|---|
| 57 | + u32 bits_per_sample; |
|---|
| 58 | + u32 channel_mask; |
|---|
| 59 | + u32 enc_options; |
|---|
| 60 | + u32 adv_enc_options; |
|---|
| 61 | + u32 adv_enc_options2; |
|---|
| 62 | +}; |
|---|
| 63 | + |
|---|
| 64 | +struct q6asm_alac_cfg { |
|---|
| 65 | + u32 frame_length; |
|---|
| 66 | + u8 compatible_version; |
|---|
| 67 | + u8 bit_depth; |
|---|
| 68 | + u8 pb; |
|---|
| 69 | + u8 mb; |
|---|
| 70 | + u8 kb; |
|---|
| 71 | + u8 num_channels; |
|---|
| 72 | + u16 max_run; |
|---|
| 73 | + u32 max_frame_bytes; |
|---|
| 74 | + u32 avg_bit_rate; |
|---|
| 75 | + u32 sample_rate; |
|---|
| 76 | + u32 channel_layout_tag; |
|---|
| 77 | +}; |
|---|
| 78 | + |
|---|
| 79 | +struct q6asm_ape_cfg { |
|---|
| 80 | + u16 compatible_version; |
|---|
| 81 | + u16 compression_level; |
|---|
| 82 | + u32 format_flags; |
|---|
| 83 | + u32 blocks_per_frame; |
|---|
| 84 | + u32 final_frame_blocks; |
|---|
| 85 | + u32 total_frames; |
|---|
| 86 | + u16 bits_per_sample; |
|---|
| 87 | + u16 num_channels; |
|---|
| 88 | + u32 sample_rate; |
|---|
| 89 | + u32 seek_table_present; |
|---|
| 90 | +}; |
|---|
| 34 | 91 | |
|---|
| 35 | 92 | typedef void (*q6asm_cb) (uint32_t opcode, uint32_t token, |
|---|
| 36 | 93 | void *payload, void *priv); |
|---|
| .. | .. |
|---|
| 39 | 96 | q6asm_cb cb, void *priv, |
|---|
| 40 | 97 | int session_id, int perf_mode); |
|---|
| 41 | 98 | void q6asm_audio_client_free(struct audio_client *ac); |
|---|
| 42 | | -int q6asm_write_async(struct audio_client *ac, uint32_t len, uint32_t msw_ts, |
|---|
| 43 | | - uint32_t lsw_ts, uint32_t flags); |
|---|
| 44 | | -int q6asm_open_write(struct audio_client *ac, uint32_t format, |
|---|
| 45 | | - uint16_t bits_per_sample); |
|---|
| 99 | +int q6asm_write_async(struct audio_client *ac, uint32_t stream_id, uint32_t len, |
|---|
| 100 | + uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags); |
|---|
| 101 | +int q6asm_open_write(struct audio_client *ac, uint32_t stream_id, |
|---|
| 102 | + uint32_t format, u32 codec_profile, |
|---|
| 103 | + uint16_t bits_per_sample, bool is_gapless); |
|---|
| 46 | 104 | |
|---|
| 47 | | -int q6asm_open_read(struct audio_client *ac, uint32_t format, |
|---|
| 48 | | - uint16_t bits_per_sample); |
|---|
| 105 | +int q6asm_open_read(struct audio_client *ac, uint32_t stream_id, |
|---|
| 106 | + uint32_t format, uint16_t bits_per_sample); |
|---|
| 49 | 107 | int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac, |
|---|
| 50 | | - uint32_t rate, uint32_t channels, uint16_t bits_per_sample); |
|---|
| 51 | | -int q6asm_read(struct audio_client *ac); |
|---|
| 108 | + uint32_t stream_id, uint32_t rate, |
|---|
| 109 | + uint32_t channels, |
|---|
| 110 | + uint16_t bits_per_sample); |
|---|
| 111 | + |
|---|
| 112 | +int q6asm_read(struct audio_client *ac, uint32_t stream_id); |
|---|
| 52 | 113 | |
|---|
| 53 | 114 | int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac, |
|---|
| 115 | + uint32_t stream_id, |
|---|
| 54 | 116 | uint32_t rate, uint32_t channels, |
|---|
| 55 | 117 | u8 channel_map[PCM_MAX_NUM_CHANNEL], |
|---|
| 56 | 118 | uint16_t bits_per_sample); |
|---|
| 57 | | -int q6asm_run(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, |
|---|
| 58 | | - uint32_t lsw_ts); |
|---|
| 59 | | -int q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, |
|---|
| 60 | | - uint32_t lsw_ts); |
|---|
| 61 | | -int q6asm_cmd(struct audio_client *ac, int cmd); |
|---|
| 62 | | -int q6asm_cmd_nowait(struct audio_client *ac, int cmd); |
|---|
| 119 | +int q6asm_stream_media_format_block_flac(struct audio_client *ac, |
|---|
| 120 | + uint32_t stream_id, |
|---|
| 121 | + struct q6asm_flac_cfg *cfg); |
|---|
| 122 | +int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac, |
|---|
| 123 | + uint32_t stream_id, |
|---|
| 124 | + struct q6asm_wma_cfg *cfg); |
|---|
| 125 | +int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac, |
|---|
| 126 | + uint32_t stream_id, |
|---|
| 127 | + struct q6asm_wma_cfg *cfg); |
|---|
| 128 | +int q6asm_stream_media_format_block_alac(struct audio_client *ac, |
|---|
| 129 | + uint32_t stream_id, |
|---|
| 130 | + struct q6asm_alac_cfg *cfg); |
|---|
| 131 | +int q6asm_stream_media_format_block_ape(struct audio_client *ac, |
|---|
| 132 | + uint32_t stream_id, |
|---|
| 133 | + struct q6asm_ape_cfg *cfg); |
|---|
| 134 | +int q6asm_run(struct audio_client *ac, uint32_t stream_id, uint32_t flags, |
|---|
| 135 | + uint32_t msw_ts, uint32_t lsw_ts); |
|---|
| 136 | +int q6asm_run_nowait(struct audio_client *ac, uint32_t stream_id, |
|---|
| 137 | + uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts); |
|---|
| 138 | +int q6asm_stream_remove_initial_silence(struct audio_client *ac, |
|---|
| 139 | + uint32_t stream_id, |
|---|
| 140 | + uint32_t initial_samples); |
|---|
| 141 | +int q6asm_stream_remove_trailing_silence(struct audio_client *ac, |
|---|
| 142 | + uint32_t stream_id, |
|---|
| 143 | + uint32_t trailing_samples); |
|---|
| 144 | +int q6asm_cmd(struct audio_client *ac, uint32_t stream_id, int cmd); |
|---|
| 145 | +int q6asm_cmd_nowait(struct audio_client *ac, uint32_t stream_id, int cmd); |
|---|
| 63 | 146 | int q6asm_get_session_id(struct audio_client *ac); |
|---|
| 64 | 147 | int q6asm_map_memory_regions(unsigned int dir, |
|---|
| 65 | 148 | struct audio_client *ac, |
|---|