1

I am trying to access codec driver (TLV320AIC3104) connected to iMX8M over I2C3 and SAI2 lines. The codec clocks bclk is 4096000 and it is provided from an FPGA and its mclk is grounded. iMx8M SOM SAI2 BCLk& MCLK is connected to clock line provided by FPGA and it frequency is 4.096 Mhz.Unable to register simple sound card or the driver get enabled. I have to configure the CODEC in tdm mode with 16 slots and capture audio at 16khz.

Here is my dts file changes

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";
  };
};

And also I have updated Makefile and added imx-tlv320aic3x.c in sound/soc/fsl and patched clk-imx8mm.c for CLK_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");

I am getting the following error

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

Any help or guidance to update the dts appropriately to get the codec working is appreciated.

Philippos
  • 13,237
  • 2
  • 37
  • 76
user480313
  • 11
  • 1
  • Welcome to this site. As to my experience, there is not much knowledge about device around here, I'm afraid. The NXP community is likely a more promising place for this kind of question. And it could help to know your `sai2` definition in the dt. – Philippos Sep 08 '21 at 06:27
  • Please find the sai2 from dt &sai2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sai2>; assigned-clocks = <&clk IMX8MM_CLK_SAI2_ROOT>; assigned-clock-parents = <&clk MX8MM_CLK_EXT3>; assigned-clock-rates = <4096000>; status = "okay"; }; – user480313 Sep 08 '21 at 09:07

0 Answers0