From: "Nuno Sá" <noname.nuno@gmail.com>
To: 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>,
linux-iio@vger.kernel.org
Cc: "Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Jonathan Corbet" <corbet@lwn.net>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info
Date: Thu, 03 Apr 2025 19:56:08 +0100 [thread overview]
Message-ID: <db78eee7049abc62a1a230ff87d04332de8afd66.camel@gmail.com> (raw)
In-Reply-To: <20250401-iio-ad7380-add-ad7389-4-v1-3-23d2568aa24f@baylibre.com>
On Tue, 2025-04-01 at 17:50 -0500, David Lechner wrote:
> Move the internal reference voltage value to the chip_info structure.
>
> Before this change, only ADAQ chips could be internal_ref_only and only
> non-ADAQ chips could be external_ref_only. Now, this restriction is
> removed.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/iio/adc/ad7380.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> 18ed07275be8e031e54f3595f70afe47514084cd..e5cd11fd7b1083af2082985f2c0226b1a97d600f
> 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -120,6 +120,7 @@ struct ad7380_chip_info {
> unsigned int num_supplies;
> bool external_ref_only;
> bool internal_ref_only;
> + unsigned int internal_ref_mv;
> const char * const *vcm_supplies;
> unsigned int num_vcm_supplies;
> const unsigned long *available_scan_masks;
> @@ -609,6 +610,7 @@ static const struct ad7380_chip_info ad7380_chip_info = {
> .num_simult_channels = 2,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .available_scan_masks = ad7380_2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> .max_conversion_rate_hz = 4 * MEGA,
> @@ -622,6 +624,7 @@ static const struct ad7380_chip_info ad7381_chip_info = {
> .num_simult_channels = 2,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .available_scan_masks = ad7380_2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> .max_conversion_rate_hz = 4 * MEGA,
> @@ -637,6 +640,7 @@ static const struct ad7380_chip_info ad7383_chip_info = {
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> .vcm_supplies = ad7380_2_channel_vcm_supplies,
> .num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .available_scan_masks = ad7380_2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> .max_conversion_rate_hz = 4 * MEGA,
> @@ -652,6 +656,7 @@ static const struct ad7380_chip_info ad7384_chip_info = {
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> .vcm_supplies = ad7380_2_channel_vcm_supplies,
> .num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .available_scan_masks = ad7380_2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> .max_conversion_rate_hz = 4 * MEGA,
> @@ -665,6 +670,7 @@ static const struct ad7380_chip_info ad7386_chip_info = {
> .num_simult_channels = 2,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> @@ -679,6 +685,7 @@ static const struct ad7380_chip_info ad7387_chip_info = {
> .num_simult_channels = 2,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> @@ -693,6 +700,7 @@ static const struct ad7380_chip_info ad7388_chip_info = {
> .num_simult_channels = 2,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x2_channel_scan_masks,
> .timing_specs = &ad7380_timing,
> @@ -721,6 +729,7 @@ static const struct ad7380_chip_info ad7381_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .available_scan_masks = ad7380_4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> .max_conversion_rate_hz = 4 * MEGA,
> @@ -734,6 +743,7 @@ static const struct ad7380_chip_info ad7383_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .vcm_supplies = ad7380_4_channel_vcm_supplies,
> .num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
> .available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -749,6 +759,7 @@ static const struct ad7380_chip_info ad7384_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .vcm_supplies = ad7380_4_channel_vcm_supplies,
> .num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
> .available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -764,6 +775,7 @@ static const struct ad7380_chip_info ad7386_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -778,6 +790,7 @@ static const struct ad7380_chip_info ad7387_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -792,6 +805,7 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
> .num_simult_channels = 4,
> .supplies = ad7380_supplies,
> .num_supplies = ARRAY_SIZE(ad7380_supplies),
> + .internal_ref_mv = AD7380_INTERNAL_REF_MV,
> .has_mux = true,
> .available_scan_masks = ad7380_2x4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -807,6 +821,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
> .supplies = adaq4380_supplies,
> .num_supplies = ARRAY_SIZE(adaq4380_supplies),
> .internal_ref_only = true,
> + .internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
> .has_hardware_gain = true,
> .available_scan_masks = ad7380_4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -822,6 +837,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
> .supplies = adaq4380_supplies,
> .num_supplies = ARRAY_SIZE(adaq4380_supplies),
> .internal_ref_only = true,
> + .internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
> .has_hardware_gain = true,
> .available_scan_masks = ad7380_4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -837,6 +853,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
> .supplies = adaq4380_supplies,
> .num_supplies = ARRAY_SIZE(adaq4380_supplies),
> .internal_ref_only = true,
> + .internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
> .has_hardware_gain = true,
> .available_scan_masks = ad7380_4_channel_scan_masks,
> .timing_specs = &ad7380_4_timing,
> @@ -1855,7 +1872,7 @@ static int ad7380_probe(struct spi_device *spi)
> * in bulk_get_enable().
> */
>
> - st->vref_mv = ADAQ4380_INTERNAL_REF_MV;
> + st->vref_mv = st->chip_info->internal_ref_mv;
>
> /* these chips don't have a register bit for this */
> external_ref_en = false;
> @@ -1880,7 +1897,8 @@ static int ad7380_probe(struct spi_device *spi)
> "Failed to get refio regulator\n");
>
> external_ref_en = ret != -ENODEV;
> - st->vref_mv = external_ref_en ? ret / 1000 :
> AD7380_INTERNAL_REF_MV;
> + st->vref_mv = external_ref_en ? ret / 1000
> + : st->chip_info->internal_ref_mv;
> }
>
> if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))
>
next prev parent reply other threads:[~2025-04-03 19:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
2025-04-02 8:25 ` Krzysztof Kozlowski
2025-04-02 14:39 ` David Lechner
2025-04-07 6:41 ` Krzysztof Kozlowski
2025-04-07 6:42 ` Krzysztof Kozlowski
2025-04-01 22:50 ` [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only David Lechner
2025-04-03 18:53 ` Nuno Sá
2025-04-01 22:50 ` [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info David Lechner
2025-04-03 18:56 ` Nuno Sá [this message]
2025-04-01 22:50 ` [PATCH 4/5] iio: adc: ad7380: add ad7389-4 David Lechner
2025-04-03 18:57 ` Nuno Sá
2025-04-01 22:50 ` [PATCH 5/5] Documentation: iio: ad7380: add AD7389-4 David Lechner
2025-04-07 18:46 ` [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support Jonathan Cameron
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=db78eee7049abc62a1a230ff87d04332de8afd66.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).