TLV320AIC3100 Codec Porting for the IMX8MP Custom Board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TLV320AIC3100 Codec Porting for the IMX8MP Custom Board

Jump to solution
12,634 Views
Wobaffet
Senior Contributor I

Hello,

I am trying to port TLV320AIC3100 for a custom board with imx8mp MPU. I've problem when probing the device with the simple-card driver. Having an issue with the dai-link configuration. Can you detect the error on my configuration? It is based on this post. I have the below config for the DT.

 

/   {
...
     sound-tlv320aic31xx {
                compatible = "simple-audio-card";
                simple-audio-card,name = "tlv320aic31xx-Codec";
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&codec_dai>;
                simple-audio-card,bitclock-master = <&codec_dai>;

                simple-audio-card,widgets =
                "Speaker", "MAK-SPEAKER";
                simple-audio-card,routing =
                "MAK-SPEAKER", "SPK";
                
                simple-audio-card,cpu {
                        sound-dai = <&sai3>;
                };
                codec_dai: simple-audio-card,codec {
                        sound-dai = <&tlv320aic31xx>;
                        system-clock-frequency = <IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>; /* this matches sai3 */
                };

        };
};
&i2c5 {
        clock-frequency = <100000>; /* Lower clock speed for external bus. */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c5>;
        status = "okay"; /* can1 pins conflict with i2c5 */
        tlv320aic31xx: tlv320aic31xx@18 {
                #sound-dai-cells=<0>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_dac_rst>;
                compatible = "ti,tlv320aic3100";
                reg = <0x18>;
               // clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
               // clock-names = "mclk";
                reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>;
//                ai31xx-micbias-vg = <MICBIAS_OFF>;
                HPVDD-supply = <&buck4>;
                SPRVDD-supply = <&vdd_input>; 
                SPLVDD-supply = <&vdd_input>;
                AVDD-supply = <&buck4>;
                IOVDD-supply = <&buck5>;
                DVDD-supply = <&buck5>;
        };
};
&sai3 {
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <12288000>;
        clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
                 <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
                 <&clk IMX8MP_CLK_DUMMY>;
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
       // fsl,sai-mclk-direction-output; Should Be commented TODO
        status = "okay";
};

 

My clocks and I2C dump can be seen as below:

root@imx8mp-lpddr4-evk:~# grep -E "clock|sai3" /sys/kernel/debug/clk/clk_summary 
   clock                          count    count    count        rate   accuracy phase  cycle    enable
sai3_mclk                            0        0        0           0          0     0  50000         Y
                sai3_mclk3_clk        0        0        0    49152000          0     0  50000         N
    sai3                              0        0        0    24000000          0     0  50000         N
       sai3_root                      0        0        0    24000000          0     0  50000         N
          sai3_mclk1_sel              0        0        0    24000000          0     0  50000         Y
             sai3_mclk1_clk           0        0        0    24000000          0     0  50000         N
          sai3_mclk2_sel              0        0        0    24000000          0     0  50000         Y
             sai3_mclk2_clk           0        0        0    24000000          0     0  50000         N
                         sai3_ipg_clk       0        0        0   400000000          0     0  50000         N

root@imx8mp-lpddr4-evk:~# i2cdump -y  -f 4 0x18
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 01 66 00 11 04 00 00 00 00 01 01 00 80 80    ..?f.??....??.??
10: 08 00 01 01 80 80 04 00 00 00 01 00 00 00 01 00    ?.?????...?...?.
20: 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00    ....?...........
30: 00 00 00 02 32 12 03 02 02 11 10 00 01 04 00 14    ...?2??????.??.?
40: 0c 00 00 00 6f 38 00 00 00 00 00 ee 10 d8 7e e3    ?...o8.....???~?
50: 00 00 80 00 00 00 00 00 7f 00 00 00 00 00 00 00    ..?.....?.......
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

Thank you in advance!

Best Regards.

0 Kudos
Reply
1 Solution
5,226 Views
Wobaffet
Senior Contributor I

Codec is probed when we moved back to 5.15 with the same configuration.

View solution in original post

