1 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
4 $id: "http://devicetree.org/schemas/bindings/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.
80 - $ref: "/schemas/types.yaml#/definitions/phandle-array"
82 interrupt-controller: true
98 const: st,stm32f4-adc-core
110 - description: interrupt line common for all ADCs
117 booster-supply: false
127 const: st,stm32h7-adc-core
144 - description: interrupt line common for all ADCs
159 const: st,stm32mp1-adc-core
176 - description: interrupt line for ADC1
177 - description: interrupt line for ADC2
184 additionalProperties: false
194 - interrupt-controller
203 An ADC block node should contain at least one subnode, representing an
204 ADC instance available on the machine.
215 Offset of ADC instance in ADC block. Valid values are:
218 - 0x200: ADC3 (stm32f4 only)
226 IRQ Line for the ADC instance. Valid values are:
229 - 2 for adc@200 (stm32f4 only)
234 Input clock private to this ADC instance. It's required only on
235 stm32f4, that has per instance clock input for registers access.
239 description: RX DMA Channel
245 assigned-resolution-bits:
247 Resolution (bits) to use for conversions:
248 - can be 6, 8, 10 or 12 on stm32f4
249 - can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
251 - $ref: /schemas/types.yaml#/definitions/uint32
255 List of single-ended channels muxed for this ADC. It can have up to:
256 - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
257 - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
260 - $ref: /schemas/types.yaml#/definitions/uint32-array
262 st,adc-diff-channels:
264 List of differential channels muxed for this ADC. Some channels can
265 be configured as differential instead of single-ended on stm32h7 and
266 on stm32mp1. Positive and negative inputs pairs are listed:
267 <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
269 Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
270 required. Both properties can be used together. Some channels can be
271 used as single-ended and some other ones as differential (mixed). But
272 channels can't be configured both as single-ended and differential.
274 - $ref: /schemas/types.yaml#/definitions/uint32-matrix
278 "vinp" indicates positive input number
282 "vinn" indicates negative input number
286 st,min-sample-time-nsecs:
288 Minimum sampling time in nanoseconds. Depending on hardware (board)
289 e.g. high/low analog input source impedance, fine tune of ADC
290 sampling time may be recommended. This can be either one value or an
291 array that matches "st,adc-channels" and/or "st,adc-diff-channels"
292 list, to set sample time resp. for all channels, or independently for
295 - $ref: /schemas/types.yaml#/definitions/uint32-array
302 const: st,stm32f4-adc
316 assigned-resolution-bits:
327 st,adc-diff-channels: false
329 st,min-sample-time-nsecs:
357 assigned-resolution-bits:
358 enum: [8, 10, 12, 14, 16]
368 st,min-sample-time-nsecs:
374 additionalProperties: false
380 - st,adc-diff-channels
386 - '#io-channel-cells'
390 // Example 1: with stm32f429, ADC1, single-ended channel 8
391 adc123: adc@40012000 {
392 compatible = "st,stm32f4-adc-core";
393 reg = <0x40012000 0x400>;
395 clocks = <&rcc 0 168>;
397 st,max-clk-rate-hz = <36000000>;
398 vdda-supply = <&vdda>;
399 vref-supply = <&vref>;
400 interrupt-controller;
401 #interrupt-cells = <1>;
402 #address-cells = <1>;
405 compatible = "st,stm32f4-adc";
406 #io-channel-cells = <1>;
408 clocks = <&rcc 0 168>;
409 interrupt-parent = <&adc123>;
411 st,adc-channels = <8>;
412 dmas = <&dma2 0 0 0x400 0x0>;
414 assigned-resolution-bits = <8>;
417 // other adc child nodes follow...
421 // Example 2: with stm32mp157c to setup ADC1 with:
422 // - channels 0 & 1 as single-ended
423 // - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
424 #include <dt-bindings/interrupt-controller/arm-gic.h>
425 #include <dt-bindings/clock/stm32mp1-clks.h>
426 adc12: adc@48003000 {
427 compatible = "st,stm32mp1-adc-core";
428 reg = <0x48003000 0x400>;
429 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
430 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
431 clocks = <&rcc ADC12>, <&rcc ADC12_K>;
432 clock-names = "bus", "adc";
433 booster-supply = <&booster>;
435 vdda-supply = <&vdda>;
436 vref-supply = <&vref>;
437 st,syscfg = <&syscfg>;
438 interrupt-controller;
439 #interrupt-cells = <1>;
440 #address-cells = <1>;
443 compatible = "st,stm32mp1-adc";
444 #io-channel-cells = <1>;
446 interrupt-parent = <&adc12>;
448 st,adc-channels = <0 1>;
449 st,adc-diff-channels = <2 6>, <3 7>;
450 st,min-sample-time-nsecs = <5000>;
451 dmas = <&dmamux1 9 0x400 0x05>;
455 // other adc child node follow...