All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register
@ 2017-11-06  6:18 Oder Chiou
  2017-11-06 11:30 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Oder Chiou @ 2017-11-06  6:18 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: Oder Chiou, jack.yu, alsa-devel, shumingf, bardliao, flove, cychiang

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register
  2017-11-06  6:18 [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register Oder Chiou
@ 2017-11-06 11:30 ` Mark Brown
       [not found]   ` <7EB0DE829A537248AF2ED30C97D12694023CFB9D@RTITMBSV02.realtek.com.tw>
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2017-11-06 11:30 UTC (permalink / raw)
  To: Oder Chiou
  Cc: jack.yu, alsa-devel, lgirdwood, shumingf, bardliao, flove, cychiang


[-- Attachment #1.1: Type: text/plain, Size: 262 bytes --]

On Mon, Nov 06, 2017 at 02:18:02PM +0800, Oder Chiou wrote:
> 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.

Why might this happen?  This sounds like papering over some other
problem.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register
       [not found]   ` <7EB0DE829A537248AF2ED30C97D12694023CFB9D@RTITMBSV02.realtek.com.tw>
@ 2017-11-08 21:20     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2017-11-08 21:20 UTC (permalink / raw)
  To: Oder Chiou
  Cc: Jack Yu, alsa-devel, lgirdwood,
	Shuming [范書銘], Bard Liao, Flove(HsinFu),
	cychiang


[-- Attachment #1.1: Type: text/plain, Size: 451 bytes --]

On Tue, Nov 07, 2017 at 02:21:21AM +0000, Oder Chiou wrote:

> The issue is similar the patch https://patchwork.kernel.org/patch/9681421/.
> And in current project, these 2 devices were connected to the same i2c host,
> and they meet the same problem.

OK...  can you resend with the log message all on one line please?  That
makes it easier for people to grep the kernel source to find where the
error came from, it's more important than 80 columns.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-08 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06  6:18 [PATCH] ASoC: rt5663: Delay and retry reading rt5663 ID register Oder Chiou
2017-11-06 11:30 ` Mark Brown
     [not found]   ` <7EB0DE829A537248AF2ED30C97D12694023CFB9D@RTITMBSV02.realtek.com.tw>
2017-11-08 21:20     ` Mark Brown

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.