ASoC: rt5640: fix rt5640_i2c_probe fail sometimes
authorSugar Zhang <sugar.zhang@rock-chips.com>
Wed, 9 Mar 2016 03:50:43 +0000 (11:50 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Wed, 9 Mar 2016 06:27:37 +0000 (14:27 +0800)
if the codec is not initialized completely, i2c transfer will be
failed, so we just return PROBE_DEFER to let codec have chance to
be probed later.

Change-Id: I68922ffa7ddf048ebe3f95be9349d38b7b059982
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
sound/soc/codecs/rt5640.c

index 6626e2c..ee920bc 100644 (file)
@@ -2337,7 +2337,10 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
                msleep(400);
        }
 
-       regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val);
+       ret = regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val);
+       if (ret)
+               return -EPROBE_DEFER;
+
        if (val != RT5640_DEVICE_ID) {
                dev_err(&i2c->dev,
                        "Device with ID register %#x is not rt5640/39\n", val);