ASoC: simple-amplifier: Make gpio property optional
authorMylène Josserand <mylene.josserand@bootlin.com>
Mon, 18 Mar 2019 10:39:38 +0000 (11:39 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 18 Mar 2019 11:18:47 +0000 (11:18 +0000)
Some amplifier may not have a GPIO to control the power, but instead simply
rely on the regulator to power up and down the amplifier.

In order to support those setups, let's make the GPIO optional.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Documentation/devicetree/bindings/sound/simple-amplifier.txt
sound/soc/codecs/simple-amplifier.c

index 7182ac4f1e6588fd502e42171b892dc04fc13b6d..b1b097cc9b68fc8a23b64de1abca2ebc303fb165 100644 (file)
@@ -2,9 +2,9 @@ Simple Amplifier Audio Driver
 
 Required properties:
 - compatible : "dioo,dio2125" or "simple-audio-amplifier"
-- enable-gpios : the gpio connected to the enable pin of the simple amplifier
 
 Optional properties:
+- enable-gpios : the gpio connected to the enable pin of the simple amplifier
 - VCC-supply   : power supply for the device, as covered
                  in Documentation/devicetree/bindings/regulator/regulator.txt
 
index c07e8a80b4b7dc99e5a31f352c9bebad023c2713..351aa55c384e2f9cd34e47a14c4f55796adfa94a 100644 (file)
@@ -89,7 +89,8 @@ static int simple_amp_probe(struct platform_device *pdev)
                return -ENOMEM;
        platform_set_drvdata(pdev, priv);
 
-       priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+       priv->gpiod_enable = devm_gpiod_get_optional(dev, "enable",
+                                                    GPIOD_OUT_LOW);
        if (IS_ERR(priv->gpiod_enable)) {
                err = PTR_ERR(priv->gpiod_enable);
                if (err != -EPROBE_DEFER)