alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Simon <horms@verge.net.au>, Liam Girdwood <lgirdwood@gmail.com>
Subject: [PATCH 8/9] ASoC: rsnd: adg: ignore undefined clock error
Date: Thu, 10 Sep 2015 07:04:24 +0000	[thread overview]
Message-ID: <87vbbin4hp.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <878u8eoj7x.wl%kuninori.morimoto.gx@renesas.com>

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

undefined clock is not error. Accept such case. And this is prepare
for clock out support in the same time.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/adg.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 606d416..d4fb11a 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -394,6 +394,28 @@ found_clock:
 	return 0;
 }
 
+static void rsnd_adg_get_clkin(struct rsnd_priv *priv,
+			       struct rsnd_adg *adg)
+{
+	struct device *dev = rsnd_priv_to_dev(priv);
+	struct clk *clk;
+	static const char * const clk_name[] = {
+		[CLKA]	= "clk_a",
+		[CLKB]	= "clk_b",
+		[CLKC]	= "clk_c",
+		[CLKI]	= "clk_i",
+	};
+	int i;
+
+	for (i = 0; i < CLKMAX; i++) {
+		clk = devm_clk_get(dev, clk_name[i]);
+		adg->clk[i] = IS_ERR(clk) ? NULL : clk;
+	}
+
+	for_each_rsnd_clk(clk, adg, i)
+		dev_dbg(dev, "clk %d : %p : %ld\n", i, clk, clk_get_rate(clk));
+}
+
 static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg)
 {
 	struct clk *clk;
@@ -466,8 +488,6 @@ int rsnd_adg_probe(struct platform_device *pdev,
 {
 	struct rsnd_adg *adg;
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct clk *clk;
-	int i;
 
 	adg = devm_kzalloc(dev, sizeof(*adg), GFP_KERNEL);
 	if (!adg) {
@@ -483,13 +503,7 @@ int rsnd_adg_probe(struct platform_device *pdev,
 	adg->mod.ops = &adg_ops;
 	adg->mod.priv = priv;
 
-	adg->clk[CLKA]	= devm_clk_get(dev, "clk_a");
-	adg->clk[CLKB]	= devm_clk_get(dev, "clk_b");
-	adg->clk[CLKC]	= devm_clk_get(dev, "clk_c");
-	adg->clk[CLKI]	= devm_clk_get(dev, "clk_i");
-
-	for_each_rsnd_clk(clk, adg, i)
-		dev_dbg(dev, "clk %d : %p : %ld\n", i, clk, clk_get_rate(clk));
+	rsnd_adg_get_clkin(priv, adg);
 
 	rsnd_adg_ssi_clk_init(priv, adg);
 
-- 
1.9.1

  parent reply	other threads:[~2015-09-10  7:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10  7:00 [PATCH 0/9] ASoC: rsnd: Gen3 support Kuninori Morimoto
2015-09-10  7:01 ` [PATCH 1/9] ASoC: rsnd: Add Gen3 initial support Kuninori Morimoto
2015-09-10  7:02 ` [PATCH 2/9] ASoC: rsnd: add rsnd_mod_get() macro and use it Kuninori Morimoto
2015-09-10  7:02 ` [PATCH 3/9] ASoC: rsnd: ADG uses mod base common method Kuninori Morimoto
2015-09-10  7:03 ` [PATCH 4/9] ASoC: rsnd: add common mod confirm method Kuninori Morimoto
2015-09-10  7:03 ` [PATCH 5/9] ASoC: rsnd: ADG initial setup on rsnd_adg_ssi_clk_init() Kuninori Morimoto
2015-09-10  7:03 ` [PATCH 6/9] ASoC: rsnd: tidyup ADG clock calculate method Kuninori Morimoto
2015-09-10  7:04 ` [PATCH 7/9] ASoC: rsnd: tidyup ADG debug message for clock selection Kuninori Morimoto
2015-09-10  7:04 ` Kuninori Morimoto [this message]
2015-09-10  7:04 ` [PATCH 9/9] ASoC: rsnd: add AUDIO_CLKOUT support Kuninori Morimoto

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=87vbbin4hp.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).