Can't output any SAI signals (using imx8m MINI)

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

Can't output any SAI signals (using imx8m MINI)

353 Views
halban
Contributor I
Hi!
 
We are trying to connect an AK4458VN with an imx8mm Variscite SOM and have some trouble doing so. We made a breakout board with the AK4458 to plug on the Variscite Symphony devboard.
 
We plan to drive 4 stereo outputs with a single dataline (using SAI2 pins MCLK, TXC, TXFS and TXD0). We want to use the imx8mm to internally output the various clocks.
 
We are on kernel release imx-6.1.22-2.0.0.xml patched with the RT patch.
 
Our device tree is as follows :

 

/dts-v1/;  
#include "imx8mm-var-som-symphony.dts"
  
/ {
    /delete-node/sound-wm8904;  
    /delete-node/ft5x06_ts;    
    sound-ak4458 {  
        compatible = "fsl,imx-audio-card";  
        model = "ak4458-audio";  
          
        pri-dai-link {  
            link-name = "akcodec";  
            format = "dsp_b";  
            dai-tdm-slot-num = <8>;  
            dai-tdm-slot-width = <32>;  
                    fsl,mclk-equal-bclk;  
            cpu {  
                sound-dai = <&sai2>;  
                    };  
                    codec {  
                        sound-dai = <&ak4458>;  
                    };  
        };  
    };  
};
&sai5 {  
    status = "disabled";  
};
&i2c3 {  
    ak4458: ak4458@10 {  
        #sound-dai-cells = <0>;  
        sound-name-prefix = "0";  
            compatible = "asahi-kasei,ak4458";  
            reg = <0x10>;  
        status = "okay";  
    };  
};
&sai2 {  
    #sound-dai-cells = <0>;  
    pinctrl-names = "default";  
    pinctrl-0 = <&pinctrl_sai2>;  
    clocks = <&clk IMX8MM_CLK_SAI2_IPG>, <&clk IMX8MM_CLK_DUMMY>,  
                 <&clk IMX8MM_CLK_SAI2_ROOT>, <&clk IMX8MM_CLK_DUMMY>,  
         <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_AUDIO_PLL1_OUT>,  
                 <&clk IMX8MM_AUDIO_PLL2_OUT>;  
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";  
    assigned-clocks = <&clk IMX8MM_CLK_SAI2>;  
    assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;  
    assigned-clock-rates = <24576000>;  
    //fsl,sai-multi-lane;  
    fsl,sai-asynchronous;  
    fsl,sai-mclk-direction-output;  
    fsl,dataline = <0 0x00 0x01>;  
    dmas = <&sdma2 2 24 0>, <&sdma2 3 24 0>;  
    status = "okay";  
};
  
&iomuxc {  
    pinctrl_sai2: sai2grp {  
                fsl,pins = <  
                        MX8MM_IOMUXC_SAI2_MCLK_SAI2_MCLK        0xd6  
                        MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0    0xd6  
                        MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK      0xd6  
                        MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC        0xd6  
                >;  
        // pcie0grp uses MX8MM_IOMUXC_SAI2_RXFS_GPIO4_IO21  
        // regusdhc2vmmc uses MX8MM_IOMUXC_SAI2_RXC_GPIO4_IO22  
        // Maybe we need them somehow ?  
        };  
};  

 

I can see the sound card with `aplay -L` and the i2c driver works well (checked with the oscilloscope and sending commands with alsamixer). But whenever I play something on the card, nothing happens, there's no activity on these SAI pins: no Master Clock, Bit Clock or Frame Sync clock is output. Note that the TD0 pin is held high.
 
Using dynamic debug, we can see that when we start playing audio, we have an underrun trace:

 

[  190.282847]  akcodec: ASoC: ak4458-aif <-> 30020000.sai info:  
[  190.282861]  akcodec: ASoC: rate mask 0x80000000  
[  190.282865]  akcodec: ASoC: ch   min 1 max 8  
[  190.282868]  akcodec: ASoC: rate min 8000 max 2822400  
[  190.287299] ak4458 2-0010: Update DAI routes for ak4458-aif playback  
[  190.287310] ak4458 2-0010: Connecting DAI route 0 Playback -> 0 AK4458 SDTI  
[  190.287320] fsl-sai 30020000.sai: ratio 2 for freq 12288000Hz based on clock 24576000Hz  
[  190.287325] fsl-sai 30020000.sai: best fit: clock id=1, div=2, deviation =0  
[  190.287845] fsl-sai 30020000.sai: Update DAI routes for 30020000.sai playback  
[  190.376450] fsl-sai 30020000.sai: isr: Transmit underrun detected  

 

We also checked the sai2 registers and all various clock output seemed to be enabled as output. After 2 weeks of testing, everything we checked seem to be fine, from software to hardware.
 
What could have we missed?
Do you know under what circumstances this underrun error can happen?
 
Thanks a lot for your help!
Alban
0 Kudos
Reply
0 Replies