summaryrefslogtreecommitdiffstats
path: root/sound/arm
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2018-06-17 12:50:01 +0200
committerMark Brown <broonie@kernel.org>2018-06-18 12:55:16 +0100
commita4519526ebbd261e36425fa1c269515ee0648ab2 (patch)
treeaa67c4d4b92ee0604d66791d6059b8046b3687f0 /sound/arm
parente2b35e468c89000cf3b8b5beb63fd73dfa8a5435 (diff)
downloadlinux-a4519526ebbd261e36425fa1c269515ee0648ab2.tar.bz2
ASoC: pxa: add devicetree support
Add the devicetree support, so that the driver can be used in a devictree platform. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/arm')
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 5950a9e218d9..8eafd3d3dff6 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/gpio.h>
+#include <linux/of_gpio.h>
#include <sound/pxa2xx-lib.h>
@@ -337,6 +338,17 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
dev_err(&dev->dev, "Invalid reset GPIO %d\n",
pdata->reset_gpio);
}
+ } else if (!pdata && dev->dev.of_node) {
+ pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ pdata->reset_gpio = of_get_named_gpio(dev->dev.of_node,
+ "reset-gpios", 0);
+ if (pdata->reset_gpio == -ENOENT)
+ pdata->reset_gpio = -1;
+ else if (pdata->reset_gpio < 0)
+ return pdata->reset_gpio;
+ reset_gpio = pdata->reset_gpio;
} else {
if (cpu_is_pxa27x())
reset_gpio = 113;