Skip to contentSkip to conversation

ASoC: rt5663: Delay and retry reading rt5663 ID register

PATCH Superseded Oder Chiou 2 participants 3 messages Nov 6, 2017 – Nov 8, 2017 1 message not in the archive

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/1 ASoC: rt5663: Delay and retry reading rt5663 ID register

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.

---
 sound/soc/codecs/rt5663.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5663.c +10 -1
index fcd1643..5985d8e 100644
@@ -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);
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 2 lines · Oder Chiou

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.

A message that is not in the archive (sent off-list or not yet received): 7EB0DE829A537248AF2ED30C97D12694023CFB9D@RTITMBSV02.realtek.com.tw

maintainer
#3 lore raw
Quoted 3 lines · Oder Chiou

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.