0 Kudos
Reply
38 Replies
8,445 Views
Wobaffet
Senior Contributor I
Hello,
Thank you for the links, I've checked them.
The issue is related to the parsing stage of the links of the DT when probing the driver. It is most probably related to the configuration of the links on the DT. Because on boot-up I got the deferred probe error and printed where it stucks for the driver and it seems it is about the parsing links. I just wanted to ask what is wrong with the configuration I've made.
Thank you,
Best Regards.
0 Kudos
Reply
8,437 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

In general looks ok, could you please share me to logs related to the errors you are getting?

Best regards.

0 Kudos
Reply
8,420 Views
Wobaffet
Senior Contributor I

Hello, I've upgraded my DT w.r.t another post, here is the latest version: I've also attached full version.

For now deferred probe error is gone but Alsa can not detect any sound device, also dmesg does not show any probing details for the tlv320aic31xx device. Also full boot log is attached.

[    2.839911] ALSA device list:
[    2.842878]   No soundcards found.
/ {
...
        sound-tlv320aic31xx {
               compatible = "simple-audio-card";
                simple-audio-card,name = "tlv320aic31xx-Codec";
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&codec_dai>;
                simple-audio-card,bitclock-master = <&codec_dai>;

                simple-audio-card,widgets =
                "Speaker", "MAK-SPEAKER";
                simple-audio-card,routing =
                "MAK-SPEAKER", "SPK";
                dai-link-0{
                        format = "i2s";
                        simple-audio-card,cpu {
                                sound-dai = <&sai3>;
                        };
                         codec_dai: simple-audio-card,codec {
                                sound-dai = <&tlv320aic31xx>;
                                system-clock-frequency = <IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>; /* this matches sai3 */
                        };
                };
        };
};
&i2c5 {
        clock-frequency = <100000>; /* Lower clock speed for external bus. */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c5>;
        status = "okay"; /* can1 pins conflict with i2c5 */
        tlv320aic31xx: tlv320aic31xx@18 {
                #sound-dai-cells=<0>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_dac_rst>;
                compatible = "ti,tlv320aic3100";
                reg = <0x18>;
               // clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
               // clock-names = "mclk";
                reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>;
//              ai31xx-micbias-vg = <MICBIAS_OFF>;
                HPVDD-supply = <&buck4>;
                SPRVDD-supply = <&vdd_input>; //5V Input How To Show? 
                SPLVDD-supply = <&vdd_input>; //5V Input
                AVDD-supply = <&buck4>; 
                IOVDD-supply = <&buck5>; 
                DVDD-supply = <&buck5>; 
        };
};
&sai3 {
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <12288000>;
        clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
                 <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
                 <&clk IMX8MP_CLK_DUMMY>;
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
       // fsl,sai-mclk-direction-output;
        status = "okay";
};

Thank you in advance!

Best Regards.

0 Kudos
Reply
8,040 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Could you please share the logs with your current device tree configuration if you run the next command?

aplay -l

Also, please try with the next configuration:

sound-tlv320aic31xx {
    compatible = "simple-audio-card";
    simple-audio-card,name = "tlv320aic31xx-Codec";
    simple-audio-card,format = "i2s";
    simple-audio-card,frame-master = <&codec_dai>;
    simple-audio-card,bitclock-master = <&codec_dai>;

    simple-audio-card,widgets =
    	"Speaker", "MAK-SPEAKER";
    simple-audio-card,routing =
    	"MAK-SPEAKER", "SPK";
                
    codec_dai:simple-audio-card,cpu {
        sound-dai = <&sai3>;
    };
	
	simple-audio-card,codec {
        sound-dai = <&tlv320aic31xx>;
    	system-clock-frequency = <12288000>; /* this matches sai3 */
    };

};

