无法为带有外部时钟的 SAI2 BCLK/MCLK 的 iMx8M 启用 TLV320AIC3104 编解码器驱动程序/简单声卡

无法为带有外部时钟的 SAI2 BCLK/MCLK 的 iMx8M 启用 TLV320AIC3104 编解码器驱动程序/简单声卡

我正在尝试访问通过 I2C3 和 SAI2 线路连接到 iMX8M 的编解码器驱动程序 (TLV320AIC3104)。编解码器时钟bclk为4096000,由FPGA提供,其mclk接地。 iMx8M SOM SAI2 BCLk& MCLK 连接到 FPGA 提供的时钟线,频率为 4.096 Mhz。无法注册简单声卡或驱动程序启用。我必须将编解码器配置为具有 16 个插槽的 tdm 模式并以 16khz 捕获音频。

这是我的 dts 文件更改

sound {
  compatible = "simple-audio-card";
  simple-audio-card,name = "tdm-audio";
  simple-audio-card,format = "tdm";
  simple-audio-card,routing =
  "Headphone Jack", "HPOUTL",
  "Headphone Jack", "HPCOMR",
  "IN2L", "Line In Jack",
  "IN2R", "Line In Jack",
  "IN1L", "Mic Jack",
  "Playback", "CPU-Playback",
  "CPU-Capture", "Capture";
  status = "okay";
  simple-audio-card,cpu {
    sound-dai = <&sai2>;
    dai-tdm-slot-num = <16>;
    dai-tdm-slot-width = <16>;
  };
  simple-audio-card,codec {
    audio-codec = <&codec>;
    clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
    clock-names = "bclk";
  };
};
pinctrl_i2c3: i2c3grp {
  fsl,pins = <
    MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c3
    MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c3
  >;
};
pinctrl_sai2: sai2grp {
  fsl,pins = <
    MX8MM_IOMUXC_SAI2_RXFS_SAI2_RX_SYNC 0xd6
    MX8MM_IOMUXC_SAI2_RXC_SAI2_RX_BCLK 0xd6
    MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0 0xd6
    MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6
    MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6
    MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6
    MX8MM_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6
  >;
};
&i2c3 {
  clock-frequency = <100000>;
  pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_i2c3>;
  status = "okay";
  codec: tlv320aic3x@18 {
    /* ai3x-micbias-vg = <2>; */
    compatible = "ti,tlv320aic3104";
    reg = <0x18>;
    /* gpio-reset = <&gpio5 0 GPIO_ACTIVE_LOW>; */
    #sound-dai-cells = <0>;
    clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
    clock-names = "bclk";
    AVDD-supply = <&reg_audio>;
    IOVDD-supply = <&reg_audio>;
    DRVDD-supply = <&reg_audio>;
    DVDD-supply = <&ldo5_reg>;
    status = "okay";
  };
};

我还更新Makefile、添加imx-tlv320aic3x.csound/soc/fsl修补clk-imx8mm.cCLK_EXT3

+   pr_info("i.MX*MM clock driver before setting CLK_EXT3");
+   clk_set_parent(clks[IMX8MM_CLK_SAI2_ROOT], clks[IMX8MM_CLK_EXT3]);
+   pr_info("i.MX*MM clock driver after setting CLK_EXT3");

我收到以下错误

OF: /sound/simple-audio-card,cpu: could not get #sound-dai-cells for /sai@30020000
asoc-simple-card sound: parse error -22
asoc-simple-card: probe of sound failed with error -22
clk: failed to reparent sai2_root_clk to audio_pll1_out: -22

任何适当更新 dts 以使编解码器正常工作的帮助或指导都值得赞赏。

相关内容