summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
blob: e35f9f1b320042c6b89714d32d3998db58e2a4e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
STMicroelectronics STM32 ADC device driver

STM32 ADC is a successive approximation analog-to-digital converter.
It has several multiplexed input channels. Conversions can be performed
in single, continuous, scan or discontinuous mode. Result of the ADC is
stored in a left-aligned or right-aligned 32-bit data register.
Conversions can be launched in software or using hardware triggers.

The analog watchdog feature allows the application to detect if the input
voltage goes beyond the user-defined, higher or lower thresholds.

Each STM32 ADC block can have up to 3 ADC instances.

Each instance supports two contexts to manage conversions, each one has its
own configurable sequence and trigger:
- regular conversion can be done in sequence, running in background
- injected conversions have higher priority, and so have the ability to
  interrupt regular conversion sequence (either triggered in SW or HW).
  Regular sequence is resumed, in case it has been interrupted.

Contents of a stm32 adc root node:
-----------------------------------
Required properties:
- compatible: Should be "st,stm32f4-adc-core".
- reg: Offset and length of the ADC block register set.
- interrupts: Must contain the interrupt for ADC block.
- clocks: Clock for the analog circuitry (common to all ADCs).
- clock-names: Must be "adc".
- interrupt-controller: Identifies the controller node as interrupt-parent
- vref-supply: Phandle to the vref input analog reference voltage.
- #interrupt-cells = <1>;
- #address-cells = <1>;
- #size-cells = <0>;

Optional properties:
- A pinctrl state named "default" for each ADC channel may be defined to set
  inX ADC pins in mode of operation for analog input on external pin.

Contents of a stm32 adc child node:
-----------------------------------
An ADC block node should contain at least one subnode, representing an
ADC instance available on the machine.

Required properties:
- compatible: Should be "st,stm32f4-adc".
- reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
- clocks: Input clock private to this ADC instance.
- interrupt-parent: Phandle to the parent interrupt controller.
- interrupts: IRQ Line for the ADC (e.g. may be 0 for adc@0, 1 for adc@100 or
  2 for adc@200).
- st,adc-channels: List of single-ended channels muxed for this ADC.
  It can have up to 16 channels, numbered from 0 to 15 (resp. for in0..in15).
- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
  Documentation/devicetree/bindings/iio/iio-bindings.txt

Optional properties:
- dmas: Phandle to dma channel for this ADC instance.
  See ../../dma/dma.txt for details.
- dma-names: Must be "rx" when dmas property is being used.
- assigned-resolution-bits: Resolution (bits) to use for conversions. Must
  match device available resolutions (e.g. can be 6, 8, 10 or 12 on stm32f4).
  Default is maximum resolution if unset.

Example:
	adc: adc@40012000 {
		compatible = "st,stm32f4-adc-core";
		reg = <0x40012000 0x400>;
		interrupts = <18>;
		clocks = <&rcc 0 168>;
		clock-names = "adc";
		vref-supply = <&reg_vref>;
		interrupt-controller;
		pinctrl-names = "default";
		pinctrl-0 = <&adc3_in8_pin>;

		#interrupt-cells = <1>;
		#address-cells = <1>;
		#size-cells = <0>;

		adc@0 {
			compatible = "st,stm32f4-adc";
			#io-channel-cells = <1>;
			reg = <0x0>;
			clocks = <&rcc 0 168>;
			interrupt-parent = <&adc>;
			interrupts = <0>;
			st,adc-channels = <8>;
			dmas = <&dma2 0 0 0x400 0x0>;
			dma-names = "rx";
			assigned-resolution-bits = <8>;
		};
		...
		other adc child nodes follow...
	};