MLK-16563-1: ASoC: cs42xx8: reset the codec in the beginning of probe
authorShengjiu Wang <shengjiu.wang@nxp.com>
Tue, 10 Oct 2017 08:59:50 +0000 (16:59 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:45 +0000 (15:38 -0500)
In AUDIO IO board for imx8qxp mek, after board reset, the codec
failed to probe, system can't find codec device on i2c bus.
The reason is not clear, but add reset operation in the beginning of
probe can fix this issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
sound/soc/codecs/cs42xx8.c

index 04e94fb..2db5b05 100644 (file)
@@ -536,11 +536,12 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
        cs42xx8->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
        if (gpio_is_valid(cs42xx8->reset_gpio)) {
                ret = devm_gpio_request_one(dev, cs42xx8->reset_gpio,
-                               GPIOF_OUT_INIT_HIGH, "cs42xx8 reset");
+                               GPIOF_OUT_INIT_LOW, "cs42xx8 reset");
                if (ret) {
                        dev_err(dev, "unable to get reset gpio\n");
                        return ret;
                }
+               gpio_set_value_cansleep(cs42xx8->reset_gpio, 1);
        }
 
        cs42xx8->clk = devm_clk_get(dev, "mclk");
@@ -632,8 +633,10 @@ static int cs42xx8_runtime_resume(struct device *dev)
                return ret;
        }
 
-       if (gpio_is_valid(cs42xx8->reset_gpio))
+       if (gpio_is_valid(cs42xx8->reset_gpio)) {
+               gpio_set_value_cansleep(cs42xx8->reset_gpio, 0);
                gpio_set_value_cansleep(cs42xx8->reset_gpio, 1);
+       }
 
        ret = regulator_bulk_enable(ARRAY_SIZE(cs42xx8->supplies),
                                    cs42xx8->supplies);