1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2%YAML 1.2 3--- 4$id: http://devicetree.org/schemas/iio/adc/st,stm32-dfsdm-adc.yaml# 5$schema: http://devicetree.org/meta-schemas/core.yaml# 6 7title: STMicroelectronics STM32 DFSDM ADC device driver 8 9maintainers: 10 - Fabrice Gasnier <fabrice.gasnier@st.com> 11 - Olivier Moysan <olivier.moysan@st.com> 12 13description: | 14 STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to 15 interface external sigma delta modulators to STM32 micro controllers. 16 It is mainly targeted for: 17 - Sigma delta modulators (motor control, metering...) 18 - PDM microphones (audio digital microphone) 19 20 It features up to 8 serial digital interfaces (SPI or Manchester) and 21 up to 4 filters on stm32h7 or 6 filters on stm32mp1. 22 23 Each child node matches with a filter instance. 24 25properties: 26 compatible: 27 enum: 28 - st,stm32h7-dfsdm 29 - st,stm32mp1-dfsdm 30 31 reg: 32 maxItems: 1 33 34 clocks: 35 items: 36 - description: 37 Internal clock used for DFSDM digital processing and control blocks. 38 dfsdm clock can also feed CLKOUT, when CLKOUT is used. 39 - description: audio clock can be used as an alternate to feed CLKOUT. 40 minItems: 1 41 maxItems: 2 42 43 clock-names: 44 items: 45 - const: dfsdm 46 - const: audio 47 minItems: 1 48 maxItems: 2 49 50 "#address-cells": 51 const: 1 52 53 "#size-cells": 54 const: 0 55 56 spi-max-frequency: 57 description: 58 SPI clock OUT frequency (Hz). Requested only for SPI master mode. 59 This clock must be set according to the "clock" property. 60 Frequency must be a multiple of the rcc clock frequency. 61 If not, SPI CLKOUT frequency will not be accurate. 62 maximum: 20000000 63 64required: 65 - compatible 66 - reg 67 - clocks 68 - clock-names 69 - "#address-cells" 70 - "#size-cells" 71 72patternProperties: 73 "^filter@[0-9]+$": 74 type: object 75 description: child node 76 77 properties: 78 compatible: 79 enum: 80 - st,stm32-dfsdm-adc 81 - st,stm32-dfsdm-dmic 82 83 reg: 84 description: Specifies the DFSDM filter instance used. 85 maxItems: 1 86 87 interrupts: 88 maxItems: 1 89 90 st,adc-channels: 91 description: | 92 List of single-ended channels muxed for this ADC. 93 On stm32h7 and stm32mp1: 94 - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7. 95 - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7. 96 allOf: 97 - $ref: /schemas/types.yaml#/definitions/uint32-array 98 - items: 99 minimum: 0 100 maximum: 7 101 102 st,adc-channel-names: 103 description: List of single-ended channel names. 104 allOf: 105 - $ref: /schemas/types.yaml#/definitions/string-array 106 107 st,filter-order: 108 description: | 109 SinC filter order from 0 to 5. 110 - 0: FastSinC 111 - [1-5]: order 1 to 5. 112 For audio purpose it is recommended to use order 3 to 5. 113 allOf: 114 - $ref: /schemas/types.yaml#/definitions/uint32 115 - items: 116 minimum: 0 117 maximum: 5 118 119 "#io-channel-cells": 120 const: 1 121 122 st,adc-channel-types: 123 description: | 124 Single-ended channel input type. 125 - "SPI_R": SPI with data on rising edge (default) 126 - "SPI_F": SPI with data on falling edge 127 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1 128 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0 129 items: 130 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] 131 allOf: 132 - $ref: /schemas/types.yaml#/definitions/non-unique-string-array 133 134 st,adc-channel-clk-src: 135 description: | 136 Conversion clock source. 137 - "CLKIN": external SPI clock (CLKIN x) 138 - "CLKOUT": internal SPI clock (CLKOUT) (default) 139 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge). 140 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge). 141 items: 142 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] 143 allOf: 144 - $ref: /schemas/types.yaml#/definitions/non-unique-string-array 145 146 st,adc-alt-channel: 147 description: 148 Must be defined if two sigma delta modulators are 149 connected on same SPI input. 150 If not set, channel n is connected to SPI input n. 151 If set, channel n is connected to SPI input n + 1. 152 type: boolean 153 154 st,filter0-sync: 155 description: 156 Set to 1 to synchronize with DFSDM filter instance 0. 157 Used for multi microphones synchronization. 158 type: boolean 159 160 dmas: 161 maxItems: 1 162 163 dma-names: 164 items: 165 - const: rx 166 167 required: 168 - compatible 169 - reg 170 - interrupts 171 - st,adc-channels 172 - st,adc-channel-names 173 - st,filter-order 174 - "#io-channel-cells" 175 176 allOf: 177 - if: 178 properties: 179 compatible: 180 contains: 181 const: st,stm32-dfsdm-adc 182 183 - then: 184 properties: 185 st,adc-channels: 186 minItems: 1 187 maxItems: 8 188 189 st,adc-channel-names: 190 minItems: 1 191 maxItems: 8 192 193 st,adc-channel-types: 194 minItems: 1 195 maxItems: 8 196 197 st,adc-channel-clk-src: 198 minItems: 1 199 maxItems: 8 200 201 io-channels: 202 description: 203 From common IIO binding. Used to pipe external sigma delta 204 modulator or internal ADC output to DFSDM channel. 205 This is not required for "st,stm32-dfsdm-pdm" compatibility as 206 PDM microphone is binded in Audio DT node. 207 208 required: 209 - io-channels 210 211 - if: 212 properties: 213 compatible: 214 contains: 215 const: st,stm32-dfsdm-dmic 216 217 - then: 218 properties: 219 st,adc-channels: 220 maxItems: 1 221 222 st,adc-channel-names: 223 maxItems: 1 224 225 st,adc-channel-types: 226 maxItems: 1 227 228 st,adc-channel-clk-src: 229 maxItems: 1 230 231 required: 232 - dmas 233 - dma-names 234 235 patternProperties: 236 "^dfsdm-dai+$": 237 type: object 238 description: child node 239 240 properties: 241 "#sound-dai-cells": 242 const: 0 243 244 io-channels: 245 description: 246 From common IIO binding. Used to pipe external sigma delta 247 modulator or internal ADC output to DFSDM channel. 248 249 required: 250 - "#sound-dai-cells" 251 - io-channels 252 253allOf: 254 - if: 255 properties: 256 compatible: 257 contains: 258 const: st,stm32h7-dfsdm 259 260 - then: 261 patternProperties: 262 "^filter@[0-9]+$": 263 properties: 264 reg: 265 items: 266 minimum: 0 267 maximum: 3 268 269 - if: 270 properties: 271 compatible: 272 contains: 273 const: st,stm32mp1-dfsdm 274 275 - then: 276 patternProperties: 277 "^filter@[0-9]+$": 278 properties: 279 reg: 280 items: 281 minimum: 0 282 maximum: 5 283 284examples: 285 - | 286 #include <dt-bindings/interrupt-controller/arm-gic.h> 287 #include <dt-bindings/clock/stm32mp1-clks.h> 288 dfsdm: dfsdm@4400d000 { 289 compatible = "st,stm32mp1-dfsdm"; 290 reg = <0x4400d000 0x800>; 291 clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>; 292 clock-names = "dfsdm", "audio"; 293 #address-cells = <1>; 294 #size-cells = <0>; 295 296 dfsdm0: filter@0 { 297 compatible = "st,stm32-dfsdm-dmic"; 298 reg = <0>; 299 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 300 dmas = <&dmamux1 101 0x400 0x01>; 301 dma-names = "rx"; 302 #io-channel-cells = <1>; 303 st,adc-channels = <1>; 304 st,adc-channel-names = "dmic0"; 305 st,adc-channel-types = "SPI_R"; 306 st,adc-channel-clk-src = "CLKOUT"; 307 st,filter-order = <5>; 308 309 asoc_pdm0: dfsdm-dai { 310 compatible = "st,stm32h7-dfsdm-dai"; 311 #sound-dai-cells = <0>; 312 io-channels = <&dfsdm0 0>; 313 }; 314 }; 315 316 dfsdm_pdm1: filter@1 { 317 compatible = "st,stm32-dfsdm-adc"; 318 reg = <1>; 319 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 320 dmas = <&dmamux1 102 0x400 0x01>; 321 dma-names = "rx"; 322 #io-channel-cells = <1>; 323 st,adc-channels = <2 3>; 324 st,adc-channel-names = "in2", "in3"; 325 st,adc-channel-types = "SPI_R", "SPI_R"; 326 st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F"; 327 io-channels = <&sd_adc2 &sd_adc3>; 328 st,filter-order = <1>; 329 }; 330 }; 331 332... 333