linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Cercueil <paul.cercueil@analog.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>, <linux-iio@vger.kernel.org>,
	Paul Cercueil <paul.cercueil@analog.com>
Subject: [PATCH 2/3] iio: ad5064: Allow choosing external supply from device tree
Date: Wed, 12 Feb 2014 13:01:57 +0100	[thread overview]
Message-ID: <1392206518-1457-2-git-send-email-paul.cercueil@analog.com> (raw)
In-Reply-To: <1392206518-1457-1-git-send-email-paul.cercueil@analog.com>

Using the boolean property "adi,use-external-reference" it is
now possible to select the external supply from the device tree.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
---
 drivers/iio/dac/ad5064.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index fbb836a..615790a 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -449,6 +449,7 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
 	unsigned int midscale;
 	unsigned int i;
 	int ret;
+	bool ext_vref;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
 	if (indio_dev == NULL)
@@ -464,7 +465,13 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
 	for (i = 0; i < ad5064_num_vref(st); ++i)
 		st->vref_reg[i].supply = ad5064_vref_name(st, i);
 
-	if (pdata && pdata->use_external_ref) {
+	if (dev->of_node)
+		ext_vref = of_property_read_bool(dev->of_node,
+				"adi,use-external-reference");
+	else
+		ext_vref = pdata && pdata->use_external_ref;
+
+	if (ext_vref) {
 		ret = devm_regulator_bulk_get(dev, ad5064_num_vref(st),
 					st->vref_reg);
 		if (ret)
-- 
1.7.10.4

  reply	other threads:[~2014-02-12 12:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 12:01 [PATCH 1/3] iio: ad5064: Explicitly configure whether to use external supply Paul Cercueil
2014-02-12 12:01 ` Paul Cercueil [this message]
2014-02-12 12:01 ` [PATCH 3/3] devicetree: ad5064: Added devicetree bindings documentation Paul Cercueil
2014-02-12 12:18   ` Mark Rutland
2014-02-12 14:07     ` Paul Cercueil
2014-02-12 12:19 ` [PATCH 1/3] iio: ad5064: Explicitly configure whether to use external supply Lars-Peter Clausen
2014-02-12 12:35   ` Lars-Peter Clausen
2014-02-18  8:57     ` Jonathan Cameron
2014-07-22 23:06 ` Gregory Fong
2014-07-23 19:23   ` Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392206518-1457-2-git-send-email-paul.cercueil@analog.com \
    --to=paul.cercueil@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).