Re: [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> On Tue, Nov 15, 2022 at 10:07 AM Jonathan Cameron
> <Jonathan.Cameron@xxxxxxxxxx> wrote:
> >
> > On Tue, 15 Nov 2022 14:43:53 +0200
> > Cosmin Tanislav <demonsingur@xxxxxxxxx> 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux