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 B57E0C4332F for ; Wed, 16 Nov 2022 10:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbiKPKR5 (ORCPT ); Wed, 16 Nov 2022 05:17:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbiKPKR4 (ORCPT ); Wed, 16 Nov 2022 05:17:56 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC66D120B4; Wed, 16 Nov 2022 02:17:54 -0800 (PST) Received: from frapeml100005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NBzQK2zl8z6H6tk; Wed, 16 Nov 2022 18:13:13 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by frapeml100005.china.huawei.com (7.182.85.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 16 Nov 2022 11:17:52 +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; Wed, 16 Nov 2022 10:17:52 +0000 Date: Wed, 16 Nov 2022 10:17:51 +0000 From: Jonathan Cameron To: Rob Herring CC: Cosmin Tanislav , Jonathan Cameron , 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: <20221116101751.000059ea@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> <20221115160724.00007460@Huawei.com> 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="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, 15 Nov 2022 12:16:41 -0600 Rob Herring wrote: > On Tue, Nov 15, 2022 at 10:07 AM Jonathan Cameron > wrote: > > > > 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? > > 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