1 STMicroelectronics STM32 ADC device driver
3 STM32 ADC is a successive approximation analog-to-digital converter.
4 It has several multiplexed input channels. Conversions can be performed
5 in single, continuous, scan or discontinuous mode. Result of the ADC is
6 stored in a left-aligned or right-aligned 32-bit data register.
7 Conversions can be launched in software or using hardware triggers.
9 The analog watchdog feature allows the application to detect if the input
10 voltage goes beyond the user-defined, higher or lower thresholds.
12 Each STM32 ADC block can have up to 3 ADC instances.
14 Each instance supports two contexts to manage conversions, each one has its
15 own configurable sequence and trigger:
16 - regular conversion can be done in sequence, running in background
17 - injected conversions have higher priority, and so have the ability to
18 interrupt regular conversion sequence (either triggered in SW or HW).
19 Regular sequence is resumed, in case it has been interrupted.
21 Contents of a stm32 adc root node:
22 -----------------------------------
24 - compatible: Should be one of:
27 "st,stm32mp1-adc-core"
28 - reg: Offset and length of the ADC block register set.
29 - interrupts: One or more interrupts for ADC block. Some parts like stm32f4
30 and stm32h7 share a common ADC interrupt line. stm32mp1 has two separate
31 interrupt lines, one for each ADC within ADC block.
32 - clocks: Core can use up to two clocks, depending on part used:
33 - "adc" clock: for the analog circuitry, common to all ADCs.
34 It's required on stm32f4.
35 It's optional on stm32h7.
36 - "bus" clock: for registers access, common to all ADCs.
37 It's not present on stm32f4.
38 It's required on stm32h7.
39 - clock-names: Must be "adc" and/or "bus" depending on part used.
40 - interrupt-controller: Identifies the controller node as interrupt-parent
41 - vdda-supply: Phandle to the vdda input analog voltage.
42 - vref-supply: Phandle to the vref input analog reference voltage.
43 - #interrupt-cells = <1>;
44 - #address-cells = <1>;
48 - A pinctrl state named "default" for each ADC channel may be defined to set
49 inX ADC pins in mode of operation for analog input on external pin.
50 - booster-supply: Phandle to the embedded booster regulator that can be used
51 to supply ADC analog input switches on stm32h7 and stm32mp1.
52 - vdd-supply: Phandle to the vdd input voltage. It can be used to supply ADC
53 analog input switches on stm32mp1.
54 - st,syscfg: Phandle to system configuration controller. It can be used to
55 control the analog circuitry on stm32mp1.
56 - st,max-clk-rate-hz: Allow to specify desired max clock rate used by analog
59 Contents of a stm32 adc child node:
60 -----------------------------------
61 An ADC block node should contain at least one subnode, representing an
62 ADC instance available on the machine.
65 - compatible: Should be one of:
69 - reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
70 - clocks: Input clock private to this ADC instance. It's required only on
71 stm32f4, that has per instance clock input for registers access.
72 - interrupts: IRQ Line for the ADC (e.g. may be 0 for adc@0, 1 for adc@100 or
74 - st,adc-channels: List of single-ended channels muxed for this ADC.
75 It can have up to 16 channels on stm32f4 or 20 channels on stm32h7, numbered
76 from 0 to 15 or 19 (resp. for in0..in15 or in0..in19).
77 - st,adc-diff-channels: List of differential channels muxed for this ADC.
78 Depending on part used, some channels can be configured as differential
79 instead of single-ended (e.g. stm32h7). List here positive and negative
80 inputs pairs as <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered
81 from 0 to 19 on stm32h7)
82 Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is required.
83 Both properties can be used together. Some channels can be used as
84 single-ended and some other ones as differential (mixed). But channels
85 can't be configured both as single-ended and differential (invalid).
86 - #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
87 Documentation/devicetree/bindings/iio/iio-bindings.txt
90 - dmas: Phandle to dma channel for this ADC instance.
91 See ../../dma/dma.txt for details.
92 - dma-names: Must be "rx" when dmas property is being used.
93 - assigned-resolution-bits: Resolution (bits) to use for conversions. Must
94 match device available resolutions:
95 * can be 6, 8, 10 or 12 on stm32f4
96 * can be 8, 10, 12, 14 or 16 on stm32h7
97 Default is maximum resolution if unset.
98 - st,min-sample-time-nsecs: Minimum sampling time in nanoseconds.
99 Depending on hardware (board) e.g. high/low analog input source impedance,
100 fine tune of ADC sampling time may be recommended.
101 This can be either one value or an array that matches 'st,adc-channels' list,
102 to set sample time resp. for all channels, or independently for each channel.
106 compatible = "st,stm32f4-adc-core";
107 reg = <0x40012000 0x400>;
109 clocks = <&rcc 0 168>;
111 vref-supply = <®_vref>;
112 interrupt-controller;
113 pinctrl-names = "default";
114 pinctrl-0 = <&adc3_in8_pin>;
116 #interrupt-cells = <1>;
117 #address-cells = <1>;
121 compatible = "st,stm32f4-adc";
122 #io-channel-cells = <1>;
124 clocks = <&rcc 0 168>;
125 interrupt-parent = <&adc>;
127 st,adc-channels = <8>;
128 dmas = <&dma2 0 0 0x400 0x0>;
130 assigned-resolution-bits = <8>;
133 other adc child nodes follow...
137 - channel 1 as single-ended
138 - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
141 compatible = "st,stm32h7-adc-core";
144 compatible = "st,stm32h7-adc";
146 st,adc-channels = <1>;
147 st,adc-diff-channels = <2 6>, <3 7>;