0001 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/iio/adc/st,stm32-dfsdm-adc.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006
0007 title: STMicroelectronics STM32 DFSDM ADC device driver
0008
0009 maintainers:
0010 - Fabrice Gasnier <fabrice.gasnier@foss.st.com>
0011 - Olivier Moysan <olivier.moysan@foss.st.com>
0012
0013 description: |
0014 STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to
0015 interface external sigma delta modulators to STM32 micro controllers.
0016 It is mainly targeted for:
0017 - Sigma delta modulators (motor control, metering...)
0018 - PDM microphones (audio digital microphone)
0019
0020 It features up to 8 serial digital interfaces (SPI or Manchester) and
0021 up to 4 filters on stm32h7 or 6 filters on stm32mp1.
0022
0023 Each child node matches with a filter instance.
0024
0025 properties:
0026 compatible:
0027 enum:
0028 - st,stm32h7-dfsdm
0029 - st,stm32mp1-dfsdm
0030
0031 reg:
0032 maxItems: 1
0033
0034 clocks:
0035 items:
0036 - description:
0037 Internal clock used for DFSDM digital processing and control blocks.
0038 dfsdm clock can also feed CLKOUT, when CLKOUT is used.
0039 - description: audio clock can be used as an alternate to feed CLKOUT.
0040 minItems: 1
0041
0042 clock-names:
0043 items:
0044 - const: dfsdm
0045 - const: audio
0046 minItems: 1
0047
0048 "#address-cells":
0049 const: 1
0050
0051 "#size-cells":
0052 const: 0
0053
0054 spi-max-frequency:
0055 description:
0056 SPI clock OUT frequency (Hz). Requested only for SPI master mode.
0057 This clock must be set according to the "clock" property.
0058 Frequency must be a multiple of the rcc clock frequency.
0059 If not, SPI CLKOUT frequency will not be accurate.
0060 maximum: 20000000
0061
0062 required:
0063 - compatible
0064 - reg
0065 - clocks
0066 - clock-names
0067 - "#address-cells"
0068 - "#size-cells"
0069
0070 additionalProperties: false
0071
0072 patternProperties:
0073 "^filter@[0-9]+$":
0074 type: object
0075 description: child node
0076
0077 properties:
0078 compatible:
0079 enum:
0080 - st,stm32-dfsdm-adc
0081 - st,stm32-dfsdm-dmic
0082
0083 reg:
0084 description: Specifies the DFSDM filter instance used.
0085 maxItems: 1
0086
0087 interrupts:
0088 maxItems: 1
0089
0090 st,adc-channels:
0091 description: |
0092 List of single-ended channels muxed for this ADC.
0093 On stm32h7 and stm32mp1:
0094 - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
0095 - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
0096 $ref: /schemas/types.yaml#/definitions/uint32-array
0097 items:
0098 minimum: 0
0099 maximum: 7
0100
0101 st,adc-channel-names:
0102 description: List of single-ended channel names.
0103
0104 st,filter-order:
0105 description: |
0106 SinC filter order from 0 to 5.
0107 - 0: FastSinC
0108 - [1-5]: order 1 to 5.
0109 For audio purpose it is recommended to use order 3 to 5.
0110 $ref: /schemas/types.yaml#/definitions/uint32
0111 maximum: 5
0112
0113 "#io-channel-cells":
0114 const: 1
0115
0116 st,adc-channel-types:
0117 description: |
0118 Single-ended channel input type.
0119 - "SPI_R": SPI with data on rising edge (default)
0120 - "SPI_F": SPI with data on falling edge
0121 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
0122 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
0123 items:
0124 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
0125 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
0126
0127 st,adc-channel-clk-src:
0128 description: |
0129 Conversion clock source.
0130 - "CLKIN": external SPI clock (CLKIN x)
0131 - "CLKOUT": internal SPI clock (CLKOUT) (default)
0132 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
0133 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
0134 items:
0135 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
0136 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
0137
0138 st,adc-alt-channel:
0139 description:
0140 Must be defined if two sigma delta modulators are
0141 connected on same SPI input.
0142 If not set, channel n is connected to SPI input n.
0143 If set, channel n is connected to SPI input n + 1.
0144 type: boolean
0145
0146 st,filter0-sync:
0147 description:
0148 Set to 1 to synchronize with DFSDM filter instance 0.
0149 Used for multi microphones synchronization.
0150 type: boolean
0151
0152 dmas:
0153 maxItems: 1
0154
0155 dma-names:
0156 items:
0157 - const: rx
0158
0159 required:
0160 - compatible
0161 - reg
0162 - interrupts
0163 - st,adc-channels
0164 - st,adc-channel-names
0165 - st,filter-order
0166 - "#io-channel-cells"
0167
0168 allOf:
0169 - if:
0170 properties:
0171 compatible:
0172 contains:
0173 const: st,stm32-dfsdm-adc
0174
0175 then:
0176 properties:
0177 st,adc-channels:
0178 minItems: 1
0179 maxItems: 8
0180
0181 st,adc-channel-names:
0182 minItems: 1
0183 maxItems: 8
0184
0185 st,adc-channel-types:
0186 minItems: 1
0187 maxItems: 8
0188
0189 st,adc-channel-clk-src:
0190 minItems: 1
0191 maxItems: 8
0192
0193 io-channels:
0194 description:
0195 From common IIO binding. Used to pipe external sigma delta
0196 modulator or internal ADC output to DFSDM channel.
0197
0198 required:
0199 - io-channels
0200
0201 - if:
0202 properties:
0203 compatible:
0204 contains:
0205 const: st,stm32-dfsdm-dmic
0206
0207 then:
0208 properties:
0209 st,adc-channels:
0210 maxItems: 1
0211
0212 st,adc-channel-names:
0213 maxItems: 1
0214
0215 st,adc-channel-types:
0216 maxItems: 1
0217
0218 st,adc-channel-clk-src:
0219 maxItems: 1
0220
0221 required:
0222 - dmas
0223 - dma-names
0224
0225 patternProperties:
0226 "^dfsdm-dai+$":
0227 type: object
0228 description: child node
0229
0230 properties:
0231 compatible:
0232 enum:
0233 - st,stm32h7-dfsdm-dai
0234
0235 "#sound-dai-cells":
0236 const: 0
0237
0238 io-channels:
0239 description:
0240 From common IIO binding. Used to pipe external sigma delta
0241 modulator or internal ADC output to DFSDM channel.
0242
0243 required:
0244 - compatible
0245 - "#sound-dai-cells"
0246 - io-channels
0247
0248 allOf:
0249 - if:
0250 properties:
0251 compatible:
0252 contains:
0253 const: st,stm32h7-dfsdm
0254
0255 then:
0256 patternProperties:
0257 "^filter@[0-9]+$":
0258 properties:
0259 reg:
0260 items:
0261 minimum: 0
0262 maximum: 3
0263
0264 - if:
0265 properties:
0266 compatible:
0267 contains:
0268 const: st,stm32mp1-dfsdm
0269
0270 then:
0271 patternProperties:
0272 "^filter@[0-9]+$":
0273 properties:
0274 reg:
0275 items:
0276 minimum: 0
0277 maximum: 5
0278
0279 examples:
0280 - |
0281 #include <dt-bindings/interrupt-controller/arm-gic.h>
0282 #include <dt-bindings/clock/stm32mp1-clks.h>
0283 dfsdm: dfsdm@4400d000 {
0284 compatible = "st,stm32mp1-dfsdm";
0285 reg = <0x4400d000 0x800>;
0286 clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
0287 clock-names = "dfsdm", "audio";
0288 #address-cells = <1>;
0289 #size-cells = <0>;
0290
0291 dfsdm0: filter@0 {
0292 compatible = "st,stm32-dfsdm-dmic";
0293 reg = <0>;
0294 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
0295 dmas = <&dmamux1 101 0x400 0x01>;
0296 dma-names = "rx";
0297 #io-channel-cells = <1>;
0298 st,adc-channels = <1>;
0299 st,adc-channel-names = "dmic0";
0300 st,adc-channel-types = "SPI_R";
0301 st,adc-channel-clk-src = "CLKOUT";
0302 st,filter-order = <5>;
0303
0304 asoc_pdm0: dfsdm-dai {
0305 compatible = "st,stm32h7-dfsdm-dai";
0306 #sound-dai-cells = <0>;
0307 io-channels = <&dfsdm0 0>;
0308 };
0309 };
0310
0311 dfsdm_pdm1: filter@1 {
0312 compatible = "st,stm32-dfsdm-adc";
0313 reg = <1>;
0314 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
0315 dmas = <&dmamux1 102 0x400 0x01>;
0316 dma-names = "rx";
0317 #io-channel-cells = <1>;
0318 st,adc-channels = <2 3>;
0319 st,adc-channel-names = "in2", "in3";
0320 st,adc-channel-types = "SPI_R", "SPI_R";
0321 st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
0322 io-channels = <&sd_adc2 &sd_adc3>;
0323 st,filter-order = <1>;
0324 };
0325 };
0326
0327 ...