匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“DFSDM Linux driver”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
DFSDM Linux driver
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Article purpose == The purpose of this article is to introduce the Linux<sup>®</sup> driver for the [[DFSDM internal peripheral]]: * Which DFSDM features are supported by the driver * How to configure, use and debug it * What is the driver structure, where to the find source code. == Short Description == The DFSDM Linux<sup>®</sup> driver (kernel space) is based on the [[IIO overview|IIO]] and [[ALSA overview|ALSA]] frameworks. It offers various modes: # '''IIO direct mode''': single capture on a channel # '''IIO software buffer''': capture one or more channels # '''IIO triggered buffer mode''': capture on one or more channels using triggers<br/>It uses hardware triggers available in IIO. See [[TIM Linux driver]] and [[LPTIM Linux driver]]. It offers an extended API<ref name="stm32-dfsdm-adc-h">{{CodeSource | Linux kernel | include/linux/iio/adc/stm32-dfsdm-adc.h}}, DFSDM IIO custom API</ref> for audio usage which allows '''PDM microphones capture''' through a SPI interface. == Configuration == === Kernel configuration === Activate the DFSDM Linux<sup>®</sup> driver in the kernel configuration by using the [[Menuconfig or how to configure kernel|menuconfig]] tool. ==== IIO driver ==== Configuration flag: CONFIG_STM32_DFSDM_ADC <pre> Device Drivers ---> <*> Industrial I/O support ---> Analog to digital converters ---> <*> STMicroelectronics STM32 dfsdm adc <*> STMicroelectronics STM32 adc # DFSDM ADC IIO driver </pre> When using the DFSDM ADC IIO driver (only), the user must also enable the driver for the external analog front-end (e.g. sigma delta modulator). The generic sigma delta modulators driver may be used for instance (CONFIG_SD_ADC_MODULATOR): <pre> Device Drivers ---> <*> Industrial I/O support ---> Analog to digital converters ---> <*> Generic sigma delta modulator # sigma delta modulator driver </pre> ==== Audio driver ==== Configuration flag: CONFIG_SND_SOC_STM32_DFSDM (Note: This configuration depends on [[#IIO_driver|CONFIG_STM32_DFSDM_ADC]]) <pre> 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 </pre> === Device tree === Refer to the [[DFSDM device tree configuration]] article when configuring the DFSDM Linux kernel driver. == How to use == === IIO driver === In "'''IIO direct mode'''", the conversion result can be read directly from '''sysfs''', see: [[How to use the IIO user space interface#How to do a simple ADC conversion using the sysfs interface|How to do a simple ADC conversion using the sysfs interface]]. In "'''IIO triggered buffer mode'''", the configuration must be performed by using '''sysfs''' first. Then, '''character device''' (/dev/iio:deviceX) is used to read data, see [[How to use the IIO user space interface#Convert_one_or_more_channels_using_triggered_buffer_mode|Convert one or more channels using triggered buffer mode]]. For information on the standard IIO consumer interface, please refer to [[IIO_overview#How_to_use_IIO_kernel_API|How to use IIO kernel API]] which gives an example of the IIO consumer kernel API. === Audio driver === The DFSDM Linux driver can be accessed from userland through an ALSA device. Refer to [[ALSA_overview#How_to_use|ALSA overview]] for information on how to list and use ALSA devices. ==How to trace and debug== === How to monitor === The DFSDM driver uses resources such as clocks and GPIOs. * Refer to [[Pinctrl_overview#How_to_monitor]] to check DFSDM GPIOs. * Refer to [[Clock_overview#How_to_monitor_with_debugfs]] to check DFSDM clocks. ==== How to monitor with debugfs ==== The DFSDM registers are accessed using REGMAP by ''DFSDM Linux<sup>®</sup> driver''. It comes with [[Debugfs|debugfs]] entries to dump registers: $ {{highlight|cd /sys/kernel/debug/regmap/4400d000.dfsdm/}} $ {{highlight|cat registers}} 000: 00000000 004: 00000000 008: 00000000 ==== Other ways to monitor ==== * Man can check the DFSDM '''interrupts''' and/or the DFSDM '''DMA''' interrupts: $ {{highlight|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 ==== 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. {{Board$}} dmesg -n8 {{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" ==== Audio driver ==== Refer to [[ALSA_overview#How_to_trace]] for details on trace tools. === How to debug === ==== Audio driver ==== Refer to [[ALSA_overview#How_to_debug]] for details on debugging tools. == 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-adc.c | stm32-dfsdm-adc.c}}, ADC part of DFSDM Linux driver to handle '''ADC''' operations * {{CodeSource | Linux kernel | sound/soc/stm/stm32_adfsdm.c | stm32_adfsdm.c}}, ASoC DAI part of DFSDM Linux driver to handle '''audio''' operations See also sigma delta modulator driver: * {{CodeSource | Linux kernel | drivers/iio/adc/sd_adc_modulator.c | sd_adc_modulator.c}}, sigma delta modulator Linux driver to handle analog front-end ==References== <references /> <noinclude> [[Category:IIO]] [[Category:ALSA]] {{PublicationRequestId | 9772 | 2018-11-28 | AlainF}} {{ArticleBasedOnModel | Linux driver article model}} </noinclude>
该页面使用的模板:
模板:Board$
(
查看源代码
)
模板:CodeSource
(
查看源代码
)
模板:Highlight
(
查看源代码
)
返回至
DFSDM Linux driver
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志