Skip to content

Commit b73287f

Browse files
plbossartbroonie
authored andcommitted
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. Fixes: 9b5db05 ("ASoC: soc-pcm: dpcm: Only allow playback/capture if supported") Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Guennadi Liakhovetski <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> BugLink: thesofproject#2031 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8a9144c commit b73287f

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

sound/soc/soc-pcm.c

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,20 +2789,44 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
27892789
struct snd_pcm *pcm;
27902790
char new_name[64];
27912791
int ret = 0, playback = 0, capture = 0;
2792+
int stream;
27922793
int i;
27932794

2795+
if (rtd->dai_link->dynamic && rtd->num_cpus > 1) {
2796+
dev_err(rtd->dev,
2797+
"DPCM doesn't support Multi CPU for Front-Ends yet\n");
2798+
return -EINVAL;
2799+
}
2800+
27942801
if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
2795-
cpu_dai = asoc_rtd_to_cpu(rtd, 0);
2796-
if (rtd->num_cpus > 1) {
2797-
dev_err(rtd->dev,
2798-
"DPCM doesn't support Multi CPU yet\n");
2799-
return -EINVAL;
2802+
if (rtd->dai_link->dpcm_playback) {
2803+
stream = SNDRV_PCM_STREAM_PLAYBACK;
2804+
2805+
for_each_rtd_cpu_dais(rtd, i, cpu_dai)
2806+
if (!snd_soc_dai_stream_valid(cpu_dai,
2807+
stream)) {
2808+
dev_err(rtd->card->dev,
2809+
"CPU DAI %s for rtd %s does not support playback\n",
2810+
cpu_dai->name,
2811+
rtd->dai_link->stream_name);
2812+
return -EINVAL;
2813+
}
2814+
playback = 1;
2815+
}
2816+
if (rtd->dai_link->dpcm_capture) {
2817+
stream = SNDRV_PCM_STREAM_CAPTURE;
2818+
2819+
for_each_rtd_cpu_dais(rtd, i, cpu_dai)
2820+
if (!snd_soc_dai_stream_valid(cpu_dai,
2821+
stream)) {
2822+
dev_err(rtd->card->dev,
2823+
"CPU DAI %s for rtd %s does not support capture\n",
2824+
cpu_dai->name,
2825+
rtd->dai_link->stream_name);
2826+
return -EINVAL;
2827+
}
2828+
capture = 1;
28002829
}
2801-
2802-
playback = rtd->dai_link->dpcm_playback &&
2803-
snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK);
2804-
capture = rtd->dai_link->dpcm_capture &&
2805-
snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE);
28062830
} else {
28072831
/* Adapt stream for codec2codec links */
28082832
int cpu_capture = rtd->dai_link->params ?

0 commit comments

Comments
 (0)