Re: [PATCH v6 05/17] iio: adc: Add AD7768 and AD7768-4 core support
From: Jonathan Cameron
Date: Wed Sep 09 2026 - 23:47:36 EST
On Mon, 7 Sep 2026 13:25:53 +0200
Janani Sunil <jananisunil.dev@xxxxxxxxx> wrote:
> On 9/6/26 05:50, Jonathan Cameron wrote:
> >> Add core support for the AD7768 and AD7768-4 simultaneous sampling ADCs.
> >> Configure supplies, clock and reset, use a custom regmap bus for the SPI
> >> protocol, and parse the enabled channels and input buffer settings from
> >> devicetree.
> >>
> >> Connect the converter to an IIO backend for buffered capture with CRC,
> >> provide a fixed safe wideband sampling configuration and add runtime
> >> power management.
> >>
> >> Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
> > ...
> >
> >> +
> >> +static int ad7768_get_enable_vref(struct device *dev, unsigned int index)
> >> +{
> >> + const char * const *supply = ad7768_vref_supply_names[index];
> >> + int refp_uV;
> >> + int refn_uV;
> >> +
> >> + refp_uV = devm_regulator_get_enable_read_voltage(dev, supply[0]);
> >> + if (refp_uV < 0)
> >> + return dev_err_probe(dev, refp_uV,
> >> + "Failed to get %s supply voltage\n", supply[0]);
> >> +
> >> + refn_uV = devm_regulator_get_enable_read_voltage(dev, supply[1]);
> >> + if (refn_uV == -ENODEV)
> >> + refn_uV = 0;
> >> + else if (refn_uV < 0)
> >> + return dev_err_probe(dev, refn_uV,
> >> + "Failed to get %s supply voltage\n", supply[1]);
> >> +
> >> + if (refp_uV <= refn_uV)
> >> + return dev_err_probe(dev, -EINVAL,
> >> + "Invalid reference %u voltage\n", index + 1);
> >> +
> >> + return refp_uV - refn_uV;
> > Do we never care about the offset inherent in where the negative sits?
>
> The absolute REFx- voltage does not introduce an offset into the ADC transfer function. The datasheet defines VREF as REFx+ - REFx- and the LSB size as (2 * VREF)/2^24. Zero code remains at AINx+ - AINx- = 0.
Fair enough - I'm not sure what I had in mind.
Jonathan
>
> Regards,
> Jan
>