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