ASoC: codecs: wsa883x: Shutdown on error path
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 9 Nov 2022 16:37:58 +0000 (17:37 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 16 Nov 2022 16:25:52 +0000 (16:25 +0000)
If probe fails, toggle shutdown via GPIO to save power and reverse
probe actions.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221109163759.1158837-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wsa883x.c

index 0ddb6362fcc52ca16fe10be4c6112e5f924318e0..d40e132cd1dc7dc119ab140e71fee5f28fc4d0b0 100644 (file)
@@ -1415,6 +1415,7 @@ static int wsa883x_probe(struct sdw_slave *pdev,
 
        wsa883x->regmap = devm_regmap_init_sdw(pdev, &wsa883x_regmap_config);
        if (IS_ERR(wsa883x->regmap)) {
+               gpiod_direction_output(wsa883x->sd_n, 1);
                dev_err(&pdev->dev, "regmap_init failed\n");
                ret = PTR_ERR(wsa883x->regmap);
                goto err;