[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG4RSAHcEYj5bUpxT8apwXZZpWkPowFJ333tZiTHhb9VVn4m7g@mail.gmail.com>
Date: Mon, 26 Nov 2018 17:24:13 -0200
From: Giuliano Belinassi <giuliano.belinassi@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: StefanSerban.Popa@...log.com,
"Ardelean, Alexandru" <alexandru.Ardelean@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Hartmut Knaack <knaack.h@....de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
devel@...verdev.osuosl.org, kernel-usp@...glegroups.com
Subject: Re: [PATCH] staging: iio: ad7780: Add gain & filter gpio support
Hi, thank you for the review
> On Thu, 22 Nov 2018 11:01:00 +0000
> "Popa, Stefan Serban" <StefanSerban.Popa@...log.com> wrote:
> > I think that instead of setting the gain directly, we should use
> > the IIO_CHAN_INFO_SCALE attribute. At page 12 of the ad7780 datasheet there
> > is a formula from which the output code can be calculated:
> > Code = 2^(N − 1)
> > × [(AIN × Gain /VREF) + 1]. So, by setting the scale from user space, the
> > driver can calculate the correct gain by using the formula above. Also, it
> > would be useful to introduce scale available.
> > Furthermore, there is a new
> > ad7124 adc driver which does this exact thing. Take a look here: https://gi
> > thub.com/analogdevicesinc/linux/blob/master/drivers/iio/adc/ad7124.c#L337.
We have some questions about the code you provided to us:
1-) What is exactly the inputs for the write_raw function?
2-) Could you give more details about the math around lines 346-348?
Is it correct to assume that the multiplication at line 346 won't
overflow? (vref is an uint)
And regarding our code:
1-) The val in our write_raw function should be, in case of GAIN, a
number that best approximate the actual gain value of 1 or 128? For
instance, if the user inputs 126, we should default to 128?
2-) In the case of FILTER, is it the same? Is the user sending the
value in mHz (milihertz)?
Thank you
Powered by blists - more mailing lists