Merge tag 'upstream-4.16-rc1' of git://git.infradead.org/linux-ubifs
[sfrench/cifs-2.6.git] / Documentation / devicetree / bindings / iio / adc / st,stm32-dfsdm-adc.txt
1 STMicroelectronics STM32 DFSDM ADC device driver
2
3
4 STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to
5 interface external sigma delta modulators to STM32 micro controllers.
6 It is mainly targeted for:
7 - Sigma delta modulators (motor control, metering...)
8 - PDM microphones (audio digital microphone)
9
10 It features up to 8 serial digital interfaces (SPI or Manchester) and
11 up to 4 filters on stm32h7.
12
13 Each child node match with a filter instance.
14
15 Contents of a STM32 DFSDM root node:
16 ------------------------------------
17 Required properties:
18 - compatible: Should be "st,stm32h7-dfsdm".
19 - reg: Offset and length of the DFSDM block register set.
20 - clocks: IP and serial interfaces clocking. Should be set according
21                 to rcc clock ID and "clock-names".
22 - clock-names: Input clock name "dfsdm" must be defined,
23                 "audio" is optional. If defined CLKOUT is based on the audio
24                 clock, else "dfsdm" is used.
25 - #interrupt-cells = <1>;
26 - #address-cells = <1>;
27 - #size-cells = <0>;
28
29 Optional properties:
30 - spi-max-frequency: Requested only for SPI master mode.
31                   SPI clock OUT frequency (Hz). This clock must be set according
32                   to "clock" property. Frequency must be a multiple of the rcc
33                   clock frequency. If not, SPI CLKOUT frequency will not be
34                   accurate.
35
36 Contents of a STM32 DFSDM child nodes:
37 --------------------------------------
38
39 Required properties:
40 - compatible: Must be:
41         "st,stm32-dfsdm-adc" for sigma delta ADCs
42         "st,stm32-dfsdm-dmic" for audio digital microphone.
43 - reg: Specifies the DFSDM filter instance used.
44 - interrupts: IRQ lines connected to each DFSDM filter instance.
45 - st,adc-channels:      List of single-ended channels muxed for this ADC.
46                         valid values:
47                                 "st,stm32h7-dfsdm" compatibility: 0 to 7.
48 - st,adc-channel-names: List of single-ended channel names.
49 - st,filter-order:  SinC filter order from 0 to 5.
50                         0: FastSinC
51                         [1-5]: order 1 to 5.
52                         For audio purpose it is recommended to use order 3 to 5.
53 - #io-channel-cells = <1>: See the IIO bindings section "IIO consumers".
54
55 Required properties for "st,stm32-dfsdm-adc" compatibility:
56 - io-channels: From common IIO binding. Used to pipe external sigma delta
57                 modulator or internal ADC output to DFSDM channel.
58                 This is not required for "st,stm32-dfsdm-pdm" compatibility as
59                 PDM microphone is binded in Audio DT node.
60
61 Required properties for "st,stm32-dfsdm-pdm" compatibility:
62 - #sound-dai-cells: Must be set to 0.
63 - dma: DMA controller phandle and DMA request line associated to the
64                 filter instance (specified by the field "reg")
65 - dma-names: Must be "rx"
66
67 Optional properties:
68 - st,adc-channel-types: Single-ended channel input type.
69                         - "SPI_R": SPI with data on rising edge (default)
70                         - "SPI_F": SPI with data on falling edge
71                         - "MANCH_R": manchester codec, rising edge = logic 0
72                         - "MANCH_F": manchester codec, falling edge = logic 1
73 - st,adc-channel-clk-src: Conversion clock source.
74                           - "CLKIN": external SPI clock (CLKIN x)
75                           - "CLKOUT": internal SPI clock (CLKOUT) (default)
76                           - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
77                           - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
78
79 - st,adc-alt-channel: Must be defined if two sigma delta modulator are
80                           connected on same SPI input.
81                           If not set, channel n is connected to SPI input n.
82                           If set, channel n is connected to SPI input n + 1.
83
84 - st,filter0-sync: Set to 1 to synchronize with DFSDM filter instance 0.
85                    Used for multi microphones synchronization.
86
87 Example of a sigma delta adc connected on DFSDM SPI port 0
88 and a pdm microphone connected on DFSDM SPI port 1:
89
90         ads1202: simple_sd_adc@0 {
91                 compatible = "ads1202";
92                 #io-channel-cells = <1>;
93         };
94
95         dfsdm: dfsdm@40017000 {
96                 compatible = "st,stm32h7-dfsdm";
97                 reg = <0x40017000 0x400>;
98                 clocks = <&rcc DFSDM1_CK>;
99                 clock-names = "dfsdm";
100                 #interrupt-cells = <1>;
101                 #address-cells = <1>;
102                 #size-cells = <0>;
103
104                 dfsdm_adc0: filter@0 {
105                         compatible = "st,stm32-dfsdm-adc";
106                         #io-channel-cells = <1>;
107                         reg = <0>;
108                         interrupts = <110>;
109                         st,adc-channels = <0>;
110                         st,adc-channel-names = "sd_adc0";
111                         st,adc-channel-types = "SPI_F";
112                         st,adc-channel-clk-src = "CLKOUT";
113                         io-channels = <&ads1202 0>;
114                         st,filter-order = <3>;
115                 };
116                 dfsdm_pdm1: filter@1 {
117                         compatible = "st,stm32-dfsdm-dmic";
118                         reg = <1>;
119                         interrupts = <111>;
120                         dmas = <&dmamux1 102 0x400 0x00>;
121                         dma-names = "rx";
122                         st,adc-channels = <1>;
123                         st,adc-channel-names = "dmic1";
124                         st,adc-channel-types = "SPI_R";
125                         st,adc-channel-clk-src = "CLKOUT";
126                         st,filter-order = <5>;
127                 };
128         }