&i2c5 {
        clock-frequency = <100000>; /* Lower clock speed for external bus. */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c5>;
        status = "okay"; /* can1 pins conflict with i2c5 */
        tlv320aic31xx: tlv320aic31xx@18 {
			compatible = "ti,tlv320aic3100";
            reg = <0x18>;
			pinctrl-0 = <&pinctrl_dac_rst>;
			reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>;
            #sound-dai-cells=<0>;
			ai31xx-micbias-vg = <MICBIAS_OFF>;
            HPVDD-supply = <&buck4>;
            SPRVDD-supply = <&vdd_input>; 
            SPLVDD-supply = <&vdd_input>;
            AVDD-supply = <&buck4>;
            IOVDD-supply = <&buck5>;
            DVDD-supply = <&buck5>;
        };
};

&sai3 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
    assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
    assigned-clock-rates = <12288000>;
    clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
             <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
             <&clk IMX8MP_CLK_DUMMY>;
    clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
    fsl,sai-mclk-direction-output;
	status = "okay";
};

Best regards.

0 Kudos
Reply
7,875 Views
Wobaffet
Senior Contributor I

Hello, 

I had to remove the micbias setting because it MICBIAS_OFF setting is only covered for devices that uses tlv320aic3x driver. When I tried the suggested tree parsing error occurs for the dai link. I've modified driver to see some logs. 

 

 

imx8mp-lpddr4-evk login: [   13.029045] probing for the TLV320AIC
[   13.032847] parsing error occured on dai links parsing 
[   13.041912] platform sound-tlv320aic31xx: deferred probe pending
[   13.047950] platform 30c30000.sai: deferred probe pending

imx8mp-lpddr4-evk login: root
root@imx8mp-lpddr4-evk:~#
root@imx8mp-lpddr4-evk:~# aplay -l
-sh: aplay: command not found

 

After further investigation may I ask why simple-audio-card is used instead of fsl,imx-audio-tlv320aic31xx?

Thank you in advance!

best regards.

Tags (1)
0 Kudos
Reply
7,809 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

For that I have understood fsl-asoc-card it is just an alternative generic sound card that is a bit like simple-audio-card.

You also could try to configure it using fsl-asoc-card.

Best regards.

0 Kudos
Reply
7,776 Views
Wobaffet
Senior Contributor I

Hello Jorge,

I've tried the fsl-asoc-card but nothing has changed. My configuration for the DT, configs and boot_log is attached. I think the problem is with the dai-links parsing but I can't seem to detect the cause. Can you please check? I've attached all the files.

            sound-tlv320aic31xx {
                compatible = "simple-audio-card";
                simple-audio-card,name = "tlv320aic31xx-Codec";
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&dailink_master>;
                simple-audio-card,bitclock-master = <&dailink_master>;
                //simple-audio-card,mclk-fs = <256>;//Multiplication rate between stream rate and codec mclk
                simple-audio-card,widgets =
                "Headphone", "Headphone Jack",
                "Speaker", "Speaker External";
                simple-audio-card,routing =
                "Speaker", "SPK",
                "Headphone Jack", "HPL",
                "Headphone Jack", "HPR";
                dailink_master:simple-audio-card,cpu {
                        sound-dai = <&sai3 0>;
                };
                thecodec:simple-audio-card,codec {
                        sound-dai = <&tlv320aic3100>;
                        clocks= <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
                 };

        };
&i2c5 {
        clock-frequency = <100000>; /* Lower clock speed for external bus. */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c5>;
        status = "okay"; /* can1 pins conflict with i2c5 */
        tlv320aic3100: tlv320aic31xx@18 {
                pinctrl-0 = <&pinctrl_dac_rst>;
                pinctrl-names= "default";
                compatible = "ti,tlv320aic3100";
                #sound-dai-cells =<0>;
                reg = <0x18>;
               //clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
               // clock-names = "mclk";
                reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>;
                HPVDD-supply = <&buck4>;
                SPRVDD-supply = <&vdd_input>; 
                SPLVDD-supply = <&vdd_input>; 
                AVDD-supply = <&buck4>;
                IOVDD-supply = <&buck5>;
                DVDD-supply = <&buck5>;
        };

        /* GPIO 2 of PCA6416 is used to switch between CAN1 and I2C5 functions:
         *     LOW:  CAN1 (default, pull-down)
         *     HIGH: I2C5
         * You need to set it to high to enable I2C5 (for example, add gpio-hog
         * in pca6416 node).
         */
};
&sai3 {
        #sound-dai-cells=<0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <12288000>;
        clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
                 <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
                 <&clk IMX8MP_CLK_DUMMY>;
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
        fsl,sai-synchronous-rx;
        status = "okay";
};
        pinctrl_sai3: sai3grp {
                fsl,pins = <
                        MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC   0xd6
                        MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK    0xd6
                        MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00  0xd6
                        MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00  0xd6
                        MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI3_MCLK      0xd6
                >;
        };
       pinctrl_dac_rst: dacrstgrp {

                fsl,pins = < 
              MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29               0x16 //DAC RST TODO
                >;
        };

