[PATCH 6/8] ASoC: soc-pcm: check DAI's activity more simply

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Feb 27 01:35:35 CET 2020


Hi Pierre-Louis

> > @@ -1226,11 +1225,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
> >     	/* apply codec digital mute */
> >   	for_each_rtd_codec_dai(rtd, i, codec_dai) {
> > -		int playback_active = codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK];
> > -		int capture_active  = codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE];
> > -
> > -		if ((playback && playback_active == 1) ||
> > -		    (!playback && capture_active == 1))
> > +		if (codec_dai->active == 1)
> 
> nit-pick: we have two tests in soc-pcm.c
> 
> if (codec_dai->active)
> if (codec_dai->active == 1)
> 
> The two are functionality equivalent but it'd be good to choose one
> version - or possibly use 'active' as a boolean.

In my understanding, dai->active can be 0/1/2.
But yes, we want to call mute if codec_dai is working

	/* Call Mute if Codec DAI is working */
	if (codec_dai->active)

	/* Call Mute if Codec DAI is used only for Playback or Capture */
	if (codec_dai->active == 1)

Thank you for your help !!
Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list