111183ac0SOlivier Moysan# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 211183ac0SOlivier Moysan%YAML 1.2 311183ac0SOlivier Moysan--- 404dbd865SRob Herring$id: http://devicetree.org/schemas/iio/adc/st,stm32-dfsdm-adc.yaml# 511183ac0SOlivier Moysan$schema: http://devicetree.org/meta-schemas/core.yaml# 611183ac0SOlivier Moysan 711183ac0SOlivier Moysantitle: STMicroelectronics STM32 DFSDM ADC device driver 811183ac0SOlivier Moysan 911183ac0SOlivier Moysanmaintainers: 10f4eedebdSPatrice Chotard - Fabrice Gasnier <fabrice.gasnier@foss.st.com> 11f4eedebdSPatrice Chotard - Olivier Moysan <olivier.moysan@foss.st.com> 1211183ac0SOlivier Moysan 1311183ac0SOlivier Moysandescription: | 1411183ac0SOlivier Moysan STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to 1511183ac0SOlivier Moysan interface external sigma delta modulators to STM32 micro controllers. 1611183ac0SOlivier Moysan It is mainly targeted for: 1711183ac0SOlivier Moysan - Sigma delta modulators (motor control, metering...) 1811183ac0SOlivier Moysan - PDM microphones (audio digital microphone) 1911183ac0SOlivier Moysan 2011183ac0SOlivier Moysan It features up to 8 serial digital interfaces (SPI or Manchester) and 2111183ac0SOlivier Moysan up to 4 filters on stm32h7 or 6 filters on stm32mp1. 2211183ac0SOlivier Moysan 2311183ac0SOlivier Moysan Each child node matches with a filter instance. 2411183ac0SOlivier Moysan 2511183ac0SOlivier Moysanproperties: 2611183ac0SOlivier Moysan compatible: 2711183ac0SOlivier Moysan enum: 2811183ac0SOlivier Moysan - st,stm32h7-dfsdm 2911183ac0SOlivier Moysan - st,stm32mp1-dfsdm 3011183ac0SOlivier Moysan 3111183ac0SOlivier Moysan reg: 3211183ac0SOlivier Moysan maxItems: 1 3311183ac0SOlivier Moysan 3411183ac0SOlivier Moysan clocks: 3511183ac0SOlivier Moysan items: 3611183ac0SOlivier Moysan - description: 3711183ac0SOlivier Moysan Internal clock used for DFSDM digital processing and control blocks. 3811183ac0SOlivier Moysan dfsdm clock can also feed CLKOUT, when CLKOUT is used. 3911183ac0SOlivier Moysan - description: audio clock can be used as an alternate to feed CLKOUT. 4011183ac0SOlivier Moysan minItems: 1 4111183ac0SOlivier Moysan 4211183ac0SOlivier Moysan clock-names: 4311183ac0SOlivier Moysan items: 4411183ac0SOlivier Moysan - const: dfsdm 4511183ac0SOlivier Moysan - const: audio 4611183ac0SOlivier Moysan minItems: 1 4711183ac0SOlivier Moysan 4811183ac0SOlivier Moysan "#address-cells": 4911183ac0SOlivier Moysan const: 1 5011183ac0SOlivier Moysan 5111183ac0SOlivier Moysan "#size-cells": 5211183ac0SOlivier Moysan const: 0 5311183ac0SOlivier Moysan 5411183ac0SOlivier Moysan spi-max-frequency: 5511183ac0SOlivier Moysan description: 5611183ac0SOlivier Moysan SPI clock OUT frequency (Hz). Requested only for SPI master mode. 5711183ac0SOlivier Moysan This clock must be set according to the "clock" property. 5811183ac0SOlivier Moysan Frequency must be a multiple of the rcc clock frequency. 5911183ac0SOlivier Moysan If not, SPI CLKOUT frequency will not be accurate. 6011183ac0SOlivier Moysan maximum: 20000000 6111183ac0SOlivier Moysan 6211183ac0SOlivier Moysanrequired: 6311183ac0SOlivier Moysan - compatible 6411183ac0SOlivier Moysan - reg 6511183ac0SOlivier Moysan - clocks 6611183ac0SOlivier Moysan - clock-names 6711183ac0SOlivier Moysan - "#address-cells" 6811183ac0SOlivier Moysan - "#size-cells" 6911183ac0SOlivier Moysan 707f464532SRob HerringadditionalProperties: false 717f464532SRob Herring 7211183ac0SOlivier MoysanpatternProperties: 7311183ac0SOlivier Moysan "^filter@[0-9]+$": 7411183ac0SOlivier Moysan type: object 75*c682c963SRob Herring unevaluatedProperties: false 7611183ac0SOlivier Moysan description: child node 7711183ac0SOlivier Moysan 7811183ac0SOlivier Moysan properties: 7911183ac0SOlivier Moysan compatible: 8011183ac0SOlivier Moysan enum: 8111183ac0SOlivier Moysan - st,stm32-dfsdm-adc 8211183ac0SOlivier Moysan - st,stm32-dfsdm-dmic 8311183ac0SOlivier Moysan 8411183ac0SOlivier Moysan reg: 8511183ac0SOlivier Moysan description: Specifies the DFSDM filter instance used. 8611183ac0SOlivier Moysan maxItems: 1 8711183ac0SOlivier Moysan 8811183ac0SOlivier Moysan interrupts: 8911183ac0SOlivier Moysan maxItems: 1 9011183ac0SOlivier Moysan 9111183ac0SOlivier Moysan st,adc-channels: 9211183ac0SOlivier Moysan description: | 9311183ac0SOlivier Moysan List of single-ended channels muxed for this ADC. 9411183ac0SOlivier Moysan On stm32h7 and stm32mp1: 9511183ac0SOlivier Moysan - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7. 9611183ac0SOlivier Moysan - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7. 973d21a460SRob Herring $ref: /schemas/types.yaml#/definitions/uint32-array 983d21a460SRob Herring items: 9911183ac0SOlivier Moysan minimum: 0 10011183ac0SOlivier Moysan maximum: 7 10111183ac0SOlivier Moysan 10211183ac0SOlivier Moysan st,adc-channel-names: 10311183ac0SOlivier Moysan description: List of single-ended channel names. 10411183ac0SOlivier Moysan 10511183ac0SOlivier Moysan st,filter-order: 10611183ac0SOlivier Moysan description: | 10711183ac0SOlivier Moysan SinC filter order from 0 to 5. 10811183ac0SOlivier Moysan - 0: FastSinC 10911183ac0SOlivier Moysan - [1-5]: order 1 to 5. 11011183ac0SOlivier Moysan For audio purpose it is recommended to use order 3 to 5. 1113d21a460SRob Herring $ref: /schemas/types.yaml#/definitions/uint32 11211183ac0SOlivier Moysan maximum: 5 11311183ac0SOlivier Moysan 11411183ac0SOlivier Moysan "#io-channel-cells": 11511183ac0SOlivier Moysan const: 1 11611183ac0SOlivier Moysan 11711183ac0SOlivier Moysan st,adc-channel-types: 11811183ac0SOlivier Moysan description: | 11911183ac0SOlivier Moysan Single-ended channel input type. 12011183ac0SOlivier Moysan - "SPI_R": SPI with data on rising edge (default) 12111183ac0SOlivier Moysan - "SPI_F": SPI with data on falling edge 12211183ac0SOlivier Moysan - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1 12311183ac0SOlivier Moysan - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0 12411183ac0SOlivier Moysan items: 12511183ac0SOlivier Moysan enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] 1263d21a460SRob Herring $ref: /schemas/types.yaml#/definitions/non-unique-string-array 12711183ac0SOlivier Moysan 12811183ac0SOlivier Moysan st,adc-channel-clk-src: 12911183ac0SOlivier Moysan description: | 13011183ac0SOlivier Moysan Conversion clock source. 13111183ac0SOlivier Moysan - "CLKIN": external SPI clock (CLKIN x) 13211183ac0SOlivier Moysan - "CLKOUT": internal SPI clock (CLKOUT) (default) 13311183ac0SOlivier Moysan - "CLKOUT_F": internal SPI clock divided by 2 (falling edge). 13411183ac0SOlivier Moysan - "CLKOUT_R": internal SPI clock divided by 2 (rising edge). 13511183ac0SOlivier Moysan items: 13611183ac0SOlivier Moysan enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] 1373d21a460SRob Herring $ref: /schemas/types.yaml#/definitions/non-unique-string-array 13811183ac0SOlivier Moysan 13911183ac0SOlivier Moysan st,adc-alt-channel: 14011183ac0SOlivier Moysan description: 14111183ac0SOlivier Moysan Must be defined if two sigma delta modulators are 14211183ac0SOlivier Moysan connected on same SPI input. 14311183ac0SOlivier Moysan If not set, channel n is connected to SPI input n. 14411183ac0SOlivier Moysan If set, channel n is connected to SPI input n + 1. 14511183ac0SOlivier Moysan type: boolean 14611183ac0SOlivier Moysan 14711183ac0SOlivier Moysan st,filter0-sync: 14811183ac0SOlivier Moysan description: 14911183ac0SOlivier Moysan Set to 1 to synchronize with DFSDM filter instance 0. 15011183ac0SOlivier Moysan Used for multi microphones synchronization. 15111183ac0SOlivier Moysan type: boolean 15211183ac0SOlivier Moysan 15311183ac0SOlivier Moysan dmas: 15411183ac0SOlivier Moysan maxItems: 1 15511183ac0SOlivier Moysan 15611183ac0SOlivier Moysan dma-names: 15711183ac0SOlivier Moysan items: 15811183ac0SOlivier Moysan - const: rx 15911183ac0SOlivier Moysan 16011183ac0SOlivier Moysan required: 16111183ac0SOlivier Moysan - compatible 16211183ac0SOlivier Moysan - reg 16311183ac0SOlivier Moysan - interrupts 16411183ac0SOlivier Moysan - st,adc-channels 16511183ac0SOlivier Moysan - st,adc-channel-names 16611183ac0SOlivier Moysan - st,filter-order 16711183ac0SOlivier Moysan - "#io-channel-cells" 16811183ac0SOlivier Moysan 16911183ac0SOlivier Moysan allOf: 17011183ac0SOlivier Moysan - if: 17111183ac0SOlivier Moysan properties: 17211183ac0SOlivier Moysan compatible: 17311183ac0SOlivier Moysan contains: 17411183ac0SOlivier Moysan const: st,stm32-dfsdm-adc 17511183ac0SOlivier Moysan 17627e4a85cSRob Herring then: 17711183ac0SOlivier Moysan properties: 17811183ac0SOlivier Moysan st,adc-channels: 17911183ac0SOlivier Moysan minItems: 1 18011183ac0SOlivier Moysan maxItems: 8 18111183ac0SOlivier Moysan 18211183ac0SOlivier Moysan st,adc-channel-names: 18311183ac0SOlivier Moysan minItems: 1 18411183ac0SOlivier Moysan maxItems: 8 18511183ac0SOlivier Moysan 18611183ac0SOlivier Moysan st,adc-channel-types: 18711183ac0SOlivier Moysan minItems: 1 18811183ac0SOlivier Moysan maxItems: 8 18911183ac0SOlivier Moysan 19011183ac0SOlivier Moysan st,adc-channel-clk-src: 19111183ac0SOlivier Moysan minItems: 1 19211183ac0SOlivier Moysan maxItems: 8 19311183ac0SOlivier Moysan 19411183ac0SOlivier Moysan io-channels: 19511183ac0SOlivier Moysan description: 19611183ac0SOlivier Moysan From common IIO binding. Used to pipe external sigma delta 19711183ac0SOlivier Moysan modulator or internal ADC output to DFSDM channel. 19811183ac0SOlivier Moysan 19911183ac0SOlivier Moysan required: 20011183ac0SOlivier Moysan - io-channels 20111183ac0SOlivier Moysan 20211183ac0SOlivier Moysan - if: 20311183ac0SOlivier Moysan properties: 20411183ac0SOlivier Moysan compatible: 20511183ac0SOlivier Moysan contains: 20611183ac0SOlivier Moysan const: st,stm32-dfsdm-dmic 20711183ac0SOlivier Moysan 20827e4a85cSRob Herring then: 20911183ac0SOlivier Moysan properties: 21011183ac0SOlivier Moysan st,adc-channels: 21111183ac0SOlivier Moysan maxItems: 1 21211183ac0SOlivier Moysan 21311183ac0SOlivier Moysan st,adc-channel-names: 21411183ac0SOlivier Moysan maxItems: 1 21511183ac0SOlivier Moysan 21611183ac0SOlivier Moysan st,adc-channel-types: 21711183ac0SOlivier Moysan maxItems: 1 21811183ac0SOlivier Moysan 21911183ac0SOlivier Moysan st,adc-channel-clk-src: 22011183ac0SOlivier Moysan maxItems: 1 22111183ac0SOlivier Moysan 22211183ac0SOlivier Moysan required: 22311183ac0SOlivier Moysan - dmas 22411183ac0SOlivier Moysan - dma-names 22511183ac0SOlivier Moysan 22611183ac0SOlivier Moysan patternProperties: 22711183ac0SOlivier Moysan "^dfsdm-dai+$": 22811183ac0SOlivier Moysan type: object 229*c682c963SRob Herring additionalProperties: false 23011183ac0SOlivier Moysan description: child node 23111183ac0SOlivier Moysan 23211183ac0SOlivier Moysan properties: 233f24fd10bSOlivier Moysan compatible: 234f24fd10bSOlivier Moysan enum: 235f24fd10bSOlivier Moysan - st,stm32h7-dfsdm-dai 236f24fd10bSOlivier Moysan 23711183ac0SOlivier Moysan "#sound-dai-cells": 23811183ac0SOlivier Moysan const: 0 23911183ac0SOlivier Moysan 24011183ac0SOlivier Moysan io-channels: 24111183ac0SOlivier Moysan description: 24211183ac0SOlivier Moysan From common IIO binding. Used to pipe external sigma delta 24311183ac0SOlivier Moysan modulator or internal ADC output to DFSDM channel. 24411183ac0SOlivier Moysan 24511183ac0SOlivier Moysan required: 246f24fd10bSOlivier Moysan - compatible 24711183ac0SOlivier Moysan - "#sound-dai-cells" 24811183ac0SOlivier Moysan - io-channels 24911183ac0SOlivier Moysan 25011183ac0SOlivier MoysanallOf: 25111183ac0SOlivier Moysan - if: 25211183ac0SOlivier Moysan properties: 25311183ac0SOlivier Moysan compatible: 25411183ac0SOlivier Moysan contains: 25511183ac0SOlivier Moysan const: st,stm32h7-dfsdm 25611183ac0SOlivier Moysan 25727e4a85cSRob Herring then: 25811183ac0SOlivier Moysan patternProperties: 25911183ac0SOlivier Moysan "^filter@[0-9]+$": 26011183ac0SOlivier Moysan properties: 26111183ac0SOlivier Moysan reg: 26211183ac0SOlivier Moysan items: 26311183ac0SOlivier Moysan minimum: 0 26411183ac0SOlivier Moysan maximum: 3 26511183ac0SOlivier Moysan 26611183ac0SOlivier Moysan - if: 26711183ac0SOlivier Moysan properties: 26811183ac0SOlivier Moysan compatible: 26911183ac0SOlivier Moysan contains: 27011183ac0SOlivier Moysan const: st,stm32mp1-dfsdm 27111183ac0SOlivier Moysan 27227e4a85cSRob Herring then: 27311183ac0SOlivier Moysan patternProperties: 27411183ac0SOlivier Moysan "^filter@[0-9]+$": 27511183ac0SOlivier Moysan properties: 27611183ac0SOlivier Moysan reg: 27711183ac0SOlivier Moysan items: 27811183ac0SOlivier Moysan minimum: 0 27911183ac0SOlivier Moysan maximum: 5 28011183ac0SOlivier Moysan 28111183ac0SOlivier Moysanexamples: 28211183ac0SOlivier Moysan - | 28311183ac0SOlivier Moysan #include <dt-bindings/interrupt-controller/arm-gic.h> 28411183ac0SOlivier Moysan #include <dt-bindings/clock/stm32mp1-clks.h> 28511183ac0SOlivier Moysan dfsdm: dfsdm@4400d000 { 28611183ac0SOlivier Moysan compatible = "st,stm32mp1-dfsdm"; 28711183ac0SOlivier Moysan reg = <0x4400d000 0x800>; 28811183ac0SOlivier Moysan clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>; 28911183ac0SOlivier Moysan clock-names = "dfsdm", "audio"; 29011183ac0SOlivier Moysan #address-cells = <1>; 29111183ac0SOlivier Moysan #size-cells = <0>; 29211183ac0SOlivier Moysan 29311183ac0SOlivier Moysan dfsdm0: filter@0 { 29411183ac0SOlivier Moysan compatible = "st,stm32-dfsdm-dmic"; 29511183ac0SOlivier Moysan reg = <0>; 29611183ac0SOlivier Moysan interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 29711183ac0SOlivier Moysan dmas = <&dmamux1 101 0x400 0x01>; 29811183ac0SOlivier Moysan dma-names = "rx"; 29911183ac0SOlivier Moysan #io-channel-cells = <1>; 30011183ac0SOlivier Moysan st,adc-channels = <1>; 30111183ac0SOlivier Moysan st,adc-channel-names = "dmic0"; 30211183ac0SOlivier Moysan st,adc-channel-types = "SPI_R"; 30311183ac0SOlivier Moysan st,adc-channel-clk-src = "CLKOUT"; 30411183ac0SOlivier Moysan st,filter-order = <5>; 30511183ac0SOlivier Moysan 30611183ac0SOlivier Moysan asoc_pdm0: dfsdm-dai { 30711183ac0SOlivier Moysan compatible = "st,stm32h7-dfsdm-dai"; 30811183ac0SOlivier Moysan #sound-dai-cells = <0>; 30911183ac0SOlivier Moysan io-channels = <&dfsdm0 0>; 31011183ac0SOlivier Moysan }; 31111183ac0SOlivier Moysan }; 31211183ac0SOlivier Moysan 31311183ac0SOlivier Moysan dfsdm_pdm1: filter@1 { 31411183ac0SOlivier Moysan compatible = "st,stm32-dfsdm-adc"; 31511183ac0SOlivier Moysan reg = <1>; 31611183ac0SOlivier Moysan interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 31711183ac0SOlivier Moysan dmas = <&dmamux1 102 0x400 0x01>; 31811183ac0SOlivier Moysan dma-names = "rx"; 31911183ac0SOlivier Moysan #io-channel-cells = <1>; 32011183ac0SOlivier Moysan st,adc-channels = <2 3>; 32111183ac0SOlivier Moysan st,adc-channel-names = "in2", "in3"; 32211183ac0SOlivier Moysan st,adc-channel-types = "SPI_R", "SPI_R"; 32311183ac0SOlivier Moysan st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F"; 32411183ac0SOlivier Moysan io-channels = <&sd_adc2 &sd_adc3>; 32511183ac0SOlivier Moysan st,filter-order = <1>; 32611183ac0SOlivier Moysan }; 32711183ac0SOlivier Moysan }; 32811183ac0SOlivier Moysan 32911183ac0SOlivier Moysan... 330