“DFSDM Linux driver”的版本间的差异

来自百问网嵌入式Linux wiki
 
(未显示同一用户的4个中间版本)
第64行: 第64行:
 
==How to trace and debug==
 
==How to trace and debug==
 
=== How to monitor ===
 
=== How to monitor ===
The DFSDM driver uses resources such as clocks and GPIOs.
+
DFSDM驱动程序使用诸如时钟和GPIO之类的资源。
* Refer to [[Pinctrl_overview#How_to_monitor]] to check DFSDM GPIOs.
+
* 请参阅[[Pinctrl_overview#How_to_monitor]] 以检查DFSDM GPIO。
* Refer to [[Clock_overview#How_to_monitor_with_debugfs]] to check DFSDM clocks.
+
* 请参阅 [[Clock_overview#How_to_monitor_with_debugfs]]检查DFSDM时钟。
  
 
==== How to monitor with debugfs ====
 
==== How to monitor with debugfs ====
The DFSDM registers are accessed using REGMAP by ''DFSDM Linux<sup>&reg;</sup> driver''.
+
通过''DFSDM Linux<sup>&reg;</sup> 驱动程序''使用REGMAP访问DFSDM寄存器。
 
+
它带有[[Debugfs|debugfs]]条目以转储寄存器:
It comes with [[Debugfs|debugfs]] entries to dump registers:
 
 
  $ {{highlight|cd /sys/kernel/debug/regmap/4400d000.dfsdm/}}
 
  $ {{highlight|cd /sys/kernel/debug/regmap/4400d000.dfsdm/}}
 
  $ {{highlight|cat registers}}
 
  $ {{highlight|cat registers}}
第79行: 第78行:
  
 
==== Other ways to monitor ====
 
==== Other ways to monitor ====
* Man can check the DFSDM '''interrupts''' and/or the DFSDM '''DMA''' interrupts:
+
* Man可以检查DFSDM'''interrupts'''/或DFSDM'''DMA'''中断:
 
  $ {{highlight|cat /proc/interrupts}}
 
  $ {{highlight|cat /proc/interrupts}}
 
             CPU0      CPU1
 
             CPU0      CPU1
第90行: 第89行:
 
=== How to trace ===
 
=== How to trace ===
 
==== IIO driver ====
 
==== IIO driver ====
Refer to [[IIO_overview#How_to_trace_with_dynamic_debug|How to trace with dynamic debug]] for how to enable the debug logs in the driver and in the framework.
+
请参阅[[IIO_overview#How_to_trace_with_dynamic_debug|How to trace with dynamic debug]],以了解如何在驱动程序和框架中启用调试日志。
 
  {{Board$}} dmesg -n8
 
  {{Board$}} dmesg -n8
 
  {{Board$}} echo "file drivers/iio/adc/stm32-dfsdm* +p" > /sys/kernel/debug/dynamic_debug/control
 
  {{Board$}} echo "file drivers/iio/adc/stm32-dfsdm* +p" > /sys/kernel/debug/dynamic_debug/control
To enable dynamic debug at boot time, append the following arguments on the kernel command line:
+
要在引导时启用动态调试,请在内核命令行上附加以下参数:
 
  loglevel=8 dyndbg="file drivers/iio/adc/stm32-dfsdm* +p"
 
  loglevel=8 dyndbg="file drivers/iio/adc/stm32-dfsdm* +p"
 +
 
==== Audio driver ====
 
==== Audio driver ====
Refer to [[ALSA_overview#How_to_trace]] for details on trace tools.
+
有关跟踪工具的详细信息,请参考 [[ALSA_overview#How_to_trace]]
  
 
=== How to debug ===
 
=== How to debug ===
 
==== Audio driver ====
 
==== Audio driver ====
Refer to [[ALSA_overview#How_to_debug]] for details on debugging tools.
+
有关调试工具的详细信息,请参考[[ALSA_overview#How_to_debug]]
  
 
== Source code location ==
 
== Source code location ==
It is composed of:
+
它由以下组成:
* {{CodeSource | Linux kernel | drivers/iio/adc/stm32-dfsdm-core.c | stm32-dfsdm-core.c}}, core part of DFSDM Linux driver to handle common resources: registers, clock
+
* {{CodeSource | Linux kernel | drivers/iio/adc/stm32-dfsdm-core.c | stm32-dfsdm-core.c}}, DFSDM Linux驱动程序的核心部分,用于处理常见资源:寄存器,时钟
* {{CodeSource | Linux kernel | drivers/iio/adc/stm32-dfsdm-adc.c | stm32-dfsdm-adc.c}}, ADC part of DFSDM Linux driver to handle '''ADC''' operations
+
* {{CodeSource | Linux kernel | drivers/iio/adc/stm32-dfsdm-adc.c | stm32-dfsdm-adc.c}}, DFSDM Linux驱动程序的ADC部分,用于处理“ ADC”操作
* {{CodeSource | Linux kernel | sound/soc/stm/stm32_adfsdm.c | stm32_adfsdm.c}}, ASoC DAI part of DFSDM Linux driver to handle '''audio''' operations
+
* {{CodeSource | Linux kernel | sound/soc/stm/stm32_adfsdm.c | stm32_adfsdm.c}}, DFSDM Linux驱动程序的ASoC DAI部分,用于处理“音频”操作
See also sigma delta modulator driver:
+
另请参见sigma delta调制器驱动程序:
* {{CodeSource | Linux kernel | drivers/iio/adc/sd_adc_modulator.c | sd_adc_modulator.c}}, sigma delta modulator Linux driver to handle analog front-end
+
* {{CodeSource | Linux kernel | drivers/iio/adc/sd_adc_modulator.c | sd_adc_modulator.c}},sigma delta调制器Linux驱动程序,用于处理模拟前端
 +
 
 
==References==
 
==References==
 
<references />
 
<references />

2020年11月9日 (一) 16:01的最新版本

Article purpose

本文的目的是介绍用于DFSDM internal peripheral的Linux®驱动程序:

  • 驱动程序支持哪些DFSDM功能
  • 如何配置,使用和调试它
  • 驱动程序的结构是什么,在哪里可以找到源代码。

Short Description

DFSDM Linux®驱动程序(内核空间)基于 IIOALSA框架。 它提供多种模式:

  1. IIO直接模式: 在一个频道上进行单次捕获
  2. IIO软件缓冲区: 捕获一个或多个频道
  3. IIO触发缓冲模式:使用触发器在一个或多个通道上捕获
    它使用IIO中可用的硬件触发器。请参见TIM Linux driver and LPTIM Linux driver.

它提供了扩展的API[1] for audio usage which allows ,它允许通过SPI接口捕获PDM麦克风

Configuration

Kernel configuration

通过使用menuconfig 工具,在内核配置中激活DFSDMLinux®驱动程序。

IIO driver

配置标志: CONFIG_STM32_DFSDM_ADC

Device Drivers  --->
   <*> Industrial I/O support  --->
      Analog to digital converters  --->
         <*> STMicroelectronics STM32 dfsdm adc
         <*>   STMicroelectronics STM32 adc                        # DFSDM ADC IIO driver

使用DFSDM ADC IIO驱动程序(仅限)时,用户还必须使能外部模拟前端的驱动程序(例如Sigma Delta调制器)。 例如,可以使用通用sigma delta调制器驱动程序(CONFIG_SD_ADC_MODULATOR):

Device Drivers  --->
   <*> Industrial I/O support  --->
      Analog to digital converters  --->
         <*> Generic sigma delta modulator                         # sigma delta modulator driver

Audio driver

配置标志: CONFIG_SND_SOC_STM32_DFSDM (注意:此配置取决于CONFIG_STM32_DFSDM_ADC)

Device Drivers  --->
   <*> Sound card support  --->
      <*>   Advanced Linux Sound Architecture  --->
         <*>   ALSA for SoC audio support  --->
            STMicroelectronics STM32 SOC audio support  --->
               <*> SoC Audio support for STM32 DFSDM               # DFSDM Audio driver for digital microphone capture

Device tree

配置DFSDM Linux内核驱动程序时,请参考DFSDM device tree configuration 文章。

How to use

IIO driver

在 "'IIO直接模式"中,可以直接从sysfs中读取转换结果,请参见: How to do a simple ADC conversion using the sysfs interface.

在“IIO触发缓冲区模式”中,必须先使用sysfs来执行配置。 然后,使用字符设备(/dev/io:deviceX)读取数据,参见 For information on the standard IIO consumer interface, please refer to How to use IIO kernel API 给出了IIO使用者内核API的示例。

Audio driver

可以通过ALSA设备从用户域访问DFSDM Linux驱动程序。 有关如何列出和使用ALSA设备的信息,请参考ALSA overview

How to trace and debug

How to monitor

DFSDM驱动程序使用诸如时钟和GPIO之类的资源。

How to monitor with debugfs

通过DFSDM Linux® 驱动程序使用REGMAP访问DFSDM寄存器。 它带有调试文件系统(debugfs)条目以转储寄存器:

$ cd /sys/kernel/debug/regmap/4400d000.dfsdm/
$ cat registers
000: 00000000
004: 00000000
008: 00000000

Other ways to monitor

  • Man可以检查DFSDMinterrupts和/或DFSDMDMA中断:
$ cat /proc/interrupts
           CPU0       CPU1
...
 99:          0          0     GIC-0 142 Level     4400d000.dfsdm:filter@0
100:          0          0     GIC-0 143 Level     4400d000.dfsdm:filter@1
101:          0          0     GIC-0 144 Level     4400d000.dfsdm:filter@2
...

How to trace

IIO driver

请参阅How to trace with dynamic debug,以了解如何在驱动程序和框架中启用调试日志。

Board $> dmesg -n8
Board $> echo "file drivers/iio/adc/stm32-dfsdm* +p" > /sys/kernel/debug/dynamic_debug/control

要在引导时启用动态调试,请在内核命令行上附加以下参数:

loglevel=8 dyndbg="file drivers/iio/adc/stm32-dfsdm* +p"

Audio driver

有关跟踪工具的详细信息,请参考 ALSA_overview#How_to_trace

How to debug

Audio driver

有关调试工具的详细信息,请参考ALSA_overview#How_to_debug

Source code location

它由以下组成:

另请参见sigma delta调制器驱动程序: