MLK-13621: ASoC: codec: wm8960: fix reset failed in probe
authorShengjiu Wang <shengjiu.wang@freescale.com>
Tue, 20 Dec 2016 09:25:24 +0000 (17:25 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:58:02 +0000 (14:58 -0500)
There is occasion that wm8960 reset failed in the beginning,
Especially after board reboot. The issue is found in the
imx7d-sdb board Rev.C. After retry, the reset operation is
successful.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
sound/soc/codecs/wm8960.c

index 2d671fd..e1429e3 100644 (file)
@@ -1296,6 +1296,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
        struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
        struct wm8960_priv *wm8960;
        int ret;
+       int repeat_reset = 10;
 
        wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
                              GFP_KERNEL);
@@ -1317,7 +1318,11 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
        else if (i2c->dev.of_node)
                wm8960_set_pdata_from_of(i2c, &wm8960->pdata);
 
-       ret = wm8960_reset(wm8960->regmap);
+       do {
+               ret = wm8960_reset(wm8960->regmap);
+               repeat_reset--;
+       } while (repeat_reset > 0 && ret != 0);
+
        if (ret != 0) {
                dev_err(&i2c->dev, "Failed to issue reset\n");
                return ret;