]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[karo-tx-linux.git] / Documentation / devicetree / bindings / iio / adc / st,stm32-adc.txt
1 STMicroelectronics STM32 ADC device driver
2
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.
8
9 The analog watchdog feature allows the application to detect if the input
10 voltage goes beyond the user-defined, higher or lower thresholds.
11
12 Each STM32 ADC block can have up to 3 ADC instances.
13
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.
20
21 Contents of a stm32 adc root node:
22 -----------------------------------
23 Required properties:
24 - compatible: Should be one of:
25   "st,stm32f4-adc-core"
26   "st,stm32h7-adc-core"
27 - reg: Offset and length of the ADC block register set.
28 - interrupts: Must contain the interrupt for ADC block.
29 - clocks: Core can use up to two clocks, depending on part used:
30   - "adc" clock: for the analog circuitry, common to all ADCs.
31     It's required on stm32f4.
32     It's optional on stm32h7.
33   - "bus" clock: for registers access, common to all ADCs.
34     It's not present on stm32f4.
35     It's required on stm32h7.
36 - clock-names: Must be "adc" and/or "bus" depending on part used.
37 - interrupt-controller: Identifies the controller node as interrupt-parent
38 - vref-supply: Phandle to the vref input analog reference voltage.
39 - #interrupt-cells = <1>;
40 - #address-cells = <1>;
41 - #size-cells = <0>;
42
43 Optional properties:
44 - A pinctrl state named "default" for each ADC channel may be defined to set
45   inX ADC pins in mode of operation for analog input on external pin.
46
47 Contents of a stm32 adc child node:
48 -----------------------------------
49 An ADC block node should contain at least one subnode, representing an
50 ADC instance available on the machine.
51
52 Required properties:
53 - compatible: Should be one of:
54   "st,stm32f4-adc"
55   "st,stm32h7-adc"
56 - reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
57 - clocks: Input clock private to this ADC instance. It's required only on
58   stm32f4, that has per instance clock input for registers access.
59 - interrupt-parent: Phandle to the parent interrupt controller.
60 - interrupts: IRQ Line for the ADC (e.g. may be 0 for adc@0, 1 for adc@100 or
61   2 for adc@200).
62 - st,adc-channels: List of single-ended channels muxed for this ADC.
63   It can have up to 16 channels on stm32f4 or 20 channels on stm32h7, numbered
64   from 0 to 15 or 19 (resp. for in0..in15 or in0..in19).
65 - #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
66   Documentation/devicetree/bindings/iio/iio-bindings.txt
67
68 Optional properties:
69 - dmas: Phandle to dma channel for this ADC instance.
70   See ../../dma/dma.txt for details.
71 - dma-names: Must be "rx" when dmas property is being used.
72 - assigned-resolution-bits: Resolution (bits) to use for conversions. Must
73   match device available resolutions:
74   * can be 6, 8, 10 or 12 on stm32f4
75   * can be 8, 10, 12, 14 or 16 on stm32h7
76   Default is maximum resolution if unset.
77
78 Example:
79         adc: adc@40012000 {
80                 compatible = "st,stm32f4-adc-core";
81                 reg = <0x40012000 0x400>;
82                 interrupts = <18>;
83                 clocks = <&rcc 0 168>;
84                 clock-names = "adc";
85                 vref-supply = <&reg_vref>;
86                 interrupt-controller;
87                 pinctrl-names = "default";
88                 pinctrl-0 = <&adc3_in8_pin>;
89
90                 #interrupt-cells = <1>;
91                 #address-cells = <1>;
92                 #size-cells = <0>;
93
94                 adc@0 {
95                         compatible = "st,stm32f4-adc";
96                         #io-channel-cells = <1>;
97                         reg = <0x0>;
98                         clocks = <&rcc 0 168>;
99                         interrupt-parent = <&adc>;
100                         interrupts = <0>;
101                         st,adc-channels = <8>;
102                         dmas = <&dma2 0 0 0x400 0x0>;
103                         dma-names = "rx";
104                         assigned-resolution-bits = <8>;
105                 };
106                 ...
107                 other adc child nodes follow...
108         };