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 6626e2cfbcb770f5e7ae3f3c66e28658fb50c76a..ee920bc4c784718c77fdf4248b02c1893215f8ef 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);