Thank you in advance,

Best Regards!

 

0 Kudos
Reply
7,719 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello, I apologize for the late response.

According to simple-card.txt "Container for dai-link level properties and the CPU and CODEC sub-nodes. This container may be omitted when the card has only one DAI link". Maybe you could check it to debug dai-link issue.

As you may know I do not have available this specific codec to replicate the issue since the only supported devices by default are the listed on Linux release notes of our BSP.

Best regards.

0 Kudos
Reply
7,647 Views
Wobaffet
Senior Contributor I

Hello Jorge,

Thank you for your eforts, I know you can't replicate the problem but can you give us some hints, what can we check? With our without dai link container result is for us. 

All the supply voltages seem to be okay for the codec, our configuration is similar to the people using the same codec with the NXP platform for the DT. I can see that we don't have MCLK from the MPU side. Also, I've enabled the SAI config from m to y, then sai started to seem as deferred for both bluetooth and codec SAI2 and SAI3. We Don't have CLK for the SAI_MCLK1, we can observe this via oscilloscope and from /sys/kernel/debug/clk/clk_summary that sai clocks have not been used. What else can we check could this issue be about clocks? How can we debug this problem? Thank you in advance!

 

-CONFIG_SND_SOC_FSL_SAI=m
+CONFIG_SND_SOC_FSL_SAI=y
root@imx8mp-lpddr4-evk:~# cat /sys/kernel/debug/devices_deferred 
sound-bt-sco	asoc-simple-card: parse error
sound-tlv320aic31xx	asoc-simple-card: parse error
30c20000.sai	
30c30000.sai	
[    1.901016] No Dai-Link?
[    1.901018] Node: (____ptrval____)
[    1.901023] Inside do-while loop
[    1.907587] mmcblk2boot1: mmc2:0001 DG4008 4.00 MiB 
[    1.908526] Node: (____ptrval____)
[    1.913082] mmcblk2rpmb: mmc2:0001 DG4008 4.00 MiB, chardev (234:0)
[    1.915181] Inside for_each_child_of_node loop
[    1.934234] np: (____ptrval____), codec: (____ptrval____)
[    1.939646] Inside for_each_child_of_node loop
[    1.944093] np: (____ptrval____), codec: (____ptrval____)
[    1.949499] Exiting __simple_for_each_link with ret: 0
[    1.954643] Entering __simple_for_each_link
[    1.958830] No Dai-Link?
[    1.961362] Node: (____ptrval____)
[    1.964768] Inside do-while loop
[    1.967998] Node: (____ptrval____)
[    1.971429] Inside for_each_child_of_node loop
[    1.975882] np: (____ptrval____), codec: (____ptrval____)
[    1.981286] Inside for_each_child_of_node loop
[    1.985732] np: (____ptrval____), codec: (____ptrval____)
[    1.991135] Exiting __simple_for_each_link with ret: 0
[    1.996293] Entering __simple_for_each_link
[    2.000485] No Dai-Link?
[    2.003023] Node: (____ptrval____)
[    2.006425] Inside do-while loop
[    2.009659] Node: (____ptrval____)
[    2.013089] Inside for_each_child_of_node loop
[    2.017538] np: (____ptrval____), codec: (____ptrval____)
[    2.022942] link_of (sound-bt-sco)
[    2.026359] ------------[ cut here ]------------
[    2.030975] WARNING: CPU: 1 PID: 1 at mm/slab_common.c:923 free_large_kmalloc+0x8c/0xc0
[    2.038992] Modules linked in:
[    2.042050] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.1.55+ga04772fe8a15 #1
[    2.049188] Hardware name: NXP i.MX8MPlus EVK board (DT)
[    2.054499] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    2.061463] pc : free_large_kmalloc+0x8c/0xc0
[    2.065826] lr : kfree+0x78/0x80
[    2.069060] sp : ffff80000a35b960
[    2.072374] x29: ffff80000a35b960 x28: ffff00000da995b0 x27: ffff00000da99598
[    2.079518] x26: 0000000000000001 x25: ffff00000da99580 x24: ffff000015f57a20
[    2.086659] x23: ffff000015f58020 x22: ffff000015f57d18 x21: ffff000015f57950
[    2.093802] x20: ffff00000c480080 x19: fffffc000057d5c0 x18: 0000000000000006
[    2.100945] x17: ffff80000a170f60 x16: 000000001b868350 x15: ffff80000a35b480
[    2.108088] x14: 0000000000000000 x13: ffff80000a0a2508 x12: 00000000000003b4
[    2.115230] x11: 000000000000013c x10: ffff80000a0fa508 x9 : ffff80000a0a2508
[    2.122373] x8 : 00000000ffffefff x7 : ffff80000a0fa508 x6 : 80000000fffff000
[    2.129517] x5 : 000000000000bff4 x4 : 0000000000000000 x3 : fffffc000057d5c7
[    2.136659] x2 : fffffc000057d5c0 x1 : ffff000015f57a20 x0 : 03fffc0000001000
[    2.143802] Call trace:
[    2.146248]  free_large_kmalloc+0x8c/0xc0
[    2.150265]  kfree+0x78/0x80
[    2.153151]  simple_dai_link_of+0xbc/0x23c
[    2.157254]  simple_for_each_link+0x270/0x368
[    2.161615]  asoc_simple_probe+0x19c/0x358
[    2.165717]  platform_probe+0x68/0xc0
[    2.169384]  really_probe+0xc0/0x3dc
[    2.172967]  __driver_probe_device+0x7c/0x160
[    2.177329]  driver_probe_device+0x3c/0x110
[    2.181518]  __driver_attach+0xf4/0x200
[    2.185361]  bus_for_each_dev+0x78/0xd4
[    2.189203]  driver_attach+0x24/0x30
[    2.192784]  bus_add_driver+0x17c/0x240
[    2.196625]  driver_register+0x78/0x130
[    2.200468]  __platform_driver_register+0x28/0x34
[    2.205179]  asoc_simple_card_init+0x1c/0x28
[    2.209453]  do_one_initcall+0x68/0x1ec
[    2.213295]  kernel_init_freeable+0x218/0x284
[    2.217657]  kernel_init+0x24/0x12c
[    2.221152]  ret_from_fork+0x10/0x20
[    2.224732] ---[ end trace 0000000000000000 ]---
[    2.229363] object pointer: 0x(____ptrval____)
[    2.233830] Exiting __simple_for_each_link with ret: -517
[    2.239234] li->cpu val:1 ret val:-517
[    2.242989] parsing error occured on dai links parsing link 
[    2.248656] parse error: -517

 

