主题中讨论的其他器件: TLV320AIC3104、 TAS2781
您好!
我们正在开发一个基于 imx8mp 的定制电路板、该电路板将 TLV320AIC34编解码器连接到 SAI3。 已使用 Yocto Hardnert 和 NXP BSP 生成操作系统。 我们使用的是内核版本5.10.72。
我们无法在设备树中为编解码器配置声卡。 由于该编解码器内部由两个 tlv320aic3104组成、因此我们首先尝试采用一种方法、即创建一个具有两个 di-link 的单个"简单音频卡"节点卡、每个编解码器块对应一个 di-link、并使用 TDM。 按照这种方法、我们希望拥有一个具有四个独立通道的单张卡。
我们构建的器件树为:
sound-codec { compatible = "simple-audio-card"; simple-audio-card,name = "ep200-audio"; status = "okay"; simple-audio-card,widgets = "Microphone", "Mic Jack", "Line", "Line Out", "Line", "Line In", "Headphone", "Headphone Jack"; simple-audio-card,routing = "MIC2L a", "Mic Jack", "MIC2L b", "Mic Jack", "MIC2L a", "Mic Jack", "MIC2L b", "Mic Jack", "Mic Jack", "Mic Bias a", "Mic Jack", "Mic Bias b", "Line Out", "LLOUT a", "Line Out", "LLOUT b", "Line Out", "RLOUT a", "Line Out", "RLOUT b", "RLOUT a", "Playback a", "RLOUT b", "Playback b", "LLOUT a", "Playback a", "LLOUT b", "Playback b", "Headphone Jack", "HPLOUT a", "Headphone Jack", "HPLOUT b", "Headphone Jack", "HPROUT a", "Headphone Jack", "HPROUT b", "LINE1L a", "Line In", "LINE1L b", "Line In", "LINE1R a", "Line In", "LINE1R b", "Line In"; simple-audio-card,dai-link@0 { format = "i2s"; bitclock-master = <&dailink_master>; frame-master = <&dailink_master>; dailink_master: cpu { sound-dai = <&sai3>; dai-tdm-slot-num = <8>; dai-tdm-slot-width = <32>; dai-tdm-slot-tx-mask = <1 1 1 1 0 0 0 0>; dai-tdm-slot-rx-mask = <1 1 1 1 0 0 0 0>; }; codec { sound-dai = <&tlv320aic3104a>; clocks = <&clk IMX8MP_CLK_SAI3>; }; }; simple-audio-card,dai-link@1 { format = "i2s"; bitclock-master = <&dailink_master2>; frame-master = <&dailink_master2>; dailink_master2: cpu { sound-dai = <&sai3>; dai-tdm-slot-num = <8>; dai-tdm-slot-width = <32>; dai-tdm-slot-tx-mask = <0 0 0 0 1 1 1 1>; dai-tdm-slot-rx-mask = <0 0 0 0 1 1 1 1>; }; codec { sound-dai = <&tlv320aic3104b>; clocks = <&clk IMX8MP_CLK_SAI3>; }; }; };
在 i2c 节点中:
&i2c3 { clock-frequency = <400000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c3>; status = "okay"; tlv320aic3104a: tlv320aic3104a@18 { #sound-dai-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_tlv320>; compatible = "ti,tlv320aic3104_a"; reg = <0x18>; status = "okay"; reset-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>; }; tlv320aic3104b: tlv320aic3104b@19 { #sound-dai-cells = <0>; //pinctrl-names = "default"; //pinctrl-0 = <&pinctrl_tlv320>; compatible = "ti,tlv320aic3104_b"; reg = <0x19>; status = "okay"; //reset-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>; }; };
我们必须创建一个新的 tlv320aic3104驱动程序,并在其中添加了 sufix "_a"和"_b",以避免使用相同名称的控件。
启动系统后、我们可以看到一张带有两个器件的卡(ep200audio):
卡1:ep200audio [ep200-音频]、设备0:30c30000.SAI-tlv320aic3x-hifi v3 20aic3x-hif-0 [30c30000.SAI-tlv320aic3x-hifi tlv320aic3x-hif-0]
子器件:1/1
子设备#0:子设备#0
卡1:ep200audio [ep200-音频]、设备1:30c30000.si-tlv320aic3x-b-hifi tl v320aic3x-b-hif-1 [30c30000.si-tlv320aic3x-b-hifi tlv320aic3x-b-hifi-1]
子器件:1/1
子设备#0:子设备#0
该卡具有重复的控件、允许我们独立控制每个编解码器块、例如"PCM Playback Volume a"和"PCM Playback Volume b"。 我们的问题是,当我们尝试使用两个卡设备同时播放两个声音时,如果我们在两个单独的控制台运行以下命令,没有播放声音,命令没有完成:
aplay /usr/share/sounds/alsa/Front_Center.wav -Dplughw:ep200audio、0
aplay /usr/share/sounds/alsa/Front_Center.wav -Dplughw:ep200audio、1
我们的方法是否正确? 我们怎样解决这个问题呢? 在我们的应用中、我们需要同时在两个器件中播放声音。
此致、
Gustavo Plaza。