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@foss.st.com> 11 - Olivier Moysan <olivier.moysan@foss.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 42 clock-names: 43 items: 44 - const: dfsdm 45 - const: audio 46 minItems: 1 47 48 "#address-cells": 49 const: 1 50 51 "#size-cells": 52 const: 0 53 54 spi-max-frequency: 55 description: 56 SPI clock OUT frequency (Hz). Requested only for SPI master mode. 57 This clock must be set according to the "clock" property. 58 Frequency must be a multiple of the rcc clock frequency. 59 If not, SPI CLKOUT frequency will not be accurate. 60 maximum: 20000000 61 62required: 63 - compatible 64 - reg 65 - clocks 66 - clock-names 67 - "#address-cells" 68 - "#size-cells" 69 70additionalProperties: false 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 $ref: /schemas/types.yaml#/definitions/uint32-array 97 items: 98 minimum: 0 99 maximum: 7 100 101 st,adc-channel-names: 102 description: List of single-ended channel names. 103 104 st,filter-order: 105 description: | 106 SinC filter order from 0 to 5. 107 - 0: FastSinC 108 - [1-5]: order 1 to 5. 109 For audio purpose it is recommended to use order 3 to 5. 110 $ref: /schemas/types.yaml#/definitions/uint32 111 items: 112 minimum: 0 113 maximum: 5 114 115 "#io-channel-cells": 116 const: 1 117 118 st,adc-channel-types: 119 description: | 120 Single-ended channel input type. 121 - "SPI_R": SPI with data on rising edge (default) 122 - "SPI_F": SPI with data on falling edge 123 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1 124 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0 125 items: 126 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] 127 $ref: /schemas/types.yaml#/definitions/non-unique-string-array 128 129 st,adc-channel-clk-src: 130 description: | 131 Conversion clock source. 132 - "CLKIN": external SPI clock (CLKIN x) 133 - "CLKOUT": internal SPI clock (CLKOUT) (default) 134 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge). 135 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge). 136 items: 137 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] 138 $ref: /schemas/types.yaml#/definitions/non-unique-string-array 139 140 st,adc-alt-channel: 141 description: 142 Must be defined if two sigma delta modulators are 143 connected on same SPI input. 144 If not set, channel n is connected to SPI input n. 145 If set, channel n is connected to SPI input n + 1. 146 type: boolean 147 148 st,filter0-sync: 149 description: 150 Set to 1 to synchronize with DFSDM filter instance 0. 151 Used for multi microphones synchronization. 152 type: boolean 153 154 dmas: 155 maxItems: 1 156 157 dma-names: 158 items: 159 - const: rx 160 161 required: 162 - compatible 163 - reg 164 - interrupts 165 - st,adc-channels 166 - st,adc-channel-names 167 - st,filter-order 168 - "#io-channel-cells" 169 170 allOf: 171 - if: 172 properties: 173 compatible: 174 contains: 175 const: st,stm32-dfsdm-adc 176 177 - then: 178 properties: 179 st,adc-channels: 180 minItems: 1 181 maxItems: 8 182 183 st,adc-channel-names: 184 minItems: 1 185 maxItems: 8 186 187 st,adc-channel-types: 188 minItems: 1 189 maxItems: 8 190 191 st,adc-channel-clk-src: 192 minItems: 1 193 maxItems: 8 194 195 io-channels: 196 description: 197 From common IIO binding. Used to pipe external sigma delta 198 modulator or internal ADC output to DFSDM channel. 199 200 required: 201 - io-channels 202 203 - if: 204 properties: 205 compatible: 206 contains: 207 const: st,stm32-dfsdm-dmic 208 209 - then: 210 properties: 211 st,adc-channels: 212 maxItems: 1 213 214 st,adc-channel-names: 215 maxItems: 1 216 217 st,adc-channel-types: 218 maxItems: 1 219 220 st,adc-channel-clk-src: 221 maxItems: 1 222 223 required: 224 - dmas 225 - dma-names 226 227 patternProperties: 228 "^dfsdm-dai+$": 229 type: object 230 description: child node 231 232 properties: 233 compatible: 234 enum: 235 - st,stm32h7-dfsdm-dai 236 237 "#sound-dai-cells": 238 const: 0 239 240 io-channels: 241 description: 242 From common IIO binding. Used to pipe external sigma delta 243 modulator or internal ADC output to DFSDM channel. 244 245 required: 246 - compatible 247 - "#sound-dai-cells" 248 - io-channels 249 250allOf: 251 - if: 252 properties: 253 compatible: 254 contains: 255 const: st,stm32h7-dfsdm 256 257 - then: 258 patternProperties: 259 "^filter@[0-9]+$": 260 properties: 261 reg: 262 items: 263 minimum: 0 264 maximum: 3 265 266 - if: 267 properties: 268 compatible: 269 contains: 270 const: st,stm32mp1-dfsdm 271 272 - then: 273 patternProperties: 274 "^filter@[0-9]+$": 275 properties: 276 reg: 277 items: 278 minimum: 0 279 maximum: 5 280 281examples: 282 - | 283 #include <dt-bindings/interrupt-controller/arm-gic.h> 284 #include <dt-bindings/clock/stm32mp1-clks.h> 285 dfsdm: dfsdm@4400d000 { 286 compatible = "st,stm32mp1-dfsdm"; 287 reg = <0x4400d000 0x800>; 288 clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>; 289 clock-names = "dfsdm", "audio"; 290 #address-cells = <1>; 291 #size-cells = <0>; 292 293 dfsdm0: filter@0 { 294 compatible = "st,stm32-dfsdm-dmic"; 295 reg = <0>; 296 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 297 dmas = <&dmamux1 101 0x400 0x01>; 298 dma-names = "rx"; 299 #io-channel-cells = <1>; 300 st,adc-channels = <1>; 301 st,adc-channel-names = "dmic0"; 302 st,adc-channel-types = "SPI_R"; 303 st,adc-channel-clk-src = "CLKOUT"; 304 st,filter-order = <5>; 305 306 asoc_pdm0: dfsdm-dai { 307 compatible = "st,stm32h7-dfsdm-dai"; 308 #sound-dai-cells = <0>; 309 io-channels = <&dfsdm0 0>; 310 }; 311 }; 312 313 dfsdm_pdm1: filter@1 { 314 compatible = "st,stm32-dfsdm-adc"; 315 reg = <1>; 316 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 317 dmas = <&dmamux1 102 0x400 0x01>; 318 dma-names = "rx"; 319 #io-channel-cells = <1>; 320 st,adc-channels = <2 3>; 321 st,adc-channel-names = "in2", "in3"; 322 st,adc-channel-types = "SPI_R", "SPI_R"; 323 st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F"; 324 io-channels = <&sd_adc2 &sd_adc3>; 325 st,filter-order = <1>; 326 }; 327 }; 328 329... 330