Skip to content

Commit 99f57e8

Browse files
committed
audio: module_adapter: Set the pipeline pointer during init
Set the pipeline pointer during init for all modules and remove the code from copier init. Also set the pipeline period for all LL modules during init. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 400db36 commit 99f57e8

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/audio/copier/copier.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ static void mic_privacy_free(struct copier_data *cd)
131131
__cold static int copier_init(struct processing_module *mod)
132132
{
133133
union ipc4_connector_node_id node_id;
134-
struct ipc_comp_dev *ipc_pipe;
135-
struct ipc *ipc = ipc_get();
136134
struct copier_data *cd;
137135
struct comp_dev *dev = mod->dev;
138136
struct module_data *md = &mod->priv;
139137
struct ipc4_copier_module_cfg *copier = (struct ipc4_copier_module_cfg *)md->cfg.init_data;
140-
struct comp_ipc_config *config = &dev->ipc_config;
141138
void *gtw_cfg = NULL;
142139
size_t gtw_cfg_size;
143140
int i, ret = 0;
@@ -186,17 +183,6 @@ __cold static int copier_init(struct processing_module *mod)
186183
for (i = 0; i < IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; i++)
187184
cd->out_fmt[i] = cd->config.out_fmt;
188185

189-
ipc_pipe = ipc_get_comp_by_ppl_id(ipc, COMP_TYPE_PIPELINE,
190-
config->pipeline_id,
191-
IPC_COMP_IGNORE_REMOTE);
192-
if (!ipc_pipe) {
193-
comp_err(dev, "pipeline %d is not existed", config->pipeline_id);
194-
ret = -EPIPE;
195-
goto error;
196-
}
197-
198-
dev->pipeline = ipc_pipe->pipeline;
199-
200186
node_id = copier->gtw_cfg.node_id;
201187
/* copier is linked to gateway */
202188
if (node_id.dw != IPC4_INVALID_NODE_ID) {
@@ -205,7 +191,7 @@ __cold static int copier_init(struct processing_module *mod)
205191
switch (node_id.f.dma_type) {
206192
case ipc4_hda_host_output_class:
207193
case ipc4_hda_host_input_class:
208-
ret = copier_host_create(dev, cd, copier, ipc_pipe->pipeline);
194+
ret = copier_host_create(dev, cd, copier, dev->pipeline);
209195
if (ret < 0) {
210196
comp_err(dev, "unable to create host");
211197
goto error;
@@ -228,7 +214,7 @@ __cold static int copier_init(struct processing_module *mod)
228214
case ipc4_i2s_link_input_class:
229215
case ipc4_alh_link_output_class:
230216
case ipc4_alh_link_input_class:
231-
ret = copier_dai_create(dev, cd, copier, ipc_pipe->pipeline);
217+
ret = copier_dai_create(dev, cd, copier, dev->pipeline);
232218
if (ret < 0) {
233219
comp_err(dev, "unable to create dai");
234220
goto error;
@@ -246,7 +232,7 @@ __cold static int copier_init(struct processing_module *mod)
246232
#if CONFIG_IPC4_GATEWAY
247233
case ipc4_ipc_output_class:
248234
case ipc4_ipc_input_class:
249-
ret = copier_ipcgtw_create(dev, cd, copier, ipc_pipe->pipeline);
235+
ret = copier_ipcgtw_create(dev, cd, copier, dev->pipeline);
250236
if (ret < 0) {
251237
comp_err(dev, "unable to create IPC gateway");
252238
goto error;

src/audio/module_adapter/module_adapter.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
6565
struct processing_module *mod;
6666
struct module_config *dst;
6767
const struct module_interface *const interface = drv->adapter_ops;
68+
struct ipc_comp_dev *ipc_pipe;
69+
struct ipc *ipc = ipc_get();
6870

6971
comp_cl_dbg(drv, "start");
7072

@@ -125,6 +127,20 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
125127
else
126128
goto err;
127129

130+
/* set the pipeline pointer */
131+
ipc_pipe = ipc_get_comp_by_ppl_id(ipc, COMP_TYPE_PIPELINE, config->pipeline_id,
132+
IPC_COMP_IGNORE_REMOTE);
133+
if (!ipc_pipe) {
134+
comp_err(dev, "pipeline %d does not exist", config->pipeline_id);
135+
goto err;
136+
}
137+
138+
dev->pipeline = ipc_pipe->pipeline;
139+
140+
/* LL modules have the same period as the pipeline */
141+
if (dev->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_LL)
142+
dev->period = ipc_pipe->pipeline->period;
143+
128144
/* Init processing module */
129145
ret = module_init(mod);
130146
if (ret) {

0 commit comments

Comments
 (0)