Skip to content

Commit 90f94b7

Browse files
committed
src: audio: module_adapter: Do the params config right after init
The module_adapter_params() functions set the stream params based on the base config for each module which is available right after module init. So configure the params for IPC4 during module_new() and remove the call to ipc4_pipeline_params(). In order to update the buffer params, add a call to comp_verify_params() during module_bind when the intermediate buffers between modules are created. This should help with reducing the time to trigger pipelines during start. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 60e7a0a commit 90f94b7

File tree

3 files changed

+22
-51
lines changed

3 files changed

+22
-51
lines changed

src/audio/module_adapter/module_adapter.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv,
123123

124124
dev->state = COMP_STATE_READY;
125125

126+
#if CONFIG_IPC_MAJOR_4
127+
struct sof_ipc_stream_params params = {{ 0 }};
128+
129+
/* set the stream params based on the module base cfg. It is OK to pass NULL params
130+
* here because it will be filled in based on the module base_cfg.
131+
*/
132+
ret = module_adapter_params(dev, &params);
133+
if (ret) {
134+
comp_err(dev, "module_adapter_new() %d: module params failed", ret);
135+
goto err;
136+
}
137+
#endif
138+
126139
comp_dbg(dev, "module_adapter_new() done");
127140
return dev;
128141
err:
@@ -1185,9 +1198,10 @@ int module_adapter_reset(struct comp_dev *dev)
11851198
buffer_zero(buffer);
11861199
}
11871200

1201+
#if CONFIG_IPC_MAJOR_3
11881202
rfree(mod->stream_params);
11891203
mod->stream_params = NULL;
1190-
1204+
#endif
11911205
comp_dbg(dev, "module_adapter_reset(): done");
11921206

11931207
return comp_set_state(dev, COMP_TRIGGER_RESET);
@@ -1219,6 +1233,7 @@ void module_adapter_free(struct comp_dev *dev)
12191233

12201234
#if CONFIG_IPC_MAJOR_4
12211235
rfree(mod->priv.cfg.input_pins);
1236+
rfree(mod->stream_params);
12221237
#endif
12231238

12241239
rfree(mod);

src/audio/module_adapter/module_adapter_ipc4.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,12 @@ int module_adapter_bind(struct comp_dev *dev, struct bind_info *bind_data)
253253

254254
mod->stream_copy_single_to_single = !module_adapter_multi_sink_source_prepare(dev);
255255

256-
return 0;
256+
/* call comp_verify_params() to update the buffer params */
257+
ret = comp_verify_params(dev, mod->verify_params_flags, mod->stream_params);
258+
if (ret < 0)
259+
comp_err(dev, "module_adapter_bind(): comp_verify_params() failed.");
260+
261+
return ret;
257262
}
258263
EXPORT_SYMBOL(module_adapter_bind);
259264

src/ipc/ipc4/handler.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -155,46 +155,6 @@ __cold static int ipc4_delete_pipeline(struct ipc4_message_request *ipc4)
155155
return ipc_pipeline_free(ipc, pipe->primary.r.instance_id);
156156
}
157157

158-
static int ipc4_comp_params(struct comp_dev *current,
159-
struct comp_buffer *calling_buf,
160-
struct pipeline_walk_context *ctx, int dir)
161-
{
162-
struct pipeline_data *ppl_data = ctx->comp_data;
163-
int err;
164-
165-
/* don't do any params if current is running */
166-
if (current->state == COMP_STATE_ACTIVE)
167-
return 0;
168-
169-
/* Stay on the current pipeline */
170-
if (current->pipeline != ((struct pipeline_data *)ctx->comp_data)->p)
171-
return 0;
172-
173-
err = comp_params(current, &ppl_data->params->params);
174-
if (err < 0 || err == PPL_STATUS_PATH_STOP)
175-
return err;
176-
177-
return pipeline_for_each_comp(current, ctx, dir);
178-
}
179-
180-
static int ipc4_pipeline_params(struct pipeline *p, struct comp_dev *host)
181-
{
182-
struct sof_ipc_pcm_params hw_params = {{ 0 }};
183-
struct pipeline_data data = {
184-
.start = host,
185-
.params = &hw_params,
186-
.p = p,
187-
};
188-
189-
struct pipeline_walk_context param_ctx = {
190-
.comp_func = ipc4_comp_params,
191-
.comp_data = &data,
192-
.skip_incomplete = true,
193-
};
194-
195-
return param_ctx.comp_func(host, NULL, &param_ctx, host->direction);
196-
}
197-
198158
static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev)
199159
{
200160
int err, reset_err;
@@ -205,15 +165,6 @@ static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev)
205165
return -EINVAL;
206166
}
207167

208-
/* configure pipeline audio params */
209-
err = ipc4_pipeline_params(pcm_dev->cd->pipeline, pcm_dev->cd);
210-
if (err < 0) {
211-
ipc_cmd_err(&ipc_tr, "ipc: pipe %d comp %d params failed %d",
212-
pcm_dev->cd->pipeline->pipeline_id,
213-
pcm_dev->cd->pipeline->comp_id, err);
214-
goto error;
215-
}
216-
217168
/* prepare pipeline audio params */
218169
err = pipeline_prepare(pcm_dev->cd->pipeline, pcm_dev->cd);
219170
if (err < 0) {

0 commit comments

Comments
 (0)