On 6/1/23 18:45, Kuninori Morimoto wrote:
Hi Pierre-Louis Cc Mark
Can I ask you about your opinion ?
This is problematic, 1:4 connections have been handled for a very long time, this is basic TDM.
static int soc_get_playback_capture(...) { ... if (dai_link->dynamic || dai_link->no_pcm) { ... } else { ... for_each_rtd_codec_dais(rtd, i, codec_dai) { if (dai_link->num_cpus == 1) { cpu_dai = asoc_rtd_to_cpu(rtd, 0); } else if (dai_link->num_cpus == dai_link->num_codecs) { cpu_dai = asoc_rtd_to_cpu(rtd, i); } else { dev_err(rtd->card->dev, "N cpus to M codecs link is not supported yet\n"); return -EINVAL; }
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; } ... }
In case of CPU:Codec = 1:N, and if its validation were
CPU : OK
Codec : OK Codec : NG ...
Current soc_get_playback_capture() will have has_playback/capture = 1 evan though one of Codec was NG. I think it should be error, but am I right ?
Indeed, we should only enable playback (resp. capture) when all codec dais have the same settings. We should revert the logic here IMHO to go from 'at least one' to 'all'.