[PATCH] ASoC: soc-pcm: dpcm: Only allow playback/capture if supported

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Apr 16 22:51:23 CEST 2020


> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 454735f8fa92..77a680da366f 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -2911,8 +2911,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
>   	int i;
>   
>   	if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
> -		playback = rtd->dai_link->dpcm_playback;
> -		capture = rtd->dai_link->dpcm_capture;
> +		cpu_dai = asoc_rtd_to_cpu(rtd, 0);
> +		if (rtd->num_cpus > 1) {
> +			dev_err(rtd->dev,
> +				"DPCM doesn't support Multi CPU yet\n");
> +			return -EINVAL;
> +		}
> +
> +		playback = rtd->dai_link->dpcm_playback &&
> +			   snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK);
> +		capture = rtd->dai_link->dpcm_capture &&
> +			  snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE);

This commit introduces major regressions with SOF on CherryTrail and 
Broadwell:

     [   25.705750]  SSP2-Codec: ASoC: no backend playback stream
     [   27.923378]  SSP2-Codec: ASoC: no users playback at close - state

it's likely due to the check for min_channels > 0 in 
snd_soc_dai_stream_valid(), which wasn't a requirement before.

We are testing a fix [1] but other users of DPCM might be impacted.

Mark, this commit is on your for-5.7 branch but not on for-next? Not 
sure which SHA1 to use for the Fixes: tag

[1] 
https://github.com/thesofproject/linux/pull/2018/commits/4fa10638dca8aad7a320e85cc3e00b179b8de410


More information about the Alsa-devel mailing list