From 4308c9b083fbab1a442e68a03de099841791df27 Mon Sep 17 00:00:00 2001 From: Jeeja KP Date: Sun, 23 Aug 2015 11:52:51 +0530 Subject: ALSA: hdac: Add snd_hdac_get_hdac_stream() Add a helper to find the stream using stream tag and direction. This is useful for drivers to query stream based on stream tag and direction, fox example while downloading FW thru DSP loader code Signed-off-by: Jeeja KP Signed-off-by: Vinod Koul Signed-off-by: Takashi Iwai --- sound/hda/hdac_stream.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sound/hda/hdac_stream.c') diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index 4c15d0accc9e..8981159813ef 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -286,6 +286,28 @@ void snd_hdac_stream_release(struct hdac_stream *azx_dev) } EXPORT_SYMBOL_GPL(snd_hdac_stream_release); +/** + * snd_hdac_get_stream - return hdac_stream based on stream_tag and + * direction + * + * @bus: HD-audio core bus + * @dir: direction for the stream to be found + * @stream_tag: stream tag for stream to be found + */ +struct hdac_stream *snd_hdac_get_stream(struct hdac_bus *bus, + int dir, int stream_tag) +{ + struct hdac_stream *s; + + list_for_each_entry(s, &bus->stream_list, list) { + if (s->direction == dir && s->stream_tag == stream_tag) + return s; + } + + return NULL; +} +EXPORT_SYMBOL_GPL(snd_hdac_get_stream); + /* * set up a BDL entry */ -- cgit v1.2.3-59-g8ed1b