From: Oder Chiou <oder_chiou@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: Oder Chiou <oder_chiou@realtek.com>,
jack.yu@realtek.com, alsa-devel@alsa-project.org,
shumingf@realtek.com, bardliao@realtek.com, flove@realtek.com,
cychiang@chromium.org
Subject: [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register
Date: Mon, 6 Nov 2017 14:18:02 +0800 [thread overview]
Message-ID: <1509949082-21443-1-git-send-email-oder_chiou@realtek.com> (raw)
In the probe, the codec may not be ready for I2C reading. So if the value
is not correct, it will read again after delay.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
---
sound/soc/codecs/rt5663.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index fcd1643..5985d8e 100644
--- a/sound/soc/codecs/rt5663.c
+++ b/sound/soc/codecs/rt5663.c
@@ -3429,7 +3429,16 @@ static int rt5663_i2c_probe(struct i2c_client *i2c,
ret);
return ret;
}
- regmap_read(regmap, RT5663_VENDOR_ID_2, &val);
+
+ ret = regmap_read(regmap, RT5663_VENDOR_ID_2, &val);
+ if (ret || (val != RT5663_DEVICE_ID_2 && val != RT5663_DEVICE_ID_1)) {
+ dev_err(&i2c->dev,
+ "Device with ID register %#x is not rt5663,"
+ " retry one time.\n", val);
+ msleep(100);
+ regmap_read(regmap, RT5663_VENDOR_ID_2, &val);
+ }
+
switch (val) {
case RT5663_DEVICE_ID_2:
rt5663->regmap = devm_regmap_init_i2c(i2c, &rt5663_v2_regmap);
--
2.7.4
next reply other threads:[~2017-11-06 6:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 6:18 Oder Chiou [this message]
2017-11-06 11:30 ` [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register Mark Brown
[not found] ` <7EB0DE829A537248AF2ED30C97D12694023CFB9D@RTITMBSV02.realtek.com.tw>
2017-11-08 21:20 ` 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=1509949082-21443-1-git-send-email-oder_chiou@realtek.com \
--to=oder_chiou@realtek.com \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=cychiang@chromium.org \
--cc=flove@realtek.com \
--cc=jack.yu@realtek.com \
--cc=lgirdwood@gmail.com \
--cc=shumingf@realtek.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).