[PATCH v3 08/13] ASoC: audio-graph: Expose helpers from audio graph

From: Sameer Pujar
Date: Thu Oct 01 2020 - 13:34:55 EST


This commit exposes following functions which can be used by a sound
card driver based on audio graph driver. Idea is vendors can have a
thin driver and re-use common stuff from audio graph driver.

- graph_card_probe()
- graph_get_dais_count()
- graph_parse_of()

In doing so a new header file is added for audio graph which can be
included by vendor drivers.

Signed-off-by: Sameer Pujar <spujar@xxxxxxxxxx>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
include/sound/graph_card.h | 19 +++++++++++++++++++
sound/soc/generic/audio-graph-card.c | 11 +++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
create mode 100644 include/sound/graph_card.h

diff --git a/include/sound/graph_card.h b/include/sound/graph_card.h
new file mode 100644
index 0000000..0372c1c
--- /dev/null
+++ b/include/sound/graph_card.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * ASoC audio graph card support
+ *
+ */
+
+#ifndef __GRAPH_CARD_H
+#define __GRAPH_CARD_H
+
+#include <sound/simple_card_utils.h>
+
+int graph_card_probe(struct snd_soc_card *card);
+
+void graph_get_dais_count(struct asoc_simple_priv *priv,
+ struct link_info *li);
+
+int graph_parse_of(struct asoc_simple_priv *priv);
+
+#endif /* __GRAPH_CARD_H */
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index fb34e34..ae234bf 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -529,7 +529,7 @@ static int graph_for_each_link(struct asoc_simple_priv *priv,
return 0;
}

-static int graph_parse_of(struct asoc_simple_priv *priv)
+int graph_parse_of(struct asoc_simple_priv *priv)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
struct link_info li;
@@ -566,6 +566,7 @@ static int graph_parse_of(struct asoc_simple_priv *priv)

return asoc_simple_parse_card_name(card, NULL);
}
+EXPORT_SYMBOL_GPL(graph_parse_of);

static int graph_count_noml(struct asoc_simple_priv *priv,
struct device_node *cpu_ep,
@@ -604,8 +605,8 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
return 0;
}

-static void graph_get_dais_count(struct asoc_simple_priv *priv,
- struct link_info *li)
+void graph_get_dais_count(struct asoc_simple_priv *priv,
+ struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);

@@ -661,8 +662,9 @@ static void graph_get_dais_count(struct asoc_simple_priv *priv,
dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
li->link, li->dais, li->conf);
}
+EXPORT_SYMBOL_GPL(graph_get_dais_count);

-static int graph_card_probe(struct snd_soc_card *card)
+int graph_card_probe(struct snd_soc_card *card)
{
struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card);
int ret;
@@ -677,6 +679,7 @@ static int graph_card_probe(struct snd_soc_card *card)

return 0;
}
+EXPORT_SYMBOL_GPL(graph_card_probe);

static int graph_probe(struct platform_device *pdev)
{
--
2.7.4