Here some logs to have some idea of the situation for you.

Thanks!

Best Regards.

0 Kudos
Reply
2,835 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello, thank you for the information.

Maybe this issue could be caused by the CODEC driver. You mentioned that there are other platforms that are using this codec, if manufacturers provide the necessary information, you could see if there is an additional software changes to support this CODEC apart of TI driver.

Best regards.

0 Kudos
Reply
2,805 Views
Wobaffet
Senior Contributor I

Hello again,

For further investigation, we can see that TI driver probes without any problem. The problem is with the clocks I think. When I convert the generated DTB to DTS I can see that the clock frequency is 0 as can be seen below for both SAIs (sai2 for Bluetooth sai3 for codec):

 

        sai-mclk2 {
                compatible = "fixed-clock";
                #clock-cells = <0x00>;
                clock-frequency = <0x00>;
                clock-output-names = "sai2_mclk";
                phandle = <0x90>;
        };

        sai-mclk3 {
                compatible = "fixed-clock";
                #clock-cells = <0x00>;
                clock-frequency = <0x00>;
                clock-output-names = "sai3_mclk";
                phandle = <0x91>;
        };

 

Here is our i2c bus from scope when the below command is used:

 

root@imx8mp-lpddr4-evk:~# i2cdump -y -f 4 0x18

 

