On 5/18/2023 7:47 AM, Kuninori Morimoto wrote:
Current soc_get_playback_capture() (A) is checking playback/capture availability for DPCM (X) / Normal (Y) / Codec2Codec (Z) connections.
(A) static int soc_get_playback_capture(...) { ... ^ if (dai_link->dynamic || dai_link->no_pcm) { | ... |(a) if (dai_link->dpcm_playback) { | ... | ^ for_each_rtd_cpu_dais(rtd, i, cpu_dai) { |(*) ... | v } | ... (X) } |(b) if (dai_link->dpcm_capture) { | ... | ^ for_each_rtd_cpu_dais(rtd, i, cpu_dai) { |(*) ... | v } | ... v } } else { ^ ^ /* Adapt stream for codec2codec links */ |(Z) int cpu_capture = ... | v int cpu_playback = ... (Y) | ^ for_each_rtd_codec_dais(rtd, i, codec_dai) { |(*) ... v v } } ... }
(*) part is checking each DAI's availability.
At first, (X) part is for DPCM, and it checks playback/capture availability if dai_link has dpcm_playback/capture flag (a)(b). But we are already using playback/capture_only flag. for Normal (Y) and Codec2Codec (Z). We can use this flags for DPCM too.
Before After dpcm_playback = 1; => /* no flags */ dpcm_capture = 1;
dpcm_playback = 1; => playback_only = 1;
dpcm_capture = 1; => capture_only = 1;
This patch enables both flags case, but dpcm_playback/capture flags will be removed if all driver were switched to new playback/capture_only flags.
Here, CPU <-> Codec relationship is like this
DPCM [CPU/dummy]-[dummy/Codec] ^^^^^^^^^^^ Normal [CPU/Codec] ^^^^^^^^^^^
(X) part is checking only CPU DAI, and (Y) part is checking both CPU/Codec DAI
This means (X)/(Y) are checking same position. Because dammy DAI is always available, we can share same code for all cases (= X/Y/Z).
This patch merge these.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Reviewed-by: Amadeusz Sławiński amadeuszx.slawinski@linux.intel.com