[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87f3aeeb767e90dbdd7b39da20af7c3d88706002.camel@gmail.com>
Date: Mon, 20 Jan 2025 09:44:42 +0000
From: Nuno Sá <noname.nuno@...il.com>
To: David Lechner <dlechner@...libre.com>, Antoniu Miclaus
<antoniu.miclaus@...log.com>, jic23@...nel.org, robh@...nel.org,
conor+dt@...nel.org, linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org
Subject: Re: [PATCH v10 8/8] iio: adc: ad4851: add ad485x driver
On Sat, 2025-01-18 at 11:37 -0600, David Lechner wrote:
> On 1/18/25 9:10 AM, Nuno Sá wrote:
> > On Fri, 2025-01-17 at 15:07 +0200, Antoniu Miclaus wrote:
> > > Add support for the AD485X a fully buffered, 8-channel simultaneous
> > > sampling, 16/20-bit, 1 MSPS data acquisition system (DAS) with
> > > differential, wide common-mode range inputs.
> > >
> > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
> > > ---
>
> ...
>
> > ...
> >
> > > +static int ad4851_read_raw(struct iio_dev *indio_dev,
> > > + const struct iio_chan_spec *chan,
> > > + int *val, int *val2, long info)
> > > +{
> > > + struct ad4851_state *st = iio_priv(indio_dev);
> > > +
> > > + switch (info) {
> > > + case IIO_CHAN_INFO_SAMP_FREQ:
> > > + *val = st->cnv_trigger_rate_hz / st->osr;
> > > + return IIO_VAL_FRACTIONAL;
> > > + case IIO_CHAN_INFO_CALIBSCALE:
> > > + return ad4851_get_calibscale(st, chan->channel, val,
> > > val2);
> > > + case IIO_CHAN_INFO_SCALE:
> > > + return ad4851_get_scale(indio_dev, chan, val, val2);
> >
> > Maybe this was discussed already and I missed it but I'm a bit puzzled.
> > Don't we
> > still need OFFSET for differential channels? How do you express negative
> > voltages?
> >
> > - Nuno Sá
> >
> >
>
> It was discussed in early revisions of the series. :-)
>
> There was an OFFSET back then, but we removed it because chip uses twos
> complement encoding for bipolar single-ended and (bipolar) differential. We
> have 's' and 'u' set in the scan_type.sign in those cases. The current
> implementation looks correct to me in this regard.
>
Yeah, my bad. I was also the one suggesting the OFFSET (IIRC) in internal review
as I assumed this was typical "straight" binary encoding. I did bothered to
check the datasheet this time and all looks good. Sorry for the noise...
- Nuno Sá
Powered by blists - more mailing lists