[alsa-devel] [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Fri May 20 11:48:07 CEST 2016
From: Kuninori Morimoto <kuninori.morimoto.gx at 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 at renesas.com>
---
include/sound/simple_card_core.h | 7 +++++++
sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
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);
--
1.9.1
More information about the Alsa-devel
mailing list