diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2023-06-01 00:42:49 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-06-06 16:57:31 +0100 |
commit | 1c943f60e830d0b959c765df09d4c4b254de0481 (patch) | |
tree | e1b38e3ffa76b4901d3149afd89ffb9b6c9484a3 /sound/soc/soc-core.c | |
parent | b9aa53fbee1e55abfcdfcc081c242de3c0582be4 (diff) |
ASoC: add snd_soc_get_stream_cpu()
We are using get_stream_cpu() to get CPU stream which cares
Codec2Codec. But it is static function for now, and we want to use it
from other files. This patch makes it global function.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fs7cj9mf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b48efc3a08d2..e8308926bd98 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3196,6 +3196,40 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider_raw); +int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream) +{ + /* + * [Normal] + * + * Playback + * CPU : SNDRV_PCM_STREAM_PLAYBACK + * Codec: SNDRV_PCM_STREAM_PLAYBACK + * + * Capture + * CPU : SNDRV_PCM_STREAM_CAPTURE + * Codec: SNDRV_PCM_STREAM_CAPTURE + */ + if (!dai_link->c2c_params) + return stream; + + /* + * [Codec2Codec] + * + * Playback + * CPU : SNDRV_PCM_STREAM_CAPTURE + * Codec: SNDRV_PCM_STREAM_PLAYBACK + * + * Capture + * CPU : SNDRV_PCM_STREAM_PLAYBACK + * Codec: SNDRV_PCM_STREAM_CAPTURE + */ + if (stream == SNDRV_PCM_STREAM_CAPTURE) + return SNDRV_PCM_STREAM_PLAYBACK; + + return SNDRV_PCM_STREAM_CAPTURE; +} +EXPORT_SYMBOL_GPL(snd_soc_get_stream_cpu); + int snd_soc_get_dai_id(struct device_node *ep) { struct snd_soc_component *component; |