Re: [PATCH 08/20] ASoC: soc-pcm.c: cleanup soc_get_playback_capture()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Amadeusz

> > static int soc_get_playback_capture(...)
> > {
> > 	...
> > (A)	if (dai_link->dynamic || dai_link->no_pcm) {
> > 		...
> > 		if (dai_link->dpcm_playback) {
> > 			...
> > (B)			for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
> > 				...
> > 			}
> > 			...
> > 		}
> > 		if (dai_link->dpcm_capture) {
> > 			...
> > (B)			for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
> > 				...
> > 			}
> > 		}
> > 		...
> > 	}
> > }
> > 
> > It checks CPU (B) when no_pcm (A) on original.
> > But I think "no_pcm - CPU" is dummy DAI -> above check is no meaning.
> > After the patch, it checks both CPU/Codec.
(snip)
> > I wonder is your Codec which is connected to no_pcm DAI valid ?
> 
> I'm not sure what do you mean, if it is valid? It works fine before this 
> patch ;)

Ah, sorry, let me explain detail.

	static int soc_get_playback_capture(...)
	{
		...
(A)		if (dai_link->dynamic || dai_link->no_pcm) {
			int stream;

			if (dai_link->dpcm_playback) {
				stream = SNDRV_PCM_STREAM_PLAYBACK;

(B)				for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
(C)					if (snd_soc_dai_stream_valid(cpu_dai, stream)) {
						has_playback = 1;
						break;
					}
				}
			...
	}

Before appling the patch, in DPCM case (A), it checks CPU valid only (B)/(C).
In many case, DPCM is like this

	dynamic			no_pcm
	[CPU/dummy-Codec] - [dummy-CPU/Codec]

I noticed that before the patch, it checks dummy DAI only for no_pcm case.
But after appling the patch, it will check both CPU and Codec
valid (X)/(Y)/(Z).

I think this was changed after patch.
So, my question was what happen for snd_soc_dai_stream_valid() on your Codec.

# I notcied that avs_create_dai_links() is not using dummy CPU on no_pcm case...


	static int soc_get_playback_capture(...)
	{
		...
(X)		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
(Y)			codec_dai = asoc_rtd_to_codec(rtd, i); /* get paired codec */

(Z)			if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
(Z)			    snd_soc_dai_stream_valid(cpu_dai,   cpu_playback))
				has_playback = 1;
(Z)			if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) &&
(Z)			    snd_soc_dai_stream_valid(cpu_dai,   cpu_capture))
				has_capture = 1;
		}
		...
	}

Thank you for your help !!

Best regards
---
Kuninori Morimoto



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux