1 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
4 $id: "http://devicetree.org/schemas/iio/adc/st,stm32-adc.yaml#"
5 $schema: "http://devicetree.org/meta-schemas/core.yaml#"
7 title: STMicroelectronics STM32 ADC bindings
10 STM32 ADC is a successive approximation analog-to-digital converter.
11 It has several multiplexed input channels. Conversions can be performed
12 in single, continuous, scan or discontinuous mode. Result of the ADC is
13 stored in a left-aligned or right-aligned 32-bit data register.
14 Conversions can be launched in software or using hardware triggers.
16 The analog watchdog feature allows the application to detect if the input
17 voltage goes beyond the user-defined, higher or lower thresholds.
19 Each STM32 ADC block can have up to 3 ADC instances.
22 - Fabrice Gasnier <fabrice.gasnier@st.com>
29 - st,stm32mp1-adc-core
36 One or more interrupts for ADC block, depending on part used:
37 - stm32f4 and stm32h7 share a common ADC interrupt line.
38 - stm32mp1 has two separate interrupt lines, one for each ADC within
45 Core can use up to two clocks, depending on part used:
46 - "adc" clock: for the analog circuitry, common to all ADCs.
47 It's required on stm32f4.
48 It's optional on stm32h7 and stm32mp1.
49 - "bus" clock: for registers access, common to all ADCs.
50 It's not present on stm32f4.
51 It's required on stm32h7 and stm32mp1.
57 Allow to specify desired max clock rate used by analog circuitry.
60 description: Phandle to the vdda input analog voltage.
63 description: Phandle to the vref input analog reference voltage.
67 Phandle to the embedded booster regulator that can be used to supply ADC
68 analog input switches on stm32h7 and stm32mp1.
72 Phandle to the vdd input voltage. It can be used to supply ADC analog
73 input switches on stm32mp1.
77 Phandle to system configuration controller. It can be used to control the
78 analog circuitry on stm32mp1.
79 $ref: "/schemas/types.yaml#/definitions/phandle-array"
81 interrupt-controller: true
97 const: st,stm32f4-adc-core
109 - description: interrupt line common for all ADCs
116 booster-supply: false
126 const: st,stm32h7-adc-core
143 - description: interrupt line common for all ADCs
158 const: st,stm32mp1-adc-core
175 - description: interrupt line for ADC1
176 - description: interrupt line for ADC2
183 additionalProperties: false
193 - interrupt-controller
202 An ADC block node should contain at least one subnode, representing an
203 ADC instance available on the machine.
214 Offset of ADC instance in ADC block. Valid values are:
217 - 0x200: ADC3 (stm32f4 only)
225 IRQ Line for the ADC instance. Valid values are:
228 - 2 for adc@200 (stm32f4 only)
233 Input clock private to this ADC instance. It's required only on
234 stm32f4, that has per instance clock input for registers access.
238 description: RX DMA Channel
244 assigned-resolution-bits:
246 Resolution (bits) to use for conversions:
247 - can be 6, 8, 10 or 12 on stm32f4
248 - can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
249 $ref: /schemas/types.yaml#/definitions/uint32
253 List of single-ended channels muxed for this ADC. It can have up to:
254 - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
255 - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
257 $ref: /schemas/types.yaml#/definitions/uint32-array
259 st,adc-diff-channels:
261 List of differential channels muxed for this ADC. Some channels can
262 be configured as differential instead of single-ended on stm32h7 and
263 on stm32mp1. Positive and negative inputs pairs are listed:
264 <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
266 Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
267 required. Both properties can be used together. Some channels can be
268 used as single-ended and some other ones as differential (mixed). But
269 channels can't be configured both as single-ended and differential.
270 $ref: /schemas/types.yaml#/definitions/uint32-matrix
274 "vinp" indicates positive input number
278 "vinn" indicates negative input number
282 st,min-sample-time-nsecs:
284 Minimum sampling time in nanoseconds. Depending on hardware (board)
285 e.g. high/low analog input source impedance, fine tune of ADC
286 sampling time may be recommended. This can be either one value or an
287 array that matches "st,adc-channels" and/or "st,adc-diff-channels"
288 list, to set sample time resp. for all channels, or independently for
290 $ref: /schemas/types.yaml#/definitions/uint32-array
297 const: st,stm32f4-adc
311 assigned-resolution-bits:
322 st,adc-diff-channels: false
324 st,min-sample-time-nsecs:
352 assigned-resolution-bits:
353 enum: [8, 10, 12, 14, 16]
363 st,min-sample-time-nsecs:
369 additionalProperties: false
375 - st,adc-diff-channels
381 - '#io-channel-cells'
385 // Example 1: with stm32f429, ADC1, single-ended channel 8
386 adc123: adc@40012000 {
387 compatible = "st,stm32f4-adc-core";
388 reg = <0x40012000 0x400>;
390 clocks = <&rcc 0 168>;
392 st,max-clk-rate-hz = <36000000>;
393 vdda-supply = <&vdda>;
394 vref-supply = <&vref>;
395 interrupt-controller;
396 #interrupt-cells = <1>;
397 #address-cells = <1>;
400 compatible = "st,stm32f4-adc";
401 #io-channel-cells = <1>;
403 clocks = <&rcc 0 168>;
404 interrupt-parent = <&adc123>;
406 st,adc-channels = <8>;
407 dmas = <&dma2 0 0 0x400 0x0>;
409 assigned-resolution-bits = <8>;
412 // other adc child nodes follow...
416 // Example 2: with stm32mp157c to setup ADC1 with:
417 // - channels 0 & 1 as single-ended
418 // - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
419 #include <dt-bindings/interrupt-controller/arm-gic.h>
420 #include <dt-bindings/clock/stm32mp1-clks.h>
421 adc12: adc@48003000 {
422 compatible = "st,stm32mp1-adc-core";
423 reg = <0x48003000 0x400>;
424 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
425 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
426 clocks = <&rcc ADC12>, <&rcc ADC12_K>;
427 clock-names = "bus", "adc";
428 booster-supply = <&booster>;
430 vdda-supply = <&vdda>;
431 vref-supply = <&vref>;
432 st,syscfg = <&syscfg>;
433 interrupt-controller;
434 #interrupt-cells = <1>;
435 #address-cells = <1>;
438 compatible = "st,stm32mp1-adc";
439 #io-channel-cells = <1>;
441 interrupt-parent = <&adc12>;
443 st,adc-channels = <0 1>;
444 st,adc-diff-channels = <2 6>, <3 7>;
445 st,min-sample-time-nsecs = <5000>;
446 dmas = <&dmamux1 9 0x400 0x05>;
450 // other adc child node follow...