[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CDKXZBW1JDOD.1ZXIT12Y3WK5B@shaak>
Date: Mon, 16 Aug 2021 08:39:30 -0400
From: "Liam Beguin" <liambeguin@...il.com>
To: "Andy Shevchenko" <andy.shevchenko@...il.com>
Cc: "Lars-Peter Clausen" <lars@...afoo.de>,
"Michael Hennerich" <Michael.Hennerich@...log.com>,
"Jonathan Cameron" <jic23@...nel.org>,
"Charles-Antoine Couret" <charles-antoine.couret@...ensium.com>,
Nuno Sá <Nuno.Sa@...log.com>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
"linux-iio" <linux-iio@...r.kernel.org>,
"devicetree" <devicetree@...r.kernel.org>,
"Rob Herring" <robh+dt@...nel.org>
Subject: Re: [PATCH v6 3/5] iio: adc: ad7949: add vref selection support
On Mon Aug 16, 2021 at 4:04 AM EDT, Andy Shevchenko wrote:
> On Mon, Aug 16, 2021 at 12:35 AM Liam Beguin <liambeguin@...il.com>
> wrote:
> >
> > From: Liam Beguin <lvb@...hos.com>
> >
> > Add support for selecting the voltage reference from the devicetree.
> >
> > This change is required to get valid readings with all three
> > vref hardware configurations supported by the ADC.
> >
> > For instance if the ADC isn't provided with an external reference,
> > the sample request must specify an internal voltage reference to get a
> > valid reading.
>
> ...
>
> > + /* Setup internal voltage reference */
> > + tmp = 4096000;
> > + ret = device_property_read_u32(dev, "adi,internal-ref-microvolt", &tmp);
>
> > + if (ret < 0 && ret != -EINVAL) {
Hi Andy,
>
> What does this check (second part) is supposed to mean?
> The first part will make it mandatory, is it the goal?
>
device_property_read_u32() will return -EINVAL if the property isn't
found in the devicetree.
This checks for errors when the property is defined while keeping it
optional.
Liam
> > + dev_err(dev, "invalid value for adi,internal-ref-microvolt\n");
> > + return ret;
> > + }
>
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists