Re: [PATCH v5 08/14] iio: adc: ad7768-1: add regulator to control VCM output

Jonathan Cameron
2025-04-12T18:02:14Z

On Fri, 11 Apr 2025 12:57:42 -0300
Jonathan Santos <Jonathan.Santos@analog.com> wrote:

> The VCM output voltage can be used as a common-mode voltage within the
> amplifier preconditioning circuits external to the AD7768-1.
>
> This change allows the user to configure VCM output using the regulator
> framework.
>
> Acked-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Just one question from me inline.

> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index 66087fabe181..13d17a13b6ea 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c

> +static const struct regulator_desc vcm_desc = {
> + .name = "ad7768-1-vcm",
> + .of_match = of_match_ptr("vcm-output"),
> + .regulators_node = of_match_ptr("regulators"),
I see this use of of_match_ptr() is common but not universal in regulator
drivers. Any idea if it really is just to save a string or if there
some more fundamental reason to make these go away when device
tree support is not built?

We spent a while getting other uses of this out of IIO so I'd like to know
more about this one!

Jonathan

> + .n_voltages = ARRAY_SIZE(vcm_voltage_table),
> + .volt_table = vcm_voltage_table,
> + .ops = &vcm_regulator_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> +};