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