From 77d8dad21e6c0b9f1febf9dd886dd30f6c5d23d9 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 15 Oct 2026 17:42:33 +0100 Subject: [PATCH 1/2] audio: pipeline: publish active topology before kcontrol initialization In sof_static_topology_init(), Stage 7 calls sof_static_topology_init_controls() which dispatches to sof_static_kcontrol_set() to set initial default control values. However, sof_static_kcontrol_set() checks for an active topology via: if (!s_active_topo) return -ENODEV; Because s_active_topo was previously assigned only after Stage 7 succeeded, all initial kcontrol configurations failed with -ENODEV (-19). Publish s_active_topo prior to running Stage 7 so control lookups succeed, and ensure s_active_topo is reset to NULL in err_unwind if initialization fails. Signed-off-by: Liam Girdwood --- src/audio/pipeline/static_pipeline_loader.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/audio/pipeline/static_pipeline_loader.c b/src/audio/pipeline/static_pipeline_loader.c index ace6eef3cb9a..e8cbc0010f1c 100644 --- a/src/audio/pipeline/static_pipeline_loader.c +++ b/src/audio/pipeline/static_pipeline_loader.c @@ -1108,6 +1108,9 @@ int sof_static_topology_init(const struct sof_static_topology *topo) goto err_unwind; } + /* Publish topology as active before initializing kcontrols */ + s_active_topo = topo; + /* Stage 7: Initialize kcontrols with default values */ ret = sof_static_topology_init_controls(topo); if (ret < 0) { @@ -1115,14 +1118,12 @@ int sof_static_topology_init(const struct sof_static_topology *topo) goto err_unwind; } - /* Publish topology as active only after all construction stages succeed */ - s_active_topo = topo; - LOG_INF("Static audio topology initialized successfully (%zu pipelines, %zu comps, %zu buffers, %zu controls)", topo->num_pipelines, topo->num_comps, topo->num_buffers, topo->num_controls); return 0; err_unwind: + s_active_topo = NULL; sof_static_topology_unwind(); return ret; } From a0838bc1a852c9bc6dedd5e357f09ecddd1ee941 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 15 Oct 2026 17:42:41 +0100 Subject: [PATCH 2/2] audio: pipeline: skip unrouted components during component prepare In sof_static_topology_prepare_comps() (Stage 6), comp_prepare() is called on all components in COMP_STATE_READY. For optional or unrouted components declared in a static topology that currently have neither source buffers nor sink buffers attached (both bsource_list and bsink_list are empty), comp_prepare() fails with -ENOTCONN (-107). Skip components that have no buffer connections in the stage 6 prepare loop. Signed-off-by: Liam Girdwood --- src/audio/pipeline/static_pipeline_loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audio/pipeline/static_pipeline_loader.c b/src/audio/pipeline/static_pipeline_loader.c index e8cbc0010f1c..0169ee8783d1 100644 --- a/src/audio/pipeline/static_pipeline_loader.c +++ b/src/audio/pipeline/static_pipeline_loader.c @@ -875,8 +875,10 @@ static int sof_static_topology_prepare_comps(const struct sof_static_topology *t if (!dev) continue; - /* Only prepare components currently in READY state */ + /* Only prepare components currently in READY state that are connected to buffers */ if (dev->state == COMP_STATE_READY) { + if (list_is_empty(&dev->bsource_list) && list_is_empty(&dev->bsink_list)) + continue; const struct sof_static_comp *cdesc = &topo->comps[i]; const struct sof_static_pipeline_desc *pdesc = sof_static_find_pipeline_desc(topo, cdesc->pipeline_id);