Set two sound cards to the same SAI (Linux 4.9 iMX6UL)

cancel
Showing results for 
Search instead for 
Did you mean: 

Set two sound cards to the same SAI (Linux 4.9 iMX6UL)

Jump to solution
989 Views
stefanozuincast
Contributor III

Hi everyone,

I'm trying to update from Linux 4.1 (Yocto Krogoth) to 4.9 (Yocto Sumo) using a iMX6UL. Everything is working fine but I'm not able to use a DAC and ADC both connected to SAI1. In Linux 4.1 there was no problem. Unfortunately in 4.9 a got this message "Trying to bind component to card X but is already bound to card Y", just DAC card is declared after that and works fine using GStreamer or ALSA. Then, I patched soc-core.c to avoid launch this error and both cards finally appear in the list of declared sound cards. But now, when I try to play a sine using GStreamer, I get message "Setting pipeline to PAUSED ..." and cannot kill the process...

I was wondering if with the current kernel drivers is possible to define more than one sound card for the same sai.

Thanks

Labels (3)
0 Kudos
1 Solution
618 Views
stefanozuincast
Contributor III

I've solved by defining a sound card with 2 codecs:

    sound-10 {
        compatible = "simple-audio-card";
        simple-audio-card,name = "10_audio";
        system-clock-direction = "out";
        system-clock-type = "mclk";
        simple-audio-card,dai-link@0{
            format = "i2s";
            cpu {
                sound-dai = <&sai1>;                
                dai-tdm-slot-num = <2>;
                system-clock-frequency = <12288000>;
            };
            codec {
                sound-dai = <&codec1>;
                system-clock-id = <2>;
                system-clock-frequency = <12288000>;
            };
        };
        simple-audio-card,dai-link@1{
            format = "i2s";
            cpu {
                sound-dai = <&sai1>;                
                dai-tdm-slot-num = <2>;
                system-clock-frequency = <12288000>;
            };
            codec {
                sound-dai = <&codec2>;
                system-clock-id = <2>;
                system-clock-frequency = <12288000>;
            };

        };
    };

Is not necessary to patch soc-core file.

View solution in original post

0 Kudos
3 Replies
619 Views
stefanozuincast
Contributor III

I've solved by defining a sound card with 2 codecs:

    sound-10 {
        compatible = "simple-audio-card";
        simple-audio-card,name = "10_audio";
        system-clock-direction = "out";
        system-clock-type = "mclk";
        simple-audio-card,dai-link@0{
            format = "i2s";
            cpu {
                sound-dai = <&sai1>;                
                dai-tdm-slot-num = <2>;
                system-clock-frequency = <12288000>;
            };
            codec {
                sound-dai = <&codec1>;
                system-clock-id = <2>;
                system-clock-frequency = <12288000>;
            };
        };
        simple-audio-card,dai-link@1{
            format = "i2s";
            cpu {
                sound-dai = <&sai1>;                
                dai-tdm-slot-num = <2>;
                system-clock-frequency = <12288000>;
            };
            codec {
                sound-dai = <&codec2>;
                system-clock-id = <2>;
                system-clock-frequency = <12288000>;
            };

        };
    };

Is not necessary to patch soc-core file.

View solution in original post

0 Kudos
618 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Stefano

one can try with nxp linux releases: L4.9.88 (rocko)
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.9.88_2.0.0_ga
or L4.14.78 (sumo)
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.14.78_1.0.0_ga

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
618 Views
stefanozuincast
Contributor III

Hi igorpadykov,

I'm currently using Linux Kernel 4.9.88 and I get that error...

This is my audio codecs declaration:

/ {

    sound-dac {
        compatible = "simple-audio-card";
        simple-audio-card,name = "pcm179x-audio";
        simple-audio-card,format = "i2s";
        system-clock-direction = "out";
        system-clock-type = "mclk";

        simple-audio-card,cpu {
            sound-dai = <&sai1>;
        };

        dailink_master: simple-audio-card,codec {
            sound-dai = <&codec1>;
            system-clock-id = <2>;
            system-clock-frequency = <12288000>;
        };
    };

    sound-adc {
        compatible = "simple-audio-card";
        simple-audio-card,name = "pcm186x-audio";
        simple-audio-card,format = "i2s";
        system-clock-direction = "out";
        system-clock-type = "mclk";
        simple-audio-card,cpu {
            sound-dai = <&sai1>;
        };

        dailink_master: simple-audio-card,codec {
            sound-dai = <&codec2>;
            system-clock-id = <2>;
            system-clock-frequency = <12288000>;
        };
    };

};

&i2c4 {
    clock_frequency = <400000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c4>;
    status = "okay";

    codec1: pcm1796@4c {
            #sound-dai-cells = <0>;
        compatible = "ti,pcm179x";
        reg = <0x4c>;
        clocks = <&clks IMX6UL_CLK_SAI1>;
        clock-names = "mclk";
    };
    
    codec2: pcm1864@4a {
        reg = <0x4a>;
            #sound-dai-cells = <0>;
        compatible = "ti,pcm1862";
        clocks = <&clks IMX6UL_CLK_SAI1>;
        clock-names = "mclk";
    };

};

/*Audio CODEC*/
&sai2 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai2>;
    assigned-clocks = <&clks IMX6UL_CLK_SAI2_SEL>,<&clks IMX6UL_CLK_SAI2>;
    assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
    assigned-clock-rates = <0>, <12288000>;
    fsl,sai-mclk-direction-output;
    status = "okay";
};

/*Audio DAC & ADC*/
&sai1 {
    #sound-dai-cells= <1>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai1>;
    assigned-clocks = <&clks IMX6UL_CLK_SAI1_SEL>,<&clks IMX6UL_CLK_SAI1>;
    assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
    assigned-clock-rates = <0>, <12288000>;
    fsl,sai-mclk-direction-output;
    status = "okay";
};

0 Kudos