Re: [PATCH 6/6] iio: adc: ad7793: add firmware support and drop platform data

From: Jonathan Cameron

Date: Wed Nov 25 2026 - 21:00:39 EST


On Wed, 25 Nov 2026 10:19:22 +0000
Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:

> The driver refuses to probe without struct ad7793_platform_data, and
> there are no in-tree users of it. That means the driver can not be used
> at all on a modern system.
>
> Get the configuration from firmware properties instead, following the
> new binding, and drop the platform data header:
>
> - The reference is REFIN (REFIN1) if refin-supply is present, REFIN2 if
> refin2-supply is present, and the internal 1.17 V reference otherwise.
> Parts without an internal reference need refin-supply.
> - An external clock on the CLK pin is used if given. A 128 kHz clock
> is divided by 2 internally.
> - The input buffer stays enabled (as it is at power-up) unless
> adi,buffer-disable is set, and unipolar coding is used unless bipolar
> is set.
> - The bias voltage generator, the burnout currents and the excitation
> current sources get their own properties.
>
> While at it, also enable the AVDD and DVDD supplies, add an OF match
> table and fold the platform data checks into the property parsing.
>
> Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Looks fine in general but could as Andy suggested be package
a tiny bit differently to be nicer to reviewers!


> diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
> index b0f44c144f20..f3e3ca724ec2 100644
> --- a/drivers/iio/adc/ad7793.c
> +++ b/drivers/iio/adc/ad7793.c

>
> +static int ad7793_parse_excitation(struct device *dev,
> + struct ad7793_config *cfg)
> +{
> + static const char * const iout_pins[] = { "iout1", "iout2" };
> + u32 pins[] = { 1, 2 };
> + const char *names[2];
> + u32 val;
> + int ret;
> +
> + ret = device_property_read_u32(dev, "adi,excitation-current-microamp",
> + &val);

Feel free to go a bit long on things like this.