Skip to content
Permalink
Browse files
ASoC: audio-graph-card2: add Audio Graph Card2 driver
We already have audio-graph-card which is Of-graph base of general
sound card driver.

It is also supporting DPCM connection, but is using very complex
DT settings/parsing, thus, it is very difficult to add new features
on it, for example Multi CPU/Codec support, Codec2Codec support, etc.

This patch adds more flexible new Audio Graph Card2 driver for it.
audio-graph-card and audio-graph-card2 are similar, but don't have
full compatibility.

Difference between audio-graph-card and audio-graph-card2 are

	- audio-graph-card  used "dais"  to indicate DAI-links,
	  audio-graph-card2 uses "links" to it.

	- audio-graph-card  used "phandle" to indicate bitclock/frame-master,
	  audio-graph-card2 uses flag to it.

	- audio-graph-card  used "format" to indicate DAI format,
	  audio-graph-card2 assumes CPU/Codec drivers have .get_fmt support.

Audio Graph Card2 supports very generic connection, but some users
want to have its own settings, for example PLL settings, etc.
For such case, it has customizing support.
In users own driver, it can use Audio Graph Card2 parsing by using
asoc_graph_parse_of2(), and doing its own customizing.

Because Audio Graph Card2 is still under experimental stage,
it will indicate such warning when probing, and the DT syntax
might be changed.

ASoC doesn't want to have duplicate drivers
(= audio-graph-card vs audio-graph-card2).
So my suggestion is that below

	step1) don't add new features to audio-graph-card, only bugfix.
	       brash up audio-graph-card2 to be more stable.
	step2) indicates audio-graph-card will be removed in the future.
	       switch to use audio-graph-card2 instead of audio-graph-card
	       on each DT.
	step3) remove audio-graph-card if all users were switched to audio-graph-card2

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  • Loading branch information
morimoto committed Apr 19, 2021
1 parent 189d634 commit 3969b3f0fb5f53791d94a04fac43bd4037e9a873
Show file tree
Hide file tree
Showing 4 changed files with 654 additions and 0 deletions.
@@ -9,6 +9,21 @@

#include <sound/simple_card_utils.h>

typedef int (*GRAPH_CUSTOM)(struct asoc_simple_priv *priv,
struct device_node *lnk,
struct link_info *li);

struct graph_custom_hooks {
int (*hook_pre)(struct asoc_simple_priv *priv);
int (*hook_post)(struct asoc_simple_priv *priv);
GRAPH_CUSTOM custom_normal;
};

int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev);
int audio_graph2_parse_of(struct asoc_simple_priv *priv, struct device *dev,
struct graph_custom_hooks *hooks);

int audio_graph2_link_normal(struct asoc_simple_priv *priv,
struct device_node *lnk, struct link_info *li);

#endif /* __GRAPH_CARD_H */
@@ -18,6 +18,14 @@ config SND_AUDIO_GRAPH_CARD
with OF-graph DT bindings.
It also support DPCM of multi CPU single Codec ststem.

config SND_AUDIO_GRAPH_CARD2
tristate "ASoC Audio Graph Sound Card2 support"
depends on OF
select SND_SIMPLE_CARD_UTILS
help
This option enables generic simple sound card support
with OF-graph DT bindings.

config SND_TEST_COMPONENT
tristate "ASoC Test component sound support"
depends on OF
@@ -2,9 +2,11 @@
snd-soc-simple-card-utils-objs := simple-card-utils.o
snd-soc-simple-card-objs := simple-card.o
snd-soc-audio-graph-card-objs := audio-graph-card.o
snd-soc-audio-graph-card2-objs := audio-graph-card2.o
snd-soc-test-component-objs := test-component.o

obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) += snd-soc-simple-card-utils.o
obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
obj-$(CONFIG_SND_AUDIO_GRAPH_CARD) += snd-soc-audio-graph-card.o
obj-$(CONFIG_SND_AUDIO_GRAPH_CARD2) += snd-soc-audio-graph-card2.o
obj-$(CONFIG_SND_TEST_COMPONENT) += snd-soc-test-component.o

0 comments on commit 3969b3f

Please sign in to comment.