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

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Wed Feb 26 20:04:18 CET 2020



On 2/26/20 12:40 AM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 
> DAI is counting its activity, and both playback/capture directional
> activity. When considering mute, DAI's activity is enough instead of
> caring both playback/capture.
> This patch makes mute check simply.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
>   sound/soc/soc-pcm.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 4a14f10b8c90..7e0464ec802e 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1202,7 +1202,6 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
>   	struct snd_soc_pcm_runtime *rtd = substream->private_data;
>   	struct snd_soc_dai *cpu_dai;
>   	struct snd_soc_dai *codec_dai;
> -	bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
>   	int i;
>   
>   	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
> @@ -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.

>   			snd_soc_dai_digital_mute(codec_dai, 1,
>   						 substream->stream);
>   	}
> 


More information about the Alsa-devel mailing list