From: fabio.estevam@freescale.com (Fabio Estevam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ASoC: sgtl5000: Defer probe in case of I2C error
Date: Tue, 25 Jun 2013 11:00:01 -0300 [thread overview]
Message-ID: <1372168801-4221-3-git-send-email-fabio.estevam@freescale.com> (raw)
In-Reply-To: <1372168801-4221-1-git-send-email-fabio.estevam@freescale.com>
In case of I2C error, let's defer the probe.
On mx28, for example, the first read of the codec revision register fails
because there is no codec clock provided at this point. The codec clock will be
enabled later in the mxs-saif driver, so return -EPROBE_DEFER in case of I2C
read error, so that the codec driver can do another attempt at a later stage
when the codec clock is available.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
sound/soc/codecs/sgtl5000.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index d441559..a2dce4a 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1536,9 +1536,12 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
/* read chip information */
ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®);
- if (ret)
+ if (ret) {
+ ret = -EPROBE_DEFER; /* If I2C read failed, try again later */
goto disable_clk;
+ }
+
if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) !=
SGTL5000_PARTID_PART_ID) {
dev_err(&client->dev,
--
1.8.1.2
next prev parent reply other threads:[~2013-06-25 14:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 13:59 [PATCH 1/3] clk: mxs: clk-imx28: Provide a dummy clock Fabio Estevam
2013-06-25 14:00 ` [PATCH 2/3] ARM: dts: mx28: Provide a codec clock Fabio Estevam
2013-06-25 14:22 ` Shawn Guo
2013-06-25 17:27 ` Mike Turquette
2013-06-25 14:00 ` Fabio Estevam [this message]
2013-06-26 8:33 ` [PATCH 3/3] ASoC: sgtl5000: Defer probe in case of I2C error Mark Brown
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=1372168801-4221-3-git-send-email-fabio.estevam@freescale.com \
--to=fabio.estevam@freescale.com \
--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