]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: rt5640: Retry DEVICE_ID verification
authorXinxin Wan <xinxin.wan@intel.com>
Fri, 30 May 2025 14:21:19 +0000 (16:21 +0200)
committerMark Brown <broonie@kernel.org>
Sun, 8 Jun 2025 22:34:37 +0000 (23:34 +0100)
To be more resilient to codec-detection failures when the hardware
powers on slowly, add retry mechanism to the device verification check.
Similar pattern is found throughout a number of Realtek codecs. Our
tests show that 60ms delay is sufficient to address readiness issues on
rt5640 chip.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Xinxin Wan <xinxin.wan@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250530142120.2944095-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5640.c

index 265b30856faf4ba0dadb8a348c324c53bda47435..f50e771db24b0f091327aa243755d16af1cd270e 100644 (file)
@@ -3013,6 +3013,11 @@ static int rt5640_i2c_probe(struct i2c_client *i2c)
        }
 
        regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val);
+       if (val != RT5640_DEVICE_ID) {
+               usleep_range(60000, 100000);
+               regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val);
+       }
+
        if (val != RT5640_DEVICE_ID) {
                dev_err(&i2c->dev,
                        "Device with ID register %#x is not rt5640/39\n", val);