diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2016-04-13 15:45:13 -0700 |
---|---|---|
committer | Kyle Yan <kyan@codeaurora.org> | 2016-06-22 14:45:07 -0700 |
commit | 44ddcabde232ba003d034803fdc4a63e72fadf7b (patch) | |
tree | 94bbf8d68462febda4b2d39ecc0b69ce361ea5da /include | |
parent | 3026cbf1d0486b9d56ce512c2d5762c08e27a125 (diff) |
ASoC: msm: qdsp6v2: pull mode playback and push mode record
Implement platform drivers to support shared memory based
pcm playback and capture.
Change-Id: I882c67ae1c3d950b98bd002ac384cc3a7e77874a
CRs-Fixed: 992798
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/apr_audio-v2.h | 108 | ||||
-rw-r--r-- | include/sound/q6asm-v2.h | 23 |
2 files changed, 131 insertions, 0 deletions
diff --git a/include/sound/apr_audio-v2.h b/include/sound/apr_audio-v2.h index 24b283311817..809d5223b638 100644 --- a/include/sound/apr_audio-v2.h +++ b/include/sound/apr_audio-v2.h @@ -3328,6 +3328,8 @@ struct asm_softvolume_params { #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5 +#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC + #define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF #define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0 @@ -3395,6 +3397,41 @@ struct asm_multi_channel_pcm_fmt_blk_v2 { */ } __packed; +struct asm_multi_channel_pcm_fmt_blk_v3 { + uint16_t num_channels; +/* + * Number of channels + * Supported values: 1 to 8 + */ + + uint16_t bits_per_sample; +/* + * Number of bits per sample per channel + * Supported values: 16, 24 + */ + + uint32_t sample_rate; +/* + * Number of samples per second + * Supported values: 2000 to 48000, 96000,192000 Hz + */ + + uint16_t is_signed; +/* Flag that indicates that PCM samples are signed (1) */ + + uint16_t sample_word_size; +/* + * Size in bits of the word that holds a sample of a channel. + * Supported values: 12,24,32 + */ + + uint8_t channel_mapping[8]; +/* + * Each element, i, in the array describes channel i inside the buffer where + * 0 <= i < num_channels. Unused channels are set to 0. + */ +} __packed; + struct asm_stream_cmd_set_encdec_param { u32 param_id; /* ID of the parameter. */ @@ -4865,6 +4902,77 @@ struct asm_stream_cmd_open_write_v3 { */ } __packed; +#define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9 + +/* Bitmask for the stream_perf_mode subfield. */ +#define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL + +/* Bitmask for the stream_perf_mode subfield. */ +#define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29 + +#define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA + +#define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL + +#define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29 + +#define ASM_DATA_EVENT_WATERMARK 0x00010DDB + +struct asm_shared_position_buffer { + volatile uint32_t frame_counter; +/* Counter used to handle interprocessor synchronization issues. + * When frame_counter is 0: read_index, wall_clock_us_lsw, and + * wall_clock_us_msw are invalid. + * Supported values: >= 0. + */ + + volatile uint32_t index; +/* Index in bytes from where the aDSP is reading/writing. + * Supported values: 0 to circular buffer size - 1 + */ + + volatile uint32_t wall_clock_us_lsw; +/* Lower 32 bits of the 64-bit wall clock time in microseconds when the + * read index was updated. + * Supported values: >= 0 + */ + + volatile uint32_t wall_clock_us_msw; +/* Upper 32 bits of the 64 bit wall clock time in microseconds when the + * read index was updated + * Supported values: >= 0 + */ +} __packed; + +struct asm_shared_watermark_level { + uint32_t watermark_level_bytes; +} __packed; + +struct asm_stream_cmd_open_shared_io { + struct apr_hdr hdr; + uint32_t mode_flags; + uint16_t endpoint_type; + uint16_t topo_bits_per_sample; + uint32_t topo_id; + uint32_t fmt_id; + uint32_t shared_pos_buf_phy_addr_lsw; + uint32_t shared_pos_buf_phy_addr_msw; + uint16_t shared_pos_buf_mem_pool_id; + uint16_t shared_pos_buf_num_regions; + uint32_t shared_pos_buf_property_flag; + uint32_t shared_circ_buf_start_phy_addr_lsw; + uint32_t shared_circ_buf_start_phy_addr_msw; + uint32_t shared_circ_buf_size; + uint16_t shared_circ_buf_mem_pool_id; + uint16_t shared_circ_buf_num_regions; + uint32_t shared_circ_buf_property_flag; + uint32_t num_watermark_levels; + struct asm_multi_channel_pcm_fmt_blk_v3 fmt; + struct avs_shared_map_region_payload map_region_pos_buf; + struct avs_shared_map_region_payload map_region_circ_buf; + struct asm_shared_watermark_level watermark[0]; +} __packed; + #define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4 /* Definition of the timestamp type flag bitmask */ diff --git a/include/sound/q6asm-v2.h b/include/sound/q6asm-v2.h index 42695f225e2e..2f3e33fd28df 100644 --- a/include/sound/q6asm-v2.h +++ b/include/sound/q6asm-v2.h @@ -170,6 +170,16 @@ struct audio_port_data { spinlock_t dsp_lock; }; +struct shared_io_config { + uint32_t format; + uint16_t bits_per_sample; + uint32_t rate; + uint32_t channels; + uint16_t sample_word_size; + uint32_t bufsz; + uint32_t bufcnt; +}; + struct audio_client { int session; app_cb cb; @@ -201,6 +211,9 @@ struct audio_client { atomic_t reset; /* holds latest DSP pipeline delay */ uint32_t path_delay; + /* shared io */ + struct audio_buffer shared_pos_buf; + struct shared_io_config config; }; void q6asm_audio_client_free(struct audio_client *ac); @@ -234,6 +247,9 @@ int q6asm_open_write(struct audio_client *ac, uint32_t format int q6asm_open_write_v2(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample); +int q6asm_open_shared_io(struct audio_client *ac, + struct shared_io_config *c, int dir); + int q6asm_stream_open_write_v2(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample, int32_t stream_id, bool is_gapless_mode); @@ -274,6 +290,13 @@ int q6asm_memory_map(struct audio_client *ac, phys_addr_t buf_add, int q6asm_memory_unmap(struct audio_client *ac, phys_addr_t buf_add, int dir); +struct audio_buffer *q6asm_shared_io_buf(struct audio_client *ac, int dir); + +int q6asm_shared_io_free(struct audio_client *ac, int dir); + +int q6asm_get_shared_pos(struct audio_client *ac, uint32_t *si, uint32_t *msw, + uint32_t *lsw); + int q6asm_map_rtac_block(struct rtac_cal_block_data *cal_block); int q6asm_unmap_rtac_block(uint32_t *mem_map_handle); |