Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5582806ybl; Tue, 14 Jan 2020 11:21:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxyUOx+9CGyF6CBufMxwDe+4MvhwDW9K6qoZERhDeTAF1kh+8yxCXYLWVrf+snTmtejHHMS X-Received: by 2002:aca:36c1:: with SMTP id d184mr18171013oia.70.1579029713246; Tue, 14 Jan 2020 11:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579029713; cv=none; d=google.com; s=arc-20160816; b=RW5BEL7TlfCmnxaFXsV9934a6zisssk8/Ad4jH9l2OiK0kOKmC4lDZBYk88FGFGgvu K78e2Xie6vngdASi3sycgid8k2/UYo+/e+I4xjl/0/hqXu3owd3A8/mUZnZeOWDot8GZ fiyP2kRVNstiJkRExbyYtXJgCn1d0Te1RTiNQ1ZqbDNb4xNDvYnC+vTfkYn02ZA7aoBA 72SSAISIRuNx3WaRasR+M01QK7SFOTh1YGWxmOE2G0+hQ5X08VbxEANIuMsJn1U0FjSP /GZ1j6lrTUnACdeznlM69v7lwm13IhlSFVbiNMmXO5QDZSOY4FT3K6tD6WITvmiCJVRY QxBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nQA3DUNhQkilbfaQyffWmOJVXQG9gkXElEzISmfPXi8=; b=CxFhlKNzeKq95yLbpDIcmzZHWnxd8jwzpS9cY+FSC6iMUpn+MWgsmyRmCbbaGQk3Ua HpKqBahH5kzh0/41ywgaYIMN4egUfiD0yz19OxnGfiInh3qiInk9fzsbjXxoRA3Q9ymv 3KjXCmVtmv1DFfGdt+Y44MgFLhAgJi6/4gSCXmQAyItGyVZSo14MSCQ1xwFN/oFJpflH LYLVl4zSeWyhpvRECAFCdXC6YyP09iG/4WrZTS/OpvGw2zhx6C/EABuRo9s4l7xTmq9D jjBDwNZt55SE4hYhdW4bngvylHUrZmkZlh6dz/eGYo6eCdJr0sQFmdcUcuR9GUWmKnUP w1Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0AzsTqV+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190si8399595oib.113.2020.01.14.11.21.41; Tue, 14 Jan 2020 11:21:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0AzsTqV+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728774AbgANTU3 (ORCPT + 99 others); Tue, 14 Jan 2020 14:20:29 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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