Lines Matching defs:adev

18 /* Must be called with adev->comp_list_mutex held. */
20 avs_path_find_tplg(struct avs_dev *adev, const char *name)
24 list_for_each_entry(acomp, &adev->comp_list, node)
53 avs_path_find_path(struct avs_dev *adev, const char *name, u32 template_id)
59 tplg = avs_path_find_tplg(adev, name);
72 spin_lock(&adev->path_list_lock);
74 list_for_each_entry(path, &adev->path_list, node) {
76 spin_unlock(&adev->path_list_lock);
81 spin_unlock(&adev->path_list_lock);
95 avs_path_find_variant(struct avs_dev *adev,
103 dev_dbg(adev->dev, "check FE rate %d chn %d vbd %d bd %d\n",
106 dev_dbg(adev->dev, "check BE rate %d chn %d vbd %d bd %d\n",
118 static struct avs_tplg_path *avs_condpath_find_variant(struct avs_dev *adev,
140 static struct avs_path *avs_condpath_find_match(struct avs_dev *adev,
164 return avs_path_find_path(adev, id2->tplg_name, id2->id);
168 avs_nhlt_config_or_default(struct avs_dev *adev, struct avs_tplg_module *t);
170 int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template *template,
213 blob = avs_nhlt_config_or_default(adev, module_template);
276 avs_nhlt_config_or_default(struct avs_dev *adev, struct avs_tplg_module *t)
323 dev_warn(adev->dev, "Endpoint format configuration not found.\n");
336 static int avs_append_dma_cfg(struct avs_dev *adev, struct avs_copier_gtw_cfg *gtw,
344 if (!avs_platattr_test(adev, ALTHDA))
379 static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg *gtw,
385 blob = avs_nhlt_config_or_default(adev, t);
397 return avs_append_dma_cfg(adev, gtw, t, dma_id, cfg_size);
400 static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
410 cfg = adev->modcfg_buf;
414 ret = avs_fill_gtw_config(adev, &cfg->gtw_cfg, t, dma_id, &cfg_size);
429 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id,
434 static int avs_whm_create(struct avs_dev *adev, struct avs_path_module *mod)
444 cfg = adev->modcfg_buf;
448 ret = avs_fill_gtw_config(adev, &cfg->gtw_cfg, t, dma_id, &cfg_size);
464 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id,
493 int avs_peakvol_set_volume(struct avs_dev *adev, struct avs_path_module *mod,
514 ret = avs_ipc_peakvol_set_volumes(adev, mod->module_id, mod->instance_id, vols,
525 ret = avs_ipc_peakvol_set_volume(adev, mod->module_id, mod->instance_id, &vols[0]);
529 int avs_peakvol_set_mute(struct avs_dev *adev, struct avs_path_module *mod,
550 ret = avs_ipc_peakvol_set_mutes(adev, mod->module_id, mod->instance_id, mutes,
561 ret = avs_ipc_peakvol_set_mute(adev, mod->module_id, mod->instance_id, &mutes[0]);
565 static int avs_peakvol_create(struct avs_dev *adev, struct avs_path_module *mod)
577 cfg = adev->modcfg_buf;
589 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id,
597 ret = avs_peakvol_set_volume(adev, mod, mc, NULL);
604 return avs_peakvol_set_mute(adev, mod, mc, NULL);
608 static int avs_updown_mix_create(struct avs_dev *adev, struct avs_path_module *mod)
625 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
630 static int avs_src_create(struct avs_dev *adev, struct avs_path_module *mod)
642 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
647 static int avs_asrc_create(struct avs_dev *adev, struct avs_path_module *mod)
662 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
667 static int avs_aec_create(struct avs_dev *adev, struct avs_path_module *mod)
681 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
686 static int avs_mux_create(struct avs_dev *adev, struct avs_path_module *mod)
699 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
704 static int avs_wov_create(struct avs_dev *adev, struct avs_path_module *mod)
716 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
721 static int avs_micsel_create(struct avs_dev *adev, struct avs_path_module *mod)
733 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
738 static int avs_modbase_create(struct avs_dev *adev, struct avs_path_module *mod)
749 return avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
754 static int avs_modext_create(struct avs_dev *adev, struct avs_path_module *mod)
768 cfg = adev->modcfg_buf;
788 ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
794 static int avs_probe_create(struct avs_dev *adev, struct avs_path_module *mod)
796 dev_err(adev->dev, "Probe module can't be instantiated by topology");
802 int (*create)(struct avs_dev *adev, struct avs_path_module *mod);
823 static int avs_path_module_type_create(struct avs_dev *adev, struct avs_path_module *mod)
829 return avs_module_create[i].create(adev, mod);
831 return avs_modext_create(adev, mod);
834 static int avs_path_module_send_init_configs(struct avs_dev *adev, struct avs_path_module *mod)
850 ret = avs_ipc_set_large_config(adev, mod->module_id, mod->instance_id,
853 dev_err(adev->dev, "send initial module config failed: %d\n", ret);
861 static void avs_path_module_free(struct avs_dev *adev, struct avs_path_module *mod)
867 avs_path_module_create(struct avs_dev *adev,
874 module_id = avs_get_module_id(adev, &template->cfg_ext->type);
887 ret = avs_path_module_type_create(adev, mod);
889 dev_err(adev->dev, "module-type create failed: %d\n", ret);
894 ret = avs_path_module_send_init_configs(adev, mod);
903 static int avs_path_binding_arm(struct avs_dev *adev, struct avs_path_binding *binding)
914 dev_err(adev->dev, "path mod %d not found\n", t->mod_id);
919 target_path = avs_path_find_path(adev, t->target_tplg_name,
922 dev_err(adev->dev, "target path %s:%d not found\n",
930 dev_err(adev->dev, "target ppl %d not found\n", t->target_ppl_id);
936 dev_err(adev->dev, "target mod %d not found\n", t->target_mod_id);
955 static void avs_path_binding_free(struct avs_dev *adev, struct avs_path_binding *binding)
960 static struct avs_path_binding *avs_path_binding_create(struct avs_dev *adev,
977 static int avs_path_pipeline_arm(struct avs_dev *adev,
998 ret = avs_ipc_bind(adev, source->module_id, source->instance_id,
1007 static void avs_path_pipeline_free(struct avs_dev *adev,
1015 avs_path_binding_free(adev, binding);
1018 avs_dsp_delete_pipeline(adev, ppl->instance_id);
1022 avs_dsp_delete_module(adev, mod->module_id, mod->instance_id,
1025 avs_path_module_free(adev, mod);
1033 avs_path_pipeline_create(struct avs_dev *adev, struct avs_path *owner,
1051 ret = avs_dsp_create_pipeline(adev, cfg->req_size, cfg->priority,
1055 dev_err(adev->dev, "error creating pipeline %d\n", ret);
1063 mod = avs_path_module_create(adev, ppl, tmod);
1066 dev_err(adev->dev, "error creating module %d\n", ret);
1076 binding = avs_path_binding_create(adev, ppl, template->bindings[i]);
1079 dev_err(adev->dev, "error creating binding %d\n", ret);
1089 avs_path_pipeline_free(adev, ppl);
1093 static int avs_path_init(struct avs_dev *adev, struct avs_path *path,
1098 path->owner = adev;
1112 ppl = avs_path_pipeline_create(adev, path, tppl);
1119 spin_lock(&adev->path_list_lock);
1120 list_add_tail(&path->node, &adev->path_list);
1121 spin_unlock(&adev->path_list_lock);
1126 static int avs_path_arm(struct avs_dev *adev, struct avs_path *path)
1138 ret = avs_path_binding_arm(adev, binding);
1143 ret = avs_path_pipeline_arm(adev, ppl);
1165 static struct avs_path *avs_path_create_unlocked(struct avs_dev *adev, u32 dma_id,
1175 ret = avs_path_init(adev, path, template, dma_id);
1179 ret = avs_path_arm(adev, path);
1190 static void avs_condpath_free(struct avs_dev *adev, struct avs_path *path)
1199 dev_err(adev->dev, "reset condpath failed: %d\n", ret);
1203 dev_err(adev->dev, "unbind condpath failed: %d\n", ret);
1208 static struct avs_path *avs_condpath_create(struct avs_dev *adev,
1216 path = avs_path_create_unlocked(adev, 0, template);
1242 static int avs_condpaths_walk(struct avs_dev *adev, struct avs_path *path, int dir)
1256 list_for_each_entry(acomp, &adev->comp_list, node) {
1269 *other = avs_condpath_find_match(adev, template, path, dir);
1273 variant = avs_condpath_find_variant(adev, template, source, sink);
1277 cpath = avs_condpath_create(adev, variant, source, sink);
1286 /* Caller responsible for holding adev->path_mutex. */
1287 static int avs_condpaths_walk_all(struct avs_dev *adev, struct avs_path *path)
1291 ret = avs_condpaths_walk(adev, path, SNDRV_PCM_STREAM_CAPTURE);
1295 return avs_condpaths_walk(adev, path, SNDRV_PCM_STREAM_PLAYBACK);
1301 struct avs_dev *adev = path->owner;
1303 mutex_lock(&adev->path_mutex);
1313 mutex_unlock(&adev->path_mutex);
1316 struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
1325 variant = avs_path_find_variant(adev, template, fe_params, be_params);
1327 dev_err(adev->dev, "no matching variant found\n");
1332 mutex_lock(&adev->path_mutex);
1334 mutex_lock(&adev->comp_list_mutex);
1336 path = avs_path_create_unlocked(adev, dma_id, variant);
1340 ret = avs_condpaths_walk_all(adev, path);
1347 mutex_unlock(&adev->comp_list_mutex);
1348 mutex_unlock(&adev->path_mutex);
1353 static int avs_path_bind_prepare(struct avs_dev *adev,
1373 ret = avs_ipc_copier_set_sink_format(adev, source->module_id,
1377 dev_err(adev->dev, "config copier failed: %d\n", ret);
1387 struct avs_dev *adev = path->owner;
1399 ret = avs_path_bind_prepare(adev, binding);
1403 ret = avs_ipc_bind(adev, source->module_id,
1408 dev_err(adev->dev, "bind path failed: %d\n", ret);
1420 struct avs_dev *adev = path->owner;
1432 ret = avs_ipc_unbind(adev, source->module_id,
1437 dev_err(adev->dev, "unbind path failed: %d\n", ret);
1449 struct avs_dev *adev = path->owner;
1456 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
1459 dev_err(adev->dev, "reset path failed: %d\n", ret);
1469 static int avs_condpath_pause(struct avs_dev *adev, struct avs_path *cpath)
1478 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id, AVS_PPL_STATE_PAUSED);
1480 dev_err(adev->dev, "pause cpath failed: %d\n", ret);
1490 static void avs_condpaths_pause(struct avs_dev *adev, struct avs_path *path)
1494 mutex_lock(&adev->path_mutex);
1498 avs_condpath_pause(adev, cpath);
1500 avs_condpath_pause(adev, cpath);
1502 mutex_unlock(&adev->path_mutex);
1508 struct avs_dev *adev = path->owner;
1514 avs_condpaths_pause(adev, path);
1517 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
1520 dev_err(adev->dev, "pause path failed: %d\n", ret);
1530 static int avs_condpath_run(struct avs_dev *adev, struct avs_path *cpath, int trigger)
1542 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id, AVS_PPL_STATE_RUNNING);
1544 dev_err(adev->dev, "run cpath failed: %d\n", ret);
1554 static void avs_condpaths_run(struct avs_dev *adev, struct avs_path *path, int trigger)
1558 mutex_lock(&adev->path_mutex);
1564 avs_condpath_run(adev, cpath, trigger);
1569 avs_condpath_run(adev, cpath, trigger);
1571 mutex_unlock(&adev->path_mutex);
1577 struct avs_dev *adev = path->owner;
1587 ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
1590 dev_err(adev->dev, "run path failed: %d\n", ret);
1600 avs_condpaths_run(adev, path, trigger);