Skip to content

Commit 894fe70

Browse files
marcinszkudlinskilgirdwood
authored andcommitted
buf: extend module unbind call API_CALL
Currently unbind api call passes IPC4 header only. This commit extends API by adding pointers to sink/source of the entity that is being bound. Note that in pipeline 2.0 there's a possibility to bind a module to a module, therefore pointers to sink/src need to be provided instead of a pointer to a buffer Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent b90b7ae commit 894fe70

15 files changed

Lines changed: 47 additions & 34 deletions

File tree

src/audio/copier/copier.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ __cold static int copier_bind(struct processing_module *mod, struct bind_info *b
12021202
return -ENODEV;
12031203
}
12041204

1205-
__cold static int copier_unbind(struct processing_module *mod, void *data)
1205+
__cold static int copier_unbind(struct processing_module *mod, struct bind_info *unbind_data)
12061206
{
12071207
struct copier_data *cd = module_get_private_data(mod);
12081208
struct comp_dev *dev = mod->dev;
@@ -1212,7 +1212,7 @@ __cold static int copier_unbind(struct processing_module *mod, void *data)
12121212
if (dev->ipc_config.type == SOF_COMP_DAI) {
12131213
struct dai_data *dd = cd->dd[0];
12141214

1215-
return dai_zephyr_unbind(dd, dev, data);
1215+
return dai_zephyr_unbind(dd, dev, unbind_data);
12161216
}
12171217

12181218
return 0;

src/audio/copier/dai_copier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static inline int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, v
6969
int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,
7070
struct comp_buffer *multi_endpoint_buffer,
7171
int num_endpoints);
72-
int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data);
72+
int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, struct bind_info *unbind_data);
7373
#endif
7474

7575

src/audio/dai-zephyr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,14 +1961,15 @@ static uint64_t dai_get_processed_data(struct comp_dev *dev, uint32_t stream_no,
19611961
}
19621962

19631963
#ifdef CONFIG_IPC_MAJOR_4
1964-
__cold int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data)
1964+
__cold
1965+
int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, struct bind_info *unbind_data)
19651966
{
19661967
struct ipc4_module_bind_unbind *bu;
19671968
int buf_id;
19681969

19691970
assert_can_be_cold();
19701971

1971-
bu = (struct ipc4_module_bind_unbind *)data;
1972+
bu = unbind_data->ipc4_data;
19721973
buf_id = IPC4_COMP_ID(bu->extension.r.src_queue, bu->extension.r.dst_queue);
19731974

19741975
if (dd && dd->local_buffer) {

src/audio/kpb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,15 @@ static int kpb_bind(struct comp_dev *dev, struct bind_info *bind_data)
383383
* \param[in] data - ipc4 bind/unbind data.
384384
* \return: none.
385385
*/
386-
static int kpb_unbind(struct comp_dev *dev, void *data)
386+
static int kpb_unbind(struct comp_dev *dev, struct bind_info *unbind_data)
387387
{
388388
struct comp_data *kpb = comp_get_drvdata(dev);
389389
struct ipc4_module_bind_unbind *bu;
390390
int buf_id;
391391

392392
comp_dbg(dev, "kpb_bind()");
393393

394-
bu = (struct ipc4_module_bind_unbind *)data;
394+
bu = unbind_data->ipc4_data;
395395
buf_id = IPC4_COMP_ID(bu->extension.r.src_queue, bu->extension.r.dst_queue);
396396

397397
/* Reset sinks when unbinding */

src/audio/mixin_mixout/mixin_mixout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int mixout_bind(struct processing_module *mod, struct bind_info *bind_dat
831831
return 0;
832832
}
833833

834-
static int mixout_unbind(struct processing_module *mod, void *data)
834+
static int mixout_unbind(struct processing_module *mod, struct bind_info *unbind_data)
835835
{
836836
struct ipc4_module_bind_unbind *bu;
837837
struct comp_dev *mixin;
@@ -841,7 +841,7 @@ static int mixout_unbind(struct processing_module *mod, void *data)
841841

842842
comp_dbg(mod->dev, "mixout_unbind()");
843843

844-
bu = (struct ipc4_module_bind_unbind *)data;
844+
bu = unbind_data->ipc4_data;
845845
src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id);
846846

847847
/* we are only interested in unbind for mixin -> mixout pair */

src/audio/module_adapter/module/generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ int module_bind(struct processing_module *mod, struct bind_info *bind_data)
502502
return 0;
503503
}
504504

505-
int module_unbind(struct processing_module *mod, void *data)
505+
int module_unbind(struct processing_module *mod, struct bind_info *unbind_data)
506506
{
507507
const struct module_interface *const ops = mod->dev->drv->adapter_ops;
508508

509509
if (ops->unbind)
510-
return ops->unbind(mod, data);
510+
return ops->unbind(mod, unbind_data);
511511
return 0;
512512
}
513513

src/audio/module_adapter/module_adapter_ipc4.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ int module_adapter_bind(struct comp_dev *dev, struct bind_info *bind_data)
257257
}
258258
EXPORT_SYMBOL(module_adapter_bind);
259259

260-
int module_adapter_unbind(struct comp_dev *dev, void *data)
260+
int module_adapter_unbind(struct comp_dev *dev, struct bind_info *unbind_data)
261261
{
262262
struct processing_module *mod = comp_mod(dev);
263263
int ret;
264264

265-
ret = module_unbind(mod, data);
265+
ret = module_unbind(mod, unbind_data);
266266
if (ret < 0)
267267
return ret;
268268

src/debug/tester/tester.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ static int tester_bind(struct processing_module *mod, struct bind_info *bind_dat
199199
return ret;
200200
}
201201

202-
static int tester_unbind(struct processing_module *mod, void *data)
202+
static int tester_unbind(struct processing_module *mod, struct bind_info *unbind_data)
203203
{
204204
struct tester_module_data *cd = module_get_private_data(mod);
205205
int ret = 0;
206206

207207
if (cd->tester_case_interface->unbind)
208-
ret = cd->tester_case_interface->unbind(cd->test_case_ctx, mod, data);
208+
ret = cd->tester_case_interface->unbind(cd->test_case_ctx, mod, unbind_data);
209209

210210
return ret;
211211
}

src/debug/tester/tester.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct tester_test_case_interface {
8080
/**
8181
* copy of module unbind method, with additional ctx param
8282
*/
83-
int (*unbind)(void *ctx, struct processing_module *mod, void *data);
83+
int (*unbind)(void *ctx, struct processing_module *mod, struct bind_info *unbind_data);
8484

8585
/**
8686
* copy of module trigger method, with additional ctx param

src/idc/idc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ static int idc_ipc4_unbind(uint32_t comp_id)
102102
{
103103
struct ipc_comp_dev *ipc_dev;
104104
struct idc_payload *payload;
105-
struct ipc4_module_bind_unbind *bu;
105+
struct bind_info *bu;
106106

107107
ipc_dev = ipc_get_comp_by_id(ipc_get(), comp_id);
108108
if (!ipc_dev)
109109
return -ENODEV;
110110

111111
payload = idc_payload_get(*idc_get(), cpu_get_id());
112-
bu = (struct ipc4_module_bind_unbind *)payload;
112+
bu = (struct bind_info *)payload;
113113

114114
return comp_unbind(ipc_dev->cd, bu);
115115
}

0 commit comments

Comments
 (0)