Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7316044rwb; Tue, 15 Nov 2022 10:23:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf6H4x1InlVy+LAl0w0zr6VlgyGnEwCaDd3a/igfTe3D/62fHWFJRcR4/ORh8IN8d7lQXMFG X-Received: by 2002:a50:9e8e:0:b0:467:4595:fc5c with SMTP id a14-20020a509e8e000000b004674595fc5cmr15934134edf.114.1668536615518; Tue, 15 Nov 2022 10:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668536615; cv=none; d=google.com; s=arc-20160816; b=j+gLcZ8S5zXbVXZ8LEn2lvl38vAQewa5KEJZd6gbbuMbjGiPGVT8FJRjp3Dljh7ANK uc9vaK/YQK4vnbR++nMVB1F7noZFXieBWZC7uCVWtyZBNezetU5tB+DhLnu7LndT6HZ6 RcwXjC2r6e+ohF+YE6KGy9XlaEwSG2RfGS7FK2nXy17jTmEi+df9A1byP18hn3qmSaqW V3hF694C4Y11+Et1HVvb8SJoBR8+Lqwqbpn3/7anqumLH91wSHJj6vBI1KlSQBpwt/XF Snz0u4lxyXI7lS1AsHYany0GPTm1aHoyGWEKi6TkWqcrnxzgj2NuQregPM7+k49bzfbp 4loQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4Z4TGSqOSAfvwTCTZEjEwLHYKupZFQ6nDVekA0+QkSo=; b=ut6IvRW0DgDP+il3tKcILLgiKOaLX+GJEPo3t0KaAw9SvIAikqEp17nEipv3SLnTfX HOmKX1mEi5l/ak7IEdLLfb1sYltutsMaah52PINfyXNv2hmc2mE2ZM3CLYr+YTHWiz04 jeyzaeojk7tHn7oIF78O8239NxfGjopepZhdlU5L4IRcebMXdXfYQ6OLRSS2Zoqx6W5N WnU0IHjXsvQpUa/2+XzSLVf7Fy4Wn0ycxdA5CIyUdqiRbaD1vLuXQSaAjo4t8x9R/ECD BmkWiEC8DHn54mB/J+ZvaUtik3ztBDMOSMbQ8ErUuzZYeMTSZth99WPisDc8Vrg1Ij/J qLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UvaUm07a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a50d0c5000000b00448d387c327si11125666edf.181.2022.11.15.10.23.11; Tue, 15 Nov 2022 10:23:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UvaUm07a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbiKOSQ6 (ORCPT + 91 others); Tue, 15 Nov 2022 13:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbiKOSQz (ORCPT ); Tue, 15 Nov 2022 13:16:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5812FC15; Tue, 15 Nov 2022 10:16:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1FA91B81A5F; Tue, 15 Nov 2022 18:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4B96C4347C; Tue, 15 Nov 2022 18:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668536211; bh=nzoZVtAKQJIQTeBQutSbLNEtJkG6ZK7nNNBfDg5J8IA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UvaUm07ab0P3VMqxkWKNgDghtJE+sdtZU1KHbWuBHxvVyOJ9sO61YjPzGaKkmKYrq f7JGa153pJJU9JEud0fFO9J4y9NOGg9zeYUr/0B3Vv52YIWEWAb5HN6sAnvqin8B4o iynVRwQvBe0avgQkEsCj379VZM8etj5v6EdNlAjhkazH7zDcGIFGZTkoLBwfkHkaFs p/WDMqPuvPlNZ3PUhqlPZUInDfzeXcF3LDAmHDdv8BdudC0VczKdrbCYT3XAEUs3Op FuHn4kCjcsNAStEAMdonN/qbzJP09QF+zn/icCLJFKyMGC7IeAT+iAJ5Sbw75ZejZs K/8Z1P7Ixxc6Q== Received: by mail-lf1-f54.google.com with SMTP id c1so25721791lfi.7; Tue, 15 Nov 2022 10:16:51 -0800 (PST) X-Gm-Message-State: ANoB5pno0b0n3PePQMgINym4MGj1rooed6kql1dzP4ErKwNEa7B2AZXp 0EHPygDxSmoUWk22ohVqG7gONwdffhvGrPLkoA== X-Received: by 2002:ac2:5cc3:0:b0:4ab:5a19:3455 with SMTP id f3-20020ac25cc3000000b004ab5a193455mr5796390lfq.462.1668536209685; Tue, 15 Nov 2022 10:16:49 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20221115160724.00007460@Huawei.com> From: Rob Herring Date: Tue, 15 Nov 2022 12:16:41 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] dt-bindings: iio: addac: add AD74115 To: Jonathan Cameron Cc: Cosmin Tanislav , Jonathan Cameron , Krzysztof Kozlowski , Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Linus Walleij , William Breathitt Gray , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Rob