diff mbox series

[v2,4/8] ASoC: atmel: switch to use snd_soc_daifmt_parse_format/clock_provider()

Message ID 877dj3dbqn.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series ASoC: tidyup snd_soc_of_parse_daifmt() | expand

Commit Message

Kuninori Morimoto June 9, 2021, 2:15 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@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@renesas.com>
---
 sound/soc/atmel/mikroe-proto.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c
index f9a85fd01b79..5bdba38ec408 100644
--- a/sound/soc/atmel/mikroe-proto.c
+++ b/sound/soc/atmel/mikroe-proto.c
@@ -69,6 +69,7 @@  static int snd_proto_probe(struct platform_device *pdev)
 	struct device_node *bitclkmaster = NULL;
 	struct device_node *framemaster = NULL;
 	unsigned int dai_fmt;
+	unsigned int dai_clk;
 	int ret = 0;
 
 	if (!np) {
@@ -120,22 +121,25 @@  static int snd_proto_probe(struct platform_device *pdev)
 	dai->cpus->of_node = cpu_np;
 	dai->platforms->of_node = cpu_np;
 
-	dai_fmt = snd_soc_of_parse_daifmt(np, NULL,
-					  &bitclkmaster, &framemaster);
+	dai_fmt = snd_soc_daifmt_parse_format(np, NULL);
+	snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL,
+						       &bitclkmaster, &framemaster);
 	if (bitclkmaster != framemaster) {
 		dev_err(&pdev->dev, "Must be the same bitclock and frame master\n");
 		return -EINVAL;
 	}
 	if (bitclkmaster) {
-		dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
 		if (codec_np == bitclkmaster)
-			dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
+			dai_clk = SND_SOC_DAIFMT_CBM_CFM;
 		else
-			dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
+			dai_clk = SND_SOC_DAIFMT_CBS_CFS;
+	} else {
+		dai_clk = snd_soc_daifmt_parse_clock_provider_as_flag(np, NULL);
 	}
+
 	of_node_put(bitclkmaster);
 	of_node_put(framemaster);
-	dai->dai_fmt = dai_fmt;
+	dai->dai_fmt = dai_fmt | dai_clk;
 
 	of_node_put(codec_np);
 	of_node_put(cpu_np);