Skip to contentSkip to conversation

ASoC: simple-amplifier: Make gpio property optional

PATCH New Maxime Ripard 1 participant 1 message Mar 18, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: simple-amplifier: Make gpio property optional

From: Mylène Josserand <[email protected]>

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.

---
 Documentation/devicetree/bindings/sound/simple-amplifier.txt | 2 +-
 sound/soc/codecs/simple-amplifier.c                          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/simple-amplifier.txt +1 -1
index 7182ac4f1e65..b1b097cc9b68 100644
@@ -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
 
sound/soc/codecs/simple-amplifier.c +2 -1
index c07e8a80b4b7..351aa55c384e 100644
@@ -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)
Signature · 1 line
2.20.1