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: 1011183ac0SOlivier Moysan - Fabrice Gasnier <fabrice.gasnier@st.com> 1111183ac0SOlivier Moysan - Olivier Moysan <olivier.moysan@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 maxItems: 2 4211183ac0SOlivier Moysan 4311183ac0SOlivier Moysan clock-names: 4411183ac0SOlivier Moysan items: 4511183ac0SOlivier Moysan - const: dfsdm 4611183ac0SOlivier Moysan - const: audio 4711183ac0SOlivier Moysan minItems: 1 4811183ac0SOlivier Moysan maxItems: 2 4911183ac0SOlivier Moysan 5011183ac0SOlivier Moysan "#address-cells": 5111183ac0SOlivier Moysan const: 1 5211183ac0SOlivier Moysan 5311183ac0SOlivier Moysan "#size-cells": 5411183ac0SOlivier Moysan const: 0 5511183ac0SOlivier Moysan 5611183ac0SOlivier Moysan spi-max-frequency: 5711183ac0SOlivier Moysan description: 5811183ac0SOlivier Moysan SPI clock OUT frequency (Hz). Requested only for SPI master mode. 5911183ac0SOlivier Moysan This clock must be set according to the "clock" property. 6011183ac0SOlivier Moysan Frequency must be a multiple of the rcc clock frequency. 6111183ac0SOlivier Moysan If not, SPI CLKOUT frequency will not be accurate. 6211183ac0SOlivier Moysan maximum: 20000000 6311183ac0SOlivier Moysan 6411183ac0SOlivier Moysanrequired: 6511183ac0SOlivier Moysan - compatible 6611183ac0SOlivier Moysan - reg 6711183ac0SOlivier Moysan - clocks 6811183ac0SOlivier Moysan - clock-names 6911183ac0SOlivier Moysan - "#address-cells" 7011183ac0SOlivier Moysan - "#size-cells" 7111183ac0SOlivier Moysan 72*7f464532SRob HerringadditionalProperties: false 73*7f464532SRob Herring 7411183ac0SOlivier MoysanpatternProperties: 7511183ac0SOlivier Moysan "^filter@[0-9]+$": 7611183ac0SOlivier Moysan type: object 7711183ac0SOlivier Moysan description: child node 7811183ac0SOlivier Moysan 7911183ac0SOlivier Moysan properties: 8011183ac0SOlivier Moysan compatible: 8111183ac0SOlivier Moysan enum: 8211183ac0SOlivier Moysan - st,stm32-dfsdm-adc 8311183ac0SOlivier Moysan - st,stm32-dfsdm-dmic 8411183ac0SOlivier Moysan 8511183ac0SOlivier Moysan reg: 8611183ac0SOlivier Moysan description: Specifies the DFSDM filter instance used. 8711183ac0SOlivier Moysan maxItems: 1 8811183ac0SOlivier Moysan 8911183ac0SOlivier Moysan interrupts: 9011183ac0SOlivier Moysan maxItems: 1 9111183ac0SOlivier Moysan 9211183ac0SOlivier Moysan st,adc-channels: 9311183ac0SOlivier Moysan description: | 9411183ac0SOlivier Moysan List of single-ended channels muxed for this ADC. 9511183ac0SOlivier Moysan On stm32h7 and stm32mp1: 9611183ac0SOlivier Moysan - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7. 9711183ac0SOlivier Moysan - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7. 9811183ac0SOlivier Moysan allOf: 9911183ac0SOlivier Moysan - $ref: /schemas/types.yaml#/definitions/uint32-array 10011183ac0SOlivier Moysan - items: 10111183ac0SOlivier Moysan minimum: 0 10211183ac0SOlivier Moysan maximum: 7 10311183ac0SOlivier Moysan 10411183ac0SOlivier Moysan st,adc-channel-names: 10511183ac0SOlivier Moysan description: List of single-ended channel names. 10611183ac0SOlivier Moysan allOf: 10711183ac0SOlivier Moysan - $ref: /schemas/types.yaml#/definitions/string-array 10811183ac0SOlivier Moysan 10911183ac0SOlivier Moysan st,filter-order: 11011183ac0SOlivier Moysan description: | 11111183ac0SOlivier Moysan SinC filter order from 0 to 5. 11211183ac0SOlivier Moysan - 0: FastSinC 11311183ac0SOlivier Moysan - [1-5]: order 1 to 5. 11411183ac0SOlivier Moysan For audio purpose it is recommended to use order 3 to 5. 11511183ac0SOlivier Moysan allOf: 11611183ac0SOlivier Moysan - $ref: /schemas/types.yaml#/definitions/uint32 11711183ac0SOlivier Moysan - items: 11811183ac0SOlivier Moysan minimum: 0 11911183ac0SOlivier Moysan maximum: 5 12011183ac0SOlivier Moysan 12111183ac0SOlivier Moysan "#io-channel-cells": 12211183ac0SOlivier Moysan const: 1 12311183ac0SOlivier Moysan 12411183ac0SOlivier Moysan st,adc-channel-types: 12511183ac0SOlivier Moysan description: | 12611183ac0SOlivier Moysan Single-ended channel input type. 12711183ac0SOlivier Moysan - "SPI_R": SPI with data on rising edge (default) 12811183ac0SOlivier Moysan - "SPI_F": SPI with data on falling edge 12911183ac0SOlivier Moysan - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1 13011183ac0SOlivier Moysan - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0 13111183ac0SOlivier Moysan items: 13211183ac0SOlivier Moysan enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] 13311183ac0SOlivier Moysan allOf: 13411183ac0SOlivier Moysan - $ref: /schemas/types.yaml#/definitions/non-unique-string-array 13511183ac0SOlivier Moysan 13611183ac0SOlivier Moysan st,adc-channel-clk-src: 13711183ac0SOlivier Moysan description: | 13811183ac0SOlivier Moysan Conversion clock source. 13911183ac0SOlivier Moysan - "CLKIN": external SPI clock (CLKIN x) 14011183ac0SOlivier Moysan - "CLKOUT": internal SPI clock (CLKOUT) (default) 14111183ac0SOlivier Moysan - "CLKOUT_F": internal SPI clock divided by 2 (falling edge). 14211183ac0SOlivier Moysan - "CLKOUT_R": internal SPI clock divided by 2 (rising edge). 14311183ac0SOlivier Moysan items: 14411183ac0SOlivier Moysan enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] 14511183ac0SOlivier Moysan allOf: 14611183ac0SOlivier Moysan - $ref: /schemas/types.yaml#/definitions/non-unique-string-array 14711183ac0SOlivier Moysan 14811183ac0SOlivier Moysan st,adc-alt-channel: 14911183ac0SOlivier Moysan description: 15011183ac0SOlivier Moysan Must be defined if two sigma delta modulators are 15111183ac0SOlivier Moysan connected on same SPI input. 15211183ac0SOlivier Moysan If not set, channel n is connected to SPI input n. 15311183ac0SOlivier Moysan If set, channel n is connected to SPI input n + 1. 15411183ac0SOlivier Moysan type: boolean 15511183ac0SOlivier Moysan 15611183ac0SOlivier Moysan st,filter0-sync: 15711183ac0SOlivier Moysan description: 15811183ac0SOlivier Moysan Set to 1 to synchronize with DFSDM filter instance 0. 15911183ac0SOlivier Moysan Used for multi microphones synchronization. 16011183ac0SOlivier Moysan type: boolean 16111183ac0SOlivier Moysan 16211183ac0SOlivier Moysan dmas: 16311183ac0SOlivier Moysan maxItems: 1 16411183ac0SOlivier Moysan 16511183ac0SOlivier Moysan dma-names: 16611183ac0SOlivier Moysan items: 16711183ac0SOlivier Moysan - const: rx 16811183ac0SOlivier Moysan 16911183ac0SOlivier Moysan required: 17011183ac0SOlivier Moysan - compatible 17111183ac0SOlivier Moysan - reg 17211183ac0SOlivier Moysan - interrupts 17311183ac0SOlivier Moysan - st,adc-channels 17411183ac0SOlivier Moysan - st,adc-channel-names 17511183ac0SOlivier Moysan - st,filter-order 17611183ac0SOlivier Moysan - "#io-channel-cells" 17711183ac0SOlivier Moysan 17811183ac0SOlivier Moysan allOf: 17911183ac0SOlivier Moysan - if: 18011183ac0SOlivier Moysan properties: 18111183ac0SOlivier Moysan compatible: 18211183ac0SOlivier Moysan contains: 18311183ac0SOlivier Moysan const: st,stm32-dfsdm-adc 18411183ac0SOlivier Moysan 18511183ac0SOlivier Moysan - then: 18611183ac0SOlivier Moysan properties: 18711183ac0SOlivier Moysan st,adc-channels: 18811183ac0SOlivier Moysan minItems: 1 18911183ac0SOlivier Moysan maxItems: 8 19011183ac0SOlivier Moysan 19111183ac0SOlivier Moysan st,adc-channel-names: 19211183ac0SOlivier Moysan minItems: 1 19311183ac0SOlivier Moysan maxItems: 8 19411183ac0SOlivier Moysan 19511183ac0SOlivier Moysan st,adc-channel-types: 19611183ac0SOlivier Moysan minItems: 1 19711183ac0SOlivier Moysan maxItems: 8 19811183ac0SOlivier Moysan 19911183ac0SOlivier Moysan st,adc-channel-clk-src: 20011183ac0SOlivier Moysan minItems: 1 20111183ac0SOlivier Moysan maxItems: 8 20211183ac0SOlivier Moysan 20311183ac0SOlivier Moysan io-channels: 20411183ac0SOlivier Moysan description: 20511183ac0SOlivier Moysan From common IIO binding. Used to pipe external sigma delta 20611183ac0SOlivier Moysan modulator or internal ADC output to DFSDM channel. 20711183ac0SOlivier Moysan This is not required for "st,stm32-dfsdm-pdm" compatibility as 20811183ac0SOlivier Moysan PDM microphone is binded in Audio DT node. 20911183ac0SOlivier Moysan 21011183ac0SOlivier Moysan required: 21111183ac0SOlivier Moysan - io-channels 21211183ac0SOlivier Moysan 21311183ac0SOlivier Moysan - if: 21411183ac0SOlivier Moysan properties: 21511183ac0SOlivier Moysan compatible: 21611183ac0SOlivier Moysan contains: 21711183ac0SOlivier Moysan const: st,stm32-dfsdm-dmic 21811183ac0SOlivier Moysan 21911183ac0SOlivier Moysan - then: 22011183ac0SOlivier Moysan properties: 22111183ac0SOlivier Moysan st,adc-channels: 22211183ac0SOlivier Moysan maxItems: 1 22311183ac0SOlivier Moysan 22411183ac0SOlivier Moysan st,adc-channel-names: 22511183ac0SOlivier Moysan maxItems: 1 22611183ac0SOlivier Moysan 22711183ac0SOlivier Moysan st,adc-channel-types: 22811183ac0SOlivier Moysan maxItems: 1 22911183ac0SOlivier Moysan 23011183ac0SOlivier Moysan st,adc-channel-clk-src: 23111183ac0SOlivier Moysan maxItems: 1 23211183ac0SOlivier Moysan 23311183ac0SOlivier Moysan required: 23411183ac0SOlivier Moysan - dmas 23511183ac0SOlivier Moysan - dma-names 23611183ac0SOlivier Moysan 23711183ac0SOlivier Moysan patternProperties: 23811183ac0SOlivier Moysan "^dfsdm-dai+$": 23911183ac0SOlivier Moysan type: object 24011183ac0SOlivier Moysan description: child node 24111183ac0SOlivier Moysan 24211183ac0SOlivier Moysan properties: 24311183ac0SOlivier Moysan "#sound-dai-cells": 24411183ac0SOlivier Moysan const: 0 24511183ac0SOlivier Moysan 24611183ac0SOlivier Moysan io-channels: 24711183ac0SOlivier Moysan description: 24811183ac0SOlivier Moysan From common IIO binding. Used to pipe external sigma delta 24911183ac0SOlivier Moysan modulator or internal ADC output to DFSDM channel. 25011183ac0SOlivier Moysan 25111183ac0SOlivier Moysan required: 25211183ac0SOlivier Moysan - "#sound-dai-cells" 25311183ac0SOlivier Moysan - io-channels 25411183ac0SOlivier Moysan 25511183ac0SOlivier MoysanallOf: 25611183ac0SOlivier Moysan - if: 25711183ac0SOlivier Moysan properties: 25811183ac0SOlivier Moysan compatible: 25911183ac0SOlivier Moysan contains: 26011183ac0SOlivier Moysan const: st,stm32h7-dfsdm 26111183ac0SOlivier Moysan 26211183ac0SOlivier Moysan - then: 26311183ac0SOlivier Moysan patternProperties: 26411183ac0SOlivier Moysan "^filter@[0-9]+$": 26511183ac0SOlivier Moysan properties: 26611183ac0SOlivier Moysan reg: 26711183ac0SOlivier Moysan items: 26811183ac0SOlivier Moysan minimum: 0 26911183ac0SOlivier Moysan maximum: 3 27011183ac0SOlivier Moysan 27111183ac0SOlivier Moysan - if: 27211183ac0SOlivier Moysan properties: 27311183ac0SOlivier Moysan compatible: 27411183ac0SOlivier Moysan contains: 27511183ac0SOlivier Moysan const: st,stm32mp1-dfsdm 27611183ac0SOlivier Moysan 27711183ac0SOlivier Moysan - then: 27811183ac0SOlivier Moysan patternProperties: 27911183ac0SOlivier Moysan "^filter@[0-9]+$": 28011183ac0SOlivier Moysan properties: 28111183ac0SOlivier Moysan reg: 28211183ac0SOlivier Moysan items: 28311183ac0SOlivier Moysan minimum: 0 28411183ac0SOlivier Moysan maximum: 5 28511183ac0SOlivier Moysan 28611183ac0SOlivier Moysanexamples: 28711183ac0SOlivier Moysan - | 28811183ac0SOlivier Moysan #include <dt-bindings/interrupt-controller/arm-gic.h> 28911183ac0SOlivier Moysan #include <dt-bindings/clock/stm32mp1-clks.h> 29011183ac0SOlivier Moysan dfsdm: dfsdm@4400d000 { 29111183ac0SOlivier Moysan compatible = "st,stm32mp1-dfsdm"; 29211183ac0SOlivier Moysan reg = <0x4400d000 0x800>; 29311183ac0SOlivier Moysan clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>; 29411183ac0SOlivier Moysan clock-names = "dfsdm", "audio"; 29511183ac0SOlivier Moysan #address-cells = <1>; 29611183ac0SOlivier Moysan #size-cells = <0>; 29711183ac0SOlivier Moysan 29811183ac0SOlivier Moysan dfsdm0: filter@0 { 29911183ac0SOlivier Moysan compatible = "st,stm32-dfsdm-dmic"; 30011183ac0SOlivier Moysan reg = <0>; 30111183ac0SOlivier Moysan interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 30211183ac0SOlivier Moysan dmas = <&dmamux1 101 0x400 0x01>; 30311183ac0SOlivier Moysan dma-names = "rx"; 30411183ac0SOlivier Moysan #io-channel-cells = <1>; 30511183ac0SOlivier Moysan st,adc-channels = <1>; 30611183ac0SOlivier Moysan st,adc-channel-names = "dmic0"; 30711183ac0SOlivier Moysan st,adc-channel-types = "SPI_R"; 30811183ac0SOlivier Moysan st,adc-channel-clk-src = "CLKOUT"; 30911183ac0SOlivier Moysan st,filter-order = <5>; 31011183ac0SOlivier Moysan 31111183ac0SOlivier Moysan asoc_pdm0: dfsdm-dai { 31211183ac0SOlivier Moysan compatible = "st,stm32h7-dfsdm-dai"; 31311183ac0SOlivier Moysan #sound-dai-cells = <0>; 31411183ac0SOlivier Moysan io-channels = <&dfsdm0 0>; 31511183ac0SOlivier Moysan }; 31611183ac0SOlivier Moysan }; 31711183ac0SOlivier Moysan 31811183ac0SOlivier Moysan dfsdm_pdm1: filter@1 { 31911183ac0SOlivier Moysan compatible = "st,stm32-dfsdm-adc"; 32011183ac0SOlivier Moysan reg = <1>; 32111183ac0SOlivier Moysan interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 32211183ac0SOlivier Moysan dmas = <&dmamux1 102 0x400 0x01>; 32311183ac0SOlivier Moysan dma-names = "rx"; 32411183ac0SOlivier Moysan #io-channel-cells = <1>; 32511183ac0SOlivier Moysan st,adc-channels = <2 3>; 32611183ac0SOlivier Moysan st,adc-channel-names = "in2", "in3"; 32711183ac0SOlivier Moysan st,adc-channel-types = "SPI_R", "SPI_R"; 32811183ac0SOlivier Moysan st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F"; 32911183ac0SOlivier Moysan io-channels = <&sd_adc2 &sd_adc3>; 33011183ac0SOlivier Moysan st,filter-order = <1>; 33111183ac0SOlivier Moysan }; 33211183ac0SOlivier Moysan }; 33311183ac0SOlivier Moysan 33411183ac0SOlivier Moysan... 335