[PATCH v2 6/8] ASoC: meson: switch to use snd_soc_daifmt_parse_format/clock_provider()

Jerome Brunet jbrunet at baylibre.com
Wed Jun 9 09:11:44 CEST 2021


On Wed 09 Jun 2021 at 04:16, Kuninori Morimoto <kuninori.morimoto.gx at renesas.com> wrote:

> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
>
> This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from
> snd_soc_of_parse_daifmt().
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
>  sound/soc/meson/meson-card-utils.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
> index 300ac8be46ef..779ac282e36d 100644
> --- a/sound/soc/meson/meson-card-utils.c
> +++ b/sound/soc/meson/meson-card-utils.c
> @@ -118,24 +118,25 @@ unsigned int meson_card_parse_daifmt(struct device_node *node,
>  	struct device_node *bitclkmaster = NULL;
>  	struct device_node *framemaster = NULL;
>  	unsigned int daifmt;
> +	unsigned int daiclk;

Why did you need to add this local ? 

>  
> -	daifmt = snd_soc_of_parse_daifmt(node, "",
> -					 &bitclkmaster, &framemaster);
> -	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
> +	daifmt = snd_soc_daifmt_parse_format(node, NULL);
> +
> +	snd_soc_daifmt_parse_clock_provider_as_phandle(node, NULL, &bitclkmaster, &framemaster);
>

Thanks for this

>  	/* If no master is provided, default to cpu master */
>  	if (!bitclkmaster || bitclkmaster == cpu_node) {
> -		daifmt |= (!framemaster || framemaster == cpu_node) ?
> +		daiclk = (!framemaster || framemaster == cpu_node) ?
>  			SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBS_CFM;
>  	} else {
> -		daifmt |= (!framemaster || framemaster == cpu_node) ?
> +		daiclk = (!framemaster || framemaster == cpu_node) ?
>  			SND_SOC_DAIFMT_CBM_CFS : SND_SOC_DAIFMT_CBM_CFM;
>  	}
>  
>  	of_node_put(bitclkmaster);
>  	of_node_put(framemaster);
>  
> -	return daifmt;
> +	return daifmt | daiclk;

These 3 last changes does seem to necessary

>  }
>  EXPORT_SYMBOL_GPL(meson_card_parse_daifmt);



More information about the Alsa-devel mailing list