st,stm32-dfsdm-adc.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. STMicroelectronics STM32 DFSDM ADC device driver
  2. STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to
  3. interface external sigma delta modulators to STM32 micro controllers.
  4. It is mainly targeted for:
  5. - Sigma delta modulators (motor control, metering...)
  6. - PDM microphones (audio digital microphone)
  7. It features up to 8 serial digital interfaces (SPI or Manchester) and
  8. up to 4 filters on stm32h7 or 6 filters on stm32mp1.
  9. Each child node match with a filter instance.
  10. Contents of a STM32 DFSDM root node:
  11. ------------------------------------
  12. Required properties:
  13. - compatible: Should be one of:
  14. "st,stm32h7-dfsdm"
  15. "st,stm32mp1-dfsdm"
  16. - reg: Offset and length of the DFSDM block register set.
  17. - clocks: IP and serial interfaces clocking. Should be set according
  18. to rcc clock ID and "clock-names".
  19. - clock-names: Input clock name "dfsdm" must be defined,
  20. "audio" is optional. If defined CLKOUT is based on the audio
  21. clock, else "dfsdm" is used.
  22. - #interrupt-cells = <1>;
  23. - #address-cells = <1>;
  24. - #size-cells = <0>;
  25. Optional properties:
  26. - spi-max-frequency: Requested only for SPI master mode.
  27. SPI clock OUT frequency (Hz). This clock must be set according
  28. to "clock" property. Frequency must be a multiple of the rcc
  29. clock frequency. If not, SPI CLKOUT frequency will not be
  30. accurate.
  31. - pinctrl-names: Set to "default".
  32. - pinctrl-0: List of phandles pointing to pin configuration
  33. nodes to set pins in mode of operation for dfsdm
  34. on external pin.
  35. Contents of a STM32 DFSDM child nodes:
  36. --------------------------------------
  37. Required properties:
  38. - compatible: Must be:
  39. "st,stm32-dfsdm-adc" for sigma delta ADCs
  40. "st,stm32-dfsdm-dmic" for audio digital microphone.
  41. - reg: Specifies the DFSDM filter instance used.
  42. Valid values are from 0 to 3 on stm32h7, 0 to 5 on stm32mp1.
  43. - interrupts: IRQ lines connected to each DFSDM filter instance.
  44. - st,adc-channels: List of single-ended channels muxed for this ADC.
  45. valid values:
  46. "st,stm32h7-dfsdm" compatibility: 0 to 7.
  47. - st,adc-channel-names: List of single-ended channel names.
  48. - st,filter-order: SinC filter order from 0 to 5.
  49. 0: FastSinC
  50. [1-5]: order 1 to 5.
  51. For audio purpose it is recommended to use order 3 to 5.
  52. - #io-channel-cells = <1>: See the IIO bindings section "IIO consumers".
  53. Required properties for "st,stm32-dfsdm-adc" compatibility:
  54. - io-channels: From common IIO binding. Used to pipe external sigma delta
  55. modulator or internal ADC output to DFSDM channel.
  56. This is not required for "st,stm32-dfsdm-pdm" compatibility as
  57. PDM microphone is binded in Audio DT node.
  58. Required properties for "st,stm32-dfsdm-pdm" compatibility:
  59. - #sound-dai-cells: Must be set to 0.
  60. - dma: DMA controller phandle and DMA request line associated to the
  61. filter instance (specified by the field "reg")
  62. - dma-names: Must be "rx"
  63. Optional properties:
  64. - st,adc-channel-types: Single-ended channel input type.
  65. - "SPI_R": SPI with data on rising edge (default)
  66. - "SPI_F": SPI with data on falling edge
  67. - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
  68. - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
  69. - st,adc-channel-clk-src: Conversion clock source.
  70. - "CLKIN": external SPI clock (CLKIN x)
  71. - "CLKOUT": internal SPI clock (CLKOUT) (default)
  72. - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
  73. - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
  74. - st,adc-alt-channel: Must be defined if two sigma delta modulator are
  75. connected on same SPI input.
  76. If not set, channel n is connected to SPI input n.
  77. If set, channel n is connected to SPI input n + 1.
  78. - st,filter0-sync: Set to 1 to synchronize with DFSDM filter instance 0.
  79. Used for multi microphones synchronization.
  80. Example of a sigma delta adc connected on DFSDM SPI port 0
  81. and a pdm microphone connected on DFSDM SPI port 1:
  82. ads1202: simple_sd_adc@0 {
  83. compatible = "ads1202";
  84. #io-channel-cells = <1>;
  85. };
  86. dfsdm: dfsdm@40017000 {
  87. compatible = "st,stm32h7-dfsdm";
  88. reg = <0x40017000 0x400>;
  89. clocks = <&rcc DFSDM1_CK>;
  90. clock-names = "dfsdm";
  91. #interrupt-cells = <1>;
  92. #address-cells = <1>;
  93. #size-cells = <0>;
  94. dfsdm_adc0: filter@0 {
  95. compatible = "st,stm32-dfsdm-adc";
  96. #io-channel-cells = <1>;
  97. reg = <0>;
  98. interrupts = <110>;
  99. st,adc-channels = <0>;
  100. st,adc-channel-names = "sd_adc0";
  101. st,adc-channel-types = "SPI_F";
  102. st,adc-channel-clk-src = "CLKOUT";
  103. io-channels = <&ads1202 0>;
  104. st,filter-order = <3>;
  105. };
  106. dfsdm_pdm1: filter@1 {
  107. compatible = "st,stm32-dfsdm-dmic";
  108. reg = <1>;
  109. interrupts = <111>;
  110. dmas = <&dmamux1 102 0x400 0x00>;
  111. dma-names = "rx";
  112. st,adc-channels = <1>;
  113. st,adc-channel-names = "dmic1";
  114. st,adc-channel-types = "SPI_R";
  115. st,adc-channel-clk-src = "CLKOUT";
  116. st,filter-order = <5>;
  117. };
  118. }