[PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt

From: Xiubo Li
Date: Tue Dec 31 2013 - 04:06:24 EST


This patch adds snd_soc_of_parse_master_clkdir() and supports below
style on dt:

[prefix]master-clkdir;

If this property is absent 0 will be returned, 1 otherwise.
0 : SND_SOC_CLOCK_IN
1 : SND_SOC_CLOCK_OUT

Signed-off-by: Xiubo Li <Li.Xiubo@xxxxxxxxxxxxx>
---

I'm not very sure whether this patch is need for dt.

For the CPU and CODEC devices' sysclk directions maybe different of
the same DAI link.



include/sound/soc.h | 2 ++
sound/soc/soc-core.c | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5a049d9..1d6396a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1170,6 +1170,8 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
const char *propname);
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
const char *propname);
+unsigned int snd_soc_of_parse_master_clkdir(struct device_node *np,
+ const char *prefix);
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
const char *prefix);
int snd_soc_of_get_dai_name(struct device_node *of_node,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index be88df5..faf102f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4472,6 +4472,25 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
}
EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing);

+unsigned int snd_soc_of_parse_master_clkdir(struct device_node *np,
+ const char *prefix)
+{
+ char prop[128];
+
+ if (!prefix)
+ prefix = "";
+
+ /*
+ * check "[prefix]master-clkdir"
+ * true means SND_SOC_CLOCK_OUT
+ * false means SND_SOC_CLOCK_IN
+ */
+ snprintf(prop, sizeof(prop), "%smaster-clkdir", prefix);
+
+ return !!of_property_read_bool(np, prop);
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_master_clkdir);
+
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
const char *prefix)
{
--
1.8.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/