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
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@foss.st.com>
29 - st,stm32mp1-adc-core
30 - st,stm32mp13-adc-core
37 One or more interrupts for ADC block, depending on part used:
38 - stm32f4 and stm32h7 share a common ADC interrupt line.
39 - stm32mp1 has two separate interrupt lines, one for each ADC within
41 - stm32mp13 has an interrupt line per ADC block.
49 Core can use up to two clocks, depending on part used:
50 - "adc" clock: for the analog circuitry, common to all ADCs.
51 It's required on stm32f4.
52 It's optional on stm32h7 and stm32mp1.
53 - "bus" clock: for registers access, common to all ADCs.
54 It's not present on stm32f4.
55 It's required on stm32h7 and stm32mp1.
61 Allow to specify desired max clock rate used by analog circuitry.
64 description: Phandle to the vdda input analog voltage.
67 description: Phandle to the vref input analog reference voltage.
71 Phandle to the embedded booster regulator that can be used to supply ADC
72 analog input switches on stm32h7 and stm32mp1.
76 Phandle to the vdd input voltage. It can be used to supply ADC analog
77 input switches on stm32mp1.
81 Phandle to system configuration controller. It can be used to control the
82 analog circuitry on stm32mp1.
83 $ref: /schemas/types.yaml#/definitions/phandle-array
85 interrupt-controller: true
101 const: st,stm32f4-adc-core
113 - description: interrupt line common for all ADCs
120 booster-supply: false
130 const: st,stm32h7-adc-core
146 - description: interrupt line common for all ADCs
161 const: st,stm32mp1-adc-core
177 - description: interrupt line for ADC1
178 - description: interrupt line for ADC2
189 const: st,stm32mp13-adc-core
205 - description: ADC interrupt line
212 additionalProperties: false
222 - interrupt-controller
231 An ADC block node should contain at least one subnode, representing an
232 ADC instance available on the machine.
244 Offset of ADC instance in ADC block. Valid values are:
247 - 0x200: ADC3 (stm32f4 only)
261 IRQ Line for the ADC instance. Valid values are:
262 - 0 for adc@0 (single adc for stm32mp13)
264 - 2 for adc@200 (stm32f4 only)
269 Input clock private to this ADC instance. It's required only on
270 stm32f4, that has per instance clock input for registers access.
274 description: RX DMA Channel
280 assigned-resolution-bits:
282 Resolution (bits) to use for conversions:
283 - can be 6, 8, 10 or 12 on stm32f4 and stm32mp13
284 - can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
288 List of single-ended channels muxed for this ADC. It can have up to:
289 - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
290 - 19 channels, numbered from 0 to 18 (for in0..in18) on stm32mp13.
291 - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
293 $ref: /schemas/types.yaml#/definitions/uint32-array
296 st,adc-diff-channels:
298 List of differential channels muxed for this ADC. Some channels can
299 be configured as differential instead of single-ended on stm32h7 and
300 on stm32mp1. Positive and negative inputs pairs are listed:
301 <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
303 Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
304 required if no adc generic channel is defined. These legacy channel
305 properties are exclusive with adc generic channel bindings.
306 Both properties can be used together. Some channels can be
307 used as single-ended and some other ones as differential (mixed). But
308 channels can't be configured both as single-ended and differential.
309 $ref: /schemas/types.yaml#/definitions/uint32-matrix
313 "vinp" indicates positive input number
317 "vinn" indicates negative input number
322 st,min-sample-time-nsecs:
324 Minimum sampling time in nanoseconds. Depending on hardware (board)
325 e.g. high/low analog input source impedance, fine tune of ADC
326 sampling time may be recommended. This can be either one value or an
327 array that matches "st,adc-channels" and/or "st,adc-diff-channels"
328 list, to set sample time resp. for all channels, or independently for
330 $ref: /schemas/types.yaml#/definitions/uint32-array
335 - description: Phandle to the calibration vrefint data provided by otp
342 "^channel@([0-9]|1[0-9])$":
345 description: Represents the external channels which are connected to the ADC.
355 Unique name to identify which channel this is.
356 Reserved label names "vddcore", "vddcpu", "vddq_ddr", "vrefint" and "vbat"
357 are used to identify internal channels with matching names.
360 $ref: /schemas/types.yaml#/definitions/uint32-array
365 st,min-sample-time-ns:
367 Minimum sampling time in nanoseconds. Depending on hardware (board)
368 e.g. high/low analog input source impedance, fine tune of ADC
369 sampling time may be recommended.
374 additionalProperties: false
381 const: st,stm32f4-adc
395 assigned-resolution-bits:
406 st,adc-diff-channels: false
408 st,min-sample-time-nsecs:
436 assigned-resolution-bits:
437 enum: [8, 10, 12, 14, 16]
447 st,min-sample-time-nsecs:
458 const: st,stm32mp13-adc
468 assigned-resolution-bits:
479 st,min-sample-time-nsecs:
484 additionalProperties: false
490 - '#io-channel-cells'
494 // Example 1: with stm32f429, ADC1, single-ended channel 8
495 adc123: adc@40012000 {
496 compatible = "st,stm32f4-adc-core";
497 reg = <0x40012000 0x400>;
499 clocks = <&rcc 0 168>;
501 st,max-clk-rate-hz = <36000000>;
502 vdda-supply = <&vdda>;
503 vref-supply = <&vref>;
504 interrupt-controller;
505 #interrupt-cells = <1>;
506 #address-cells = <1>;
509 compatible = "st,stm32f4-adc";
510 #io-channel-cells = <1>;
512 clocks = <&rcc 0 168>;
513 interrupt-parent = <&adc123>;
515 st,adc-channels = <8>;
516 dmas = <&dma2 0 0 0x400 0x0>;
518 assigned-resolution-bits = <8>;
521 // other adc child nodes follow...
525 // Example 2: with stm32mp157c to setup ADC1 with:
526 // - channels 0 & 1 as single-ended
527 // - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
528 #include <dt-bindings/interrupt-controller/arm-gic.h>
529 #include <dt-bindings/clock/stm32mp1-clks.h>
530 adc12: adc@48003000 {
531 compatible = "st,stm32mp1-adc-core";
532 reg = <0x48003000 0x400>;
533 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
534 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
535 clocks = <&rcc ADC12>, <&rcc ADC12_K>;
536 clock-names = "bus", "adc";
537 booster-supply = <&booster>;
539 vdda-supply = <&vdda>;
540 vref-supply = <&vref>;
541 st,syscfg = <&syscfg>;
542 interrupt-controller;
543 #interrupt-cells = <1>;
544 #address-cells = <1>;
547 compatible = "st,stm32mp1-adc";
548 #io-channel-cells = <1>;
550 interrupt-parent = <&adc12>;
552 st,adc-channels = <0 1>;
553 st,adc-diff-channels = <2 6>, <3 7>;
554 st,min-sample-time-nsecs = <5000>;
555 dmas = <&dmamux1 9 0x400 0x05>;
559 // other adc child node follow...
563 // Example 3: with stm32mp157c to setup ADC2 with:
564 // - internal channels 13, 14, 15.
565 #include <dt-bindings/interrupt-controller/arm-gic.h>
566 #include <dt-bindings/clock/stm32mp1-clks.h>
567 adc122: adc@48003000 {
568 compatible = "st,stm32mp1-adc-core";
569 reg = <0x48003000 0x400>;
570 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
571 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
572 clocks = <&rcc ADC12>, <&rcc ADC12_K>;
573 clock-names = "bus", "adc";
574 booster-supply = <&booster>;
576 vdda-supply = <&vdda>;
577 vref-supply = <&vref>;
578 st,syscfg = <&syscfg>;
579 interrupt-controller;
580 #interrupt-cells = <1>;
581 #address-cells = <1>;
584 compatible = "st,stm32mp1-adc";
585 #io-channel-cells = <1>;
588 #address-cells = <1>;
593 st,min-sample-time-ns = <9000>;
598 st,min-sample-time-ns = <9000>;
603 st,min-sample-time-ns = <9000>;