Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1588095pxb; Mon, 11 Oct 2021 09:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0ZHEXnGDfXixuIMMmoKPg8jGIi97lyWqINaRT5q2nwhCbzgguwhKK/LO7YBLjw3O3w1QG X-Received: by 2002:a17:903:11c3:b0:138:f348:4340 with SMTP id q3-20020a17090311c300b00138f3484340mr25530048plh.84.1633968079828; Mon, 11 Oct 2021 09:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633968079; cv=none; d=google.com; s=arc-20160816; b=0zYV5RpUw+RHIb24pJPix/D8QEZCxWSHgzKke1+gy9HBBk+8fifLsgjbwFvPDmB8GC K78t/osUph6daX6lJc7CsW4qvyBWfovSAJDgU8yT0Px7CPq+t5sgHOXqBf3x3GSB+6U3 E5T5u+QtgmTbo5sg/uu70z5sZOLzKHse6RHXnQryAoG3jaTwyBUeOEj3AWYDGvHUQCFK 5LX7rACkW5rOvVjukkrkIWAEIqkt0sjGKZy0xO5CpjB1QtsUokMuT6FzI5eX3G9WGeDA xQ0MiTxTVTB3cVtSIvCDLYNujLPyYOizsyyQrzF0maBm65DNjqVp/STa69Hy+daNEyiV M/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ehzqaetFwAxKeidlDcFPfHTrZiO8cJwJfarmE2gZgmk=; b=bMk2xIW0bS+fnpgzRID2npsHHytzeryz/tFKTxmH7rLUiTjF89BzhyVpav7He3uir/ 0gGmcody2N0vRQpgzPW5cgK3ULLUzumJZszjeiHiIKAqpePV+hMHiRAn79gmHhd4oTQy XuDg/pQr5wteMqcBuBrOU7QKrES8tSTj/qG8dBkyTjXZcL5y/yytp1Zvk31Kzo9cQ/v4 y9WG1TgUbW/TvyhKqY+zBZRirKPaL016z8RWoZWPQufLyluHNCy1HK79icZguI4jHXY/ NSdz9ieqM/21V8grAYqEGHUsICQuEMpJO9gTsq248UHl5GghCm9pV2/rbRpki8r12BpQ fvXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=PTbIiJdN; 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=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mr1si10118267pjb.118.2021.10.11.09.01.00; Mon, 11 Oct 2021 09:01:19 -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; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=PTbIiJdN; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238816AbhJKQAi (ORCPT + 99 others); Mon, 11 Oct 2021 12:00:38 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:48504 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231766AbhJKQAZ (ORCPT ); Mon, 11 Oct 2021 12:00:25 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19B9etq0022265; Mon, 11 Oct 2021 17:58:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=ehzqaetFwAxKeidlDcFPfHTrZiO8cJwJfarmE2gZgmk=; b=PTbIiJdNjG4ugdJyVseHHMXmHt/vSTWdZa43yhov8q++U3PSp0xBtyRouJGbQ4Vi9tDx X/s2xmtGUmczrcyfRgdxaf2Jl8r4YoLTqDcY7atWDwCHJ7g8xQNDK7T0g65SP8irkKbg GCuWfH4m2JmkM1gj66qwtesSQu7l+hsl06MtQTMdhxYe9mipCkCMTFViCIlp7PiFYzCs CR0X+CbF95eEfj7EVLO/MqoCOSCaNGCwP+NHi8rxK5WJAJ0ssl+CSEXlgfe8B9Gr8kQV 1cWSv+wSeh0yGgPi3EpPah6Qr4bbQF5gGZGWEPLkqaGR6MaFae6qipHSWPK6NCXWHQvz aQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 3bmdxrkunn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Oct 2021 17:58:01 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 33BE9100039; Mon, 11 Oct 2021 17:58:01 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2B7BF231DE0; Mon, 11 Oct 2021 17:58:01 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 11 Oct 2021 17:58:00 +0200 From: Olivier Moysan To: Alexandre Torgue , Fabrice Gasnier , Jonathan Cameron , "Lars-Peter Clausen" , Maxime Coquelin , Olivier Moysan , Rob Herring CC: , , , , Subject: [PATCH v4 1/7] dt-bindings: iio: stm32-adc: add generic channel binding Date: Mon, 11 Oct 2021 17:57:11 +0200 Message-ID: <20211011155717.1594-2-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211011155717.1594-1-olivier.moysan@foss.st.com> References: <20211011155717.1594-1-olivier.moysan@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-11_05,2021-10-11_01,2020-04-07_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Fabrice Gasnier --- .../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..ece1864fdcd9 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" + 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-ns: + 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 + + additionalProperties: false 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