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

来自百问网嵌入式Linux wiki
 
第1行: 第1行:
 
== Article purpose ==
 
== Article purpose ==
This article introduces the I2S Linux<sup>&reg;</sup> driver for the [[SPI internal peripheral|SPI/I2S internal peripheral]].
+
本文介绍了[[SPI internal peripheral|SPI/I2S internal peripheral]]的 I2S Linux<sup>&reg;</sup>  驱动程序。
  
 
== Short Description ==
 
== Short Description ==
The I2S Linux driver is an ASoC CPU DAI driver implemented in the Linux [[ALSA_overview|ALSA framework]].
+
I2S Linux驱动程序是在Linux[[ALSA_overview|ALSA framework]]中实现的ASoC CPU DAI驱动程序。
  
The I2S driver requests two clocks which can be used as parent clocks of the IS2 peripheral kernel clock.
+
I2S驱动程序请求两个时钟,这些时钟可用作IS2外设内核时钟的父时钟。
The rates of these parent clocks must be respectively a multiple of 8kHz and 11.025kHz.
+
这些父时钟的速率必须分别是8kHz和11.025kHz的倍数
One of these two clocks  is selected at run-time through the I2S clock mux, depending on audio stream sampling rate.
+
在运行时通过I2S时钟复用器选择这两个时钟之一,具体取决于音频流采样率。
  
  
SPI/I2S2 and SPI/I2S3 internal peripherals share the same clock mux.
+
SPI/I2S2 SPI/I2S3 内部外设共享相同的时钟复用器
This may result in a conflict on clock mux configuration, if I2S2 and I2S3 are used to run audio streams having
+
如果使用I2S2和I2S3来运行具有以下内容的音频流,则这可能会导致时钟多路复用器配置冲突:
incompatible rates (i.e. rates not multiple of each other). The I2S driver does not protect by itself against such conflict.
+
 
 +
不兼容的费率(即费率不是彼此的倍数)。I2S驱动程序不能自行保护以免发生这种冲突。
 
</div></div>
 
</div></div>
  
第18行: 第19行:
  
 
=== Kernel Configuration ===
 
=== Kernel Configuration ===
Activate the I2S Linux driver in the kernel configuration using the Linux Menuconfig tool: [[Menuconfig or how to configure kernel]].
+
使用Linux Menuconfig 工具在内核配置中激活I2S Linux驱动程序: [[Menuconfig or how to configure kernel]].
 
<pre>
 
<pre>
 
[*] Device Drivers
 
[*] Device Drivers
第29行: 第30行:
  
 
=== Device tree ===
 
=== Device tree ===
Refer to the [[I2S_device_tree_configuration]] article when configuring the I2S Linux kernel driver.
+
配置I2S Linux内核驱动程序时,请参考 [[I2S_device_tree_configuration]]文章。
  
{{Info|The I2S peripheral can be configured in transmit only, receive only or full-duplex mode, via its configuration register.
+
{{Info|I2S外设可以通过其配置寄存器配置为仅发送,仅接收或全双工模式。
The I2S driver offers the support of transmit only, receive only, or full-duplex use cases. However, the driver always configure the I2S in full-duplex mode in the configuration register, whatever the chosen use case. If a path (transmit or capture) is not used, it is simply discarded.
+
I2S驱动程序提供仅发送,仅接收或全双工用例的支持。 但是,无论选择哪种使用情况,驱动程序始终在配置寄存器中以全双工模式配置I2S。 如果未使用路径(发送或捕获),则将其简单地丢弃。
So, '''there is no property in the I2S device tree bindings to configure the mode''' of the I2S peripheral.}}
+
因此,'''I2S设备树绑定中没有属性来配置I2S外设的模式'''}}
  
 
== How to use ==
 
== How to use ==
The I2S 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.
+
可以通过ALSA设备从用户区访问I2S Linux驱动程序。 有关如何列出和使用ALSA设备的信息,请参考[[ALSA_overview#How_to_use|ALSA overview]]
  
 
==How to trace and debug==
 
==How to trace and debug==
The [[Debugfs|debugfs]] and procfs file system can be checked to get information on the I2S driver and the resources it uses. A non-exhaustive list of these file system entries is provided below. Refer to [[ALSA_overview#How_to_trace_and_debug_the_framework|ALSA overview]] for more details on debugging tools.
+
可以检查 [[Debugfs|debugfs]] 和procfs文件系统以获取有关I2S驱动程序及其使用的资源的信息。 下面提供了这些文件系统条目的详尽列表。 有关调试工具的更多详细信息,请参见 [[ALSA_overview#How_to_trace_and_debug_the_framework|ALSA overview]]
  
* debugfs entries:
+
* debugfs条目:
:* '''asoc''': refer to [[ALSA_overview#How_to_monitor]]
+
:* '''asoc''': 请参阅 [[ALSA_overview#How_to_monitor]]
:* '''clk''': refer to [[Clock_overview#How_to_monitor_with_debugfs]] to get information on clocks.
+
:* '''clk''': 请参阅[ [qi[Clock_overview#How_to_monitor_with_debugfs]] 以获取有关时钟的信息。
:* '''pinctrl''': refer to [[Pinctrl_overview#How_to_monitor]] to get information on pins.
+
:* '''pinctrl''': 请参阅 [[Pinctrl_overview#How_to_monitor]] 以获取有关引脚的信息。
:* '''regmap''': allow to monitor SPI/I2S peripheral registers.
+
:* '''regmap''': 允许监视SPI / I2S外设寄存器。
 
<div style="margin-left: 2em;">
 
<div style="margin-left: 2em;">
 
  $ cat /sys/kernel/debug/regmap/xxx.audio-controller/registers
 
  $ cat /sys/kernel/debug/regmap/xxx.audio-controller/registers
 
</div>
 
</div>
* procfs entries:
+
* procfs条目:
:* '''asound''': refer to [[ALSA_overview#How_to_debug]]
+
:* '''asound''': 请参阅 [[ALSA_overview#How_to_debug]]
:* '''interrupts''': allow to check interrupts.
+
:* '''interrupts''': 允许检查中断。
 
<div style="margin-left: 2em;">
 
<div style="margin-left: 2em;">
 
  $ cat /proc/interrupts
 
  $ cat /proc/interrupts
第57行: 第58行:
  
 
== Source code location ==
 
== Source code location ==
{{CodeSource | Linux kernel | sound/soc/stm/stm32_i2s.c}}: implements the I2S Linux driver.
+
{{CodeSource | Linux kernel | sound/soc/stm/stm32_i2s.c}}: 实现I2S Linux驱动程序。
  
 
==References==
 
==References==
 
<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文章。

Info.png 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条目:
$ cat /sys/kernel/debug/regmap/xxx.audio-controller/registers
  • procfs条目:
$ cat /proc/interrupts

Source code location

sound/soc/stm/stm32_i2s.c| |}} sound/soc/stm/stm32_i2s.c : 实现I2S Linux驱动程序。

References