All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Jyri Sarha <jsarha@ti.com>
Subject: [PATCH 4/4] ASoC: simple-card: Support for selecting system clocks by ID
Date: Mon, 15 Feb 2016 16:11:35 +0200	[thread overview]
Message-ID: <1455545495-20292-5-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com>

From: Jyri Sarha <jsarha@ti.com>

Most CPU and codec drivers can select their system clock from different
sources. They rely on snd_soc_dai_set_sysclk(x, sysclk_id, x, x) to do so.
Add support for selecting which clock need to be selected along with the
rate.

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

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 1f2cf76d701a..bc8f9e4a17cc 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -85,6 +85,8 @@ Optional CPU/CODEC subnodes properties:
 					  clk_disable_unprepare() in dai
 					  shutdown().
 - system-clock-direction		: "in" or "out", default "in"
+- system-clock-id			: Numberic ID of the system clock to
+					  select within the dai, default is 0.
 
 Example 1 - single DAI link:
 
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 783bc5499794..f930ad3763ff 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -18,6 +18,7 @@ struct asoc_simple_dai {
 	const char *name;
 	unsigned int sysclk;
 	int sysclk_dir;
+	int sysclk_id;
 	int slots;
 	int slot_width;
 	unsigned int tx_slot_mask;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f0d89e6f28a6..c6111e7a6d93 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -142,7 +142,7 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 	int ret;
 
 	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");
@@ -284,6 +284,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			dai->sysclk = clk_get_rate(clk);
 	}
 
+	if (!of_property_read_u32(np, "system-clock-id", &val))
+		dai->sysclk_id = val;
+
 	return 0;
 }
 
-- 
2.7.1

  parent reply	other threads:[~2016-02-15 14:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 14:11 [PATCH 0/4] ASoC: simple-card/davinci-mcasp: System clock configuration support Peter Ujfalusi
2016-02-15 14:11 ` [PATCH 1/4] ASoC: davinci-mcasp: Use defines for clkdiv IDs via DT binding header Peter Ujfalusi
2016-02-15 14:11 ` [PATCH 2/4] ASoC: davinci-mcasp: Improve the sysclk selection Peter Ujfalusi
2016-02-15 14:11 ` [PATCH 3/4] ASoC: simple-card: Add system-clock-direction DT parameter to dai nodes Peter Ujfalusi
2016-02-15 14:11 ` Peter Ujfalusi [this message]
2016-02-15 15:26   ` [PATCH 4/4] ASoC: simple-card: Support for selecting system clocks by ID Mark Brown
2016-02-16  9:46     ` Peter Ujfalusi
2016-02-16  9:46       ` Peter Ujfalusi
2016-02-16 13:42       ` Mark Brown
2016-02-16 19:13         ` Michael Turquette
2016-02-16 19:13           ` Michael Turquette
2016-02-17  8:13           ` Peter Ujfalusi
2016-02-17  8:13             ` Peter Ujfalusi
2016-02-17 12:07             ` Mark Brown
2016-02-17 19:52               ` Peter Ujfalusi
2016-02-17 19:52                 ` Peter Ujfalusi
2016-04-18 15:50                 ` [alsa-devel] " Peter Ujfalusi
2016-04-18 15:50                   ` Peter Ujfalusi
2016-04-18 16:29                   ` Mark Brown
2016-04-21 22:29                     ` Stephen Boyd
2016-04-22 11:52                       ` Peter Ujfalusi
2016-04-22 11:52                         ` Peter Ujfalusi
2016-04-22 12:08                         ` Tero Kristo
2016-04-22 12:08                           ` Tero Kristo
2016-02-17 11:31           ` Mark Brown
2016-02-17 14:18           ` [alsa-devel] " Ricard Wanderlof
2016-02-17 14:18             ` Ricard Wanderlof
2016-02-17 14:18             ` Ricard Wanderlof
2016-02-22  3:21             ` Mark Brown
2016-02-16 12:46     ` Andreas Irestål

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455545495-20292-5-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.