[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221115160724.00007460@Huawei.com>
Date: Tue, 15 Nov 2022 16:07:24 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Cosmin Tanislav <demonsingur@...il.com>
CC: Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Cosmin Tanislav <cosmin.tanislav@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
"Michael Hennerich" <Michael.Hennerich@...log.com>,
Linus Walleij <linus.walleij@...aro.org>,
William Breathitt Gray <william.gray@...aro.org>,
<linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115
On Tue, 15 Nov 2022 14:43:53 +0200
Cosmin Tanislav <demonsingur@...il.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?
Jonathan
>
> > >
> > > >
> > > > > + minimum: 0
> > > > > + maximum: 7
> > > > > + default: 0
> > > > > +
>
Powered by blists - more mailing lists