alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Takashi Iwai <tiwai@suse.de>, Mark Brown <broonie@kernel.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	sound-open-firmware@alsa-project.org
Subject: [PATCH v2 07/12] [RESEND] ASoC: SOF: add two helper lookup functions
Date: Fri,  3 Apr 2020 11:14:01 +0200	[thread overview]
Message-ID: <20200403091406.22381-8-guennadi.liakhovetski@linux.intel.com> (raw)
In-Reply-To: <20200403091406.22381-1-guennadi.liakhovetski@linux.intel.com>

Add two helper lookup functions for finding a widget by its component
ID and a DAI by a pipeline ID.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
---
 sound/soc/sof/sof-audio.c | 24 ++++++++++++++++++++++++
 sound/soc/sof/sof-audio.h |  4 ++++
 2 files changed, 28 insertions(+)

diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index fc4ed2a..b4c5fe2 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -395,6 +395,30 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_soc_component *scomp,
 	return NULL;
 }
 
+struct snd_sof_widget *snd_sof_find_swidget_id(struct snd_sof_dev *sdev,
+					       unsigned int comp_id)
+{
+	struct snd_sof_widget *swidget;
+
+	list_for_each_entry(swidget, &sdev->widget_list, list)
+		if (swidget->comp_id == comp_id)
+			return swidget;
+
+	return NULL;
+}
+
+struct snd_sof_dai *snd_sof_find_dai_pipe(struct snd_sof_dev *sdev,
+					  unsigned int pipeline_id)
+{
+	struct snd_sof_dai *dai;
+
+	list_for_each_entry(dai, &sdev->dai_list, list)
+		if (dai->pipeline_id == pipeline_id)
+			return dai;
+
+	return NULL;
+}
+
 /*
  * SOF Driver enumeration.
  */
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index bf65f31a..4880b32 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -190,6 +190,10 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp,
 					   int *direction);
 struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_soc_component *scomp,
 					     unsigned int pcm_id);
+struct snd_sof_widget *snd_sof_find_swidget_id(struct snd_sof_dev *sdev,
+					       unsigned int comp_id);
+struct snd_sof_dai *snd_sof_find_dai_pipe(struct snd_sof_dev *sdev,
+					  unsigned int pipeline_id);
 void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream);
 void snd_sof_pcm_period_elapsed_work(struct work_struct *work);
 
-- 
1.9.3


  parent reply	other threads:[~2020-04-03  9:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03  9:13 [PATCH v2 00/12] [RESEND] ASoC: SOF DSP virtualisation Guennadi Liakhovetski
2020-04-03  9:13 ` [PATCH v2 01/12] [RESEND] ASoC: add function parameters to enable forced path pruning Guennadi Liakhovetski
2020-04-03  9:13 ` [PATCH v2 02/12] [RESEND] ASoC: SOF: extract firmware-related operation into a function Guennadi Liakhovetski
2020-04-03  9:13 ` [PATCH v2 03/12] [RESEND] ASoC: SOF: VirtIO: make a function global Guennadi Liakhovetski
2020-04-03  9:13 ` [PATCH v2 04/12] [RESEND] vhost: convert VHOST_VSOCK_SET_RUNNING to a generic ioctl Guennadi Liakhovetski
2020-04-03  9:13 ` [PATCH v2 05/12] [RESEND] ASoC: SOF: support IPC with immediate response Guennadi Liakhovetski
2020-04-03  9:14 ` [PATCH v2 06/12] [RESEND] ASoC: SOF: add a power status IPC Guennadi Liakhovetski
2020-04-03  9:14 ` Guennadi Liakhovetski [this message]
2020-04-03  9:14 ` [PATCH v2 08/12] [RESEND] ASoC: SOF: add a VirtIO DSP driver Guennadi Liakhovetski
2020-04-03  9:14 ` [PATCH v2 09/12] [RESEND] ASoC: SOF: add a vhost driver: sound part Guennadi Liakhovetski
2020-04-03  9:14 ` [PATCH v2 10/12] [RESEND] vhost: add an SOF DSP driver Guennadi Liakhovetski
2020-04-03  9:14 ` [PATCH v2 11/12] [RESEND] ASoC: SOF: VirtIO: free guest pipelines upon termination Guennadi Liakhovetski
2020-04-03  9:14 ` [PATCH v2 12/12] [RESEND] ASoC: SOF: VirtIO: enable simultaneous playback and capture Guennadi Liakhovetski
2020-04-03  9:28 ` [PATCH v2 00/12] [RESEND] ASoC: SOF DSP virtualisation Mark Brown
2020-04-03 11:04   ` Guennadi Liakhovetski
2020-04-03 11:26     ` Mark Brown
2020-04-03 16:10     ` [Sound-open-firmware] " Liam Girdwood
2020-04-03 16:21       ` Mark Brown
2020-04-03 18:09       ` Guennadi Liakhovetski
2020-04-07 11:24         ` Guennadi Liakhovetski
2020-04-07 11:30           ` Mark Brown
2020-04-07 12:44             ` Guennadi Liakhovetski

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=20200403091406.22381-8-guennadi.liakhovetski@linux.intel.com \
    --to=guennadi.liakhovetski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).