Skip to content

Commit c32ff05

Browse files
committed
ASoC: soc-pcm: dpcm: fix playback/capture checks
Recent changes in the ASoC core prevent multi-cpu BE dailinks from being used. DPCM does support multi-cpu DAIs for BE Dailinks, but not for FE. Handle the FE checks first, and make sure all DAIs support the same capabilities within the same dailink. BugLink: #2031 Fixes: 9b5db05 ("ASoC: soc-pcm: dpcm: Only allow playback/capture if supported") Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 8f1c6ad commit c32ff05

1 file changed

Lines changed: 32 additions & 10 deletions

File tree

sound/soc/soc-pcm.c

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,20 +2908,42 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
29082908
struct snd_pcm *pcm;
29092909
char new_name[64];
29102910
int ret = 0, playback = 0, capture = 0;
2911+
int stream;
29112912
int i;
29122913

2914+
if (rtd->dai_link->dynamic && rtd->num_cpus > 1) {
2915+
dev_err(rtd->dev,
2916+
"DPCM doesn't support Multi CPU for Front-Ends yet\n");
2917+
return -EINVAL;
2918+
}
2919+
29132920
if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
2914-
cpu_dai = asoc_rtd_to_cpu(rtd, 0);
2915-
if (rtd->num_cpus > 1) {
2916-
dev_err(rtd->dev,
2917-
"DPCM doesn't support Multi CPU yet\n");
2918-
return -EINVAL;
2919-
}
2921+
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
2922+
2923+
if (rtd->dai_link->dpcm_playback) {
2924+
stream = SNDRV_PCM_STREAM_PLAYBACK;
2925+
if (snd_soc_dai_stream_valid(cpu_dai, stream)) {
2926+
playback = 1;
2927+
} else if (playback != 0) {
2928+
dev_err(rtd->card->dev,
2929+
"CPU Dai %s does not support playback\n",
2930+
cpu_dai->name);
2931+
return -EINVAL;
2932+
}
2933+
}
29202934

2921-
playback = rtd->dai_link->dpcm_playback &&
2922-
snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK);
2923-
capture = rtd->dai_link->dpcm_capture &&
2924-
snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE);
2935+
if (rtd->dai_link->dpcm_capture) {
2936+
stream = SNDRV_PCM_STREAM_CAPTURE;
2937+
if (snd_soc_dai_stream_valid(cpu_dai, stream)) {
2938+
capture = 1;
2939+
} else if (capture != 0) {
2940+
dev_err(rtd->card->dev,
2941+
"CPU Dai %s does not support capture\n",
2942+
cpu_dai->name);
2943+
return -EINVAL;
2944+
}
2945+
}
2946+
}
29252947
} else {
29262948
/* Adapt stream for codec2codec links */
29272949
int cpu_capture = rtd->dai_link->params ?

0 commit comments

Comments
 (0)