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

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

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

Jump to solution
3,817 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
Reply
1 Solution
3,446 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
Reply
4 Replies
1,131 Views
surya45
Contributor II

Hi @stefanozuincast ,

i want btsco codec and wm8960  codec drivers to use sai2 interface.

i tried adding the dts nodes as you mentioned. its building fine and android booted up but no codec soundcards  were created.

mentioning the node :

sound-new {
compatible = "simple-audio-card";
simple-audio-card,name = "mixcard";
simple-audio-card,dai-link@0{
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <32>;
simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
status = "okay";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&codec>;
system-clock-frequency = <12288000>;
};

};

simple-audio-card,dai-link@1{
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-inversion;
simple-audio-card,frame-master = <&btcpu>;
simple-audio-card,bitclock-master = <&btcpu>;

btcpu: simple-audio-card,cpu {
sound-dai = <&sai2>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};

simple-audio-card,codec {
sound-dai = <&bt_sco_codec 0>;
};
};
};

 

please help here @igorpadykov 

0 Kudos
Reply
3,447 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.

0 Kudos
Reply
3,446 Views
igorpadykov
NXP Employee
NXP Employee

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
Reply
3,446 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
Reply