From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6048CC4332F for ; Tue, 15 Nov 2022 16:07:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiKOQHn convert rfc822-to-8bit (ORCPT ); Tue, 15 Nov 2022 11:07:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbiKOQHj (ORCPT ); Tue, 15 Nov 2022 11:07:39 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 967232609; Tue, 15 Nov 2022 08:07:37 -0800 (PST) Received: from fraeml708-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NBWGk5v1Jz6H76x; Wed, 16 Nov 2022 00:05:02 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml708-chm.china.huawei.com (10.206.15.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 17:07:26 +0100 Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 16:07:25 +0000 Date: Tue, 15 Nov 2022 16:07:24 +0000 From: Jonathan Cameron To: Cosmin Tanislav CC: Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Cosmin Tanislav , Lars-Peter Clausen , "Michael Hennerich" , Linus Walleij , William Breathitt Gray , , , Subject: Re: [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115 Message-ID: <20221115160724.00007460@Huawei.com> In-Reply-To: References: <20221103094436.2136698-1-demonsingur@gmail.com> <20221103094436.2136698-2-demonsingur@gmail.com> <20221106154634.2286faf3@jic23-huawei> <20221112154040.54dc5cf2@jic23-huawei> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Nov 2022 14:43:53 +0200 Cosmin Tanislav 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 > > > > > + >