“I2S Linux driver”的版本间的差异
| (未显示2个用户的3个中间版本) | |||
| 第1行: | 第1行: | ||
| − | [[ | + | == Article purpose == |
| − | + | 本文介绍了[[SPI internal peripheral|SPI/I2S internal peripheral]]的 I2S Linux<sup>®</sup> 驱动程序。 | |
| − | + | ||
| + | == Short Description == | ||
| + | I2S Linux驱动程序是在Linux[[ALSA_overview|ALSA framework]]中实现的ASoC CPU DAI驱动程序。 | ||
| + | |||
| + | I2S驱动程序请求两个时钟,这些时钟可用作IS2外设内核时钟的父时钟。 | ||
| + | 这些父时钟的速率必须分别是8kHz和11.025kHz的倍数 | ||
| + | 在运行时通过I2S时钟复用器选择这两个时钟之一,具体取决于音频流采样率。 | ||
| + | |||
| + | |||
| + | SPI/I2S2 和 SPI/I2S3 内部外设共享相同的时钟复用器 | ||
| + | 如果使用I2S2和I2S3来运行具有以下内容的音频流,则这可能会导致时钟多路复用器配置冲突: | ||
| + | |||
| + | 不兼容的费率(即费率不是彼此的倍数)。I2S驱动程序不能自行保护以免发生这种冲突。 | ||
| + | </div></div> | ||
| + | |||
| + | == Configuration == | ||
| + | |||
| + | === Kernel Configuration === | ||
| + | 使用Linux Menuconfig 工具在内核配置中激活I2S Linux驱动程序: [[Menuconfig or how to configure kernel]]. | ||
| + | <pre> | ||
| + | [*] Device Drivers | ||
| + | [*] Sound card support | ||
| + | [*] Advanced Linux Sound Architecture | ||
| + | [*] ALSA for SoC audio support | ||
| + | STMicroelectronics STM32 SOC audio support | ||
| + | [*] STM32 I2S interface (SPI/I2S block) support | ||
| + | </pre> | ||
| + | |||
| + | === Device tree === | ||
| + | 配置I2S Linux内核驱动程序时,请参考 [[I2S_device_tree_configuration]]文章。 | ||
| + | |||
| + | {{Info|I2S外设可以通过其配置寄存器配置为仅发送,仅接收或全双工模式。 | ||
| + | I2S驱动程序提供仅发送,仅接收或全双工用例的支持。 但是,无论选择哪种使用情况,驱动程序始终在配置寄存器中以全双工模式配置I2S。 如果未使用路径(发送或捕获),则将其简单地丢弃。 | ||
| + | 因此,'''I2S设备树绑定中没有属性来配置I2S外设的模式'''。}} | ||
| + | |||
| + | == How to use == | ||
| + | 可以通过ALSA设备从用户区访问I2S Linux驱动程序。 有关如何列出和使用ALSA设备的信息,请参考[[ALSA_overview#How_to_use|ALSA overview]] 。 | ||
| + | |||
| + | ==How to trace and debug== | ||
| + | 可以检查 [[Debugfs|debugfs]] 和procfs文件系统以获取有关I2S驱动程序及其使用的资源的信息。 下面提供了这些文件系统条目的详尽列表。 有关调试工具的更多详细信息,请参见 [[ALSA_overview#How_to_trace_and_debug_the_framework|ALSA overview]]。 | ||
| + | |||
| + | * debugfs条目: | ||
| + | :* '''asoc''': 请参阅 [[ALSA_overview#How_to_monitor]] | ||
| + | :* '''clk''': 请参阅[ [qi[Clock_overview#How_to_monitor_with_debugfs]] 以获取有关时钟的信息。 | ||
| + | :* '''pinctrl''': 请参阅 [[Pinctrl_overview#How_to_monitor]] 以获取有关引脚的信息。 | ||
| + | :* '''regmap''': 允许监视SPI / I2S外设寄存器。 | ||
| + | <div style="margin-left: 2em;"> | ||
| + | $ cat /sys/kernel/debug/regmap/xxx.audio-controller/registers | ||
| + | </div> | ||
| + | * procfs条目: | ||
| + | :* '''asound''': 请参阅 [[ALSA_overview#How_to_debug]] | ||
| + | :* '''interrupts''': 允许检查中断。 | ||
| + | <div style="margin-left: 2em;"> | ||
| + | $ cat /proc/interrupts | ||
| + | </div> | ||
| + | |||
| + | == Source code location == | ||
| + | {{CodeSource | Linux kernel | sound/soc/stm/stm32_i2s.c}}: 实现I2S Linux驱动程序。 | ||
| + | |||
| + | ==References== | ||
| + | <references /> | ||
2020年11月5日 (四) 10:48的最新版本
目录
Article purpose
本文介绍了SPI/I2S internal peripheral的 I2S Linux® 驱动程序。
Short Description
I2S Linux驱动程序是在LinuxALSA framework中实现的ASoC CPU DAI驱动程序。
I2S驱动程序请求两个时钟,这些时钟可用作IS2外设内核时钟的父时钟。 这些父时钟的速率必须分别是8kHz和11.025kHz的倍数 在运行时通过I2S时钟复用器选择这两个时钟之一,具体取决于音频流采样率。
SPI/I2S2 和 SPI/I2S3 内部外设共享相同的时钟复用器
如果使用I2S2和I2S3来运行具有以下内容的音频流,则这可能会导致时钟多路复用器配置冲突:
不兼容的费率(即费率不是彼此的倍数)。I2S驱动程序不能自行保护以免发生这种冲突。
Configuration
Kernel Configuration
使用Linux Menuconfig 工具在内核配置中激活I2S Linux驱动程序: Menuconfig or how to configure kernel.
[*] Device Drivers
[*] Sound card support
[*] Advanced Linux Sound Architecture
[*] ALSA for SoC audio support
STMicroelectronics STM32 SOC audio support
[*] STM32 I2S interface (SPI/I2S block) support
Device tree
配置I2S Linux内核驱动程序时,请参考 I2S_device_tree_configuration文章。
| I2S外设可以通过其配置寄存器配置为仅发送,仅接收或全双工模式。
I2S驱动程序提供仅发送,仅接收或全双工用例的支持。 但是,无论选择哪种使用情况,驱动程序始终在配置寄存器中以全双工模式配置I2S。 如果未使用路径(发送或捕获),则将其简单地丢弃。 因此,I2S设备树绑定中没有属性来配置I2S外设的模式。 |
How to use
可以通过ALSA设备从用户区访问I2S Linux驱动程序。 有关如何列出和使用ALSA设备的信息,请参考ALSA overview 。
How to trace and debug
可以检查 调试文件系统(debugfs) 和procfs文件系统以获取有关I2S驱动程序及其使用的资源的信息。 下面提供了这些文件系统条目的详尽列表。 有关调试工具的更多详细信息,请参见 ALSA overview。
- debugfs条目:
- asoc: 请参阅 ALSA_overview#How_to_monitor
- clk: 请参阅[ [qi[Clock_overview#How_to_monitor_with_debugfs]] 以获取有关时钟的信息。
- pinctrl: 请参阅 Pinctrl_overview#How_to_monitor 以获取有关引脚的信息。
- regmap: 允许监视SPI / I2S外设寄存器。
$ cat /sys/kernel/debug/regmap/xxx.audio-controller/registers
- procfs条目:
- asound: 请参阅 ALSA_overview#How_to_debug
- interrupts: 允许检查中断。
$ cat /proc/interrupts
Source code location
sound/soc/stm/stm32_i2s.c| |}} sound/soc/stm/stm32_i2s.c : 实现I2S Linux驱动程序。