diff mbox

[14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()

Message ID 871t4xrrq4.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto May 20, 2016, 9:48 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card like driver is supporting DPCM FE/BE.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  7 +++++++
 sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

Comments

Mark Brown May 30, 2016, 4:47 p.m. UTC | #1
On Fri, May 20, 2016 at 09:48:07AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> simple-card like driver is supporting DPCM FE/BE.
> This patch makes this method simple style standard.

DPCM is very much an implementation detail of the current stack,
providing helpers that promote its use doesn't seem like the best idea -
we want to change it for in kernel use going forwards and that's going
to be harder with DPCM.  We should be encouraging bindings that make
DSPs look more like CODECs.
Kuninori Morimoto May 31, 2016, 12:17 a.m. UTC | #2
Hi Mark

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > simple-card like driver is supporting DPCM FE/BE.
> > This patch makes this method simple style standard.
> 
> DPCM is very much an implementation detail of the current stack,
> providing helpers that promote its use doesn't seem like the best idea -
> we want to change it for in kernel use going forwards and that's going
> to be harder with DPCM.  We should be encouraging bindings that make
> DSPs look more like CODECs.

rsrc-card which is using DPCM is already existing in upstream.
And, sharing code between simple-card <-> rsrc-card (= simple-dpcm-card),
(and expand it to simple-graph-card) is the purpose of this patch-set.

So, I will drop this "DPCM specific helper function" from
simple-card-core (= will be simple-card-util).
But simple-dpcm-card itself is OK. Is this correct ?

Best regards
---
Kuninori Morimoto
diff mbox

Patch

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 8155001..5e2e824 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -69,4 +69,11 @@  int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 				  const char *cells_name,
 				  int *is_single_links);
 
+#define asoc_simple_card_parse_dpcm_fe(dai_link)	\
+	asoc_simple_card_parse_dpcm(dai_link, NULL)
+#define asoc_simple_card_parse_dpcm_be(dai_link, fixup)	\
+	asoc_simple_card_parse_dpcm(dai_link, fixup)
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+			int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params));
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index d9285df..d3aab6d 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -242,3 +242,32 @@  int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
+
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+				 int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+						 struct snd_pcm_hw_params *params))
+{
+	if (be_fixup) {
+		/* FE is dummy */
+		dai_link->cpu_of_node		= NULL;
+		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
+		dai_link->cpu_name		= "snd-soc-dummy";
+
+		/* BE settings */
+		dai_link->no_pcm		= 1;
+		dai_link->be_hw_params_fixup	= be_fixup;
+	} else {
+		/* BE is dummy */
+		dai_link->codec_of_node		= NULL;
+		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
+		dai_link->codec_name		= "snd-soc-dummy";
+
+		/* FE settings */
+		dai_link->dynamic		= 1;
+		dai_link->dpcm_merged_format	= 1;
+	}
+
+	dai_link->dpcm_playback		= 1;
+	dai_link->dpcm_capture		= 1;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);