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=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable 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 DAE05C433EF for ; Sat, 11 Sep 2021 15:50:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A4651611B0 for ; Sat, 11 Sep 2021 15:50:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A4651611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lhmL0q4q+qLHgHijpbsrXXhj9h7GCT8fLK4MRcEs+eU=; b=u6SGx3vCsRcTau x/d50XRI4rmedbI3k6zUm4zxtVAFndZk0oZPGoccCxWX5O+rRKL/9zuEZ8jX/uUJTYDxvi4WP9jpW xG5xkv5/V722Ah05Z7FyMNsKUQbaeUhy+10jY97DjWftaTQumcjZRJJ2gVmnEd+BU+wmu19IWzNSI Ql3Y0R8TU9TYGsCfGz3n0nVQw4p115IPQEYaBwSlpsexKIIIe/OfSP7XnxkFhmF23iP3FBB9Jcaw+ +7UIo1e/lkeOltDPpPp41rpnq6Yi371Cset1IZSkvP7h7YieN0Ubrla3NkbPBIuyNVnsRtaZ7Vgrg vdmPeIpmtLDn194g/Lgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mP5F0-00FBRo-7A; Sat, 11 Sep 2021 15:48:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mP5Ew-00FBRM-DW for linux-arm-kernel@lists.infradead.org; Sat, 11 Sep 2021 15:48:28 +0000 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1698611B0; Sat, 11 Sep 2021 15:48:22 +0000 (UTC) Date: Sat, 11 Sep 2021 16:51:54 +0100 From: Jonathan Cameron To: Olivier Moysan Cc: Alexandre Torgue , Arnaud Pouliquen , Fabrice Gasnier , Lars-Peter Clausen , Maxime Coquelin , Rob Herring , , , , , , Subject: Re: [PATCH 1/7] dt-bindings: iio: adc: add generic channel binding Message-ID: <20210911165154.3afb17f7@jic23-huawei> In-Reply-To: <20210908155452.25458-2-olivier.moysan@foss.st.com> References: <20210908155452.25458-1-olivier.moysan@foss.st.com> <20210908155452.25458-2-olivier.moysan@foss.st.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210911_084826_547405_7F775356 X-CRM114-Status: GOOD ( 25.80 ) X-BeenThere: linux-arm-kernel@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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 8 Sep 2021 17:54:46 +0200 Olivier Moysan wrote: dt-bindings: iio: adc: stm32-adc: ... > Add ADC generic channel binding. This binding should > be used as an alternate to legacy channel properties > whenever possible. > ADC generic channel binding allows to identify supported > internal channels through the following reserved label names: > "vddcore", "vrefint" and "vbat". > This binding also allows to set a different sampling time > for each channel. > > Signed-off-by: Olivier Moysan > --- > Note: The schema here is too permissive as either legacy or generic > channels properties are required. These properties are mutually > exclusive, however all attempts to describe this constraint are > failing. In particular the following schemas and their variants have > shown unsucessful. > Given yaml still drives me crazy I'll rely on Rob's expertise for suggestions here. The new binding text itself looks great to me. > oneOf: > - anyOf: > - required: > - st,adc-channels > - required: > - st,adc-diff-channels > - anyOf: > - required: > - $nodename > > - if: > patternProperties: > "^channel@([0-9]|1[0-9])$": > type: object > then: > properties: > st,adc-channels: false > st,adc-diff-channels: false > else: > - anyOf: > - required: > - st,adc-channels > - required: > - st,adc-diff-channels > --- > .../bindings/iio/adc/st,stm32-adc.yaml | 100 ++++++++++++++++-- > 1 file changed, 93 insertions(+), 7 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml > index a58334c3bb76..a1f6cbe144ba 100644 > --- a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml > @@ -222,6 +222,12 @@ patternProperties: > '#io-channel-cells': > const: 1 > > + '#address-cells': > + const: 1 > + > + '#size-cells': > + const: 0 > + > interrupts: > description: | > IRQ Line for the ADC instance. Valid values are: > @@ -265,7 +271,9 @@ patternProperties: > , ,... vinp and vinn are numbered from 0 to 19. > > Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is > - required. Both properties can be used together. Some channels can be > + required if no adc generic channel is defined. These legacy channel > + properties are exclusive with adc generic channel bindings. > + Both properties can be used together. Some channels can be > used as single-ended and some other ones as differential (mixed). But > channels can't be configured both as single-ended and differential. > $ref: /schemas/types.yaml#/definitions/uint32-matrix > @@ -290,6 +298,44 @@ patternProperties: > each channel. > $ref: /schemas/types.yaml#/definitions/uint32-array > > + patternProperties: > + "^channel@([0-9]|1[0-9])$": > + type: object > + $ref: "adc.yaml" > + description: | > + Represents the external channels which are connected to the ADC. > + > + properties: > + reg: > + items: > + minimum: 0 > + maximum: 19 > + > + label: > + description: | > + Unique name to identify which channel this is. > + Reserved label names "vddcore", "vrefint" and "vbat" > + are used to identify internal channels with matching names. > + > + diff-channels: > + $ref: /schemas/types.yaml#/definitions/uint32-array > + items: > + minimum: 0 > + maximum: 19 > + > + st,min-sample-time-nsecs: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + Minimum sampling time in nanoseconds. Depending on hardware (board) > + e.g. high/low analog input source impedance, fine tune of ADC > + sampling time may be recommended. > + > + required: > + - reg > + > + dependencies: > + $nodename: [ '#address-cells', '#size-cells' ] > + > allOf: > - if: > properties: > @@ -369,12 +415,6 @@ patternProperties: > > additionalProperties: false > > - anyOf: > - - required: > - - st,adc-channels > - - required: > - - st,adc-diff-channels > - > required: > - compatible > - reg > @@ -451,4 +491,50 @@ examples: > // other adc child node follow... > }; > > + - | > + // Example 3: with stm32mp157c to setup ADC2 with: > + // - internal channels 13, 14, 15. > + #include > + #include > + adc122: adc@48003000 { > + compatible = "st,stm32mp1-adc-core"; > + reg = <0x48003000 0x400>; > + interrupts = , > + ; > + clocks = <&rcc ADC12>, <&rcc ADC12_K>; > + clock-names = "bus", "adc"; > + booster-supply = <&booster>; > + vdd-supply = <&vdd>; > + vdda-supply = <&vdda>; > + vref-supply = <&vref>; > + st,syscfg = <&syscfg>; > + interrupt-controller; > + #interrupt-cells = <1>; > + #address-cells = <1>; > + #size-cells = <0>; > + adc@100 { > + compatible = "st,stm32mp1-adc"; > + #io-channel-cells = <1>; > + reg = <0x100>; > + interrupts = <1>; > + #address-cells = <1>; > + #size-cells = <0>; > + channel@13 { > + reg = <13>; > + label = "vrefint"; > + st,min-sample-time-nsecs = <9000>; > + }; > + channel@14 { > + reg = <14>; > + label = "vddcore"; > + st,min-sample-time-nsecs = <9000>; > + }; > + channel@15 { > + reg = <15>; > + label = "vbat"; > + st,min-sample-time-nsecs = <9000>; > + }; > + }; > + }; > + > ... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel