[v2,2/3] ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2
diff mbox

Message ID 20171108172404.19118-3-alexander.deucher@amd.com
State New
Headers show

Commit Message

Alex Deucher Nov. 8, 2017, 5:24 p.m. UTC
From: Akshu Agrawal <akshu.agrawal@amd.com>

Minimum time required between power On of codec and read
of RT5645_VENDOR_ID2 is 400msec. We should wait that long
before reading the value.

TEST=Cold boot the device and check for sound device.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---

v2: rework the patch based on mailing list discussion.
    Just wait before reading the register.

 sound/soc/codecs/rt5645.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mark Brown Nov. 8, 2017, 6:09 p.m. UTC | #1
On Wed, Nov 08, 2017 at 12:24:03PM -0500, Alex Deucher wrote:

>  	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
>  
> +	/*
> +	 * Read after 400msec, as it is the interval required between
> +	 * read and power On.
> +	 */
> +	msleep(TIME_TO_POWER_MS);
> +	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
> +

This leaves the original read in there so we've both got the early read
(which might upset things potentially) and the delayed read.  Shouldn't
we just be adding a msleep() before the existing read?
Akshu Agrawal Nov. 9, 2017, 9:14 a.m. UTC | #2
On 11/8/2017 11:39 PM, Mark Brown wrote:
> On Wed, Nov 08, 2017 at 12:24:03PM -0500, Alex Deucher wrote:
> 
>>   	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
>>   
>> +	/*
>> +	 * Read after 400msec, as it is the interval required between
>> +	 * read and power On.
>> +	 */
>> +	msleep(TIME_TO_POWER_MS);
>> +	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
>> +
> 
> This leaves the original read in there so we've both got the early read
> (which might upset things potentially) and the delayed read.  Shouldn't
> we just be adding a msleep() before the existing read?
> 

My bad, I should have removed the addition of register read from the patch.

Patch
diff mbox

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 23cc2cb8393f..ce5d2c3c6976 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -55,6 +55,8 @@  MODULE_PARM_DESC(quirk, "RT5645 pdata quirk override");
 
 #define RT5645_HWEQ_NUM 57
 
+#define TIME_TO_POWER_MS 400
+
 static const struct regmap_range_cfg rt5645_ranges[] = {
 	{
 		.name = "PR",
@@ -3786,6 +3788,13 @@  static int rt5645_i2c_probe(struct i2c_client *i2c,
 	}
 	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
 
+	/*
+	 * Read after 400msec, as it is the interval required between
+	 * read and power On.
+	 */
+	msleep(TIME_TO_POWER_MS);
+	regmap_read(regmap, RT5645_VENDOR_ID2, &val);
+
 	switch (val) {
 	case RT5645_DEVICE_ID:
 		rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);