From: Rob Herring <robh@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: linux-iio@vger.kernel.org,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: iio: adc: add ad7944 ADCs
Date: Thu, 15 Feb 2024 07:23:34 -0600 [thread overview]
Message-ID: <20240215132334.GA3847183-robh@kernel.org> (raw)
In-Reply-To: <CAMknhBGG_RS1t0OJw6_UnNQ_=S4YgN4i1YN26V8n=f9y28J9hQ@mail.gmail.com>
On Tue, Feb 06, 2024 at 11:34:13AM -0600, David Lechner wrote:
> On Tue, Feb 6, 2024 at 11:26 AM David Lechner <dlechner@baylibre.com> wrote:
> >
> > This adds a new binding for the Analog Devices, Inc. AD7944, AD7985, and
> > AD7986 ADCs.
> >
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---
> > .../devicetree/bindings/iio/adc/adi,ad7944.yaml | 231 +++++++++++++++++++++
> > MAINTAINERS | 8 +
> > 2 files changed, 239 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7944.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7944.yaml
> > new file mode 100644
> > index 000000000000..a023adbeba42
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7944.yaml
>
> ...
>
>
> + adi,reference:
> + $ref: /schemas/types.yaml#/definitions/string
> + enum: [ internal, internal-buffer, external ]
> + default: internal
>
> ...
>
> > +allOf:
> > + # ref-supply is only used for external reference voltage
> > + - if:
> > + not:
> > + required:
> > + - adi,reference
> > + then:
> > + properties:
> > + ref-supply: false
> > + else:
> > + if:
> > + properties:
> > + adi,reference:
> > + const: external
> > + then:
> > + required:
> > + - ref-supply
> > + else:
> > + properties:
> > + ref-supply: false
>
> This seems like something that could potentially be improved in the
> dtschema tooling. Since adi,reference has a default of "internal", I
> would expect:
>
> if:
> properties:
> adi,reference:
> const: external
required:
- adi,reference
> then:
> required:
> - ref-supply
> else:
> properties:
> ref-supply: false
>
> to be sufficient here. However, currently, if the adi,reference
> property is omitted from the dts/dtb, the condition here evaluates to
> true and unexpectedly (incorrectly?) the validator requires the
> ref-supply property.
That's just how json-schema works. With the above, it should work for
you.
However, redesigning the binding would make things simpler. Just make
'ref-supply' being present mean external ref. No 'ref-supply' is then
internal. Then you just need a boolean for 'internal-buffer' mode and:
dependentSchemas:
ref-supply:
not:
required: ['adi,internal-buffer-ref']
Rob
next prev parent reply other threads:[~2024-02-15 13:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 17:25 [PATCH 0/2] iio: adc: ad7944: new driver David Lechner
2024-02-06 17:25 ` [PATCH 1/2] dt-bindings: iio: adc: add ad7944 ADCs David Lechner
2024-02-06 17:34 ` David Lechner
2024-02-07 17:27 ` Conor Dooley
2024-02-15 13:23 ` Rob Herring [this message]
2024-02-15 21:49 ` David Lechner
2024-02-10 17:40 ` Jonathan Cameron
2024-02-11 17:49 ` David Lechner
2024-02-16 14:08 ` Jonathan Cameron
2024-02-06 17:26 ` [PATCH 2/2] iio: adc: ad7944: add driver for AD7944/AD7985/AD7986 David Lechner
2024-02-07 10:10 ` Nuno Sá
2024-02-07 14:19 ` David Lechner
2024-02-08 8:17 ` Nuno Sá
2024-02-10 17:42 ` Jonathan Cameron
2024-02-10 17:47 ` Jonathan Cameron
2024-02-11 17:03 ` David Lechner
2024-02-14 16:13 ` 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=20240215132334.GA3847183-robh@kernel.org \
--to=robh@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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).