diff mbox

[3/3] ASoC: simple-card: Add system-clock-id DT parameter to dai nodes

Message ID c0281e720e9ef2056d3460047cf5bc5e75684abf.1402653217.git.jsarha@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jyri Sarha June 13, 2014, 10:04 a.m. UTC
Select clk_id parameters for set_sysclk calls in the card init phase.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 .../devicetree/bindings/sound/simple-card.txt      |    2 ++
 include/sound/simple_card.h                        |    1 +
 sound/soc/generic/simple-card.c                    |    6 +++++-
 3 files changed, 8 insertions(+), 1 deletion(-)

Comments

Mark Brown June 21, 2014, 10:09 a.m. UTC | #1
On Fri, Jun 13, 2014 at 01:04:38PM +0300, Jyri Sarha wrote:
> Select clk_id parameters for set_sysclk calls in the card init phase.

This is making the ID defined by the drivers into ABI.  It's not clear
that this is something we want to do, and we certainly don't want to do
it without updating the driver bindings.  In principle what we want to
do here is have our clocks handled by the clock API, though that's not
trivial work.
Jyri Sarha June 24, 2014, 9:59 a.m. UTC | #2
On 06/21/2014 01:09 PM, Mark Brown wrote:
> On Fri, Jun 13, 2014 at 01:04:38PM +0300, Jyri Sarha wrote:
>> Select clk_id parameters for set_sysclk calls in the card init phase.
>
> This is making the ID defined by the drivers into ABI.  It's not clear
> that this is something we want to do, and we certainly don't want to do
> it without updating the driver bindings.  In principle what we want to
> do here is have our clocks handled by the clock API, though that's not
> trivial work.
>

I see, actually this is not something I would need anytime soon, but
how about the previous "Add system-clock-direction DT parameter to dai 
nodes" patch?

There is a clear common definitions for clock direction, so this should 
be ok, right?

If the clock direction patch would go in I would not need to add more 
stuff to already quite messy davinci-evm driver.

Best regards,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown June 24, 2014, 10:20 a.m. UTC | #3
On Tue, Jun 24, 2014 at 12:59:20PM +0300, Jyri Sarha wrote:

> I see, actually this is not something I would need anytime soon, but
> how about the previous "Add system-clock-direction DT parameter to dai
> nodes" patch?

> There is a clear common definitions for clock direction, so this should be
> ok, right?

> If the clock direction patch would go in I would not need to add more stuff
> to already quite messy davinci-evm driver.

Yeah, I'm still thinking about that one.  One thing I was wondering was
if we should agree a definition that's generic with the clock API but
then have an ASoC specific implementation for now until the clock API
gets further along.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 8460744..8877130 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -72,6 +72,8 @@  Optional CPU/CODEC subnodes properties:
 					  clock node (= common clock), or "system-clock-frequency"
 					  (if system doens't support common clock)
 - system-clock-direction		: "in" or "out", default "in"
+- system-clock-id			: u32, clk_id parameter for set_sysclk,
+					  default 0
 
 Example 1 - single DAI link:
 
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 6d74fef..f3c7a30 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -19,6 +19,7 @@  struct asoc_simple_dai {
 	unsigned int fmt;
 	unsigned int sysclk;
 	int sysclk_dir;
+	int sysclk_id;
 	int slots;
 	int slot_width;
 };
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 8dd7957..f840d9c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -64,7 +64,7 @@  static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 	}
 
 	if (set->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk,
+		ret = snd_soc_dai_set_sysclk(dai, set->sysclk_id, set->sysclk,
 					     set->sysclk_dir);
 		if (ret && ret != -ENOTSUPP) {
 			dev_err(dai->dev, "simple-card: set_sysclk error\n");
@@ -150,6 +150,10 @@  asoc_simple_card_sub_parse_of(struct device_node *np,
 			return -EINVAL;
 	}
 
+	ret = of_property_read_u32(np, "system-clock-id", &val);
+	if (ret == 0)
+		dai->sysclk_id = val;
+
 	/*
 	 * dai->sysclk come from
 	 *  "clocks = <&xxx>" (if system has common clock)