Re: [PATCH v4 6/6] iio: adc: ad7625: add LTC2387 and ADAQ2387x support
From: Jonathan Cameron
Date: Sat Nov 21 2026 - 18:48:49 EST
On Thu, 19 Nov 2026 13:24:20 +0200
Nicolae-Daniel Deaconescu <Nicolae-daniel.Deaconescu@xxxxxxxxxx> wrote:
> From: Sergiu Cuciurean <sergiu.cuciurean@xxxxxxxxxx>
>
> Add the LTC2387-16, LTC2387-18, ADAQ23875, ADAQ23876 and ADAQ23878 as chip
> data of this driver. The same two PWMs and IIO backend are used to read
> from them. See the binding patch for how they differ from the existing
> parts.
>
> The CLK burst of a conversion starts at least t_FIRSTCLK after its CNV and
> ends at most t_LASTCLK after the next CNV, so the sampling period is raised
> until the burst fits, instead of being clamped to 10 MSPS. Waveforms are
> built in whole PWM steps, read with pwm_get_waveform_step_might_sleep().
>
> The scale is divided by the gain of the ADAQ front end.
>
> Add new maintainer entries.
>
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@xxxxxxxxxx>
> Co-developed-by: Nicolae-Daniel Deaconescu <Nicolae-daniel.Deaconescu@xxxxxxxxxx>
> Signed-off-by: Nicolae-Daniel Deaconescu <Nicolae-daniel.Deaconescu@xxxxxxxxxx>
> diff --git a/drivers/iio/adc/ad7625.c b/drivers/iio/adc/ad7625.c
> index 127441050687..8ddd18e45c8a 100644
> --- a/drivers/iio/adc/ad7625.c
> +++ b/drivers/iio/adc/ad7625.c
One minor thing inline. Looks to be a good shape. Thanks
Jonathan
> @@ -498,8 +822,40 @@ static int devm_ad7625_pwm_get(struct device *dev,
> return 0;
> }
>
> +static int devm_ad7625_listed_regulator_setup(struct device *dev,
> + struct ad7625_state *st)
> +{
> + int ret;
> +
> + ret = devm_regulator_bulk_get_enable(dev, st->info->num_supplies,
> + st->info->supplies);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to enable supplies\n");
> +
> + /* VS- of the ADAQ modules is left out if it is tied to ground. */
> + ret = devm_regulator_get_enable_optional(dev, "vs-n");
Does it hurt to just a non optional call here?
You'll get a stub regulator that will do nothing. That seems to make
little difference vs carefully handling the not present case.
The optional stuff only really comes into its own when we want
to do something else instead. It doesn't matter if we are ignoring
the lack of presence.
> + if (ret && ret != -ENODEV)
> + return dev_err_probe(dev, ret, "failed to enable VS-\n");
> +
> + ret = devm_regulator_get_enable_read_voltage(dev, "ref");
> + if (ret == -ENODEV) {
> + /* Without ref-supply the internal reference is used. */
> + st->vref_mv = AD7625_INTERNAL_REF_MV;
> + return 0;
> + }
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "failed to get REF voltage\n");
> +
> + st->vref_mv = ret / (MICRO / MILLI);
> +
> + return 0;
> +}