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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03CEBC3DA4A for ; Tue, 20 Aug 2024 16:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SUbIbaWrwk1bX8bsLFQ0eE6r5p3USsnQBy630A6CnNk=; b=kHvnqgZzEM4GURDKyvdufLJPOm aMN0z98f3YQ+ULf/rjtTZHDQveBxPbgfpGjgf/OOlCzS7j9nfGKhVymxh8EzYybIwPzV0THKr09bo vOrCdZO68XuG3efIvnv08oFmYJhVbElw2qSxodkLzOaSBSeVyYLw8IiMUZ+ERmmxqB2eyv3whdX8C 6bDhlk6YIT48sM4rPER5mzSzV/ZEuYzpdqxFIPNm9R1Zr8B28g6Z2NwDLjtXrbalFfevqAB6Sufl9 vzImiDZevHMgXigqbi3WAcYEeFj+ugDxTrtVS83tbWca9NS7ezpCazFHt4H9mp9pCOQZffLtS5PLE /PeiaCug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgRsa-000000062Kd-2pvI; Tue, 20 Aug 2024 16:38:45 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgRsX-000000062Ji-320g for linux-riscv@lists.infradead.org; Tue, 20 Aug 2024 16:38:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0C656CE068C; Tue, 20 Aug 2024 16:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EECDAC4AF0B; Tue, 20 Aug 2024 16:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724171919; bh=eTAFu5MDjrr3QkWwNJyutsTNYLYlsNqI67cfpl+Qv9s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VAXys7rutrHrlW4Zyuz6HS3stTrofPuyIPs6AAcMEegfz062bJvYWe072vA5KIuy5 R6VTDQaBlgVQpxTo/ofP99jNXx+3sr0g/0XGJG6q0mQWWYiooJ8ld2/mKVvwMEV0lP 9Ylvt2UShnORRzCpuG/LQgyuGgh2uT1Z+q+RrfLPdToXo9yzvZ/yWCQx2tn1b8bbz5 Wdt9Usx8eUEZqDk8WLsKaD3yIXFVBwd3oNsLtQulh6h8ga1OfuV0WD1chxa8V02vTt sm9ssfAiSBGjdTH+KgEE4e/mTy4Ocr/WJ/c51i/7b/Or1Yx8+Nyr3LjLS3cvLw2jMH gZ6YH/xorjDIg== Date: Tue, 20 Aug 2024 17:38:33 +0100 From: Conor Dooley To: Thomas Bonnefille Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Petazzoni , =?iso-8859-1?Q?Miqu=E8l?= Raynal , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo CV18XX SARADC binding Message-ID: <20240820-borough-latch-17d785301aef@spud> References: <20240812-sg2002-adc-v4-0-599bdb67592f@bootlin.com> <20240812-sg2002-adc-v4-1-599bdb67592f@bootlin.com> <20240812-unwary-mongrel-9f6758bf624c@spud> <89aabfbe-79bf-4da7-be44-b6cbd92b72a9@bootlin.com> MIME-Version: 1.0 In-Reply-To: <89aabfbe-79bf-4da7-be44-b6cbd92b72a9@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_093842_139329_C6D4F631 X-CRM114-Status: GOOD ( 37.87 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2816700510320892911==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org --===============2816700510320892911== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6ptQ2bA1w/WPJsRN" Content-Disposition: inline --6ptQ2bA1w/WPJsRN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 20, 2024 at 06:21:07PM +0200, Thomas Bonnefille wrote: > Hello Conor, >=20 > On 8/12/24 5:53 PM, Conor Dooley wrote: > > On Mon, Aug 12, 2024 at 05:00:55PM +0200, Thomas Bonnefille wrote: > > > The Sophgo SARADC is a Successive Approximation ADC that can be found= in > > > the Sophgo SoC. > > >=20 > > > Signed-off-by: Thomas Bonnefille > > > --- > > > .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml | 85 +++++++++++= +++++++++++ > > > 1 file changed, 85 insertions(+) > > >=20 > > > diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-= saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-sarad= c.yaml > > > new file mode 100644 > > > index 000000000000..846590808e5f > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.= yaml > > > @@ -0,0 +1,85 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-saradc.yaml# > >=20 > > Filename matching the compatible please. > >=20 > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: > > > + Sophgo CV18XX SoC series 3 channels Successive Approximation Analo= g to > > > + Digital Converters > > > + > > > +maintainers: > > > + - Thomas Bonnefille > > > + > > > +description: > > > + Datasheet at https://github.com/sophgo/sophgo-doc/releases > > > + > > > +properties: > > > + compatible: > > > + const: sophgo,cv1800b-saradc > > > + > > > + reg: > > > + maxItems: 1 > > > + > > > + interrupts: > > > + maxItems: 1 > > > + > > > + clocks: > > > + maxItems: 1 > > > + > > > + '#address-cells': > > > + const: 1 > > > + > > > + '#size-cells': > > > + const: 0 > > > + > > > +patternProperties: > > > + "^channel@[0-3]+$": > > > + $ref: adc.yaml > > > + > > > + description: | > >=20 > > This | is not required. > >=20 > > > + Represents the channels of the ADC. > > > + > > > + properties: > > > + reg: > > > + description: | > > > + The channel number. It can have up to 3 channels numbered = =66rom 0 to 2. > > > + items: > > > + - minimum: 0 > > > + maximum: 2 > >=20 > > Is this sufficient to limit the number of channels to 3? Aren't you rel= ying > > on the unique unit addresses warning in dtc to limit it, rather than > > actually limiting with min/maxItems? > >=20 > It seems like I can't use min/maxItems on this property. I think that it = is > using size-cells + address-cells to deduce that the number of items should > be equal to 1. I think I was mistaken in talking about mix/max items here. I had the right idea, but mentioned an incorrect solution - sorry about that. I wasn't talking about the number of elements in the reg property, what I meant was limiting the number of channel nodes in the first place - something which min/maxItems cannot do. As examples of the problem I was thinking of, see the below two examples: adc@30f0000 { compatible =3D "sophgo,cv1800b-saradc"; reg =3D <0x030f0000 0x1000>; clocks =3D <&clk CLK_SARADC>; interrupts =3D <100 IRQ_TYPE_LEVEL_HIGH>; #address-cells =3D <1>; #size-cells =3D <0>; channel@0 { reg =3D <0>; }; channel@2 { reg =3D <2>; }; channel@22 { reg =3D <2>; }; }; adc@30f0000 { compatible =3D "sophgo,cv1800b-saradc"; reg =3D <0x030f0000 0x1000>; clocks =3D <&clk CLK_SARADC>; interrupts =3D <100 IRQ_TYPE_LEVEL_HIGH>; #address-cells =3D <1>; #size-cells =3D <0>; channel@0 { reg =3D <0>; }; channel@2 { reg =3D <2>; }; channel@22 { reg =3D <2>; }; }; The solution is simple, remove the + from the regex. Sorry for sending you on the wrong track Thomas. Thanks, Conor. > Looking at the dtschema repository it seems to be the case in reg.yaml wi= th > address-cells/size-cells =3D 2/2, 1/1 and 2/1. > If I try to use maxItems here : >=20 > properties: > reg: > maxItems: 1 > items: > - minimum: 0 > maximum: 2 >=20 > I get this strange error message from `make dt_binding_check`: >=20 > DTEX > Documentation/devicetree/bindings/iio/adc/sophgo,cv1800b-saradc.example.d= ts > /home/thomas/linux/Documentation/devicetree/bindings/iio/adc/sophgo,cv180= 0b-saradc.yaml: > patternProperties:^channel@[0-2]+$:properties:reg: {'maxItems': 1, 'items= ': > [{'minimum': 0, 'maximum': 2}]} should not be valid under {'required': > ['maxItems']} > hint: "maxItems" is not needed with an "items" list > from schema $id: http://devicetree.org/meta-schemas/items.yaml# > /home/thomas/linux/Documentation/devicetree/bindings/iio/adc/sophgo,cv180= 0b-saradc.yaml: > patternProperties:^channel@[0-2]+$:properties:reg: 'anyOf' conditional > failed, one must be fixed: > 'items' is not one of ['maxItems', 'description', 'deprecated'] > hint: Only "maxItems" is required for a single entry if there are no > constraints defined for the values. > 'maxItems' is not one of ['description', 'deprecated', 'const', 'enum', > 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] > 'items' is not one of ['description', 'deprecated', 'const', 'enum', > 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] > 1 is less than the minimum of 2 > hint: Arrays must be described with a combination of > minItems/maxItems/items > hint: cell array properties must define how many entries and what the > entries are when there is more than one entry. > from schema $id: http://devicetree.org/meta-schemas/core.yaml# >=20 > Isn't it okay to just use minimum and maximum and rely on > address-cells/size-cells for the number of items allowed ? >=20 --6ptQ2bA1w/WPJsRN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZsTGiQAKCRB4tDGHoIJi 0lmMAQCp1+yBiaWxL3PTB/rJ5FazFWt3PM2XHDc3R2L8MtUWpwD/dkGI2qROY760 7Swgkl94fpctemkgXSdKI98EEnnPEAE= =3s0l -----END PGP SIGNATURE----- --6ptQ2bA1w/WPJsRN-- --===============2816700510320892911== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============2816700510320892911==--