mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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>
This commit is contained in:
parent
b9aa53fbee
commit
1c943f60e8
@ -1291,6 +1291,7 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,
|
||||
snd_soc_daifmt_clock_provider_from_bitmap( \
|
||||
snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix))
|
||||
|
||||
int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream);
|
||||
int snd_soc_get_dai_id(struct device_node *ep);
|
||||
int snd_soc_get_dai_name(const struct of_phandle_args *args,
|
||||
const char **dai_name);
|
||||
|
@ -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;
|
||||
|
@ -4338,39 +4338,6 @@ static void dapm_connect_dai_routes(struct snd_soc_dapm_context *dapm,
|
||||
snd_soc_dapm_add_path(dapm, src, sink, NULL, NULL);
|
||||
}
|
||||
|
||||
static int get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream)
|
||||
{
|
||||
/*
|
||||
* [Normal]
|
||||
*
|
||||
* Playback
|
||||
* CPU : SNDRV_PCM_STREAM_PLAYBACK
|
||||
* Codec: SNDRV_PCM_STREAM_PLAYBACK
|
||||
*
|
||||
* Playback
|
||||
* 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;
|
||||
}
|
||||
|
||||
static void dapm_connect_dai_pair(struct snd_soc_card *card,
|
||||
struct snd_soc_pcm_runtime *rtd,
|
||||
struct snd_soc_dai *codec_dai,
|
||||
@ -4388,7 +4355,7 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card,
|
||||
for_each_pcm_streams(stream) {
|
||||
int stream_cpu, stream_codec;
|
||||
|
||||
stream_cpu = get_stream_cpu(dai_link, stream);
|
||||
stream_cpu = snd_soc_get_stream_cpu(dai_link, stream);
|
||||
stream_codec = stream;
|
||||
|
||||
/* connect BE DAI playback if widgets are valid */
|
||||
|
@ -2781,10 +2781,8 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
|
||||
struct snd_soc_dai *codec_dai;
|
||||
|
||||
/* Adapt stream for codec2codec links */
|
||||
int cpu_capture = dai_link->c2c_params ?
|
||||
SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
|
||||
int cpu_playback = dai_link->c2c_params ?
|
||||
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
|
||||
int cpu_capture = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_CAPTURE);
|
||||
int cpu_playback = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_PLAYBACK);
|
||||
|
||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
if (dai_link->num_cpus == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user