xref: /linux/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1a8cf1723SFabrice Gasnier# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2a8cf1723SFabrice Gasnier%YAML 1.2
3a8cf1723SFabrice Gasnier---
434d1e754SKrzysztof Kozlowski$id: http://devicetree.org/schemas/iio/adc/st,stm32-adc.yaml#
534d1e754SKrzysztof Kozlowski$schema: http://devicetree.org/meta-schemas/core.yaml#
6a8cf1723SFabrice Gasnier
784e85359SKrzysztof Kozlowskititle: STMicroelectronics STM32 ADC
8a8cf1723SFabrice Gasnier
9a8cf1723SFabrice Gasnierdescription: |
10a8cf1723SFabrice Gasnier  STM32 ADC is a successive approximation analog-to-digital converter.
11a8cf1723SFabrice Gasnier  It has several multiplexed input channels. Conversions can be performed
12a8cf1723SFabrice Gasnier  in single, continuous, scan or discontinuous mode. Result of the ADC is
13a8cf1723SFabrice Gasnier  stored in a left-aligned or right-aligned 32-bit data register.
14a8cf1723SFabrice Gasnier  Conversions can be launched in software or using hardware triggers.
15a8cf1723SFabrice Gasnier
16a8cf1723SFabrice Gasnier  The analog watchdog feature allows the application to detect if the input
17a8cf1723SFabrice Gasnier  voltage goes beyond the user-defined, higher or lower thresholds.
18a8cf1723SFabrice Gasnier
19a8cf1723SFabrice Gasnier  Each STM32 ADC block can have up to 3 ADC instances.
20a8cf1723SFabrice Gasnier
21a8cf1723SFabrice Gasniermaintainers:
22f4eedebdSPatrice Chotard  - Fabrice Gasnier <fabrice.gasnier@foss.st.com>
23a8cf1723SFabrice Gasnier
24a8cf1723SFabrice Gasnierproperties:
25a8cf1723SFabrice Gasnier  compatible:
26a8cf1723SFabrice Gasnier    enum:
27a8cf1723SFabrice Gasnier      - st,stm32f4-adc-core
28a8cf1723SFabrice Gasnier      - st,stm32h7-adc-core
29a8cf1723SFabrice Gasnier      - st,stm32mp1-adc-core
306cafcdb1SOlivier Moysan      - st,stm32mp13-adc-core
31a8cf1723SFabrice Gasnier
32a8cf1723SFabrice Gasnier  reg:
33a8cf1723SFabrice Gasnier    maxItems: 1
34a8cf1723SFabrice Gasnier
35a8cf1723SFabrice Gasnier  interrupts:
36a8cf1723SFabrice Gasnier    description: |
37a8cf1723SFabrice Gasnier      One or more interrupts for ADC block, depending on part used:
38a8cf1723SFabrice Gasnier        - stm32f4 and stm32h7 share a common ADC interrupt line.
39a8cf1723SFabrice Gasnier        - stm32mp1 has two separate interrupt lines, one for each ADC within
40a8cf1723SFabrice Gasnier          ADC block.
416cafcdb1SOlivier Moysan        - stm32mp13 has an interrupt line per ADC block.
42a8cf1723SFabrice Gasnier    minItems: 1
43a8cf1723SFabrice Gasnier    maxItems: 2
44a8cf1723SFabrice Gasnier
45a8cf1723SFabrice Gasnier  clocks:
460499220dSRob Herring    minItems: 1
470499220dSRob Herring    maxItems: 2
48a8cf1723SFabrice Gasnier    description: |
49a8cf1723SFabrice Gasnier      Core can use up to two clocks, depending on part used:
50a8cf1723SFabrice Gasnier        - "adc" clock: for the analog circuitry, common to all ADCs.
51a8cf1723SFabrice Gasnier          It's required on stm32f4.
52a8cf1723SFabrice Gasnier          It's optional on stm32h7 and stm32mp1.
53a8cf1723SFabrice Gasnier        - "bus" clock: for registers access, common to all ADCs.
54a8cf1723SFabrice Gasnier          It's not present on stm32f4.
55a8cf1723SFabrice Gasnier          It's required on stm32h7 and stm32mp1.
56a8cf1723SFabrice Gasnier
57*bd5eebf4SKrzysztof Kozlowski  clock-names:
58*bd5eebf4SKrzysztof Kozlowski    minItems: 1
59*bd5eebf4SKrzysztof Kozlowski    maxItems: 2
60a8cf1723SFabrice Gasnier
61a8cf1723SFabrice Gasnier  st,max-clk-rate-hz:
62a8cf1723SFabrice Gasnier    description:
63a8cf1723SFabrice Gasnier      Allow to specify desired max clock rate used by analog circuitry.
64a8cf1723SFabrice Gasnier
65a8cf1723SFabrice Gasnier  vdda-supply:
66a8cf1723SFabrice Gasnier    description: Phandle to the vdda input analog voltage.
67a8cf1723SFabrice Gasnier
68a8cf1723SFabrice Gasnier  vref-supply:
69a8cf1723SFabrice Gasnier    description: Phandle to the vref input analog reference voltage.
70a8cf1723SFabrice Gasnier
71a8cf1723SFabrice Gasnier  booster-supply:
72a8cf1723SFabrice Gasnier    description:
73a8cf1723SFabrice Gasnier      Phandle to the embedded booster regulator that can be used to supply ADC
74a8cf1723SFabrice Gasnier      analog input switches on stm32h7 and stm32mp1.
75a8cf1723SFabrice Gasnier
76a8cf1723SFabrice Gasnier  vdd-supply:
77a8cf1723SFabrice Gasnier    description:
78a8cf1723SFabrice Gasnier      Phandle to the vdd input voltage. It can be used to supply ADC analog
79a8cf1723SFabrice Gasnier      input switches on stm32mp1.
80a8cf1723SFabrice Gasnier
81a8cf1723SFabrice Gasnier  st,syscfg:
82a8cf1723SFabrice Gasnier    description:
83a8cf1723SFabrice Gasnier      Phandle to system configuration controller. It can be used to control the
84a8cf1723SFabrice Gasnier      analog circuitry on stm32mp1.
8534d1e754SKrzysztof Kozlowski    $ref: /schemas/types.yaml#/definitions/phandle-array
86a8cf1723SFabrice Gasnier
87a8cf1723SFabrice Gasnier  interrupt-controller: true
88a8cf1723SFabrice Gasnier
89a8cf1723SFabrice Gasnier  '#interrupt-cells':
90a8cf1723SFabrice Gasnier    const: 1
91a8cf1723SFabrice Gasnier
92a8cf1723SFabrice Gasnier  '#address-cells':
93a8cf1723SFabrice Gasnier    const: 1
94a8cf1723SFabrice Gasnier
95a8cf1723SFabrice Gasnier  '#size-cells':
96a8cf1723SFabrice Gasnier    const: 0
97a8cf1723SFabrice Gasnier
9802ec75edSGatien Chevallier  access-controllers:
9902ec75edSGatien Chevallier    minItems: 1
10002ec75edSGatien Chevallier    maxItems: 2
10102ec75edSGatien Chevallier
102a8cf1723SFabrice GasnierallOf:
103a8cf1723SFabrice Gasnier  - if:
104a8cf1723SFabrice Gasnier      properties:
105a8cf1723SFabrice Gasnier        compatible:
106a8cf1723SFabrice Gasnier          contains:
107a8cf1723SFabrice Gasnier            const: st,stm32f4-adc-core
108a8cf1723SFabrice Gasnier
109a8cf1723SFabrice Gasnier    then:
110a8cf1723SFabrice Gasnier      properties:
111a8cf1723SFabrice Gasnier        clocks:
112a8cf1723SFabrice Gasnier          maxItems: 1
113a8cf1723SFabrice Gasnier
114a8cf1723SFabrice Gasnier        clock-names:
115a8cf1723SFabrice Gasnier          const: adc
116a8cf1723SFabrice Gasnier
117a8cf1723SFabrice Gasnier        interrupts:
118a8cf1723SFabrice Gasnier          items:
119a8cf1723SFabrice Gasnier            - description: interrupt line common for all ADCs
120a8cf1723SFabrice Gasnier
121a8cf1723SFabrice Gasnier        st,max-clk-rate-hz:
122a8cf1723SFabrice Gasnier          minimum: 600000
123a8cf1723SFabrice Gasnier          maximum: 36000000
124a8cf1723SFabrice Gasnier          default: 36000000
125a8cf1723SFabrice Gasnier
126a8cf1723SFabrice Gasnier        booster-supply: false
127a8cf1723SFabrice Gasnier
128a8cf1723SFabrice Gasnier        vdd-supply: false
129a8cf1723SFabrice Gasnier
130a8cf1723SFabrice Gasnier        st,syscfg: false
131a8cf1723SFabrice Gasnier
132a8cf1723SFabrice Gasnier  - if:
133a8cf1723SFabrice Gasnier      properties:
134a8cf1723SFabrice Gasnier        compatible:
135a8cf1723SFabrice Gasnier          contains:
136a8cf1723SFabrice Gasnier            const: st,stm32h7-adc-core
137a8cf1723SFabrice Gasnier
138a8cf1723SFabrice Gasnier    then:
139a8cf1723SFabrice Gasnier      properties:
140a8cf1723SFabrice Gasnier        clocks:
141a8cf1723SFabrice Gasnier          minItems: 1
142a8cf1723SFabrice Gasnier          maxItems: 2
143a8cf1723SFabrice Gasnier
144a8cf1723SFabrice Gasnier        clock-names:
145a8cf1723SFabrice Gasnier          items:
146a8cf1723SFabrice Gasnier            - const: bus
147a8cf1723SFabrice Gasnier            - const: adc
148a8cf1723SFabrice Gasnier          minItems: 1
149a8cf1723SFabrice Gasnier
150a8cf1723SFabrice Gasnier        interrupts:
151a8cf1723SFabrice Gasnier          items:
152a8cf1723SFabrice Gasnier            - description: interrupt line common for all ADCs
153a8cf1723SFabrice Gasnier
154a8cf1723SFabrice Gasnier        st,max-clk-rate-hz:
155a8cf1723SFabrice Gasnier          minimum: 120000
156a8cf1723SFabrice Gasnier          maximum: 36000000
157a8cf1723SFabrice Gasnier          default: 36000000
158a8cf1723SFabrice Gasnier
159a8cf1723SFabrice Gasnier        vdd-supply: false
160a8cf1723SFabrice Gasnier
161a8cf1723SFabrice Gasnier        st,syscfg: false
162a8cf1723SFabrice Gasnier
163a8cf1723SFabrice Gasnier  - if:
164a8cf1723SFabrice Gasnier      properties:
165a8cf1723SFabrice Gasnier        compatible:
166a8cf1723SFabrice Gasnier          contains:
167a8cf1723SFabrice Gasnier            const: st,stm32mp1-adc-core
168a8cf1723SFabrice Gasnier
169a8cf1723SFabrice Gasnier    then:
170a8cf1723SFabrice Gasnier      properties:
171a8cf1723SFabrice Gasnier        clocks:
172a8cf1723SFabrice Gasnier          minItems: 1
173a8cf1723SFabrice Gasnier          maxItems: 2
174a8cf1723SFabrice Gasnier
175a8cf1723SFabrice Gasnier        clock-names:
176a8cf1723SFabrice Gasnier          items:
177a8cf1723SFabrice Gasnier            - const: bus
178a8cf1723SFabrice Gasnier            - const: adc
179a8cf1723SFabrice Gasnier          minItems: 1
180a8cf1723SFabrice Gasnier
181a8cf1723SFabrice Gasnier        interrupts:
182a8cf1723SFabrice Gasnier          items:
183a8cf1723SFabrice Gasnier            - description: interrupt line for ADC1
184a8cf1723SFabrice Gasnier            - description: interrupt line for ADC2
185a8cf1723SFabrice Gasnier
186a8cf1723SFabrice Gasnier        st,max-clk-rate-hz:
187a8cf1723SFabrice Gasnier          minimum: 120000
188a8cf1723SFabrice Gasnier          maximum: 36000000
189a8cf1723SFabrice Gasnier          default: 36000000
190a8cf1723SFabrice Gasnier
1916cafcdb1SOlivier Moysan  - if:
1926cafcdb1SOlivier Moysan      properties:
1936cafcdb1SOlivier Moysan        compatible:
1946cafcdb1SOlivier Moysan          contains:
1956cafcdb1SOlivier Moysan            const: st,stm32mp13-adc-core
1966cafcdb1SOlivier Moysan
1976cafcdb1SOlivier Moysan    then:
1986cafcdb1SOlivier Moysan      properties:
1996cafcdb1SOlivier Moysan        clocks:
2006cafcdb1SOlivier Moysan          minItems: 1
2016cafcdb1SOlivier Moysan          maxItems: 2
2026cafcdb1SOlivier Moysan
2036cafcdb1SOlivier Moysan        clock-names:
2046cafcdb1SOlivier Moysan          items:
2056cafcdb1SOlivier Moysan            - const: bus
2066cafcdb1SOlivier Moysan            - const: adc
2076cafcdb1SOlivier Moysan          minItems: 1
2086cafcdb1SOlivier Moysan
2096cafcdb1SOlivier Moysan        interrupts:
2106cafcdb1SOlivier Moysan          items:
2116cafcdb1SOlivier Moysan            - description: ADC interrupt line
2126cafcdb1SOlivier Moysan
2136cafcdb1SOlivier Moysan        st,max-clk-rate-hz:
2146cafcdb1SOlivier Moysan          minimum: 150000
2156cafcdb1SOlivier Moysan          maximum: 75000000
2166cafcdb1SOlivier Moysan          default: 75000000
2176cafcdb1SOlivier Moysan
218a8cf1723SFabrice GasnieradditionalProperties: false
219a8cf1723SFabrice Gasnier
220a8cf1723SFabrice Gasnierrequired:
221a8cf1723SFabrice Gasnier  - compatible
222a8cf1723SFabrice Gasnier  - reg
223a8cf1723SFabrice Gasnier  - interrupts
224a8cf1723SFabrice Gasnier  - clocks
225a8cf1723SFabrice Gasnier  - clock-names
226a8cf1723SFabrice Gasnier  - vdda-supply
227a8cf1723SFabrice Gasnier  - vref-supply
228a8cf1723SFabrice Gasnier  - interrupt-controller
229a8cf1723SFabrice Gasnier  - '#interrupt-cells'
230a8cf1723SFabrice Gasnier  - '#address-cells'
231a8cf1723SFabrice Gasnier  - '#size-cells'
232a8cf1723SFabrice Gasnier
233a8cf1723SFabrice GasnierpatternProperties:
234a8cf1723SFabrice Gasnier  "^adc@[0-9]+$":
235a8cf1723SFabrice Gasnier    type: object
236a8cf1723SFabrice Gasnier    description:
237a8cf1723SFabrice Gasnier      An ADC block node should contain at least one subnode, representing an
238a8cf1723SFabrice Gasnier      ADC instance available on the machine.
239a8cf1723SFabrice Gasnier
240a8cf1723SFabrice Gasnier    properties:
241a8cf1723SFabrice Gasnier      compatible:
242a8cf1723SFabrice Gasnier        enum:
243a8cf1723SFabrice Gasnier          - st,stm32f4-adc
244a8cf1723SFabrice Gasnier          - st,stm32h7-adc
245a8cf1723SFabrice Gasnier          - st,stm32mp1-adc
2466cafcdb1SOlivier Moysan          - st,stm32mp13-adc
247a8cf1723SFabrice Gasnier
248a8cf1723SFabrice Gasnier      reg:
249a8cf1723SFabrice Gasnier        description: |
250a8cf1723SFabrice Gasnier          Offset of ADC instance in ADC block. Valid values are:
251a8cf1723SFabrice Gasnier            - 0x0:   ADC1
252a8cf1723SFabrice Gasnier            - 0x100: ADC2
253a8cf1723SFabrice Gasnier            - 0x200: ADC3 (stm32f4 only)
254a8cf1723SFabrice Gasnier        maxItems: 1
255a8cf1723SFabrice Gasnier
256a8cf1723SFabrice Gasnier      '#io-channel-cells':
257a8cf1723SFabrice Gasnier        const: 1
258a8cf1723SFabrice Gasnier
259664b9879SOlivier Moysan      '#address-cells':
260664b9879SOlivier Moysan        const: 1
261664b9879SOlivier Moysan
262664b9879SOlivier Moysan      '#size-cells':
263664b9879SOlivier Moysan        const: 0
264664b9879SOlivier Moysan
265a8cf1723SFabrice Gasnier      interrupts:
266a8cf1723SFabrice Gasnier        description: |
267a8cf1723SFabrice Gasnier          IRQ Line for the ADC instance. Valid values are:
2686cafcdb1SOlivier Moysan            - 0 for adc@0 (single adc for stm32mp13)
269a8cf1723SFabrice Gasnier            - 1 for adc@100
270a8cf1723SFabrice Gasnier            - 2 for adc@200 (stm32f4 only)
271a8cf1723SFabrice Gasnier        maxItems: 1
272a8cf1723SFabrice Gasnier
273a8cf1723SFabrice Gasnier      clocks:
274a8cf1723SFabrice Gasnier        description:
275a8cf1723SFabrice Gasnier          Input clock private to this ADC instance. It's required only on
276a8cf1723SFabrice Gasnier          stm32f4, that has per instance clock input for registers access.
277a8cf1723SFabrice Gasnier        maxItems: 1
278a8cf1723SFabrice Gasnier
279a8cf1723SFabrice Gasnier      dmas:
280a8cf1723SFabrice Gasnier        description: RX DMA Channel
281a8cf1723SFabrice Gasnier        maxItems: 1
282a8cf1723SFabrice Gasnier
283a8cf1723SFabrice Gasnier      dma-names:
284a8cf1723SFabrice Gasnier        const: rx
285a8cf1723SFabrice Gasnier
286a8cf1723SFabrice Gasnier      assigned-resolution-bits:
287a8cf1723SFabrice Gasnier        description: |
288a8cf1723SFabrice Gasnier          Resolution (bits) to use for conversions:
2896cafcdb1SOlivier Moysan            - can be 6, 8, 10 or 12 on stm32f4 and stm32mp13
290a8cf1723SFabrice Gasnier            - can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
291a8cf1723SFabrice Gasnier
292a8cf1723SFabrice Gasnier      st,adc-channels:
293a8cf1723SFabrice Gasnier        description: |
294a8cf1723SFabrice Gasnier          List of single-ended channels muxed for this ADC. It can have up to:
295a8cf1723SFabrice Gasnier            - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
2966cafcdb1SOlivier Moysan            - 19 channels, numbered from 0 to 18 (for in0..in18) on stm32mp13.
297a8cf1723SFabrice Gasnier            - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
298a8cf1723SFabrice Gasnier              stm32mp1.
2993d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
300664b9879SOlivier Moysan        deprecated: true
301a8cf1723SFabrice Gasnier
302a8cf1723SFabrice Gasnier      st,adc-diff-channels:
303a8cf1723SFabrice Gasnier        description: |
304a8cf1723SFabrice Gasnier          List of differential channels muxed for this ADC. Some channels can
305a8cf1723SFabrice Gasnier          be configured as differential instead of single-ended on stm32h7 and
306a8cf1723SFabrice Gasnier          on stm32mp1. Positive and negative inputs pairs are listed:
307a8cf1723SFabrice Gasnier          <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
308a8cf1723SFabrice Gasnier
309a8cf1723SFabrice Gasnier          Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
310664b9879SOlivier Moysan          required if no adc generic channel is defined. These legacy channel
311664b9879SOlivier Moysan          properties are exclusive with adc generic channel bindings.
312664b9879SOlivier Moysan          Both properties can be used together. Some channels can be
313a8cf1723SFabrice Gasnier          used as single-ended and some other ones as differential (mixed). But
314a8cf1723SFabrice Gasnier          channels can't be configured both as single-ended and differential.
3153d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-matrix
3163d21a460SRob Herring        items:
317a8cf1723SFabrice Gasnier          items:
318a8cf1723SFabrice Gasnier            - description: |
319a8cf1723SFabrice Gasnier                "vinp" indicates positive input number
320a8cf1723SFabrice Gasnier              minimum: 0
321a8cf1723SFabrice Gasnier              maximum: 19
322a8cf1723SFabrice Gasnier            - description: |
323a8cf1723SFabrice Gasnier                "vinn" indicates negative input number
324a8cf1723SFabrice Gasnier              minimum: 0
325a8cf1723SFabrice Gasnier              maximum: 19
326664b9879SOlivier Moysan        deprecated: true
327a8cf1723SFabrice Gasnier
328a8cf1723SFabrice Gasnier      st,min-sample-time-nsecs:
329a8cf1723SFabrice Gasnier        description:
330a8cf1723SFabrice Gasnier          Minimum sampling time in nanoseconds. Depending on hardware (board)
331a8cf1723SFabrice Gasnier          e.g. high/low analog input source impedance, fine tune of ADC
332a8cf1723SFabrice Gasnier          sampling time may be recommended. This can be either one value or an
333a8cf1723SFabrice Gasnier          array that matches "st,adc-channels" and/or "st,adc-diff-channels"
334a8cf1723SFabrice Gasnier          list, to set sample time resp. for all channels, or independently for
335a8cf1723SFabrice Gasnier          each channel.
3363d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
337664b9879SOlivier Moysan        deprecated: true
338664b9879SOlivier Moysan
3396cd4ed8eSOlivier Moysan      nvmem-cells:
3406cd4ed8eSOlivier Moysan        items:
3416cd4ed8eSOlivier Moysan          - description: Phandle to the calibration vrefint data provided by otp
3426cd4ed8eSOlivier Moysan
3436cd4ed8eSOlivier Moysan      nvmem-cell-names:
3446cd4ed8eSOlivier Moysan        items:
3456cd4ed8eSOlivier Moysan          - const: vrefint
3466cd4ed8eSOlivier Moysan
347664b9879SOlivier Moysan    patternProperties:
348664b9879SOlivier Moysan      "^channel@([0-9]|1[0-9])$":
349664b9879SOlivier Moysan        type: object
35034d1e754SKrzysztof Kozlowski        $ref: adc.yaml
351664b9879SOlivier Moysan        description: Represents the external channels which are connected to the ADC.
352664b9879SOlivier Moysan
353664b9879SOlivier Moysan        properties:
354664b9879SOlivier Moysan          reg:
355664b9879SOlivier Moysan            items:
356664b9879SOlivier Moysan              minimum: 0
357664b9879SOlivier Moysan              maximum: 19
358664b9879SOlivier Moysan
359664b9879SOlivier Moysan          label:
360664b9879SOlivier Moysan            description: |
361664b9879SOlivier Moysan              Unique name to identify which channel this is.
3626cafcdb1SOlivier Moysan              Reserved label names "vddcore", "vddcpu", "vddq_ddr", "vrefint" and "vbat"
363664b9879SOlivier Moysan              are used to identify internal channels with matching names.
364664b9879SOlivier Moysan
365664b9879SOlivier Moysan          diff-channels:
366664b9879SOlivier Moysan            $ref: /schemas/types.yaml#/definitions/uint32-array
367664b9879SOlivier Moysan            items:
368664b9879SOlivier Moysan              minimum: 0
369664b9879SOlivier Moysan              maximum: 19
370664b9879SOlivier Moysan
371664b9879SOlivier Moysan          st,min-sample-time-ns:
372664b9879SOlivier Moysan            description: |
373664b9879SOlivier Moysan              Minimum sampling time in nanoseconds. Depending on hardware (board)
374664b9879SOlivier Moysan              e.g. high/low analog input source impedance, fine tune of ADC
375664b9879SOlivier Moysan              sampling time may be recommended.
376664b9879SOlivier Moysan
377664b9879SOlivier Moysan        required:
378664b9879SOlivier Moysan          - reg
379664b9879SOlivier Moysan
380664b9879SOlivier Moysan        additionalProperties: false
381a8cf1723SFabrice Gasnier
382a8cf1723SFabrice Gasnier    allOf:
383a8cf1723SFabrice Gasnier      - if:
384a8cf1723SFabrice Gasnier          properties:
385a8cf1723SFabrice Gasnier            compatible:
386a8cf1723SFabrice Gasnier              contains:
387a8cf1723SFabrice Gasnier                const: st,stm32f4-adc
388a8cf1723SFabrice Gasnier
389a8cf1723SFabrice Gasnier        then:
390a8cf1723SFabrice Gasnier          properties:
391a8cf1723SFabrice Gasnier            reg:
392a8cf1723SFabrice Gasnier              enum:
393a8cf1723SFabrice Gasnier                - 0x0
394a8cf1723SFabrice Gasnier                - 0x100
395a8cf1723SFabrice Gasnier                - 0x200
396a8cf1723SFabrice Gasnier
397a8cf1723SFabrice Gasnier            interrupts:
398a8cf1723SFabrice Gasnier              minimum: 0
399a8cf1723SFabrice Gasnier              maximum: 2
400a8cf1723SFabrice Gasnier
401a8cf1723SFabrice Gasnier            assigned-resolution-bits:
402a8cf1723SFabrice Gasnier              enum: [6, 8, 10, 12]
403a8cf1723SFabrice Gasnier              default: 12
404a8cf1723SFabrice Gasnier
405a8cf1723SFabrice Gasnier            st,adc-channels:
406a8cf1723SFabrice Gasnier              minItems: 1
407a8cf1723SFabrice Gasnier              maxItems: 16
408a8cf1723SFabrice Gasnier              items:
409a8cf1723SFabrice Gasnier                minimum: 0
410a8cf1723SFabrice Gasnier                maximum: 15
411a8cf1723SFabrice Gasnier
412a8cf1723SFabrice Gasnier            st,adc-diff-channels: false
413a8cf1723SFabrice Gasnier
414a8cf1723SFabrice Gasnier            st,min-sample-time-nsecs:
415a8cf1723SFabrice Gasnier              minItems: 1
416a8cf1723SFabrice Gasnier              maxItems: 16
417a8cf1723SFabrice Gasnier              items:
418a8cf1723SFabrice Gasnier                minimum: 80
419a8cf1723SFabrice Gasnier
420a8cf1723SFabrice Gasnier          required:
421a8cf1723SFabrice Gasnier            - clocks
422a8cf1723SFabrice Gasnier
423a8cf1723SFabrice Gasnier      - if:
424a8cf1723SFabrice Gasnier          properties:
425a8cf1723SFabrice Gasnier            compatible:
426a8cf1723SFabrice Gasnier              contains:
427a8cf1723SFabrice Gasnier                enum:
428a8cf1723SFabrice Gasnier                  - st,stm32h7-adc
429a8cf1723SFabrice Gasnier                  - st,stm32mp1-adc
430a8cf1723SFabrice Gasnier
431a8cf1723SFabrice Gasnier        then:
432a8cf1723SFabrice Gasnier          properties:
433a8cf1723SFabrice Gasnier            reg:
434a8cf1723SFabrice Gasnier              enum:
435a8cf1723SFabrice Gasnier                - 0x0
436a8cf1723SFabrice Gasnier                - 0x100
437a8cf1723SFabrice Gasnier
438a8cf1723SFabrice Gasnier            interrupts:
439a8cf1723SFabrice Gasnier              minimum: 0
440a8cf1723SFabrice Gasnier              maximum: 1
441a8cf1723SFabrice Gasnier
442a8cf1723SFabrice Gasnier            assigned-resolution-bits:
443a8cf1723SFabrice Gasnier              enum: [8, 10, 12, 14, 16]
444a8cf1723SFabrice Gasnier              default: 16
445a8cf1723SFabrice Gasnier
446a8cf1723SFabrice Gasnier            st,adc-channels:
447a8cf1723SFabrice Gasnier              minItems: 1
448a8cf1723SFabrice Gasnier              maxItems: 20
449a8cf1723SFabrice Gasnier              items:
450a8cf1723SFabrice Gasnier                minimum: 0
451a8cf1723SFabrice Gasnier                maximum: 19
452a8cf1723SFabrice Gasnier
453a8cf1723SFabrice Gasnier            st,min-sample-time-nsecs:
454a8cf1723SFabrice Gasnier              minItems: 1
455a8cf1723SFabrice Gasnier              maxItems: 20
456a8cf1723SFabrice Gasnier              items:
457a8cf1723SFabrice Gasnier                minimum: 40
458a8cf1723SFabrice Gasnier
4596cafcdb1SOlivier Moysan
4606cafcdb1SOlivier Moysan      - if:
4616cafcdb1SOlivier Moysan          properties:
4626cafcdb1SOlivier Moysan            compatible:
4636cafcdb1SOlivier Moysan              contains:
4646cafcdb1SOlivier Moysan                const: st,stm32mp13-adc
4656cafcdb1SOlivier Moysan
4666cafcdb1SOlivier Moysan        then:
4676cafcdb1SOlivier Moysan          properties:
4686cafcdb1SOlivier Moysan            reg:
4696cafcdb1SOlivier Moysan              const: 0x0
4706cafcdb1SOlivier Moysan
4716cafcdb1SOlivier Moysan            interrupts:
4726cafcdb1SOlivier Moysan              const: 0
4736cafcdb1SOlivier Moysan
4746cafcdb1SOlivier Moysan            assigned-resolution-bits:
4756cafcdb1SOlivier Moysan              enum: [6, 8, 10, 12]
4766cafcdb1SOlivier Moysan              default: 12
4776cafcdb1SOlivier Moysan
4786cafcdb1SOlivier Moysan            st,adc-channels:
4796cafcdb1SOlivier Moysan              minItems: 1
4806cafcdb1SOlivier Moysan              maxItems: 19
4816cafcdb1SOlivier Moysan              items:
4826cafcdb1SOlivier Moysan                minimum: 0
4836cafcdb1SOlivier Moysan                maximum: 18
4846cafcdb1SOlivier Moysan
4856cafcdb1SOlivier Moysan            st,min-sample-time-nsecs:
4866cafcdb1SOlivier Moysan              minItems: 1
4876cafcdb1SOlivier Moysan              maxItems: 19
4886cafcdb1SOlivier Moysan              items:
4896cafcdb1SOlivier Moysan                minimum: 40
490a8cf1723SFabrice Gasnier    additionalProperties: false
491a8cf1723SFabrice Gasnier
492a8cf1723SFabrice Gasnier    required:
493a8cf1723SFabrice Gasnier      - compatible
494a8cf1723SFabrice Gasnier      - reg
495a8cf1723SFabrice Gasnier      - interrupts
496a8cf1723SFabrice Gasnier      - '#io-channel-cells'
497a8cf1723SFabrice Gasnier
498a8cf1723SFabrice Gasnierexamples:
499a8cf1723SFabrice Gasnier  - |
500a8cf1723SFabrice Gasnier    // Example 1: with stm32f429, ADC1, single-ended channel 8
501a8cf1723SFabrice Gasnier      adc123: adc@40012000 {
502a8cf1723SFabrice Gasnier        compatible = "st,stm32f4-adc-core";
503a8cf1723SFabrice Gasnier        reg = <0x40012000 0x400>;
504a8cf1723SFabrice Gasnier        interrupts = <18>;
505a8cf1723SFabrice Gasnier        clocks = <&rcc 0 168>;
506a8cf1723SFabrice Gasnier        clock-names = "adc";
507a8cf1723SFabrice Gasnier        st,max-clk-rate-hz = <36000000>;
508a8cf1723SFabrice Gasnier        vdda-supply = <&vdda>;
509a8cf1723SFabrice Gasnier        vref-supply = <&vref>;
510a8cf1723SFabrice Gasnier        interrupt-controller;
511a8cf1723SFabrice Gasnier        #interrupt-cells = <1>;
512a8cf1723SFabrice Gasnier        #address-cells = <1>;
513a8cf1723SFabrice Gasnier        #size-cells = <0>;
514a8cf1723SFabrice Gasnier        adc@0 {
515a8cf1723SFabrice Gasnier          compatible = "st,stm32f4-adc";
516a8cf1723SFabrice Gasnier          #io-channel-cells = <1>;
517a8cf1723SFabrice Gasnier          reg = <0x0>;
518a8cf1723SFabrice Gasnier          clocks = <&rcc 0 168>;
519a8cf1723SFabrice Gasnier          interrupt-parent = <&adc123>;
520a8cf1723SFabrice Gasnier          interrupts = <0>;
521a8cf1723SFabrice Gasnier          st,adc-channels = <8>;
522a8cf1723SFabrice Gasnier          dmas = <&dma2 0 0 0x400 0x0>;
523a8cf1723SFabrice Gasnier          dma-names = "rx";
524a8cf1723SFabrice Gasnier          assigned-resolution-bits = <8>;
525a8cf1723SFabrice Gasnier        };
526a8cf1723SFabrice Gasnier        // ...
527a8cf1723SFabrice Gasnier        // other adc child nodes follow...
528a8cf1723SFabrice Gasnier      };
529a8cf1723SFabrice Gasnier
530a8cf1723SFabrice Gasnier  - |
531a8cf1723SFabrice Gasnier    // Example 2: with stm32mp157c to setup ADC1 with:
532a8cf1723SFabrice Gasnier    // - channels 0 & 1 as single-ended
533a8cf1723SFabrice Gasnier    // - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
534a8cf1723SFabrice Gasnier      #include <dt-bindings/interrupt-controller/arm-gic.h>
535a8cf1723SFabrice Gasnier      #include <dt-bindings/clock/stm32mp1-clks.h>
536a8cf1723SFabrice Gasnier      adc12: adc@48003000 {
537a8cf1723SFabrice Gasnier        compatible = "st,stm32mp1-adc-core";
538a8cf1723SFabrice Gasnier        reg = <0x48003000 0x400>;
539a8cf1723SFabrice Gasnier        interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
540a8cf1723SFabrice Gasnier                     <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
541a8cf1723SFabrice Gasnier        clocks = <&rcc ADC12>, <&rcc ADC12_K>;
542a8cf1723SFabrice Gasnier        clock-names = "bus", "adc";
543a8cf1723SFabrice Gasnier        booster-supply = <&booster>;
544a8cf1723SFabrice Gasnier        vdd-supply = <&vdd>;
545a8cf1723SFabrice Gasnier        vdda-supply = <&vdda>;
546a8cf1723SFabrice Gasnier        vref-supply = <&vref>;
547a8cf1723SFabrice Gasnier        st,syscfg = <&syscfg>;
548a8cf1723SFabrice Gasnier        interrupt-controller;
549a8cf1723SFabrice Gasnier        #interrupt-cells = <1>;
550a8cf1723SFabrice Gasnier        #address-cells = <1>;
551a8cf1723SFabrice Gasnier        #size-cells = <0>;
552a8cf1723SFabrice Gasnier        adc@0 {
553a8cf1723SFabrice Gasnier          compatible = "st,stm32mp1-adc";
554a8cf1723SFabrice Gasnier          #io-channel-cells = <1>;
555a8cf1723SFabrice Gasnier          reg = <0x0>;
556a8cf1723SFabrice Gasnier          interrupt-parent = <&adc12>;
557a8cf1723SFabrice Gasnier          interrupts = <0>;
558a8cf1723SFabrice Gasnier          st,adc-channels = <0 1>;
559a8cf1723SFabrice Gasnier          st,adc-diff-channels = <2 6>, <3 7>;
560a8cf1723SFabrice Gasnier          st,min-sample-time-nsecs = <5000>;
561a8cf1723SFabrice Gasnier          dmas = <&dmamux1 9 0x400 0x05>;
562a8cf1723SFabrice Gasnier          dma-names = "rx";
563a8cf1723SFabrice Gasnier        };
564a8cf1723SFabrice Gasnier        // ...
565a8cf1723SFabrice Gasnier        // other adc child node follow...
566a8cf1723SFabrice Gasnier      };
567a8cf1723SFabrice Gasnier
568664b9879SOlivier Moysan  - |
569664b9879SOlivier Moysan    // Example 3: with stm32mp157c to setup ADC2 with:
570664b9879SOlivier Moysan    // - internal channels 13, 14, 15.
571664b9879SOlivier Moysan      #include <dt-bindings/interrupt-controller/arm-gic.h>
572664b9879SOlivier Moysan      #include <dt-bindings/clock/stm32mp1-clks.h>
573664b9879SOlivier Moysan      adc122: adc@48003000 {
574664b9879SOlivier Moysan        compatible = "st,stm32mp1-adc-core";
575664b9879SOlivier Moysan        reg = <0x48003000 0x400>;
576664b9879SOlivier Moysan        interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
577664b9879SOlivier Moysan                     <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
578664b9879SOlivier Moysan        clocks = <&rcc ADC12>, <&rcc ADC12_K>;
579664b9879SOlivier Moysan        clock-names = "bus", "adc";
580664b9879SOlivier Moysan        booster-supply = <&booster>;
581664b9879SOlivier Moysan        vdd-supply = <&vdd>;
582664b9879SOlivier Moysan        vdda-supply = <&vdda>;
583664b9879SOlivier Moysan        vref-supply = <&vref>;
584664b9879SOlivier Moysan        st,syscfg = <&syscfg>;
585664b9879SOlivier Moysan        interrupt-controller;
586664b9879SOlivier Moysan        #interrupt-cells = <1>;
587664b9879SOlivier Moysan        #address-cells = <1>;
588664b9879SOlivier Moysan        #size-cells = <0>;
589664b9879SOlivier Moysan        adc@100 {
590664b9879SOlivier Moysan          compatible = "st,stm32mp1-adc";
591664b9879SOlivier Moysan          #io-channel-cells = <1>;
592664b9879SOlivier Moysan          reg = <0x100>;
593664b9879SOlivier Moysan          interrupts = <1>;
594664b9879SOlivier Moysan          #address-cells = <1>;
595664b9879SOlivier Moysan          #size-cells = <0>;
596664b9879SOlivier Moysan          channel@13 {
597664b9879SOlivier Moysan            reg = <13>;
598664b9879SOlivier Moysan            label = "vrefint";
599664b9879SOlivier Moysan            st,min-sample-time-ns = <9000>;
600664b9879SOlivier Moysan          };
601664b9879SOlivier Moysan          channel@14 {
602664b9879SOlivier Moysan            reg = <14>;
603664b9879SOlivier Moysan            label = "vddcore";
604664b9879SOlivier Moysan            st,min-sample-time-ns = <9000>;
605664b9879SOlivier Moysan          };
606664b9879SOlivier Moysan          channel@15 {
607664b9879SOlivier Moysan            reg = <15>;
608664b9879SOlivier Moysan            label = "vbat";
609664b9879SOlivier Moysan            st,min-sample-time-ns = <9000>;
610664b9879SOlivier Moysan          };
611664b9879SOlivier Moysan        };
612664b9879SOlivier Moysan      };
613664b9879SOlivier Moysan
614a8cf1723SFabrice Gasnier...
615