Lines Matching +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0-only
18 /* Must be called with adev->comp_list_mutex held. */
24 list_for_each_entry(acomp, &adev->comp_list, node) in avs_path_find_tplg()
25 if (!strcmp(acomp->tplg->name, name)) in avs_path_find_tplg()
26 return acomp->tplg; in avs_path_find_tplg()
35 list_for_each_entry(mod, &ppl->mod_list, node) in avs_path_find_module()
36 if (mod->template->id == template_id) in avs_path_find_module()
46 list_for_each_entry(ppl, &path->ppl_list, node) in avs_path_find_pipeline()
47 if (ppl->template->id == template_id) in avs_path_find_pipeline()
63 list_for_each_entry(pos, &tplg->path_tmpl_list, node) { in avs_path_find_path()
64 if (pos->id == template_id) { in avs_path_find_path()
72 spin_lock(&adev->path_list_lock); in avs_path_find_path()
74 list_for_each_entry(path, &adev->path_list, node) { in avs_path_find_path()
75 if (path->template->owner == template) { in avs_path_find_path()
76 spin_unlock(&adev->path_list_lock); in avs_path_find_path()
81 spin_unlock(&adev->path_list_lock); in avs_path_find_path()
88 return (params_rate(params) == fmt->sampling_freq && in avs_test_hw_params()
89 params_channels(params) == fmt->num_channels && in avs_test_hw_params()
90 params_physical_width(params) == fmt->bit_depth && in avs_test_hw_params()
91 snd_pcm_hw_params_bits(params) == fmt->valid_bit_depth); in avs_test_hw_params()
102 list_for_each_entry(variant, &template->path_list, node) { in avs_path_find_variant()
103 dev_dbg(adev->dev, "check FE rate %d chn %d vbd %d bd %d\n", in avs_path_find_variant()
104 variant->fe_fmt->sampling_freq, variant->fe_fmt->num_channels, in avs_path_find_variant()
105 variant->fe_fmt->valid_bit_depth, variant->fe_fmt->bit_depth); in avs_path_find_variant()
106 dev_dbg(adev->dev, "check BE rate %d chn %d vbd %d bd %d\n", in avs_path_find_variant()
107 variant->be_fmt->sampling_freq, variant->be_fmt->num_channels, in avs_path_find_variant()
108 variant->be_fmt->valid_bit_depth, variant->be_fmt->bit_depth); in avs_path_find_variant()
110 if (variant->fe_fmt && avs_test_hw_params(fe_params, variant->fe_fmt) && in avs_path_find_variant()
111 variant->be_fmt && avs_test_hw_params(be_params, variant->be_fmt)) in avs_path_find_variant()
147 struct avs_tplg_module *t = mod->template; in avs_copier_create()
148 struct avs_copier_cfg *cfg; in avs_copier_create() local
157 data_size = sizeof(cfg->gtw_cfg.config); in avs_copier_create()
158 dma_type = t->cfg_ext->copier.dma_type; in avs_copier_create()
172 if (t->cfg_ext->copier.blob_fmt) in avs_copier_create()
173 fmt = t->cfg_ext->copier.blob_fmt; in avs_copier_create()
175 fmt = t->in_fmt; in avs_copier_create()
177 fmt = t->cfg_ext->copier.out_fmt; in avs_copier_create()
181 t->cfg_ext->copier.vindex.i2s.instance); in avs_copier_create()
182 ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq, in avs_copier_create()
183 fmt->valid_bit_depth, fmt->bit_depth); in avs_copier_create()
185 dev_err(adev->dev, "no I2S ep_blob found\n"); in avs_copier_create()
186 return -ENOENT; in avs_copier_create()
189 data = ep_blob->config.capabilities; in avs_copier_create()
190 data_size = ep_blob->config.capabilities_size; in avs_copier_create()
192 node_id.vindex = t->cfg_ext->copier.vindex.val; in avs_copier_create()
199 if (t->cfg_ext->copier.blob_fmt) in avs_copier_create()
200 fmt = t->cfg_ext->copier.blob_fmt; in avs_copier_create()
202 fmt = t->in_fmt; in avs_copier_create()
204 ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0); in avs_copier_create()
205 ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq, in avs_copier_create()
206 fmt->valid_bit_depth, fmt->bit_depth); in avs_copier_create()
208 dev_err(adev->dev, "no DMIC ep_blob found\n"); in avs_copier_create()
209 return -ENOENT; in avs_copier_create()
212 data = ep_blob->config.capabilities; in avs_copier_create()
213 data_size = ep_blob->config.capabilities_size; in avs_copier_create()
215 node_id.vindex = t->cfg_ext->copier.vindex.val; in avs_copier_create()
222 node_id.vindex = mod->owner->owner->dma_id; in avs_copier_create()
227 node_id.vindex = t->cfg_ext->copier.vindex.val | in avs_copier_create()
228 mod->owner->owner->dma_id; in avs_copier_create()
239 return -EINVAL; in avs_copier_create()
241 cfg = adev->modcfg_buf; in avs_copier_create()
242 memset(cfg, 0, cfg_size); in avs_copier_create()
243 cfg->base.cpc = t->cfg_base->cpc; in avs_copier_create()
244 cfg->base.ibs = t->cfg_base->ibs; in avs_copier_create()
245 cfg->base.obs = t->cfg_base->obs; in avs_copier_create()
246 cfg->base.is_pages = t->cfg_base->is_pages; in avs_copier_create()
247 cfg->base.audio_fmt = *t->in_fmt; in avs_copier_create()
248 cfg->out_fmt = *t->cfg_ext->copier.out_fmt; in avs_copier_create()
249 cfg->feature_mask = t->cfg_ext->copier.feature_mask; in avs_copier_create()
250 cfg->gtw_cfg.node_id = node_id; in avs_copier_create()
251 cfg->gtw_cfg.dma_buffer_size = t->cfg_ext->copier.dma_buffer_size; in avs_copier_create()
253 cfg->gtw_cfg.config_length = DIV_ROUND_UP(data_size, 4); in avs_copier_create()
255 memcpy(&cfg->gtw_cfg.config.blob, data, data_size); in avs_copier_create()
257 mod->gtw_attrs = cfg->gtw_cfg.config.attrs; in avs_copier_create()
259 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_copier_create()
260 t->core_id, t->domain, cfg, cfg_size, in avs_copier_create()
261 &mod->instance_id); in avs_copier_create()
267 struct avs_tplg_module *t = mod->template; in avs_get_module_control()
272 path_tmpl = t->owner->owner->owner; in avs_get_module_control()
273 w = path_tmpl->w; in avs_get_module_control()
275 for (i = 0; i < w->num_kcontrols; i++) { in avs_get_module_control()
279 mc = (struct soc_mixer_control *)w->kcontrols[i]->private_value; in avs_get_module_control()
280 ctl_data = (struct avs_control_data *)mc->dobj.private; in avs_get_module_control()
281 if (ctl_data->id == t->ctl_id) in avs_get_module_control()
290 struct avs_tplg_module *t = mod->template; in avs_peakvol_create()
292 struct avs_peakvol_cfg *cfg; in avs_peakvol_create() local
299 volume = ctl_data->volume; in avs_peakvol_create()
302 cfg_size = struct_size(cfg, vols, 1); in avs_peakvol_create()
304 return -EINVAL; in avs_peakvol_create()
306 cfg = adev->modcfg_buf; in avs_peakvol_create()
307 memset(cfg, 0, cfg_size); in avs_peakvol_create()
308 cfg->base.cpc = t->cfg_base->cpc; in avs_peakvol_create()
309 cfg->base.ibs = t->cfg_base->ibs; in avs_peakvol_create()
310 cfg->base.obs = t->cfg_base->obs; in avs_peakvol_create()
311 cfg->base.is_pages = t->cfg_base->is_pages; in avs_peakvol_create()
312 cfg->base.audio_fmt = *t->in_fmt; in avs_peakvol_create()
313 cfg->vols[0].target_volume = volume; in avs_peakvol_create()
314 cfg->vols[0].channel_id = AVS_ALL_CHANNELS_MASK; in avs_peakvol_create()
315 cfg->vols[0].curve_type = AVS_AUDIO_CURVE_NONE; in avs_peakvol_create()
316 cfg->vols[0].curve_duration = 0; in avs_peakvol_create()
318 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, in avs_peakvol_create()
319 t->domain, cfg, cfg_size, &mod->instance_id); in avs_peakvol_create()
326 struct avs_tplg_module *t = mod->template; in avs_updown_mix_create()
327 struct avs_updown_mixer_cfg cfg; in avs_updown_mix_create() local
330 cfg.base.cpc = t->cfg_base->cpc; in avs_updown_mix_create()
331 cfg.base.ibs = t->cfg_base->ibs; in avs_updown_mix_create()
332 cfg.base.obs = t->cfg_base->obs; in avs_updown_mix_create()
333 cfg.base.is_pages = t->cfg_base->is_pages; in avs_updown_mix_create()
334 cfg.base.audio_fmt = *t->in_fmt; in avs_updown_mix_create()
335 cfg.out_channel_config = t->cfg_ext->updown_mix.out_channel_config; in avs_updown_mix_create()
336 cfg.coefficients_select = t->cfg_ext->updown_mix.coefficients_select; in avs_updown_mix_create()
338 cfg.coefficients[i] = t->cfg_ext->updown_mix.coefficients[i]; in avs_updown_mix_create()
339 cfg.channel_map = t->cfg_ext->updown_mix.channel_map; in avs_updown_mix_create()
341 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_updown_mix_create()
342 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_updown_mix_create()
343 &mod->instance_id); in avs_updown_mix_create()
348 struct avs_tplg_module *t = mod->template; in avs_src_create()
349 struct avs_src_cfg cfg; in avs_src_create() local
351 cfg.base.cpc = t->cfg_base->cpc; in avs_src_create()
352 cfg.base.ibs = t->cfg_base->ibs; in avs_src_create()
353 cfg.base.obs = t->cfg_base->obs; in avs_src_create()
354 cfg.base.is_pages = t->cfg_base->is_pages; in avs_src_create()
355 cfg.base.audio_fmt = *t->in_fmt; in avs_src_create()
356 cfg.out_freq = t->cfg_ext->src.out_freq; in avs_src_create()
358 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_src_create()
359 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_src_create()
360 &mod->instance_id); in avs_src_create()
365 struct avs_tplg_module *t = mod->template; in avs_asrc_create()
366 struct avs_asrc_cfg cfg; in avs_asrc_create() local
368 memset(&cfg, 0, sizeof(cfg)); in avs_asrc_create()
369 cfg.base.cpc = t->cfg_base->cpc; in avs_asrc_create()
370 cfg.base.ibs = t->cfg_base->ibs; in avs_asrc_create()
371 cfg.base.obs = t->cfg_base->obs; in avs_asrc_create()
372 cfg.base.is_pages = t->cfg_base->is_pages; in avs_asrc_create()
373 cfg.base.audio_fmt = *t->in_fmt; in avs_asrc_create()
374 cfg.out_freq = t->cfg_ext->asrc.out_freq; in avs_asrc_create()
375 cfg.mode = t->cfg_ext->asrc.mode; in avs_asrc_create()
376 cfg.disable_jitter_buffer = t->cfg_ext->asrc.disable_jitter_buffer; in avs_asrc_create()
378 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_asrc_create()
379 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_asrc_create()
380 &mod->instance_id); in avs_asrc_create()
385 struct avs_tplg_module *t = mod->template; in avs_aec_create()
386 struct avs_aec_cfg cfg; in avs_aec_create() local
388 cfg.base.cpc = t->cfg_base->cpc; in avs_aec_create()
389 cfg.base.ibs = t->cfg_base->ibs; in avs_aec_create()
390 cfg.base.obs = t->cfg_base->obs; in avs_aec_create()
391 cfg.base.is_pages = t->cfg_base->is_pages; in avs_aec_create()
392 cfg.base.audio_fmt = *t->in_fmt; in avs_aec_create()
393 cfg.ref_fmt = *t->cfg_ext->aec.ref_fmt; in avs_aec_create()
394 cfg.out_fmt = *t->cfg_ext->aec.out_fmt; in avs_aec_create()
395 cfg.cpc_lp_mode = t->cfg_ext->aec.cpc_lp_mode; in avs_aec_create()
397 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_aec_create()
398 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_aec_create()
399 &mod->instance_id); in avs_aec_create()
404 struct avs_tplg_module *t = mod->template; in avs_mux_create()
405 struct avs_mux_cfg cfg; in avs_mux_create() local
407 cfg.base.cpc = t->cfg_base->cpc; in avs_mux_create()
408 cfg.base.ibs = t->cfg_base->ibs; in avs_mux_create()
409 cfg.base.obs = t->cfg_base->obs; in avs_mux_create()
410 cfg.base.is_pages = t->cfg_base->is_pages; in avs_mux_create()
411 cfg.base.audio_fmt = *t->in_fmt; in avs_mux_create()
412 cfg.ref_fmt = *t->cfg_ext->mux.ref_fmt; in avs_mux_create()
413 cfg.out_fmt = *t->cfg_ext->mux.out_fmt; in avs_mux_create()
415 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_mux_create()
416 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_mux_create()
417 &mod->instance_id); in avs_mux_create()
422 struct avs_tplg_module *t = mod->template; in avs_wov_create()
423 struct avs_wov_cfg cfg; in avs_wov_create() local
425 cfg.base.cpc = t->cfg_base->cpc; in avs_wov_create()
426 cfg.base.ibs = t->cfg_base->ibs; in avs_wov_create()
427 cfg.base.obs = t->cfg_base->obs; in avs_wov_create()
428 cfg.base.is_pages = t->cfg_base->is_pages; in avs_wov_create()
429 cfg.base.audio_fmt = *t->in_fmt; in avs_wov_create()
430 cfg.cpc_lp_mode = t->cfg_ext->wov.cpc_lp_mode; in avs_wov_create()
432 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_wov_create()
433 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_wov_create()
434 &mod->instance_id); in avs_wov_create()
439 struct avs_tplg_module *t = mod->template; in avs_micsel_create()
440 struct avs_micsel_cfg cfg; in avs_micsel_create() local
442 cfg.base.cpc = t->cfg_base->cpc; in avs_micsel_create()
443 cfg.base.ibs = t->cfg_base->ibs; in avs_micsel_create()
444 cfg.base.obs = t->cfg_base->obs; in avs_micsel_create()
445 cfg.base.is_pages = t->cfg_base->is_pages; in avs_micsel_create()
446 cfg.base.audio_fmt = *t->in_fmt; in avs_micsel_create()
447 cfg.out_fmt = *t->cfg_ext->micsel.out_fmt; in avs_micsel_create()
449 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_micsel_create()
450 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_micsel_create()
451 &mod->instance_id); in avs_micsel_create()
456 struct avs_tplg_module *t = mod->template; in avs_modbase_create()
457 struct avs_modcfg_base cfg; in avs_modbase_create() local
459 cfg.cpc = t->cfg_base->cpc; in avs_modbase_create()
460 cfg.ibs = t->cfg_base->ibs; in avs_modbase_create()
461 cfg.obs = t->cfg_base->obs; in avs_modbase_create()
462 cfg.is_pages = t->cfg_base->is_pages; in avs_modbase_create()
463 cfg.audio_fmt = *t->in_fmt; in avs_modbase_create()
465 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_modbase_create()
466 t->core_id, t->domain, &cfg, sizeof(cfg), in avs_modbase_create()
467 &mod->instance_id); in avs_modbase_create()
472 struct avs_tplg_module *t = mod->template; in avs_modext_create()
473 struct avs_tplg_modcfg_ext *tcfg = t->cfg_ext; in avs_modext_create()
474 struct avs_modcfg_ext *cfg; in avs_modext_create() local
478 num_pins = tcfg->generic.num_input_pins + tcfg->generic.num_output_pins; in avs_modext_create()
479 cfg_size = struct_size(cfg, pin_fmts, num_pins); in avs_modext_create()
482 return -EINVAL; in avs_modext_create()
484 cfg = adev->modcfg_buf; in avs_modext_create()
485 memset(cfg, 0, cfg_size); in avs_modext_create()
486 cfg->base.cpc = t->cfg_base->cpc; in avs_modext_create()
487 cfg->base.ibs = t->cfg_base->ibs; in avs_modext_create()
488 cfg->base.obs = t->cfg_base->obs; in avs_modext_create()
489 cfg->base.is_pages = t->cfg_base->is_pages; in avs_modext_create()
490 cfg->base.audio_fmt = *t->in_fmt; in avs_modext_create()
491 cfg->num_input_pins = tcfg->generic.num_input_pins; in avs_modext_create()
492 cfg->num_output_pins = tcfg->generic.num_output_pins; in avs_modext_create()
496 struct avs_tplg_pin_format *tpin = &tcfg->generic.pin_fmts[i]; in avs_modext_create()
497 struct avs_pin_format *pin = &cfg->pin_fmts[i]; in avs_modext_create()
499 pin->pin_index = tpin->pin_index; in avs_modext_create()
500 pin->iobs = tpin->iobs; in avs_modext_create()
501 pin->audio_fmt = *tpin->fmt; in avs_modext_create()
504 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, in avs_modext_create()
505 t->core_id, t->domain, cfg, cfg_size, in avs_modext_create()
506 &mod->instance_id); in avs_modext_create()
512 dev_err(adev->dev, "Probe module can't be instantiated by topology"); in avs_probe_create()
513 return -EINVAL; in avs_probe_create()
540 const guid_t *type = &mod->template->cfg_ext->type; in avs_path_module_type_create()
553 acomp = to_avs_soc_component(mod->template->owner->owner->owner->owner->comp); in avs_path_module_send_init_configs()
555 u32 num_ids = mod->template->num_config_ids; in avs_path_module_send_init_configs()
556 u32 *ids = mod->template->config_ids; in avs_path_module_send_init_configs()
559 struct avs_tplg_init_config *config = &acomp->tplg->init_configs[ids[i]]; in avs_path_module_send_init_configs()
560 size_t len = config->length; in avs_path_module_send_init_configs()
561 void *data = config->data; in avs_path_module_send_init_configs()
562 u32 param = config->param; in avs_path_module_send_init_configs()
565 ret = avs_ipc_set_large_config(adev, mod->module_id, mod->instance_id, in avs_path_module_send_init_configs()
568 dev_err(adev->dev, "send initial module config failed: %d\n", ret); in avs_path_module_send_init_configs()
589 module_id = avs_get_module_id(adev, &template->cfg_ext->type); in avs_path_module_create()
595 return ERR_PTR(-ENOMEM); in avs_path_module_create()
597 mod->template = template; in avs_path_module_create()
598 mod->module_id = module_id; in avs_path_module_create()
599 mod->owner = owner; in avs_path_module_create()
600 INIT_LIST_HEAD(&mod->node); in avs_path_module_create()
604 dev_err(adev->dev, "module-type create failed: %d\n", ret); in avs_path_module_create()
625 t = binding->template; in avs_path_binding_arm()
626 this_mod = avs_path_find_module(binding->owner, in avs_path_binding_arm()
627 t->mod_id); in avs_path_binding_arm()
629 dev_err(adev->dev, "path mod %d not found\n", t->mod_id); in avs_path_binding_arm()
630 return -EINVAL; in avs_path_binding_arm()
634 target_path = avs_path_find_path(adev, t->target_tplg_name, in avs_path_binding_arm()
635 t->target_path_tmpl_id); in avs_path_binding_arm()
637 dev_err(adev->dev, "target path %s:%d not found\n", in avs_path_binding_arm()
638 t->target_tplg_name, t->target_path_tmpl_id); in avs_path_binding_arm()
639 return -EINVAL; in avs_path_binding_arm()
643 t->target_ppl_id); in avs_path_binding_arm()
645 dev_err(adev->dev, "target ppl %d not found\n", t->target_ppl_id); in avs_path_binding_arm()
646 return -EINVAL; in avs_path_binding_arm()
649 target_mod = avs_path_find_module(target_ppl, t->target_mod_id); in avs_path_binding_arm()
651 dev_err(adev->dev, "target mod %d not found\n", t->target_mod_id); in avs_path_binding_arm()
652 return -EINVAL; in avs_path_binding_arm()
655 if (t->is_sink) { in avs_path_binding_arm()
656 binding->sink = this_mod; in avs_path_binding_arm()
657 binding->sink_pin = t->mod_pin; in avs_path_binding_arm()
658 binding->source = target_mod; in avs_path_binding_arm()
659 binding->source_pin = t->target_mod_pin; in avs_path_binding_arm()
661 binding->sink = target_mod; in avs_path_binding_arm()
662 binding->sink_pin = t->target_mod_pin; in avs_path_binding_arm()
663 binding->source = this_mod; in avs_path_binding_arm()
664 binding->source_pin = t->mod_pin; in avs_path_binding_arm()
683 return ERR_PTR(-ENOMEM); in avs_path_binding_create()
685 binding->template = t; in avs_path_binding_create()
686 binding->owner = owner; in avs_path_binding_create()
687 INIT_LIST_HEAD(&binding->node); in avs_path_binding_create()
697 list_for_each_entry(mod, &ppl->mod_list, node) { in avs_path_pipeline_arm()
705 if (mod == list_last_entry(&ppl->mod_list, in avs_path_pipeline_arm()
713 ret = avs_ipc_bind(adev, source->module_id, source->instance_id, in avs_path_pipeline_arm()
714 sink->module_id, sink->instance_id, 0, 0); in avs_path_pipeline_arm()
728 list_for_each_entry_safe(binding, bsave, &ppl->binding_list, node) { in avs_path_pipeline_free()
729 list_del(&binding->node); in avs_path_pipeline_free()
733 avs_dsp_delete_pipeline(adev, ppl->instance_id); in avs_path_pipeline_free()
736 list_for_each_entry_safe(mod, save, &ppl->mod_list, node) { in avs_path_pipeline_free()
737 avs_dsp_delete_module(adev, mod->module_id, mod->instance_id, in avs_path_pipeline_free()
738 mod->owner->instance_id, in avs_path_pipeline_free()
739 mod->template->core_id); in avs_path_pipeline_free()
743 list_del(&ppl->node); in avs_path_pipeline_free()
752 struct avs_tplg_pplcfg *cfg = template->cfg; in avs_path_pipeline_create() local
758 return ERR_PTR(-ENOMEM); in avs_path_pipeline_create()
760 ppl->template = template; in avs_path_pipeline_create()
761 ppl->owner = owner; in avs_path_pipeline_create()
762 INIT_LIST_HEAD(&ppl->binding_list); in avs_path_pipeline_create()
763 INIT_LIST_HEAD(&ppl->mod_list); in avs_path_pipeline_create()
764 INIT_LIST_HEAD(&ppl->node); in avs_path_pipeline_create()
766 ret = avs_dsp_create_pipeline(adev, cfg->req_size, cfg->priority, in avs_path_pipeline_create()
767 cfg->lp, cfg->attributes, in avs_path_pipeline_create()
768 &ppl->instance_id); in avs_path_pipeline_create()
770 dev_err(adev->dev, "error creating pipeline %d\n", ret); in avs_path_pipeline_create()
775 list_for_each_entry(tmod, &template->mod_list, node) { in avs_path_pipeline_create()
781 dev_err(adev->dev, "error creating module %d\n", ret); in avs_path_pipeline_create()
785 list_add_tail(&mod->node, &ppl->mod_list); in avs_path_pipeline_create()
788 for (i = 0; i < template->num_bindings; i++) { in avs_path_pipeline_create()
791 binding = avs_path_binding_create(adev, ppl, template->bindings[i]); in avs_path_pipeline_create()
794 dev_err(adev->dev, "error creating binding %d\n", ret); in avs_path_pipeline_create()
798 list_add_tail(&binding->node, &ppl->binding_list); in avs_path_pipeline_create()
813 path->owner = adev; in avs_path_init()
814 path->template = template; in avs_path_init()
815 path->dma_id = dma_id; in avs_path_init()
816 INIT_LIST_HEAD(&path->ppl_list); in avs_path_init()
817 INIT_LIST_HEAD(&path->node); in avs_path_init()
820 list_for_each_entry(tppl, &template->ppl_list, node) { in avs_path_init()
827 list_add_tail(&ppl->node, &path->ppl_list); in avs_path_init()
830 spin_lock(&adev->path_list_lock); in avs_path_init()
831 list_add_tail(&path->node, &adev->path_list); in avs_path_init()
832 spin_unlock(&adev->path_list_lock); in avs_path_init()
843 list_for_each_entry(ppl, &path->ppl_list, node) { in avs_path_arm()
848 list_for_each_entry(binding, &ppl->binding_list, node) { in avs_path_arm()
866 spin_lock(&path->owner->path_list_lock); in avs_path_free_unlocked()
867 list_del(&path->node); in avs_path_free_unlocked()
868 spin_unlock(&path->owner->path_list_lock); in avs_path_free_unlocked()
870 list_for_each_entry_safe(ppl, save, &path->ppl_list, node) in avs_path_free_unlocked()
871 avs_path_pipeline_free(path->owner, ppl); in avs_path_free_unlocked()
884 return ERR_PTR(-ENOMEM); in avs_path_create_unlocked()
894 path->state = AVS_PPL_STATE_INVALID; in avs_path_create_unlocked()
903 struct avs_dev *adev = path->owner; in avs_path_free()
905 mutex_lock(&adev->path_mutex); in avs_path_free()
907 mutex_unlock(&adev->path_mutex); in avs_path_free()
920 dev_err(adev->dev, "no matching variant found\n"); in avs_path_create()
921 return ERR_PTR(-ENOENT); in avs_path_create()
925 mutex_lock(&adev->path_mutex); in avs_path_create()
927 mutex_lock(&adev->comp_list_mutex); in avs_path_create()
931 mutex_unlock(&adev->comp_list_mutex); in avs_path_create()
932 mutex_unlock(&adev->path_mutex); in avs_path_create()
941 struct avs_tplg_module *tsource = binding->source->template; in avs_path_bind_prepare()
942 struct avs_path_module *source = binding->source; in avs_path_bind_prepare()
949 if (!binding->source_pin) in avs_path_bind_prepare()
951 if (!guid_equal(&tsource->cfg_ext->type, &AVS_COPIER_MOD_UUID)) in avs_path_bind_prepare()
954 src_fmt = tsource->in_fmt; in avs_path_bind_prepare()
955 sink_fmt = binding->sink->template->in_fmt; in avs_path_bind_prepare()
957 ret = avs_ipc_copier_set_sink_format(adev, source->module_id, in avs_path_bind_prepare()
958 source->instance_id, binding->source_pin, in avs_path_bind_prepare()
961 dev_err(adev->dev, "config copier failed: %d\n", ret); in avs_path_bind_prepare()
971 struct avs_dev *adev = path->owner; in avs_path_bind()
974 list_for_each_entry(ppl, &path->ppl_list, node) { in avs_path_bind()
977 list_for_each_entry(binding, &ppl->binding_list, node) { in avs_path_bind()
980 source = binding->source; in avs_path_bind()
981 sink = binding->sink; in avs_path_bind()
987 ret = avs_ipc_bind(adev, source->module_id, in avs_path_bind()
988 source->instance_id, sink->module_id, in avs_path_bind()
989 sink->instance_id, binding->sink_pin, in avs_path_bind()
990 binding->source_pin); in avs_path_bind()
992 dev_err(adev->dev, "bind path failed: %d\n", ret); in avs_path_bind()
1004 struct avs_dev *adev = path->owner; in avs_path_unbind()
1007 list_for_each_entry(ppl, &path->ppl_list, node) { in avs_path_unbind()
1010 list_for_each_entry(binding, &ppl->binding_list, node) { in avs_path_unbind()
1013 source = binding->source; in avs_path_unbind()
1014 sink = binding->sink; in avs_path_unbind()
1016 ret = avs_ipc_unbind(adev, source->module_id, in avs_path_unbind()
1017 source->instance_id, sink->module_id, in avs_path_unbind()
1018 sink->instance_id, binding->sink_pin, in avs_path_unbind()
1019 binding->source_pin); in avs_path_unbind()
1021 dev_err(adev->dev, "unbind path failed: %d\n", ret); in avs_path_unbind()
1033 struct avs_dev *adev = path->owner; in avs_path_reset()
1036 if (path->state == AVS_PPL_STATE_RESET) in avs_path_reset()
1039 list_for_each_entry(ppl, &path->ppl_list, node) { in avs_path_reset()
1040 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id, in avs_path_reset()
1043 dev_err(adev->dev, "reset path failed: %d\n", ret); in avs_path_reset()
1044 path->state = AVS_PPL_STATE_INVALID; in avs_path_reset()
1049 path->state = AVS_PPL_STATE_RESET; in avs_path_reset()
1056 struct avs_dev *adev = path->owner; in avs_path_pause()
1059 if (path->state == AVS_PPL_STATE_PAUSED) in avs_path_pause()
1062 list_for_each_entry_reverse(ppl, &path->ppl_list, node) { in avs_path_pause()
1063 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id, in avs_path_pause()
1066 dev_err(adev->dev, "pause path failed: %d\n", ret); in avs_path_pause()
1067 path->state = AVS_PPL_STATE_INVALID; in avs_path_pause()
1072 path->state = AVS_PPL_STATE_PAUSED; in avs_path_pause()
1079 struct avs_dev *adev = path->owner; in avs_path_run()
1082 if (path->state == AVS_PPL_STATE_RUNNING && trigger == AVS_TPLG_TRIGGER_AUTO) in avs_path_run()
1085 list_for_each_entry(ppl, &path->ppl_list, node) { in avs_path_run()
1086 if (ppl->template->cfg->trigger != trigger) in avs_path_run()
1089 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id, in avs_path_run()
1092 dev_err(adev->dev, "run path failed: %d\n", ret); in avs_path_run()
1093 path->state = AVS_PPL_STATE_INVALID; in avs_path_run()
1098 path->state = AVS_PPL_STATE_RUNNING; in avs_path_run()