[Sound-open-firmware] [PATCH v2 07/12] [RESEND] ASoC: SOF: add two helper lookup functions
Guennadi Liakhovetski
guennadi.liakhovetski at linux.intel.com
Fri Apr 3 11:14:01 CEST 2020
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 at 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
More information about the Sound-open-firmware
mailing list