Skip to content

Commit 489da6e

Browse files
committed
copier: update buffer format on bind
Windows driver sends SET_SINK_FORMAT IPC to configure Copier module sink processing parameters before bind when there is no processing buffer between connected components. Add Copier bind operation to update buffer format on BIND IPC. Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
1 parent 65bad5c commit 489da6e

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

src/audio/copier/copier.c

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -693,19 +693,6 @@ static int copier_set_sink_fmt(struct comp_dev *dev, const void *data,
693693
&sink_fmt->sink_fmt, ipc4_gtw_none,
694694
ipc4_bidirection);
695695

696-
/* update corresponding sink format */
697-
list_for_item(sink_list, &dev->bsink_list) {
698-
int sink_id;
699-
700-
sink = container_of(sink_list, struct comp_buffer, source_list);
701-
702-
sink_id = IPC4_SINK_QUEUE_ID(buf_get_id(sink));
703-
if (sink_id == sink_fmt->sink_id) {
704-
ipc4_update_buffer_format(sink, &sink_fmt->sink_fmt);
705-
break;
706-
}
707-
}
708-
709696
return 0;
710697
}
711698

@@ -990,6 +977,30 @@ static int copier_get_hw_params(struct comp_dev *dev, struct sof_ipc_stream_para
990977
return dai_common_get_hw_params(dd, dev, params, dir);
991978
}
992979

980+
static int copier_bind(struct processing_module *mod, void *data)
981+
{
982+
struct copier_data *cd = module_get_private_data(mod);
983+
struct comp_dev *dev = mod->dev;
984+
struct ipc4_module_bind_unbind *bu = data;
985+
struct list_item *sink_list;
986+
struct comp_buffer *sink;
987+
988+
/* update corresponding sink format */
989+
list_for_item(sink_list, &dev->bsink_list) {
990+
int sink_id;
991+
992+
sink = container_of(sink_list, struct comp_buffer, source_list);
993+
sink_id = IPC4_SRC_QUEUE_ID(buf_get_id(sink));
994+
if (sink_id == bu->extension.r.src_queue) {
995+
ipc4_update_buffer_format(sink, &cd->out_fmt[sink_id]);
996+
return 0;
997+
}
998+
}
999+
1000+
comp_err(dev, "No sink buffer found for src_queue %d", bu->extension.r.src_queue);
1001+
return -ENODEV;
1002+
}
1003+
9931004
static int copier_unbind(struct processing_module *mod, void *data)
9941005
{
9951006
struct copier_data *cd = module_get_private_data(mod);
@@ -1023,6 +1034,7 @@ static const struct module_interface copier_interface = {
10231034
.free = copier_free,
10241035
.set_configuration = copier_set_configuration,
10251036
.get_configuration = copier_get_configuration,
1037+
.bind = copier_bind,
10261038
.unbind = copier_unbind,
10271039
.endpoint_ops = &copier_endpoint_ops,
10281040
};

0 commit comments

Comments
 (0)