brintos

brintos / linux-shallow public Read only

0
0
Text · 11.4 KiB · c24ac98 Raw
430 lines · yaml
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)2%YAML 1.23---4$id: http://devicetree.org/schemas/iio/adc/st,stm32-dfsdm-adc.yaml#5$schema: http://devicetree.org/meta-schemas/core.yaml#6 7title: STMicroelectronics STM32 DFSDM ADC device driver8 9maintainers:10  - Fabrice Gasnier <fabrice.gasnier@foss.st.com>11  - Olivier Moysan <olivier.moysan@foss.st.com>12 13description: |14  STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to15  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) and21  up to 4 filters on stm32h7 or 6 filters on stm32mp1.22 23  Each child node matches with a filter instance.24 25properties:26  compatible:27    enum:28      - st,stm32h7-dfsdm29      - st,stm32mp1-dfsdm30 31  reg:32    maxItems: 133 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: 141 42  clock-names:43    items:44      - const: dfsdm45      - const: audio46    minItems: 147 48  "#address-cells":49    const: 150 51  "#size-cells":52    const: 053 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: 2000000061 62  access-controllers:63    minItems: 164    maxItems: 265 66required:67  - compatible68  - reg69  - clocks70  - clock-names71  - "#address-cells"72  - "#size-cells"73 74additionalProperties: false75 76patternProperties:77  "^filter@[0-9]+$":78    type: object79    unevaluatedProperties: false80    description: child node81 82    properties:83      compatible:84        enum:85          - st,stm32-dfsdm-adc86          - st,stm32-dfsdm-dmic87 88      reg:89        description: Specifies the DFSDM filter instance used.90        maxItems: 191 92      interrupts:93        maxItems: 194 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-array102        items:103          minimum: 0104          maximum: 7105        deprecated: true106 107      st,adc-channel-names:108        description: List of single-ended channel names.109        deprecated: true110 111      st,filter-order:112        description: |113          SinC filter order from 0 to 5.114          - 0: FastSinC115          - [1-5]: order 1 to 5.116          For audio purpose it is recommended to use order 3 to 5.117        $ref: /schemas/types.yaml#/definitions/uint32118        maximum: 5119 120      "#io-channel-cells":121        const: 1122 123      '#address-cells':124        const: 1125 126      '#size-cells':127        const: 0128 129      st,adc-channel-types:130        description: |131          Single-ended channel input type.132          - "SPI_R": SPI with data on rising edge (default)133          - "SPI_F": SPI with data on falling edge134          - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1135          - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0136        items:137          enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]138        $ref: /schemas/types.yaml#/definitions/non-unique-string-array139        deprecated: true140 141      st,adc-channel-clk-src:142        description: |143          Conversion clock source.144          - "CLKIN": external SPI clock (CLKIN x)145          - "CLKOUT": internal SPI clock (CLKOUT) (default)146          - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).147          - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).148        items:149          enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]150        $ref: /schemas/types.yaml#/definitions/non-unique-string-array151        deprecated: true152 153      st,adc-alt-channel:154        description:155          Must be defined if two sigma delta modulators are156          connected on same SPI input.157          If not set, channel n is connected to SPI input n.158          If set, channel n is connected to SPI input n + 1.159        type: boolean160        deprecated: true161 162      st,filter0-sync:163        description:164          Set to 1 to synchronize with DFSDM filter instance 0.165          Used for multi microphones synchronization.166        type: boolean167 168      dmas:169        maxItems: 1170 171      dma-names:172        items:173          - const: rx174 175    required:176      - compatible177      - reg178      - interrupts179      - st,filter-order180      - "#io-channel-cells"181 182    patternProperties:183      "^channel@[0-7]$":184        type: object185        $ref: adc.yaml186        unevaluatedProperties: false187        description: Represents the external channels which are connected to the DFSDM.188 189        properties:190          reg:191            maximum: 7192 193          label:194            description:195              Unique name to identify which channel this is.196 197          st,adc-channel-type:198            description: |199              Single-ended channel input type.200              - "SPI_R": SPI with data on rising edge (default)201              - "SPI_F": SPI with data on falling edge202              - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1203              - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0204            $ref: /schemas/types.yaml#/definitions/string205            enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]206 207          st,adc-channel-clk-src:208            description: |209              Conversion clock source.210              - "CLKIN": external SPI clock (CLKIN x)211              - "CLKOUT": internal SPI clock (CLKOUT) (default)212              - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).213              - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).214            $ref: /schemas/types.yaml#/definitions/string215            enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]216 217          st,adc-alt-channel:218            description:219              Must be defined if two sigma delta modulators are220              connected on same SPI input.221              If not set, channel n is connected to SPI input n.222              If set, channel n is connected to SPI input n + 1.223            type: boolean224 225          io-backends:226            description:227              Used to pipe external sigma delta modulator or internal ADC backend to DFSDM channel.228            maxItems: 1229 230        required:231          - reg232 233    allOf:234      - if:235          properties:236            compatible:237              contains:238                const: st,stm32-dfsdm-adc239 240        then:241          properties:242            st,adc-channels:243              minItems: 1244              maxItems: 8245 246            st,adc-channel-names:247              minItems: 1248              maxItems: 8249 250            st,adc-channel-types:251              minItems: 1252              maxItems: 8253 254            st,adc-channel-clk-src:255              minItems: 1256              maxItems: 8257 258            io-channels:259              description:260                From common IIO binding. Used to pipe external sigma delta261                modulator or internal ADC output to DFSDM channel.262              deprecated: true263 264          if:265            required:266              - st,adc-channels267          then:268            required:269              - io-channels270 271          patternProperties:272            "^channel@[0-7]$":273              required:274                - io-backends275 276      - if:277          properties:278            compatible:279              contains:280                const: st,stm32-dfsdm-dmic281 282        then:283          properties:284            st,adc-channels:285              maxItems: 1286 287            st,adc-channel-names:288              maxItems: 1289 290            st,adc-channel-types:291              maxItems: 1292 293            st,adc-channel-clk-src:294              maxItems: 1295 296          required:297            - dmas298            - dma-names299 300          patternProperties:301            "^dfsdm-dai+$":302              type: object303              additionalProperties: false304              description: child node305 306              properties:307                compatible:308                  enum:309                    - st,stm32h7-dfsdm-dai310 311                "#sound-dai-cells":312                  const: 0313 314                io-channels:315                  description:316                    From common IIO binding. Used to pipe external sigma delta317                    modulator or internal ADC output to DFSDM channel.318 319                port:320                  $ref: /schemas/sound/audio-graph-port.yaml#321                  unevaluatedProperties: false322 323              required:324                - compatible325                - "#sound-dai-cells"326                - io-channels327 328allOf:329  - if:330      properties:331        compatible:332          contains:333            const: st,stm32h7-dfsdm334 335    then:336      patternProperties:337        "^filter@[0-9]+$":338          properties:339            reg:340              items:341                minimum: 0342                maximum: 3343 344  - if:345      properties:346        compatible:347          contains:348            const: st,stm32mp1-dfsdm349 350    then:351      patternProperties:352        "^filter@[0-9]+$":353          properties:354            reg:355              items:356                minimum: 0357                maximum: 5358 359examples:360  - |361    #include <dt-bindings/interrupt-controller/arm-gic.h>362    #include <dt-bindings/clock/stm32mp1-clks.h>363    dfsdm: dfsdm@4400d000 {364      compatible = "st,stm32mp1-dfsdm";365      reg = <0x4400d000 0x800>;366      clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;367      clock-names = "dfsdm", "audio";368      #address-cells = <1>;369      #size-cells = <0>;370 371      // Example 1: Audio use case with generic binding372      dfsdm0: filter@0 {373        compatible = "st,stm32-dfsdm-dmic";374        reg = <0>;375        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;376        dmas = <&dmamux1 101 0x400 0x01>;377        dma-names = "rx";378        #io-channel-cells = <1>;379        #address-cells = <1>;380        #size-cells = <0>;381        st,filter-order = <5>;382 383        channel@1 {384          reg = <1>;385          label = "dmic0";386          st,adc-channel-type = "SPI_R";387          st,adc-channel-clk-src = "CLKOUT";388          st,adc-alt-channel;389        };390 391        asoc_pdm0: dfsdm-dai {392          compatible = "st,stm32h7-dfsdm-dai";393          #sound-dai-cells = <0>;394          io-channels = <&dfsdm0 0>;395        };396      };397 398      // Example 2: Analog use case with generic binding399      dfsdm1: filter@1 {400        compatible = "st,stm32-dfsdm-adc";401        reg = <1>;402        interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;403        dmas = <&dmamux1 102 0x400 0x01>;404        dma-names = "rx";405        st,filter-order = <1>;406        #io-channel-cells = <1>;407        #address-cells = <1>;408        #size-cells = <0>;409 410        channel@2 {411          reg = <2>;412          label = "in2";413          st,adc-channel-type = "SPI_F";414          st,adc-channel-clk-src = "CLKOUT";415          st,adc-alt-channel;416          io-backends = <&sd_adc2>;417        };418 419        channel@3 {420          reg = <3>;421          label = "in3";422          st,adc-channel-type = "SPI_R";423          st,adc-channel-clk-src = "CLKOUT";424          io-backends = <&sd_adc3>;425        };426      };427    };428 429...430