All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: Cosmin Tanislav <demonsingur@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Cosmin Tanislav <cosmin.tanislav@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	William Breathitt Gray <william.gray@linaro.org>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115
Date: Wed, 16 Nov 2022 10:17:51 +0000	[thread overview]
Message-ID: <20221116101751.000059ea@Huawei.com> (raw)
In-Reply-To: <CAL_JsqLt6B73XSE8dMHMGuw1N9m1v1xwr3sOEEHonGgLAYya=A@mail.gmail.com>

On Tue, 15 Nov 2022 12:16:41 -0600
Rob Herring <robh+dt@kernel.org> wrote:

> On Tue, Nov 15, 2022 at 10:07 AM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > On Tue, 15 Nov 2022 14:43:53 +0200
> > Cosmin Tanislav <demonsingur@gmail.com> wrote:
> >  
> > > On Sat, 2022-11-12 at 15:40 +0000, Jonathan Cameron wrote:  
> > > > > >  
> > > > > > > +    $ref: /schemas/types.yaml#/definitions/uint32
> > > > > > > +    description: |
> > > > > > > +      Conversion range for ADC conversion 2.
> > > > > > > +      0 - 0V to 12V
> > > > > > > +      1 - -12V to +12V
> > > > > > > +      2 - -2.5V to +2.5V
> > > > > > > +      3 - -2.5V to 0V
> > > > > > > +      4 - 0V to 2.5V
> > > > > > > +      5 - 0V to 0.625V
> > > > > > > +      6 - -104mV to +104mV
> > > > > > > +      7 - 0V to 12V  
> > > > > >
> > > > > > For a lot of similar cases we handle these numerically to give
> > > > > > a human readable dts.  Is there a strong reason not to do so here (in mv)
> > > > > >  
> > > > >
> > > > > I used this approach mostly because it maps dirrectly to register values
> > > > > and because it's easier to parse. dts isn't exactly nice at handling
> > > > > negative values. I can switch it to mv array if you insist.  
> > > >
> > > > We have quite a few existing cases of
> > > > adi,[output-]range-microvolt so it would be good to copy that style here.
> > > >  
> > >
> > > With this:
> > >
> > >   adi,conv2-range-microvolt:
> > >     description: Conversion range for ADC conversion 2.
> > >     oneOf:
> > >       - items:
> > >           - enum: [-2500000, 0]
> > >           - const: 2500000
> > >       - items:
> > >           - enum: [-12000000, 0]
> > >           - const: 12000000
> > >       - items:
> > >           - const: -2500000
> > >           - const: 0
> > >       - items:
> > >           - const: -104000
> > >           - const: 104000
> > >       - items:
> > >           - const: 0
> > >           - const: 625000
> > >
> > > And this:
> > >
> > > adi,conv2-range-microvolt = <(-12000000) 12000000>;
> > >
> > > I get this:
> > >
> > > Documentation/devicetree/bindings/iio/addac/adi,ad74115.example.dtb:
> > > addac@0: adi,conv2-range-microvolt: 'oneOf' conditional failed,
> > > one must be fixed:
> > >         4282967296 is not one of [-2500000, 0]
> > >         4282967296 is not one of [-12000000, 0]
> > >         -2500000 was expected
> > >         -104000 was expected
> > >         625000 was expected
> > >         From schema: Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
> > >
> > > As I said, negative numbers don't play too nice...  
> >
> > From what I recall we just ignore those warnings :)
> >
> > Rob, do I remember correctly that there was a plan to make this work longer term?  
> 
> Yes, but handling signed types is working now (since the move to
> validating dtbs directly).
> 
> The issue here is -microvolt is defined as unsigned. IIRC, I had some
> issue changing it, but I think that was just with the YAML encoding
> which I intend to remove. I'll give it another look and update the
> type if there's no issues.

Thanks!

Jonathan

> 
> Rob


  reply	other threads:[~2022-11-16 10:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  9:44 [PATCH v2 0/2] AD74115 Cosmin Tanislav
2022-11-03  9:44 ` [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115 Cosmin Tanislav
2022-11-06 15:46   ` Jonathan Cameron
2022-11-08  8:51     ` Cosmin Tanislav
2022-11-12 15:40       ` Jonathan Cameron
2022-11-15 12:43         ` Cosmin Tanislav
2022-11-15 16:07           ` Jonathan Cameron
2022-11-15 18:16             ` Rob Herring
2022-11-16 10:17               ` Jonathan Cameron [this message]
2022-11-07 16:45   ` Rob Herring
2022-11-03  9:44 ` [PATCH v2 2/2] iio: addac: add AD74115 driver Cosmin Tanislav
2022-11-06 16:27   ` Jonathan Cameron
2022-11-07 15:39   ` kernel test robot

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=20221116101751.000059ea@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=demonsingur@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=william.gray@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.