This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA745: McASP and Dummy Sound Card on DRA7xx

Part Number: DRA745
Other Parts Discussed in Thread: TLV320AIC3106

Tool/software: Linux

Hi Experts,

I'm new on Jacinto and Audio interface.
We have a customer use DRA7xx for their automotive product.
As customer requirement, we need to enable McASP1, McASP5, McASP6, McASP7 and McASP8 for their product.
My colleague and I have set up the device tree in dra7-evm.dts, and we can see the system has init McASP interface under /sys/bus/platform/devices/.
Now we need to verify these settings are work.
We think we can create some dummy sound cards to link to these McASP port to verify it.
However, we've try some days and no luck, system can not creat sound cards.

Can anyone priovide some document or example for McASP port and dummy sound card?
Or other simple way to verify the McASP ports are work appropriate.

Thanks and Best Regards,
Wayne

  • Hi Wayne,

    I have forwarded your question to McASP expert.

    Can you just tell which SDK you use?

    Regards,
    Yordan
  • Hi Yordan,

    Thank you for your reply.
    1.
    I follow this release note to setup my host environment:
    omapedia.org/.../6AM.1.3_Release_Notes
    I'm not sure the SDK version, is that "6AM.1.3"?
    The Kernel version is 4.4.45.

    2.
    We have some progress today.
    We follow this link to add patch to <Kernel DIR>/sound/soc/soc-utils.c, to make dra7-evm.dts link to this driver.
    patchwork.kernel.org/.../
    Now we can see the dummy sound card on our system.

    3.
    We meet another question.
    During Kernel init process, we saw the following log.
    Seems sound card's routing has some problem.
    [ 13.537410] asoc-simple-card sound@0: snd-soc-dummy-dai <-> 48460000.mcasp mapping ok
    [ 13.545304] asoc-simple-card sound@0: ASoC: no source widget found for HPLOUT
    [ 13.552471] asoc-simple-card sound@0: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
    [ 13.561519] asoc-simple-card sound@0: ASoC: no source widget found for HPROUT
    [ 13.568705] asoc-simple-card sound@0: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
    [ 13.577719] asoc-simple-card sound@0: ASoC: no source widget found for LLOUT
    [ 13.584814] asoc-simple-card sound@0: ASoC: Failed to add route LLOUT -> direct -> Line Out
    [ 13.593201] asoc-simple-card sound@0: ASoC: no source widget found for RLOUT
    [ 13.600294] asoc-simple-card sound@0: ASoC: Failed to add route RLOUT -> direct -> Line Out
    [ 13.608691] asoc-simple-card sound@0: ASoC: no sink widget found for MIC3L
    [ 13.615612] asoc-simple-card sound@0: ASoC: Failed to add route Mic Jack -> direct -> MIC3L
    [ 13.624013] asoc-simple-card sound@0: ASoC: no sink widget found for MIC3R
    [ 13.630918] asoc-simple-card sound@0: ASoC: Failed to add route Mic Jack -> direct -> MIC3R
    [ 13.639344] asoc-simple-card sound@0: ASoC: no source widget found for Mic Bias
    [ 13.646703] asoc-simple-card sound@0: ASoC: Failed to add route Mic Bias -> direct -> Mic Jack
    [ 13.655367] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1L
    [ 13.662359] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1L
    [ 13.670760] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1R
    [ 13.677767] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1R

    4.
    Here is our DTS setting, please correct me if we get something mistake.

    codec_test: codec_test {
    compatible = "linux,snd-soc-dummy";
    #sound-dai-cells = <0>;
    };

    snd0: sound@0 {
    compatible = "simple-audio-card";
    simple-audio-card,name = "DRA7xx-EVM";
    simple-audio-card,widgets =
    "Headphone", "Headphone Jack",
    "Line", "Line Out",
    "Microphone", "Mic Jack",
    "Line", "Line In";
    simple-audio-card,routing =
    "Headphone Jack", "HPLOUT",
    "Headphone Jack", "HPROUT",
    "Line Out", "LLOUT",
    "Line Out", "RLOUT",
    "MIC3L", "Mic Jack",
    "MIC3R", "Mic Jack",
    "Mic Jack", "Mic Bias",
    "LINE1L", "Line In",
    "LINE1R", "Line In";
    simple-audio-card,format = "dsp_b";
    simple-audio-card,bitclock-master = <&sound0_master>;
    simple-audio-card,frame-master = <&sound0_master>;
    //simple-audio-card,bitclock-master = <&codec_test>;
    //simple-audio-card,frame-master = <&codec_test>;
    simple-audio-card,bitclock-inversion;

    sound0_master: simple-audio-card,cpu {
    sound-dai = <&mcasp1>;
    system-clock-frequency = <11289600>;
    };

    simple-audio-card,codec {
    //sound-dai = "linux,snd-soc-dummy";
    //#sound-dai-cells = <0>;
    //sound-dai = <&tlv320aic3106>;
    //clocks = <&atl_clkin2_ck>;
    sound-dai = <&codec_test>;
    #sound-dai-cells = <0>;
    };
    };

    &mcasp1 {
    #sound-dai-cells = <0>;

    assigned-clocks = <&mcasp1_ahclkx_mux>;
    assigned-clock-parents = <&atl_clkin2_ck>;

    status = "okay";

    op-mode = <0>; /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    /* 16 serializer */
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    >;
    tx-num-evt = <32>;
    rx-num-evt = <32>;
    };


    Thank you and Regards,
    Wayne Kuo
  • Wayne,

    You can remove the 'simple-audio-card,widgets' and 'simple-audio-card,routing' properties from your sound node because the dummy codec most likely doesn't have any widgets defined that need to be connected in the sound card.

    Also, you can remove the 'sound-dai-cells' property in the card's codec: 

    simple-audio-card,codec {
    sound-dai = <&codec_test>;
    #sound-dai-cells = <0>;     <- Remove this
    };

    Do you still see any problems? It's not quite clear. Please make sure that the appropriate McASP1 pinmux settings are done in u-boot.

  • Hi Misael,

    Thanks for your valuable suggestion.

    We found somehow all McASP1 pins be configure to input pins, so we modify dummy codec to link to McASP8.
    Dummy codec seems work OK on McASP8, but there still no signal when we probe ACLKX / FSX /AXR0 / AXR1 on McASP8 port.
    Here is our log for playing *.wav:

    root@jacinto6evm:/ # tinyplay /vendor/wav/SampleAudio_0_4mb_44.1K.wav &
    [1] 1203
    root@jacinto6evm:/ # Playing sample: 2 ch, 44100 hz, 24 bit
    root@jacinto6evm:/ # cat /proc/asound/card0/pcm0p/sub0/status
    state: RUNNING
    owner_pid : 1203
    trigger_time: 117.217354754
    tstamp : 119.570235849
    delay : 3552
    avail : 544
    avail_max : 1024
    -----
    hw_ptr : 183840
    appl_ptr : 187392
    root@jacinto6evm:/ # cat /proc/asound/card0/pcm0p/sub0/status
    state: RUNNING
    owner_pid : 1203
    trigger_time: 117.217354754
    tstamp : 126.100228898
    delay : 3344
    avail : 752
    avail_max : 1024
    -----
    hw_ptr : 694000
    appl_ptr : 697344

    We have 3 questions:
    1.
    The log seems dummy codec works find and be able to play *.wav file, but why we can not probe any signal? What we miss?

    2.
    During Kernel initial process, we found a log as below, does it make any effect for output signal?
    supply DVDD not found using dummy regulator

    3.
    We found there are two files in U-Boot, mux_data.h and dra7-evm.dts, these two files seems to setup the PIN MUX configuration both.
    As my experience on Sitara series (SDK7.0 to PSDK1.0), *.dts files are use for defining the device tree (link PIN MUX to Kernel driver) on Kernel level.
    However, these *.dts in U-Boot DO be compiled while I make the U-Boot images.
    I'm not sure if these *.dts affect the PIN MUX configuration for U-Boot or not.
    So witch file we use to configure PIN MUX for U-Boot?


    Thank You and Regards,
    Wayne Kuo
  • 1. Since the hw_ptr is changing in your logs, that means that McASP is receiving data and shifting it out. So, most likely it's only the pinmux that's wrong.

    2. No, that shouldn't affect.

    3. For u-boot pinmux, please make your changes in mux_data.h file. Make sure you add your entries for McASP8 in the appropriate array for the DRA7xx silicon you have.

  • Hi Misael,

    Thanks for reply.

    We double check the pin mux on U-Boot and found our pin mux was be overwrite.
    We can probe the signal out put on McASP8 ACLKX and FSX.

    Now we face another issue, customer need the I2S run on 48KHz sample rate stereo 24bits format, that is BCLK should be 3.072MHz.
    However, our McASP8_FSX is around 78.12KHz, McASP8_ACLKX is 2.5MHz.

    How can we set the McASP clock?
    There is a dra7xx-clocks.dtsi file in Kernel Device Tree, I think this file can use to set the clock source for all the peripheral.
    If yes, where is appropriate place to set the McASP port clock?
    If no, any example for setup McASP port clock for reference?


    Thank you and Regards,
    Wayne Kuo
  • Do you have the system-clock-frequency property set in your sound node? The system-clock-frequency must be set so that an accurate bit clock can be generated from it. If you still have 11.2896MHz, then you won't be able to generate an exact BCLK frequency of 3.072MHz.

    So, you might want to try something like this:

    @@ -146,7 +146,7 @@
    
                    sound0_master: simple-audio-card,cpu {
                            sound-dai = <&mcasp3>;
    -                       system-clock-frequency = <11289600>;
    +                       system-clock-frequency = <24576000>;
                    };
    
                    simple-audio-card,codec {
    @@ -1313,8 +1313,8 @@ i2c_p3_exp: &i2c2 {
                              <&atl_clkin1_ck>,
                              <&atl_clkin2_ck>;
            assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>;
    -       assigned-clock-rates = <0>, <0>, <180633600>, <361267200>,
    -                              <11289600>, <11289600>;
    +       assigned-clock-rates = <0>, <0>, <122880000>, <245760000>,
    +                              <24576000>, <24576000>;
    
            status = "okay";
    
    

    You may need to set an additional property in the sound0_master node to make the slot_width = 32 (24 bits of data in a 32-bit slot):

    dai-tdm-slot-width = 32;

  • Hi Misael,

    Very thanks for your support.

    We follow your suggestion to modify dra7-evm.dts file as below:

            snd0: sound@0 {
                    compatible = "simple-audio-card";
                    //compatible = "snd_dummy";
                    simple-audio-card,name = "DRA7xx-EVM";
                    //simple-audio-card,widgets =
                    //      "Headphone", "Headphone Jack",
                    //      "Line", "Line Out",
                    //      "Microphone", "Mic Jack",
                    //      "Line", "Line In";
                    //simple-audio-card,routing =
                    //      "Headphone Jack",       "HPLOUT",
                    //      "Headphone Jack",       "HPROUT",
                    //      "Line Out",             "LLOUT",
                    //      "Line Out",             "RLOUT",
                    //      "MIC3L",                "Mic Jack",
                    //      "MIC3R",                "Mic Jack",
                    //      "Mic Jack",             "Mic Bias",
                    //      "LINE1L",               "Line In",
                    //      "LINE1R",               "Line In";
                    //simple-audio-card,format = "dsp_b";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&sound0_master>;
                    simple-audio-card,frame-master = <&sound0_master>;
                    //simple-audio-card,bitclock-master = <&codec_test>;
                    //simple-audio-card,frame-master = <&codec_test>;
                    simple-audio-card,bitclock-inversion;
                    sound0_master: simple-audio-card,cpu {
                            sound-dai = <&mcasp8>;
                            //system-clock-frequency = <11289600>;
                            system-clock-frequency = <24576000>;
                            dai-tdm-slot-width = <32>;
                    };
    
                    simple-audio-card,codec {
                            //sound-dai = "linux,snd-soc-dummy";
                            //#sound-dai-cells = <0>;
                            //sound-dai = <&tlv320aic3106>;
                            clocks = <&atl_clkin2_ck>;
                            sound-dai = <&codec_test>;
                            //#sound-dai-cells = <0>;
                    };
            };
    &atl {                                                                                               
            assigned-clocks = <&abe_dpll_sys_clk_mux>,                                                   
                              <&atl_gfclk_mux>,                                                          
                              <&dpll_abe_ck>,                                                            
                              <&dpll_abe_m2x2_ck>,                                                       
                              <&atl_clkin1_ck>,                                                          
                              <&atl_clkin2_ck>;                                                          
            assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>;                                   
            //assigned-clock-rates = <0>, <0>, <180633600>, <361267200>,                                 
            //                             <11289600>, <11289600>;                                       
            assigned-clock-rates = <0>, <0>, <122880000>, <245760000>,                                   
                                    <24576000>, <24576000>;                                              
                                                                                                         
            status = "okay";                                                                             
                                                                                                         
            atl2 {                                                                                       
                    bws = <DRA7_ATL_WS_MCASP2_FSX>;                                                      
                    aws = <DRA7_ATL_WS_MCASP3_FSX>;                                                      
            };                                                                                           
    };

    Now we probe the ACLKX and AFSX, but the frequency is still not what we wanted.
    The frequency of ACLKX is 1.25MHz, the frequency of AFSX is 39.1KHz, as below picture:

    I'm curious why we increase the system-clock-frequency from <11289600> to <2457600>, but the frequency we probe is decreased?
    What is the connection between "system-clock-frequency" and ACLKX/AFSX frequency?


    Best Regards,
    Wayne Kuo

  • When McASP is in master mode, the McASP CLKXDIV is calculated from the required BCLK rate (channels * slot_width * rate) and the AHCLKX rate. The system-clock-frequency property in the sound0_master node corresponds to the AHCLKX rate. The BCLK rate is determined by the parameters being used during playback.

    The actual BCLK (ACLKX) and FSYNC (AFSX) rates are determined by the driver's calculation of its internal CLKXDIV. So even after increasing the system-clock-frequency property the BCLK could have decreased if the driver used a larger divider.

    Does your McASP8 node have the "assigned-clocks" and "assigned-clock-parents" properties set to McASP8 AHCLKX and ATL2, respectively.

    > I2S run on 48KHz sample rate stereo 24bits format, that is BCLK should be 3.072MHz.

    Above BCLK corresponds to: 2 (stereo) * 48000 (rate) * 32 bits (slot width) = 3.072MHz. So, make sure that your playback command corresponds to those parameters (i.e. a sample file that is stereo, 24 or 32-bits, 48kHz).

    I think that the next steps are:

    1. Check that the McASP8 AHCLKX is routed from ATL2 (see the "assigned-clocks" and "assigned-clock-parents" properties)
    2. Check that the ATL2, AHCLKX are at the rates that we expect (i.e. cat /d/clk/atl_clkin2_ck/clk_rate, cat /d/clk/mcasp3_ahclkx_mux/clk_rate)
    3. Get the output of 'omapconf show mcasp8' while the playback is going on in the background. We can check how the McASP clock divider is configured
    4. Take a closer look at the computation of the clock divider in davinci_mcasp_calc_clk_div() for your specific parameters. You may want to add prints to see if the values in those formulas are the expected ones
    5. The "clocks" property in the simple-audio-card,codec node maybe harmful, but could also be setting the ATL clock frequency to something else (I'm not familiar with the dummy codec you're using to be sure). Please try removing it.