[PATCH] ASoC: soc-dai: pull out be_hw_params_fixup from snd_soc_dai_hw_params

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon May 11 20:47:01 CEST 2020



On 5/10/20 10:31 PM, Gyeongtaek Lee wrote:
> When dpcm_be_dai_hw_params() called, be_hw_params_fixup() callback is
> called with same arguments 3times.
> It is called in be_hw_params_fixup() itself and in soc_pcm_hw_params()
> for cpu dai and codec dai.
> Tested in 5.4.
> 
> Signed-off-by: Gyeongtaek Lee <gt82.lee at samsung.com>
> Cc: stable at vger.kernel.org
> ---
>   sound/soc/soc-dai.c  | 12 ------------
>   sound/soc/soc-dapm.c | 11 +++++++++++
>   2 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
> index 31c41559034b..4785cb6b336f 100644
> --- a/sound/soc/soc-dai.c
> +++ b/sound/soc/soc-dai.c
> @@ -257,20 +257,8 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
>   			  struct snd_pcm_substream *substream,
>   			  struct snd_pcm_hw_params *params)
>   {
> -	struct snd_soc_pcm_runtime *rtd = substream->private_data;
>   	int ret;
>   
> -	/* perform any topology hw_params fixups before DAI  */
> -	if (rtd->dai_link->be_hw_params_fixup) {
> -		ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
> -		if (ret < 0) {
> -			dev_err(rtd->dev,
> -				"ASoC: hw_params topology fixup failed %d\n",
> -				ret);
> -			return ret;
> -		}
> -	}
> -

Sorry I don't get this change.

If the be_hw_params_fixup() callback is called three times, it's because 
the soc_soc_dai_hw_params() routine is called three times, so what is 
the problem here?

Also the comment is explicit about doing fixups before calling the dai 
hw_params() callback, so that is not longer the case with this change? 
Even if the change was legit, the comment is no longer relevant and 
should be updated.

>   	if (dai->driver->ops->hw_params) {
>   		ret = dai->driver->ops->hw_params(substream, params, dai);
>   		if (ret < 0) {
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index e2632841b321..d86c1cd4e8fa 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -3886,6 +3886,17 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
>   	hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max
>   		= config->channels_max;
>   
> +	/* perform any topology hw_params fixups before DAI  */
> +	if (rtd->dai_link->be_hw_params_fixup) {
> +		ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
> +		if (ret < 0) {
> +			dev_err(rtd->dev,
> +				"ASoC: hw_params topology fixup failed %d\n",
> +				ret);
> +			return ret;
> +		}
> +	}
> +
>   	substream->stream = SNDRV_PCM_STREAM_CAPTURE;
>   	snd_soc_dapm_widget_for_each_source_path(w, path) {
>   		source = path->source->priv;
> 
> base-commit: f3643491bd079c973ac6c693da7966cd17506ca3
> 


More information about the Alsa-devel mailing list