Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 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 | |
| 7 | title: STMicroelectronics STM32 DFSDM ADC device driver |
| 8 | |
| 9 | maintainers: |
| 10 | - Fabrice Gasnier <fabrice.gasnier@foss.st.com> |
| 11 | - Olivier Moysan <olivier.moysan@foss.st.com> |
| 12 | |
| 13 | description: | |
| 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 | |
| 25 | properties: |
| 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 | |
Tom Rini | 762f85b | 2024-07-20 11:15:10 -0600 | [diff] [blame] | 62 | access-controllers: |
| 63 | minItems: 1 |
| 64 | maxItems: 2 |
| 65 | |
Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 66 | required: |
| 67 | - compatible |
| 68 | - reg |
| 69 | - clocks |
| 70 | - clock-names |
| 71 | - "#address-cells" |
| 72 | - "#size-cells" |
| 73 | |
| 74 | additionalProperties: false |
| 75 | |
| 76 | patternProperties: |
| 77 | "^filter@[0-9]+$": |
| 78 | type: object |
| 79 | unevaluatedProperties: false |
| 80 | description: child node |
| 81 | |
| 82 | properties: |
| 83 | compatible: |
| 84 | enum: |
| 85 | - st,stm32-dfsdm-adc |
| 86 | - st,stm32-dfsdm-dmic |
| 87 | |
| 88 | reg: |
| 89 | description: Specifies the DFSDM filter instance used. |
| 90 | maxItems: 1 |
| 91 | |
| 92 | interrupts: |
| 93 | maxItems: 1 |
| 94 | |
| 95 | st,adc-channels: |
| 96 | description: | |
| 97 | List of single-ended channels muxed for this ADC. |
| 98 | On stm32h7 and stm32mp1: |
| 99 | - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7. |
| 100 | - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7. |
| 101 | $ref: /schemas/types.yaml#/definitions/uint32-array |
| 102 | items: |
| 103 | minimum: 0 |
| 104 | maximum: 7 |
| 105 | |
| 106 | st,adc-channel-names: |
| 107 | description: List of single-ended channel names. |
| 108 | |
| 109 | st,filter-order: |
| 110 | description: | |
| 111 | SinC filter order from 0 to 5. |
| 112 | - 0: FastSinC |
| 113 | - [1-5]: order 1 to 5. |
| 114 | For audio purpose it is recommended to use order 3 to 5. |
| 115 | $ref: /schemas/types.yaml#/definitions/uint32 |
| 116 | maximum: 5 |
| 117 | |
| 118 | "#io-channel-cells": |
| 119 | const: 1 |
| 120 | |
| 121 | st,adc-channel-types: |
| 122 | description: | |
| 123 | Single-ended channel input type. |
| 124 | - "SPI_R": SPI with data on rising edge (default) |
| 125 | - "SPI_F": SPI with data on falling edge |
| 126 | - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1 |
| 127 | - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0 |
| 128 | items: |
| 129 | enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] |
| 130 | $ref: /schemas/types.yaml#/definitions/non-unique-string-array |
| 131 | |
| 132 | st,adc-channel-clk-src: |
| 133 | description: | |
| 134 | Conversion clock source. |
| 135 | - "CLKIN": external SPI clock (CLKIN x) |
| 136 | - "CLKOUT": internal SPI clock (CLKOUT) (default) |
| 137 | - "CLKOUT_F": internal SPI clock divided by 2 (falling edge). |
| 138 | - "CLKOUT_R": internal SPI clock divided by 2 (rising edge). |
| 139 | items: |
| 140 | enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] |
| 141 | $ref: /schemas/types.yaml#/definitions/non-unique-string-array |
| 142 | |
| 143 | st,adc-alt-channel: |
| 144 | description: |
| 145 | Must be defined if two sigma delta modulators are |
| 146 | connected on same SPI input. |
| 147 | If not set, channel n is connected to SPI input n. |
| 148 | If set, channel n is connected to SPI input n + 1. |
| 149 | type: boolean |
| 150 | |
| 151 | st,filter0-sync: |
| 152 | description: |
| 153 | Set to 1 to synchronize with DFSDM filter instance 0. |
| 154 | Used for multi microphones synchronization. |
| 155 | type: boolean |
| 156 | |
| 157 | dmas: |
| 158 | maxItems: 1 |
| 159 | |
| 160 | dma-names: |
| 161 | items: |
| 162 | - const: rx |
| 163 | |
| 164 | required: |
| 165 | - compatible |
| 166 | - reg |
| 167 | - interrupts |
| 168 | - st,adc-channels |
| 169 | - st,adc-channel-names |
| 170 | - st,filter-order |
| 171 | - "#io-channel-cells" |
| 172 | |
| 173 | allOf: |
| 174 | - if: |
| 175 | properties: |
| 176 | compatible: |
| 177 | contains: |
| 178 | const: st,stm32-dfsdm-adc |
| 179 | |
| 180 | then: |
| 181 | properties: |
| 182 | st,adc-channels: |
| 183 | minItems: 1 |
| 184 | maxItems: 8 |
| 185 | |
| 186 | st,adc-channel-names: |
| 187 | minItems: 1 |
| 188 | maxItems: 8 |
| 189 | |
| 190 | st,adc-channel-types: |
| 191 | minItems: 1 |
| 192 | maxItems: 8 |
| 193 | |
| 194 | st,adc-channel-clk-src: |
| 195 | minItems: 1 |
| 196 | maxItems: 8 |
| 197 | |
| 198 | io-channels: |
| 199 | description: |
| 200 | From common IIO binding. Used to pipe external sigma delta |
| 201 | modulator or internal ADC output to DFSDM channel. |
| 202 | |
| 203 | required: |
| 204 | - io-channels |
| 205 | |
| 206 | - if: |
| 207 | properties: |
| 208 | compatible: |
| 209 | contains: |
| 210 | const: st,stm32-dfsdm-dmic |
| 211 | |
| 212 | then: |
| 213 | properties: |
| 214 | st,adc-channels: |
| 215 | maxItems: 1 |
| 216 | |
| 217 | st,adc-channel-names: |
| 218 | maxItems: 1 |
| 219 | |
| 220 | st,adc-channel-types: |
| 221 | maxItems: 1 |
| 222 | |
| 223 | st,adc-channel-clk-src: |
| 224 | maxItems: 1 |
| 225 | |
| 226 | required: |
| 227 | - dmas |
| 228 | - dma-names |
| 229 | |
| 230 | patternProperties: |
| 231 | "^dfsdm-dai+$": |
| 232 | type: object |
| 233 | additionalProperties: false |
| 234 | description: child node |
| 235 | |
| 236 | properties: |
| 237 | compatible: |
| 238 | enum: |
| 239 | - st,stm32h7-dfsdm-dai |
| 240 | |
| 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 | |
Tom Rini | 6b642ac | 2024-10-01 12:20:28 -0600 | [diff] [blame] | 249 | port: |
| 250 | $ref: /schemas/sound/audio-graph-port.yaml# |
| 251 | unevaluatedProperties: false |
| 252 | |
Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 253 | required: |
| 254 | - compatible |
| 255 | - "#sound-dai-cells" |
| 256 | - io-channels |
| 257 | |
| 258 | allOf: |
| 259 | - if: |
| 260 | properties: |
| 261 | compatible: |
| 262 | contains: |
| 263 | const: st,stm32h7-dfsdm |
| 264 | |
| 265 | then: |
| 266 | patternProperties: |
| 267 | "^filter@[0-9]+$": |
| 268 | properties: |
| 269 | reg: |
| 270 | items: |
| 271 | minimum: 0 |
| 272 | maximum: 3 |
| 273 | |
| 274 | - if: |
| 275 | properties: |
| 276 | compatible: |
| 277 | contains: |
| 278 | const: st,stm32mp1-dfsdm |
| 279 | |
| 280 | then: |
| 281 | patternProperties: |
| 282 | "^filter@[0-9]+$": |
| 283 | properties: |
| 284 | reg: |
| 285 | items: |
| 286 | minimum: 0 |
| 287 | maximum: 5 |
| 288 | |
| 289 | examples: |
| 290 | - | |
| 291 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 292 | #include <dt-bindings/clock/stm32mp1-clks.h> |
| 293 | dfsdm: dfsdm@4400d000 { |
| 294 | compatible = "st,stm32mp1-dfsdm"; |
| 295 | reg = <0x4400d000 0x800>; |
| 296 | clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>; |
| 297 | clock-names = "dfsdm", "audio"; |
| 298 | #address-cells = <1>; |
| 299 | #size-cells = <0>; |
| 300 | |
| 301 | dfsdm0: filter@0 { |
| 302 | compatible = "st,stm32-dfsdm-dmic"; |
| 303 | reg = <0>; |
| 304 | interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; |
| 305 | dmas = <&dmamux1 101 0x400 0x01>; |
| 306 | dma-names = "rx"; |
| 307 | #io-channel-cells = <1>; |
| 308 | st,adc-channels = <1>; |
| 309 | st,adc-channel-names = "dmic0"; |
| 310 | st,adc-channel-types = "SPI_R"; |
| 311 | st,adc-channel-clk-src = "CLKOUT"; |
| 312 | st,filter-order = <5>; |
| 313 | |
| 314 | asoc_pdm0: dfsdm-dai { |
| 315 | compatible = "st,stm32h7-dfsdm-dai"; |
| 316 | #sound-dai-cells = <0>; |
| 317 | io-channels = <&dfsdm0 0>; |
| 318 | }; |
| 319 | }; |
| 320 | |
| 321 | dfsdm_pdm1: filter@1 { |
| 322 | compatible = "st,stm32-dfsdm-adc"; |
| 323 | reg = <1>; |
| 324 | interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; |
| 325 | dmas = <&dmamux1 102 0x400 0x01>; |
| 326 | dma-names = "rx"; |
| 327 | #io-channel-cells = <1>; |
| 328 | st,adc-channels = <2 3>; |
| 329 | st,adc-channel-names = "in2", "in3"; |
| 330 | st,adc-channel-types = "SPI_R", "SPI_R"; |
| 331 | st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F"; |
| 332 | io-channels = <&sd_adc2 &sd_adc3>; |
| 333 | st,filter-order = <1>; |
| 334 | }; |
| 335 | }; |
| 336 | |
| 337 | ... |