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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 338ECC33C9E for ; Tue, 14 Jan 2020 19:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0ABDC24656 for ; Tue, 14 Jan 2020 19:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579029627; bh=51mPKvKOvFBPcyebnpeFfrpdOAPyvnnFW5SZb3BDz5A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=ls+OadTt9YfZnqtNekBr4jaWLkJ/LGdY8+weTzXCGo+8juSQtmwmTGsc2tR94Y3jm e+QZSym8u+zxzt6WOaLSeTwfvLnlmiO46K8CMXhkBM0tqBNuJOlwV1aSbuGGV92+qj shywEkl2Z7bm/T2kKXXQ+22IIMmQoFEQQ7dcJsjU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728739AbgANTU0 (ORCPT ); Tue, 14 Jan 2020 14:20:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:44612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgANTUZ (ORCPT ); Tue, 14 Jan 2020 14:20:25 -0500 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09D9B24679; Tue, 14 Jan 2020 19:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579029624; bh=51mPKvKOvFBPcyebnpeFfrpdOAPyvnnFW5SZb3BDz5A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=0AzsTqV+6NRVdOwYlop8UGvirDY6l6CFWTp76WjFI/3G25rUyinXv5ASQPgWsOVJB GomQpKA16rlD6ylSIvLNc5VHnSKssm/NbO/8Yw2Fo/Z0klQ0VVy4HF3/DXH09v5NM9 gg5eboqH985MWFANNYfhEI/QvEHQa1j0DAYBFmCs= Received: by mail-qt1-f179.google.com with SMTP id t3so13466245qtr.11; Tue, 14 Jan 2020 11:20:24 -0800 (PST) X-Gm-Message-State: APjAAAXkfrlErTvvVstfO50qZEx6h/QYWNWp9B5OdmkKFSGrfC3j9/5b VfChq1K3HRDu91ucGLDbwITNQVX6iHQ5mtA3BA== X-Google-Smtp-Source: APXvYqxtoC7YzVsJSq0poDkCvJI/CcjPKwVkad6yKqrUxD2hA8j7iTo4qnjLsj9KT03fSLGDVtvDkqcYswDEUHsVCD0= X-Received: by 2002:ac8:6747:: with SMTP id n7mr128832qtp.224.1579029623073; Tue, 14 Jan 2020 11:20:23 -0800 (PST) MIME-Version: 1.0 References: <1575649028-10909-1-git-send-email-fabrice.gasnier@st.com> <20191217234345.GA7738@bogus> In-Reply-To: From: Rob Herring Date: Tue, 14 Jan 2020 13:20:10 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] dt-bindings: iio: adc: stm32-adc: convert bindings to json-schema To: Fabrice Gasnier Cc: Jonathan Cameron , Alexandre Torgue , Mark Rutland , Maxime Coquelin , Lars-Peter Clausen , Hartmut Knaack , Peter Meerwald , olivier moysan , "open list:IIO SUBSYSTEM AND DRIVERS" , devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Tue, Jan 14, 2020 at 10:02 AM Fabrice Gasnier wrote: > > On 12/18/19 12:43 AM, Rob Herring wrote: > > On Fri, Dec 06, 2019 at 05:17:08PM +0100, Fabrice Gasnier wrote: > >> Convert the STM32 ADC binding to DT schema format using json-schema > >> > >> Signed-off-by: Fabrice Gasnier > >> --- > >> Note: this applies on top of IIO tree currently (iio-for-5.5c). > >> > >> Changes in V2: > >> - Take almost all of Rob suggestions (removed reg generic description, > >> added minItems, maxItems, st,max-clk-rate-hz range, drop some pipes, > >> simplify clock-names, remove unneeded allOfs) > >> - For now, keep all in one file despite there are lots of if/thens in the > >> bindings > >> --- > >> .../devicetree/bindings/iio/adc/st,stm32-adc.txt | 149 ------- > >> .../devicetree/bindings/iio/adc/st,stm32-adc.yaml | 454 +++++++++++++++++++++ > >> 2 files changed, 454 insertions(+), 149 deletions(-) > >> delete mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt > >> create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml > > > > > > > [snip] > > >> + > >> + st,adc-channels: > >> + description: | > >> + List of single-ended channels muxed for this ADC. It can have up to: > >> + - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4 > >> + - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and > >> + stm32mp1. > >> + allOf: > >> + - $ref: /schemas/types.yaml#/definitions/uint32-array > >> + > > [snip] > > >> + > >> + allOf: > >> + - if: > >> + properties: > >> + compatible: > >> + contains: > >> + const: st,stm32f4-adc > >> + > >> + then: > >> + properties: > >> + reg: > >> + enum: > >> + - 0x0 > >> + - 0x100 > >> + - 0x200 > >> + > >> + interrupts: > >> + minimum: 0 > >> + maximum: 2 > >> + > >> + assigned-resolution-bits: > >> + enum: [6, 8, 10, 12] > >> + default: 12 > >> + > >> + st,adc-channels: > >> + minItems: 1 > >> + maxItems: 16 > >> + minimum: 0 > >> + maximum: 15 > > > > You are mixing array and scalar constraints here. You need: > > > > minItems: 1 > > maxItems:16 > > items: > > minimum: 0 > > maximum: 15 > > > > Update dtschema. It will now catch this. There's a few others too. > > Hi Rob, > > Sorry for the late reply. I updated dtschema. Now it catches it. > > I've tried your suggestion, but when I test it, I don't get any error on > maxItems. > > In the example: "st,adc-channels = <0>, <1>, ... more than 16 items;" > > Is it possible I face some other issue with dtschema ? The problem is how "<0>, <1>" vs. "<0 1>" gets encoded. While those are the same in the dtb, in yaml we have "[[0], [1]]" vs. "[[0, 1]]". Making the brackets significant is helpful for some things like phandle+args and 'reg' where we have a matrix of values, but for arrays it just gets in the way. I think as I suggested is the right form for the binding schema, and we need to either decide what's the correct way for brackets or improve the tool to accept both ways. Rob