Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: dpcm: extend channel merging to the backend cpu dai

Extend dpcm_merge_chan to also check backend cpu dai channels
capabilities. Apply the same policy as soc_pcm_init_runtime_hw() for
multicodec links and only check cpu dai in this case.

Cc: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jerome Brunet and committed by
Mark Brown
4f2bd18b c54c1c5e

+17 -3
+17 -3
sound/soc/soc-pcm.c
··· 1736 1736 1737 1737 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { 1738 1738 struct snd_soc_pcm_runtime *be = dpcm->be; 1739 + struct snd_soc_dai_driver *cpu_dai_drv = be->cpu_dai->driver; 1739 1740 struct snd_soc_dai_driver *codec_dai_drv; 1740 1741 struct snd_soc_pcm_stream *codec_stream; 1741 - int i; 1742 + struct snd_soc_pcm_stream *cpu_stream; 1742 1743 1743 - for (i = 0; i < be->num_codecs; i++) { 1744 - codec_dai_drv = be->codec_dais[i]->driver; 1744 + if (stream == SNDRV_PCM_STREAM_PLAYBACK) 1745 + cpu_stream = &cpu_dai_drv->playback; 1746 + else 1747 + cpu_stream = &cpu_dai_drv->capture; 1748 + 1749 + *channels_min = max(*channels_min, cpu_stream->channels_min); 1750 + *channels_max = min(*channels_max, cpu_stream->channels_max); 1751 + 1752 + /* 1753 + * chan min/max cannot be enforced if there are multiple CODEC 1754 + * DAIs connected to a single CPU DAI, use CPU DAI's directly 1755 + */ 1756 + if (be->num_codecs == 1) { 1757 + codec_dai_drv = be->codec_dais[0]->driver; 1758 + 1745 1759 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 1746 1760 codec_stream = &codec_dai_drv->playback; 1747 1761 else