From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Julien Stephan" <jstephan@baylibre.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Conor Dooley <conor.dooley@microchip.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 4/5] iio: adc: ad7380: fix supplies for ad7380-4
Date: Mon, 21 Oct 2024 13:22:19 +0200 [thread overview]
Message-ID: <037d7ebb4d037edb32f9d717e456ab545621ea94.camel@gmail.com> (raw)
In-Reply-To: <20241021-ad7380-fix-supplies-v2-4-2ca551b3352a@baylibre.com>
On Mon, 2024-10-21 at 12:00 +0200, Julien Stephan wrote:
> ad7380-4 is the only device in the family that does not have an internal
> reference. It uses "refin" as a required external reference.
> All other devices in the family use "refio"" as an optional external
> reference.
>
> Fixes: 737413da8704 ("iio: adc: ad7380: add support for ad738x-4 4 channels
> variants")
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
Hi Julien,
Patch looks good. Sorry if this already came out in the previous version or in
the other patchset you mention but shouldn't this fix come first in the series?
Anyways, for the patch itself:
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
> drivers/iio/adc/ad7380.c | 36 ++++++++++++++++++++++++++----------
> 1 file changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> e257f78d63edd7910fcb936ec5344922f8e70b99..65096717f0dd3ea6a4ff7020bc544d62b84c
> b8fd 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -89,6 +89,7 @@ struct ad7380_chip_info {
> bool has_mux;
> const char * const *supplies;
> unsigned int num_supplies;
> + bool external_ref_only;
> const char * const *vcm_supplies;
> unsigned int num_vcm_supplies;
> const unsigned long *available_scan_masks;
> @@ -431,6 +432,7 @@ static const struct ad7380_chip_info ad7380_4_chip_info =
> {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .external_ref_only = true,
> .available_scan_masks = ad7380_4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> };
> @@ -1047,17 +1049,31 @@ static int ad7380_probe(struct spi_device *spi)
> "Failed to enable power supplies\n");
> msleep(T_POWERUP_MS);
>
> - /*
> - * If there is no REFIO supply, then it means that we are using
> - * the internal 2.5V reference, otherwise REFIO is reference voltage.
> - */
> - ret = devm_regulator_get_enable_read_voltage(&spi->dev, "refio");
> - if (ret < 0 && ret != -ENODEV)
> - return dev_err_probe(&spi->dev, ret,
> - "Failed to get refio regulator\n");
> + if (st->chip_info->external_ref_only) {
> + ret = devm_regulator_get_enable_read_voltage(&spi->dev,
> + "refin");
> + if (ret < 0)
> + return dev_err_probe(&spi->dev, ret,
> + "Failed to get refin
> regulator\n");
> +
> + st->vref_mv = ret / 1000;
>
> - external_ref_en = ret != -ENODEV;
> - st->vref_mv = external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV;
> + /* these chips don't have a register bit for this */
> + external_ref_en = false;
> + } else {
> + /*
> + * If there is no REFIO supply, then it means that we are
> using
> + * the internal reference, otherwise REFIO is reference
> voltage.
> + */
> + ret = devm_regulator_get_enable_read_voltage(&spi->dev,
> + "refio");
> + if (ret < 0 && ret != -ENODEV)
> + return dev_err_probe(&spi->dev, ret,
> + "Failed to get refio
> regulator\n");
> +
> + external_ref_en = ret != -ENODEV;
> + st->vref_mv = external_ref_en ? ret / 1000 :
> AD7380_INTERNAL_REF_MV;
> + }
>
> if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))
> return dev_err_probe(&spi->dev, -EINVAL,
>
next prev parent reply other threads:[~2024-10-21 11:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 10:00 [PATCH v2 0/5] iio: adc: ad7380: fix several supplies issues Julien Stephan
2024-10-21 10:00 ` [PATCH v2 1/5] dt-bindings: iio: adc: ad7380: fix ad7380-4 reference supply Julien Stephan
2024-10-21 12:07 ` Conor Dooley
2024-10-21 10:00 ` [PATCH v2 2/5] iio: adc: ad7380: use devm_regulator_get_enable_read_voltage() Julien Stephan
2024-10-21 11:09 ` Nuno Sá
2024-10-21 10:00 ` [PATCH v2 3/5] iio: adc: ad7380: add missing supplies Julien Stephan
2024-10-21 11:15 ` Nuno Sá
2024-10-21 10:00 ` [PATCH v2 4/5] iio: adc: ad7380: fix supplies for ad7380-4 Julien Stephan
2024-10-21 11:22 ` Nuno Sá [this message]
2024-10-21 12:50 ` Julien Stephan
2024-10-21 10:00 ` [PATCH v2 5/5] docs: iio: ad7380: fix supply " Julien Stephan
2024-10-21 20:49 ` [PATCH v2 0/5] iio: adc: ad7380: fix several supplies issues David Lechner
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=037d7ebb4d037edb32f9d717e456ab545621ea94.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=conor.dooley@microchip.com \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jstephan@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-doc@vger.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