ipc4: mixin & mixout: set sink buffer format

This patch fixes zero-data issues to enable mixin & mixout
set sink buffer format for ipc4

Signed-off-by: Rander Wang <rander.wang@intel.com>
This commit is contained in:
Rander Wang 2021-09-03 13:21:32 +08:00 committed by Liam Girdwood
parent b49a170caf
commit 15122b2d99
1 changed files with 22 additions and 2 deletions

View File

@ -550,6 +550,8 @@ static int mixout_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params) struct sof_ipc_stream_params *params)
{ {
struct mixer_data *md = comp_get_drvdata(dev); struct mixer_data *md = comp_get_drvdata(dev);
struct comp_buffer *sink;
int i;
memset(params, 0, sizeof(*params)); memset(params, 0, sizeof(*params));
params->channels = md->base_cfg.audio_fmt.channels_count; params->channels = md->base_cfg.audio_fmt.channels_count;
@ -560,6 +562,26 @@ static int mixout_params(struct comp_dev *dev,
params->buffer_fmt = md->base_cfg.audio_fmt.interleaving_style; params->buffer_fmt = md->base_cfg.audio_fmt.interleaving_style;
params->buffer.size = md->base_cfg.ibs; params->buffer.size = md->base_cfg.ibs;
/* update each sink format based on base_cfg initialized by
* host driver. There is no hw_param ipc message for ipc4, instead
* all module params are built into module initialization data by
* host driver based on runtime hw_params and topology setting.
*/
sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
sink->stream.channels = md->base_cfg.audio_fmt.channels_count;
sink->stream.rate = md->base_cfg.audio_fmt.sampling_frequency;
sink->stream.frame_fmt = (md->base_cfg.audio_fmt.valid_bit_depth >> 3) - 2;
sink->buffer_fmt = md->base_cfg.audio_fmt.interleaving_style;
/* 8 ch stream is supported by ch_map and each channel
* is mapped by 4 bits. The first channel will be mapped
* by the bits of 0 ~ 3 and the 2th channel will be mapped
* by bits 4 ~ 7. The N channel will be mapped by bits
* N*4 ~ N*4 + 3
*/
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
sink->chmap[i] = (md->base_cfg.audio_fmt.ch_map >> i * 4) & 0xf;
return mixer_params(dev, params); return mixer_params(dev, params);
} }
@ -586,8 +608,6 @@ static int mixin_bind(struct comp_dev *dev, void *data)
source_buf = container_of(blist, struct comp_buffer, sink_list); source_buf = container_of(blist, struct comp_buffer, sink_list);
if (source_buf->source == dev) { if (source_buf->source == dev) {
pipeline_disconnect(sink, source_buf, PPL_CONN_DIR_BUFFER_TO_COMP); pipeline_disconnect(sink, source_buf, PPL_CONN_DIR_BUFFER_TO_COMP);
pipeline_disconnect(dev, source_buf, PPL_CONN_DIR_COMP_TO_BUFFER);
buffer_free(source_buf);
break; break;
} }
} }