summaryrefslogtreecommitdiff
path: root/include/sound/soc-dai.h
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2023-01-31 04:58:58 +0300
committerMark Brown <broonie@kernel.org>2023-01-31 14:04:51 +0300
commit60df5935c27e19cc6595bd1740479a60f1880a32 (patch)
tree334d8d6f2adc9c85e97798e7c471d68d9b13fb4a /include/sound/soc-dai.h
parent37ed123689968fa7f733598d9a6966e8a2db66fb (diff)
downloadlinux-60df5935c27e19cc6595bd1740479a60f1880a32.tar.xz
ASoC: soc-dai.h: add snd_soc_dai_dma_data_set/get() for low level
Current ASoC has snd_soc_dai_set/get_dma_data() which is assuming struct snd_pcm_substream to get Playback/Capture direction. But, many drivers want to use it not through snd_pcm_substream. This patch adds more low level snd_soc_dai_dma_data_set/get() for it, and previous functions will be macro for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/87a61zfori.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound/soc-dai.h')
-rw-r--r--include/sound/soc-dai.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index ea704d92deaa..f27b33dd97bd 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -493,18 +493,21 @@ void snd_soc_dai_set_widget(struct snd_soc_dai *dai, int stream, struct snd_soc_
dai->capture_widget = widget;
}
-static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
- const struct snd_pcm_substream *ss)
+#define snd_soc_dai_dma_data_get_playback(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_PLAYBACK)
+#define snd_soc_dai_dma_data_get_capture(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_CAPTURE)
+#define snd_soc_dai_get_dma_data(dai, ss) snd_soc_dai_dma_data_get(dai, ss->stream)
+static inline void *snd_soc_dai_dma_data_get(const struct snd_soc_dai *dai, int stream)
{
- return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
dai->playback_dma_data : dai->capture_dma_data;
}
-static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
- const struct snd_pcm_substream *ss,
- void *data)
+#define snd_soc_dai_dma_data_set_playback(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_PLAYBACK, data)
+#define snd_soc_dai_dma_data_set_capture(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_CAPTURE, data)
+#define snd_soc_dai_set_dma_data(dai, ss, data) snd_soc_dai_dma_data_set(dai, ss->stream, data)
+static inline void snd_soc_dai_dma_data_set(struct snd_soc_dai *dai, int stream, void *data)
{
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (stream == SNDRV_PCM_STREAM_PLAYBACK)
dai->playback_dma_data = data;
else
dai->capture_dma_data = data;