devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: Conor Dooley <conor@kernel.org>,
	Marcelo Schmitt <marcelo.schmitt@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	lars@metafoo.de, Michael.Hennerich@analog.com,
	nuno.sa@analog.com, andy@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linus.walleij@linaro.org, brgl@bgdev.pl,
	marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v5 01/11] dt-bindings: iio: adc: Add AD4170
Date: Sat, 21 Jun 2025 17:28:08 +0100	[thread overview]
Message-ID: <20250621172808.6f304023@jic23-huawei> (raw)
In-Reply-To: <eeb66815-3f7d-41fc-9d32-c28a3dda7749@baylibre.com>


> >> +
> >> +$defs:
> >> +  reference-buffer:
> >> +    description: |
> >> +      Enable precharge buffer, full buffer, or skip reference buffering of
> >> +      the positive/negative voltage reference. Because the output impedance
> >> +      of the source driving the voltage reference inputs may be dynamic,
> >> +      resistive/capacitive combinations of those inputs can cause DC gain
> >> +      errors if the reference inputs go unbuffered into the ADC. Enable
> >> +      reference buffering if the provided reference source has dynamic high
> >> +      impedance output. Note the absolute voltage allowed on REFINn+ and REFINn-
> >> +      inputs is from AVSS - 50 mV to AVDD + 50 mV when the reference buffers are
> >> +      disabled but narrows to AVSS to AVDD when reference buffering is enabled
> >> +      or in precharge mode. The valid options for this property are:
> >> +      0: Reference precharge buffer.
> >> +      1: Full reference buffering.
> >> +      2: Bypass reference buffers (buffering disabled).
> >> +    $ref: /schemas/types.yaml#/definitions/uint32
> >> +    enum: [0, 1, 2]
> >> +    default: 1  
> > 
> > Why make this property a uint32, rather than a string where you can use
> > something like "precharge", "full" and "bypass" (or "disabled")? The
> > next similar device could use something slightly different then the
> > binding becomes pretty clunky.
> > Can you explain why this is a dt property rather than something
> > adjustable at runtime?
> > 
> > Otherwise, what you have here looks sane enough to me - but I'd like to
> > see some comments from Jonathan or David etc about your approach to the
> > excitation properties.  
> 
> This looks like something that should be in the devicetree to me. For example
> if the external reference supply is high impedance, buffering is pretty
> much required. And using precharge is an application design choice to
> reduce THD at the expense of other limitations.
> 

Agreed that this pretty much only makes sense in DT.

In the ideal world we would have firm rules on when to enable buffering
etc and then the DT would describe the impedance of the circuit connected
and any other relevant properties and then we'd have the driver enable it
only when those rigid rules dictated that we should.

Sadly no such simple rules exist (as far as I know) so we just expose the thing
that gets set dependent on someone's judgement of the suitability of
the buffering choice given the circuit being connected to the input.

If we pushed it to userspace we'd just end up with a per device blob
that dictated the mode to pick on boot and left it like that.  So effectively
another bit of firmware :(


J

<cropping other comments>

  reply	other threads:[~2025-06-21 16:28 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 20:30 [PATCH v5 00/11] iio: adc: Add support for AD4170 series of ADCs Marcelo Schmitt
2025-06-10 20:31 ` [PATCH v5 01/11] dt-bindings: iio: adc: Add AD4170 Marcelo Schmitt
2025-06-16 15:41   ` Conor Dooley
2025-06-16 17:58     ` Marcelo Schmitt
2025-06-16 20:41     ` David Lechner
2025-06-21 16:28       ` Jonathan Cameron [this message]
2025-06-23 16:03         ` Conor Dooley
2025-06-21 16:37     ` Jonathan Cameron
2025-06-10 20:31 ` [PATCH v5 02/11] iio: adc: Add basic support for AD4170 Marcelo Schmitt
2025-06-10 21:10   ` Andy Shevchenko
2025-06-11 21:04     ` Marcelo Schmitt
2025-06-12 12:48       ` Andy Shevchenko
2025-06-12 14:03         ` Marcelo Schmitt
2025-06-12 18:48           ` Andy Shevchenko
2025-06-14 10:51             ` Jonathan Cameron
2025-06-14 10:52         ` Jonathan Cameron
2025-06-16 20:41   ` David Lechner
2025-06-17 18:54     ` Marcelo Schmitt
2025-06-18 17:37   ` Dan Carpenter
2025-06-18 17:59     ` Andy Shevchenko
2025-06-10 20:31 ` [PATCH v5 03/11] iio: adc: ad4170: Add support for calibration gain Marcelo Schmitt
2025-06-10 20:32 ` [PATCH v5 04/11] iio: adc: ad4170: Add support for calibration bias Marcelo Schmitt
2025-06-10 20:32 ` [PATCH v5 05/11] iio: adc: ad4170: Add digital filter and sample frequency config support Marcelo Schmitt
2025-06-16 20:53   ` David Lechner
2025-06-10 20:32 ` [PATCH v5 06/11] iio: adc: ad4170: Add support for buffered data capture Marcelo Schmitt
2025-06-10 21:17   ` Andy Shevchenko
2025-06-10 20:33 ` [PATCH v5 07/11] iio: adc: ad4170: Add clock provider support Marcelo Schmitt
2025-06-16 21:11   ` David Lechner
2025-06-17  6:24     ` Andy Shevchenko
2025-06-10 20:33 ` [PATCH v5 08/11] iio: adc: ad4170: Add GPIO controller support Marcelo Schmitt
2025-06-18 10:15   ` Linus Walleij
2025-06-10 20:33 ` [PATCH v5 09/11] iio: adc: ad4170: Add support for internal temperature sensor Marcelo Schmitt
2025-06-10 20:33 ` [PATCH v5 10/11] iio: adc: ad4170: Add support for weigh scale and RTD sensors Marcelo Schmitt
2025-06-10 20:34 ` [PATCH v5 11/11] iio: adc: ad4170: Add timestamp channel Marcelo Schmitt
2025-06-14 11:04 ` [PATCH v5 00/11] iio: adc: Add support for AD4170 series of ADCs 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=20250621172808.6f304023@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --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).