[PATCH 09/83] ASoC: audio-graph-card2: recommend to use auto select DAI format

Kuninori Morimoto <[email protected]>
Newsgroups dev.linux.lists.chrome-platform,dev.linux.lists.imx,dev.linux.lists.spacemit,org.infradead.lists.linux-riscv,org.kernel.vger.linux-mips,org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-sound
Message-ID <[email protected]>
"Simple Audio Card", "Audio Graph Card", "Audio Graph Card2" are
possible to set DAI format via DT.

OTOH, ASoC is supporting .auto_selectable_formats to select DAI
format automatically. Let's recommend to use it on "Audio Graph Card2".
One note is that it keeps supporting DAI format setting via DT.

Signed-off-by: Kuninori Morimoto <[email protected]>
---
 sound/soc/generic/audio-graph-card2.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
index 0202ed0ee78e8..6894bb936cfd2 100644
--- a/sound/soc/generic/audio-graph-card2.c
+++ b/sound/soc/generic/audio-graph-card2.c
@@ -778,6 +778,18 @@ static void graph_link_init(struct simple_util_priv *priv,
 	graph_parse_daifmt(ports_cpu,	&daifmt);
 	graph_parse_daifmt(ports_codec,	&daifmt);
 	graph_parse_daifmt(lnk,		&daifmt);
+	if (daifmt) {
+		struct device *dev = simple_priv_to_dev(priv);
+
+		/*
+		 * Recommend to use Auto Select by using .auto_selectable_formats.
+		 * linux/sound/soc/renesas/rcar/core.c can be good sample for it.
+		 *
+		 * One note is that Audio Graph Card2 still keeps compatible to set
+		 * DAI format via DT.
+		 */
+		dev_warn_once(dev, "use .auto_selectable_formats on each corresponding CPU/Codec driver");
+	}
 
 	graph_util_parse_link_direction(lnk,		&playback_only, &capture_only);
 	graph_util_parse_link_direction(ports_cpu,	&playback_only, &capture_only);
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.