Wobaffet_0-1703684583038.jpeg

How can we solve this issue, why is the configuration from the device tree not taken when building? How can we activate SAI's clocks? Both drivers are not probed right now, simple-card.c and both sais are deferred.

 

[   15.497663] platform sound-bt-sco: deferred probe pending
[   15.503107] platform sound-tlv320aic31xx: deferred probe pending
[   15.509128] platform 30c20000.sai: deferred probe pending
[   15.514548] platform 30c30000.sai: deferred probe pending

 

Thank you in advance! 

Best Regards.

0 Kudos
Reply
2,802 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

It is strange that when you build your DTB files is not taking the changes.

Could you please confirm if it is not taking the changes when you use next command?

 

cat /sys/kernel/debug/clk/clk_summary

 

Also, could you please share the other platforms that uses your codec?

Best regards.

0 Kudos
Reply
2,774 Views
Wobaffet
Senior Contributor I

Here is the command output, the full command is attached. 

 

root@imx8mp-lpddr4-evk:~# cat /sys/kernel/debug/clk/clk_summary | grep sai3
 sai3_mclk   0    0     0    0          0     0  50000         Y
                sai3_mclk3_clk        0        0        0    49152000          0     0  50000         N
          sai3_mclk2_sel              0        0        0    24000000          0     0  50000         Y
             sai3_mclk2_clk           0        0        0    24000000          0     0  50000         N
                         sai3_ipg_clk       0        0        0   400000000          0     0  50000         N
                sai3                  0        0        0    12288000          0     0  50000         N
                   sai3_root          0        0        0    12288000          0     0  50000         N
                      sai3_mclk1_sel       0        0        0    12288000          0     0  50000         Y
                         sai3_mclk1_clk       0        0        0    12288000          0     0  50000         N

 

Here are some of the examples I've checked from Toradex and TI using this codec with NXP MPU's. Especially this post states that wm8960 driver enables the MCLK but TI' driver does not do that. Could that be the case?

https://community.toradex.com/t/verdin-imx8mm-with-sound-codec-tlv320dac3100/18009/2

https://e2e.ti.com/support/audio-group/audio/f/audio-forum/1269307/tlv320aic3100-tlv320aic3100-24mhz...

 

 

Thanks!

Best Regards.

0 Kudos
Reply
2,600 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

For that I have understood, our SAI driver enables the clock output only when you transmit or receive data. There are some cases where CODEC needs clock signal all the time since power-up sequence to initialize it, I do not know if it is the case with TLV320AIC3100 but if CODEC does not have the clock signal at start, this could cause the issue where CODEC is not detected so, I suggest you check if Toradex has some modifications on this driver to have the clock signal all the time if it is a requirement for this CODEC.

Best regards.

0 Kudos
Reply
2,568 Views
Wobaffet
Senior Contributor I

Hello,

TI states that TLV320AIC3100 works as a slave, so it doesn't need MCLK. Also, I've checked that the from the tlv320aic31xx driver aic31xx_i2c_probe  function is being called, but aic31xx_codec_probe is not being called. Is this an issue related to DTS configuration or am I missing setting up some kernel configs?

Thank you in advance!

Best Regards.

0 Kudos
Reply
2,516 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

I think it is not related to the device tree configuration, but to the TI driver integration. I suggest you check it directly with TI.

Best regards.

2,650 Views
Wobaffet
Senior Contributor I

reminder

0 Kudos
Reply
2,728 Views
Wobaffet
Senior Contributor I

reminder

Tags (1)
0 Kudos
Reply