mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt
@ 2013-12-31  8:10 Xiubo Li
  2013-12-31 12:04 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Xiubo Li @ 2013-12-31  8:10 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai; +Cc: alsa-devel, linux-kernel, Xiubo Li

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@freescale.com>
---

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt
  2013-12-31  8:10 [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt Xiubo Li
@ 2013-12-31 12:04 ` Mark Brown
  2014-01-02  2:57   ` Li.Xiubo
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2013-12-31 12:04 UTC (permalink / raw)
  To: Xiubo Li; +Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

On Tue, Dec 31, 2013 at 04:10:44PM +0800, Xiubo Li wrote:

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

It's not clear to me - it's not adding much on top of just passing the
full property string to _read_bool() directly really.

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

Yes, this is common if one of them is generating the clock.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt
  2013-12-31 12:04 ` Mark Brown
@ 2014-01-02  2:57   ` Li.Xiubo
  0 siblings, 0 replies; 3+ messages in thread
From: Li.Xiubo @ 2014-01-02  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel


> Subject: Re: [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt
> 
> On Tue, Dec 31, 2013 at 04:10:44PM +0800, Xiubo Li wrote:
> 
> > I'm not very sure whether this patch is need for dt.
> 
> It's not clear to me - it's not adding much on top of just passing the
> full property string to _read_bool() directly really.
>

This was just inherited from the _daifmt formats. Maybe this is not very
correct here.

> > For the CPU and CODEC devices' sysclk directions maybe different of
> > the same DAI link.
> 
> Yes, this is common if one of them is generating the clock.

I will use one full name for the next verion.

 
Thanks,

--
Best Regards,
Xiubo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-02  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-31  8:10 [PATCH] ASoC: add snd_soc_of_parse_master_clkdir() for dt Xiubo Li
2013-12-31 12:04 ` Mark Brown
2014-01-02  2:57   ` Li.Xiubo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®