From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-sound@vger.kernel.org, kai.vehmanen@linux.intel.com,
ranjani.sridharan@linux.intel.com,
yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
liam.r.girdwood@intel.com, mateuszx.redzynia@intel.com
Subject: [PATCH 07/10] ASoC: SOF: sof-audio: Traverse paths with aggregated DAI widgets
Date: Wed, 4 Feb 2026 10:18:30 +0200 [thread overview]
Message-ID: <20260204081833.16630-8-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20260204081833.16630-1-peter.ujfalusi@linux.intel.com>
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Aggregated DAI widgets exist in topology for representation and are not
actually initialized in the firmware. But in preparation for using this
as a virtual DAI for loopback capture, make sure that we can traverse
the path from an aggregated DAI widget to the host widget.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/sof-audio.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index ac2d6660d2fa..efb5ed7d2b13 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -13,6 +13,21 @@
#include "sof-audio.h"
#include "ops.h"
+/*
+ * Check if a DAI widget is an aggregated DAI. Aggregated DAI's have names ending in numbers
+ * starting with 0. For example: in the case of a SDW speaker with 2 amps, the topology contains
+ * 2 DAI's names alh-copier.SDW1.Playback.0 and alh-copier-SDW1.Playback.1. In this case, only the
+ * DAI alh-copier.SDW1.Playback.0 is set up in the firmware. The other DAI,
+ * alh-copier.SDW1.Playback.1 in topology is for the sake of completeness to show aggregation for
+ * the speaker amp and does not need any firmware configuration.
+ */
+static bool is_aggregated_dai(struct snd_sof_widget *swidget)
+{
+ return (WIDGET_IS_DAI(swidget->id) &&
+ isdigit(swidget->widget->name[strlen(swidget->widget->name) - 1]) &&
+ swidget->widget->name[strlen(swidget->widget->name) - 1] != '0');
+}
+
static bool is_virtual_widget(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget,
const char *func)
{
@@ -402,8 +417,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
if (is_virtual_widget(sdev, widget, __func__))
return;
- /* skip if the widget is in use or if it is already unprepared */
- if (!swidget || !swidget->prepared || swidget->use_count > 0)
+ /* skip if the widget in use or already unprepared or is an aggregated DAI */
+ if (!swidget || !swidget->prepared || swidget->use_count > 0 ||
+ is_aggregated_dai(swidget))
goto sink_unprepare;
widget_ops = tplg_ops ? tplg_ops->widget : NULL;
@@ -449,6 +465,10 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget
if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared)
goto sink_prepare;
+ /* skip aggregated DAIs */
+ if (is_aggregated_dai(swidget))
+ goto sink_prepare;
+
/* prepare the source widget */
ret = widget_ops[widget->id].ipc_prepare(swidget, fe_params, platform_params,
pipeline_params, dir);
@@ -493,6 +513,7 @@ static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dap
int dir, struct snd_sof_pcm *spcm)
{
struct snd_soc_dapm_widget_list *list = spcm->stream[dir].list;
+ struct snd_sof_widget *swidget;
struct snd_soc_dapm_path *p;
int err;
int ret = 0;
@@ -500,8 +521,11 @@ static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dap
if (is_virtual_widget(sdev, widget, __func__))
return 0;
- if (widget->dobj.private) {
- err = sof_widget_free(sdev, widget->dobj.private);
+ swidget = widget->dobj.private;
+
+ /* no need to free aggregated DAI widgets */
+ if (swidget && !is_aggregated_dai(swidget)) {
+ err = sof_widget_free(sdev, swidget);
if (err < 0)
ret = err;
}
@@ -545,7 +569,10 @@ static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_d
if (swidget) {
int i;
- ret = sof_widget_setup(sdev, widget->dobj.private);
+ if (is_aggregated_dai(swidget))
+ goto sink_setup;
+
+ ret = sof_widget_setup(sdev, swidget);
if (ret < 0)
return ret;
--
2.52.0
next prev parent reply other threads:[~2026-02-04 8:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 8:18 [PATCH 00/10] ASoC: SOF: Support for echoref (virtual DAI) Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 01/10] ASoC: SOF: sof-audio: Add a new op in struct sof_ipc_tplg_ops Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 02/10] ASoC: SOF: pcm: Split up widget prepare and setup Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 03/10] uapi: sound: sof: tokens: Add missing token for KCPS Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 04/10] ASoC: Intel: sof_sdw: Add a DAI link for loopback capture Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 05/10] ASoC: SOF: ipc4-topology: Add new tokens for pipeline direction Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 06/10] ASoC: SOF: ipc4-topology: Add support for process modules with no input pins Peter Ujfalusi
2026-02-04 8:18 ` Peter Ujfalusi [this message]
2026-02-04 8:18 ` [PATCH 08/10] ASoC: SOF: sof-audio: Add support for loopback capture Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 09/10] ASoC: SOF: Intel: hda: Fix NULL pointer dereference Peter Ujfalusi
2026-02-04 8:18 ` [PATCH 10/10] ASoC: SOF: Intel: hda: Add a virtual CPU DAI Peter Ujfalusi
2026-02-05 11:04 ` [PATCH 00/10] ASoC: SOF: Support for echoref (virtual DAI) Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260204081833.16630-8-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=liam.r.girdwood@intel.com \
--cc=linux-sound@vger.kernel.org \
--cc=mateuszx.redzynia@intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox