[PATCH 01/19] ASoC: hdmi-codec: merge .digital_mute() into .mute_stream()

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Tue Jun 23 17:18:08 CEST 2020


> -static int sii902x_audio_digital_mute(struct device *dev,
> -				      void *data, bool enable)
> +static int sii902x_audio_mute(struct device *dev, void *data,
> +			      bool enable, int direction)
>   {
>   	struct sii902x *sii902x = dev_get_drvdata(dev);
>   
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +

Thanks for this clean-up Morimoto-san.

One question: in all the codec changes the return is now 0.

But in the previous implementation based on digital_mute, when the wrong 
direction was used it would have been -ENOTSUPP.

int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
			     int direction)
{
	int ret = -ENOTSUPP;

	if (dai->driver->ops &&
	    dai->driver->ops->mute_stream)
		ret = dai->driver->ops->mute_stream(dai, mute, direction);
	else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
		 dai->driver->ops &&
		 dai->driver->ops->digital_mute)
		ret = dai->driver->ops->digital_mute(dai, mute);

<<< none of the branches taken for capture + digital_mute supported, so 
return -ENOTSUPP.

	return soc_dai_ret(dai, ret);
}

Was this change intentional?

We also want to check why this return value is only tested in 
soc-dapm.c, if this digital_mute can fail then we are missing tests left 
and right - maybe that's a follow-up change?



More information about the Alsa-devel mailing list