linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ASoC: sgtl5000: defer the probe if clock is not found
Date: Mon, 1 Jul 2013 16:16:09 +0800	[thread overview]
Message-ID: <1372666571-17276-3-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1372666571-17276-1-git-send-email-shawn.guo@linaro.org>

It's not always the case that clock is already available when sgtl5000
get probed at the first time, e.g. the clock is provided by CPU DAI
which may be probed after sgtl5000.  So let's defer the probe when
devm_clk_get() call fails and give it chance to try later.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 sound/soc/codecs/sgtl5000.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 20bca03..1b7003c 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1527,7 +1527,8 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
 	if (IS_ERR(sgtl5000->mclk)) {
 		ret = PTR_ERR(sgtl5000->mclk);
 		dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
-		return ret;
+		/* Defer the probe to see if the clk will be provided later */
+		return ret == -ENOENT ? -EPROBE_DEFER : ret;
 	}
 
 	ret = clk_prepare_enable(sgtl5000->mclk);
-- 
1.7.9.5

  parent reply	other threads:[~2013-07-01  8:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01  8:16 [PATCH 0/4] Fix mxs audio regressions Shawn Guo
2013-07-01  8:16 ` [PATCH 1/4] ASoC: sgtl5000: give it a ramping time before writting Shawn Guo
2013-07-01 10:07   ` Mark Brown
2013-07-01 10:54     ` Marek Vasut
2013-07-01 13:55       ` Shawn Guo
2013-07-01 14:12       ` [alsa-devel] " Fabio Estevam
2013-07-01 14:26         ` Shawn Guo
2013-07-01 14:34           ` Shawn Guo
2013-07-01 15:11             ` Fabio Estevam
2013-07-01 15:33               ` Shawn Guo
2013-07-01 15:42                 ` Fabio Estevam
2013-07-01 17:43                   ` Marek Vasut
2013-07-01 19:14                     ` Fabio Estevam
2013-07-01 19:28                       ` Alexandre Belloni
2013-07-02  2:16                     ` Shawn Guo
2013-07-01 19:23                   ` Alexandre Belloni
2013-07-01 14:04     ` Shawn Guo
2013-07-01 10:57   ` Lothar Waßmann
2013-07-01  8:16 ` Shawn Guo [this message]
2013-07-01  9:45   ` [PATCH 2/4] ASoC: sgtl5000: defer the probe if clock is not found Mark Brown
2013-07-01 11:33     ` Russell King - ARM Linux
2013-07-01 12:51       ` Mark Brown
2013-07-01  8:16 ` [PATCH 3/4] ASoC: mxs: register saif mclk to clock framework Shawn Guo
2013-07-01 10:11   ` Mark Brown
2013-07-01  8:16 ` [PATCH 4/4] ARM: mxs: saif0 is the clock provider to sgtl5000 Shawn Guo

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=1372666571-17276-3-git-send-email-shawn.guo@linaro.org \
    --to=shawn.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).