Re: [PATCH v6 05/17] iio: adc: Add AD7768 and AD7768-4 core support
From: Jonathan Cameron
Date: Sat Sep 05 2026 - 23:54:27 EST
> 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>
Just a few minor things I spotted on a fresh look at this.
> diff --git a/drivers/iio/adc/ad7768.c b/drivers/iio/adc/ad7768.c
> new file mode 100644
> index 000000000000..c80056a9edd8
> --- /dev/null
> +++ b/drivers/iio/adc/ad7768.c
> +
> +static int ad7768_regmap_write(void *context, const void *data, size_t count)
> +{
> + struct spi_device *spi = context;
I'm not seeing huge value in teh local variable. I'd rename context
to spi and just pass it directly to spi_write()
Not important if you strongly prefer this way though.
> +
> + return spi_write(spi, data, count);
> +}
> +
...
> +
> +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?
--
Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>