mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Jonathan Santos <Jonathan.Santos@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Michael.Hennerich@analog.com, jic23@kernel.org,
	nuno.sa@analog.com, andy@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, jonath4nns@gmail.com
Subject: Re: [PATCH 3/4] iio: adc: ad7768-1: use devm_regulator_get_enable_read_voltage
Date: Wed, 13 Aug 2025 09:50:52 -0500	[thread overview]
Message-ID: <dc817ac9-105f-40c5-806d-93db95955628@baylibre.com> (raw)
In-Reply-To: <3b9f5a9f188af8b1df947806e1049269f3a0dfa3.1754617360.git.Jonathan.Santos@analog.com>

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@analog.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.



  parent reply	other threads:[~2025-08-13 14:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13  2:48 [PATCH 0/4] Add support for ADAQ776x-1 ADC Family Jonathan Santos
2025-08-13  2:48 ` [PATCH 1/4] dt-bindings: iio: adc: ad7768-1: add new supported parts Jonathan Santos
2025-08-13  8:27   ` Krzysztof Kozlowski
2025-08-13 22:39     ` Jonathan Santos
2025-08-14  6:03       ` Krzysztof Kozlowski
2025-08-16 13:12         ` Jonathan Cameron
2025-08-18 21:04           ` Jonathan Santos
2025-08-19  6:39             ` Krzysztof Kozlowski
2025-08-19 18:01               ` Marcelo Schmitt
2025-08-13  2:48 ` [PATCH 2/4] iio: adc: ad7768-1: introduce chip info for future multidevice support Jonathan Santos
2025-08-13 10:37   ` Andy Shevchenko
2025-08-16 13:16   ` Jonathan Cameron
2025-08-13  2:49 ` [PATCH 3/4] iio: adc: ad7768-1: use devm_regulator_get_enable_read_voltage Jonathan Santos
2025-08-13 10:39   ` Andy Shevchenko
2025-08-13 14:50   ` David Lechner [this message]
2025-08-14  6:43   ` Nuno Sá
2025-08-19 18:06   ` Marcelo Schmitt
2025-08-13  2:49 ` [PATCH 4/4] iio: adc: ad7768-1: add support for ADAQ776x-1 ADC Family Jonathan Santos
2025-08-13 12:16   ` Andy Shevchenko
2025-08-13 23:21   ` kernel test robot
2025-08-14  6:55   ` Nuno Sá
2025-08-18 21:53     ` Jonathan Santos
2025-08-19 19:14   ` Marcelo Schmitt
2025-08-19 20:09     ` Andy Shevchenko
2025-08-14  6:42 ` [PATCH 0/4] Add " Nuno Sá

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc817ac9-105f-40c5-806d-93db95955628@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Jonathan.Santos@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=jonath4nns@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®