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
47 Core can use up to two clocks, depending on part used:
48 - "adc" clock: for the analog circuitry, common to all ADCs.
49 It's required on stm32f4.
50 It's optional on stm32h7 and stm32mp1.
51 - "bus" clock: for registers access, common to all ADCs.
52 It's not present on stm32f4.
53 It's required on stm32h7 and stm32mp1.
59 Allow to specify desired max clock rate used by analog circuitry.
62 description: Phandle to the vdda input analog voltage.
65 description: Phandle to the vref input analog reference voltage.
69 Phandle to the embedded booster regulator that can be used to supply ADC
70 analog input switches on stm32h7 and stm32mp1.
74 Phandle to the vdd input voltage. It can be used to supply ADC analog
75 input switches on stm32mp1.
79 Phandle to system configuration controller. It can be used to control the
80 analog circuitry on stm32mp1.
81 $ref: "/schemas/types.yaml#/definitions/phandle-array"
83 interrupt-controller: true
99 const: st,stm32f4-adc-core
111 - description: interrupt line common for all ADCs
118 booster-supply: false
128 const: st,stm32h7-adc-core
145 - description: interrupt line common for all ADCs
160 const: st,stm32mp1-adc-core
177 - description: interrupt line for ADC1
178 - description: interrupt line for ADC2
185 additionalProperties: false
195 - interrupt-controller
204 An ADC block node should contain at least one subnode, representing an
205 ADC instance available on the machine.
216 Offset of ADC instance in ADC block. Valid values are:
219 - 0x200: ADC3 (stm32f4 only)
227 IRQ Line for the ADC instance. Valid values are:
230 - 2 for adc@200 (stm32f4 only)
235 Input clock private to this ADC instance. It's required only on
236 stm32f4, that has per instance clock input for registers access.
240 description: RX DMA Channel
246 assigned-resolution-bits:
248 Resolution (bits) to use for conversions:
249 - can be 6, 8, 10 or 12 on stm32f4
250 - can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
254 List of single-ended channels muxed for this ADC. It can have up to:
255 - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
256 - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
258 $ref: /schemas/types.yaml#/definitions/uint32-array
260 st,adc-diff-channels:
262 List of differential channels muxed for this ADC. Some channels can
263 be configured as differential instead of single-ended on stm32h7 and
264 on stm32mp1. Positive and negative inputs pairs are listed:
265 <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
267 Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
268 required. Both properties can be used together. Some channels can be
269 used as single-ended and some other ones as differential (mixed). But
270 channels can't be configured both as single-ended and differential.
271 $ref: /schemas/types.yaml#/definitions/uint32-matrix
275 "vinp" indicates positive input number
279 "vinn" indicates negative input number
283 st,min-sample-time-nsecs:
285 Minimum sampling time in nanoseconds. Depending on hardware (board)
286 e.g. high/low analog input source impedance, fine tune of ADC
287 sampling time may be recommended. This can be either one value or an
288 array that matches "st,adc-channels" and/or "st,adc-diff-channels"
289 list, to set sample time resp. for all channels, or independently for
291 $ref: /schemas/types.yaml#/definitions/uint32-array
298 const: st,stm32f4-adc
312 assigned-resolution-bits:
323 st,adc-diff-channels: false
325 st,min-sample-time-nsecs:
353 assigned-resolution-bits:
354 enum: [8, 10, 12, 14, 16]
364 st,min-sample-time-nsecs:
370 additionalProperties: false
376 - st,adc-diff-channels
382 - '#io-channel-cells'
386 // Example 1: with stm32f429, ADC1, single-ended channel 8
387 adc123: adc@40012000 {
388 compatible = "st,stm32f4-adc-core";
389 reg = <0x40012000 0x400>;
391 clocks = <&rcc 0 168>;
393 st,max-clk-rate-hz = <36000000>;
394 vdda-supply = <&vdda>;
395 vref-supply = <&vref>;
396 interrupt-controller;
397 #interrupt-cells = <1>;
398 #address-cells = <1>;
401 compatible = "st,stm32f4-adc";
402 #io-channel-cells = <1>;
404 clocks = <&rcc 0 168>;
405 interrupt-parent = <&adc123>;
407 st,adc-channels = <8>;
408 dmas = <&dma2 0 0 0x400 0x0>;
410 assigned-resolution-bits = <8>;
413 // other adc child nodes follow...
417 // Example 2: with stm32mp157c to setup ADC1 with:
418 // - channels 0 & 1 as single-ended
419 // - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
420 #include <dt-bindings/interrupt-controller/arm-gic.h>
421 #include <dt-bindings/clock/stm32mp1-clks.h>
422 adc12: adc@48003000 {
423 compatible = "st,stm32mp1-adc-core";
424 reg = <0x48003000 0x400>;
425 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
426 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
427 clocks = <&rcc ADC12>, <&rcc ADC12_K>;
428 clock-names = "bus", "adc";
429 booster-supply = <&booster>;
431 vdda-supply = <&vdda>;
432 vref-supply = <&vref>;
433 st,syscfg = <&syscfg>;
434 interrupt-controller;
435 #interrupt-cells = <1>;
436 #address-cells = <1>;
439 compatible = "st,stm32mp1-adc";
440 #io-channel-cells = <1>;
442 interrupt-parent = <&adc12>;
444 st,adc-channels = <0 1>;
445 st,adc-diff-channels = <2 6>, <3 7>;
446 st,min-sample-time-nsecs = <5000>;
447 dmas = <&dmamux1 9 0x400 0x05>;
451 // other adc child node follow...