[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc817ac9-105f-40c5-806d-93db95955628@baylibre.com>
Date: Wed, 13 Aug 2025 09:50:52 -0500
From: David Lechner <dlechner@...libre.com>
To: Jonathan Santos <Jonathan.Santos@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Michael.Hennerich@...log.com, jic23@...nel.org, nuno.sa@...log.com,
andy@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
jonath4nns@...il.com
Subject: Re: [PATCH 3/4] iio: adc: ad7768-1: use
devm_regulator_get_enable_read_voltage
On 8/12/25 9:49 PM, Jonathan Santos wrote:
> Use devm_regulator_get_enable_read_voltage function as a standard and
> concise way of reading the voltage from the regulator and keep the
> regulator enabled. Replace the regulator descriptor with the direct
> voltage value in the device struct.
>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@...log.com>
> ---
> drivers/iio/adc/ad7768-1.c | 29 +++++++----------------------
> 1 file changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index 36ba208fc119..d0b9764a8f92 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -225,7 +225,7 @@ struct ad7768_state {
> struct spi_device *spi;
> struct regmap *regmap;
> struct regmap *regmap24;
> - struct regulator *vref;
> + int vref_uv;
> struct regulator_dev *vcm_rdev;
> unsigned int vcm_output_sel;
> struct clk *mclk;
> @@ -809,7 +809,7 @@ static int ad7768_read_raw(struct iio_dev *indio_dev,
> return IIO_VAL_INT;
>
> case IIO_CHAN_INFO_SCALE:
> - scale_uv = regulator_get_voltage(st->vref);
> + scale_uv = st->vref_uv;
> if (scale_uv < 0)
> return scale_uv;
Can also drop the error check since we've already done that in probe.
Powered by blists - more mailing lists