Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4088252pxb; Mon, 4 Oct 2021 17:14:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgNmd+c6lHfLNWy2VQtAQxjiXc21YyzOZmkviZ2HPHu3BdmHkbAr2cwo7Y8HmnuhMECKxj X-Received: by 2002:a17:907:3e0f:: with SMTP id hp15mr20980796ejc.58.1633392845882; Mon, 04 Oct 2021 17:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633392845; cv=none; d=google.com; s=arc-20160816; b=hRNXbKtEU4wF33W+pxp8DbFf1rfN3cQVO18ryRP0jIZJS17Ktx0T39j0e2d4JjA+rf oD2LZP1SQmuTLLytbhXkwBHE9R7lWeM86tYBtteXKpaVVbu8fZcBe20R41cIoyYEOfmu ej6Szs7RTwRzf0vrgXLsElyyNxf29WEiQo36RsB8sC1QKMFCxia+Bsf2/AeuCVGCIJR9 bqw0JRkJlwsqcrkz19h2YB2M/stU7wRFRokAlcPDHsyXcOl3SXgL/HO7rh4Fob9ynB45 qNAMCpso4qlLv0ghrrznKDPYGUYU8ucOCIMVYZ8ADj7Epu6KxXrrCWWDjMKeIae2Pw9A x/xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ih10pMBW5lUPCC/x9rLmG7kgKn8xGXvYQdK5s5DKY/o=; b=wbOFFobyN9RlDHz8Dw4gI4HF6za1i6nWk9ERupBbG/dFOYYvWMH1Qys9B2jCI8HuB4 ih4g29l4XdgppXyxdcrNYsp5MMpHUQuSY4drVeVBIYbX4V41a1VUoOkUWMwrbYELEKi+ Xsc3Bv92IpvpPHv/XGSIKK/8TlNZC8AFXOEXUCEHDKZ2Sgn7QnnGm57V7BxTI9oMppPi x6OZF/q8HKU+eofeymyJwTlqLorTztIsA36TbuDZ3OeSi4+1eh/2E0pQXCbHBGKA6/lX XOtTrXP7a1+Tp0fSrGSJHS6XtPsAw6zQhMV5ISs7A6HbidAFzHScC/cb00QhLk5Jv5ie QQBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id nc14si33987263ejc.181.2021.10.04.17.13.42; Mon, 04 Oct 2021 17:14:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237846AbhJDQ7V (ORCPT + 99 others); Mon, 4 Oct 2021 12:59:21 -0400 Received: from mail-ot1-f41.google.com ([209.85.210.41]:46848 "EHLO mail-ot1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235803AbhJDQ7U (ORCPT ); Mon, 4 Oct 2021 12:59:20 -0400 Received: by mail-ot1-f41.google.com with SMTP id o59-20020a9d2241000000b0054745f28c69so22361944ota.13; Mon, 04 Oct 2021 09:57:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ih10pMBW5lUPCC/x9rLmG7kgKn8xGXvYQdK5s5DKY/o=; b=2yGafm1w/euuEn1ECHFDM2Ek44RvNwe4VK6ZzBlrmCr/0f4+anjd85j0tjJXVLEc7+ e8FI/xbkiVmD9N5CBDBHH39ojIuLt1RhQoOc0IjaBmTqUYYn6m+44reXyrYQl8RoQ61I qE2xEdrVB+LGSsN+HxucQHL2h1qMFlzCJxqeoyuYyxWo2sE2nD+U2Mfhvh7XSWZXLc7A 1jWTvJCAOM8ib3Z+gdKJTuuRb4h0PxM6fH2kKoj2CAtkaT+Uq6lj4DPpu8FKy7VeYfEm HwcNXx7vHQ4DhSasl09JdrfsI/O8OQ/d9O9osS1KOt/1lT0I5BiTba6PI8dMOXYirozD H0mA== X-Gm-Message-State: AOAM5310/UdPXGMPFvohzcMTCPbn1qSLMLgigM2LR+lvcbYg8iS5tdxY HizTOZNO0uG//LMiW6uqKg== X-Received: by 2002:a9d:8a7:: with SMTP id 36mr10021321otf.263.1633366651128; Mon, 04 Oct 2021 09:57:31 -0700 (PDT) Received: from robh.at.kernel.org (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.gmail.com with ESMTPSA id s7sm2720818oiw.27.2021.10.04.09.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 09:57:30 -0700 (PDT) Received: (nullmailer pid 1469674 invoked by uid 1000); Mon, 04 Oct 2021 16:57:27 -0000 Date: Mon, 4 Oct 2021 11:57:27 -0500 From: Rob Herring To: Olivier Moysan Cc: Alexandre Torgue , Fabrice Gasnier , Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v3 1/7] dt-bindings: iio: stm32-adc: add generic channel binding Message-ID: References: <20210924083410.12332-1-olivier.moysan@foss.st.com> <20210924083410.12332-2-olivier.moysan@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210924083410.12332-2-olivier.moysan@foss.st.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 24, 2021 at 10:34:04AM +0200, Olivier Moysan wrote: > 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 > --- > .../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..1c13921b0556 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: > @@ -256,6 +262,7 @@ patternProperties: > - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and > stm32mp1. > $ref: /schemas/types.yaml#/definitions/uint32-array > + deprecated: true > > st,adc-diff-channels: > description: | > @@ -265,7 +272,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 > @@ -279,6 +288,7 @@ patternProperties: > "vinn" indicates negative input number > minimum: 0 > maximum: 19 > + deprecated: true > > st,min-sample-time-nsecs: > description: > @@ -289,6 +299,42 @@ patternProperties: > list, to set sample time resp. for all channels, or independently for > each channel. > $ref: /schemas/types.yaml#/definitions/uint32-array > + deprecated: true > + > + patternProperties: > + "^channel@([0-9]|1[0-9])$": > + type: object > + $ref: "adc.yaml" You need 'additionalProperties: false' here. Or unevaluatedProperties if there are properties used and defined in adc.yaml, but not here. > + description: | Don't need '|' unless you need to maintain formatting (line breaks). > + 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: Use standard unit suffix (-ns). > + $ref: /schemas/types.yaml#/definitions/uint32 And then drop this. > + 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 > > allOf: > - if: > @@ -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>; > + }; > + }; > + }; > + > ... > -- > 2.17.1 > >