mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
ASoC: soc-pcm: merge DPCM and non-DPCM validation check
DPCM and non-DPCM validation check are very similar. The big difference is that DPCM doesn't check Codec validation. This is historical reason. It should be checked, but it breaks existing driver/behavior. Anyway, if we uses dummy DAI as Codec when DPCM case, there is no difference between DPCM and non-DPCM. Let's merge these. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/8734kq9vgq.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0e3dc8e4bd
commit
a6ff8572fd
@ -2822,7 +2822,11 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
|
||||
{
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_dai_link_ch_map *ch_maps;
|
||||
struct snd_soc_dai *dummy_dai = snd_soc_find_dai(&snd_soc_dummy_dlc);
|
||||
int cpu_capture;
|
||||
int cpu_playback;
|
||||
int has_playback = 0;
|
||||
int has_capture = 0;
|
||||
int i;
|
||||
@ -2832,40 +2836,38 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dai_link->dynamic || dai_link->no_pcm) {
|
||||
/* Adapt stream for codec2codec links */
|
||||
cpu_capture = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_CAPTURE);
|
||||
cpu_playback = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_PLAYBACK);
|
||||
|
||||
for_each_rtd_ch_maps(rtd, i, ch_maps) {
|
||||
cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu);
|
||||
|
||||
if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK))
|
||||
has_playback = 1;
|
||||
|
||||
if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE))
|
||||
has_capture = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
struct snd_soc_dai *codec_dai;
|
||||
|
||||
/* Adapt stream for codec2codec links */
|
||||
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);
|
||||
/*
|
||||
* see
|
||||
* soc.h :: [dai_link->ch_maps Image sample]
|
||||
*/
|
||||
for_each_rtd_ch_maps(rtd, i, ch_maps) {
|
||||
cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu);
|
||||
codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec);
|
||||
|
||||
/*
|
||||
* see
|
||||
* soc.h :: [dai_link->ch_maps Image sample]
|
||||
* FIXME
|
||||
*
|
||||
* DPCM Codec has been no checked before.
|
||||
* It should be checked, but it breaks compatibility.
|
||||
*
|
||||
* For example there is a case that CPU have loopback capabilities which is used
|
||||
* for tests on boards where the Codec has no capture capabilities. In this case,
|
||||
* Codec capture validation check will be fail, but system should allow capture
|
||||
* capabilities. We have no solution for it today.
|
||||
*/
|
||||
for_each_rtd_ch_maps(rtd, i, ch_maps) {
|
||||
cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu);
|
||||
codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec);
|
||||
if (dai_link->dynamic || dai_link->no_pcm)
|
||||
codec_dai = dummy_dai;
|
||||
|
||||
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
|
||||
snd_soc_dai_stream_valid(cpu_dai, cpu_playback))
|
||||
has_playback = 1;
|
||||
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) &&
|
||||
snd_soc_dai_stream_valid(cpu_dai, cpu_capture))
|
||||
has_capture = 1;
|
||||
}
|
||||
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
|
||||
snd_soc_dai_stream_valid(cpu_dai, cpu_playback))
|
||||
has_playback = 1;
|
||||
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) &&
|
||||
snd_soc_dai_stream_valid(cpu_dai, cpu_capture))
|
||||
has_capture = 1;
|
||||
}
|
||||
|
||||
if (dai_link->playback_only)
|
||||
|
Loading…
Reference in New Issue
Block a user