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.

AM1808, mcbsp audio on kernel 3.17.0

Other Parts Discussed in Thread: AM1808, OMAPL138

Hi all,

i am trying to have the pcm audio working moving from kernel 3.5.1 to 3.17.

I ported my soc machine based on wolfson wm8758 codec, but the audio is muted, i just hear some "clicks" on start and stop playing.

Also, come alsa mixer channels, as "Capture Volume" and some other are broken (I/O error accessing them).

A main change on kernel 3.17 is that "davinci-pcm-audio" is no more a platform driver.

A new function, "davinci_soc_platform_register()" seems need to be called, but if i call it from my soc machine card driver, nothing happen.

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/116088.html

If someone have experience, every suggestion is welcome.

Regards

  • Hi,

    Thanks for your post.

    After reviewing the kernel patch suggested above, i didn't find the static struct for "snd_soc_dai_link am1808_evm_dai[]" which seems the structure for the same is not available for AM1808 platform but, some how you can consider DA850 structure as "struct snd_soc_dai_link da850_evm_dai" which has the same ARM core as AM1808 sine DA850 is similar to OMAPL138 platform. With this consideration, still, but the platform name in the patch is wrongly identified as  read as "davinci-mcasp.0" but actually it should be "davinci-mcbsp". Please correct me if i am wrong.

    With respect to above, you have to check appropriately for the right "cpu_dai_name", "codec_dai_name", "codec_name" etc. Kindly manipulate the below structure accordingly and apply the suggested patch in your build.

    static struct snd_soc_dai_link da850_evm_dai = {
          .cpu_dai_name= "davinci-mcasp.0",
          .codec_dai_name = "tlv320aic3x-hifi",
          .codec_name = "tlv320aic3x-codec.1-0018",
          - .platform_name = "davinci-pcm-audio",
         + .platform_name = "davinci-mcasp.0",

         .init = evm_aic3x_init,
         .ops = &evm_ops,
    };

    After manipulating the above mentioned parameters, apply the patch & build. Still you dind audio issue, please debug the code and check the return value of the function "davinci_soc_platform_register(&pdev->dev)". Based on the return value, kindly check for printing any device error like below:

    ret = davinci_soc_platform_register(&pdev->dev);
             + if (ret) {
             + dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
             + goto err_unregister_dai;
             + }

    Kindly ensure the code should not print the above PCM register failed error, then obviously, you will have audio issues. Again, the above should be checked in the McBSP audio source file but it is wrongly identified in the patch for McASP source file. Please correct the same too as below:

    diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
    index 6a2c54c..34ee2f1 100644
    --- a/sound/soc/davinci/davinci-mcasp.c
    +++ b/sound/soc/davinci/davinci-mcasp.c
    @@ -951,8 +951,17 @@ static int davinci_mcasp_probe(struct platform_device *pdev)

    if (ret != 0)
    goto err_release_clk;
    +
    + ret = davinci_soc_platform_register(&pdev->dev);
    + if (ret) {
    + dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
    + goto err_unregister_dai;
    + }

    I would also recommend you to walkthrough the below E2E posts for better understanding on alsa sound usage and audio capture glitch problem on different platform but however, would be useful references for you to add more clarity to the issue:

    http://e2e.ti.com/support/embedded/linux/f/354/p/134170/483965.aspx#483965

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/140604/812458.aspx#812458

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/p/119432/797218.aspx#797218

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

     

     

     

  • Dear Sivaraj,

    many thanks.

    Well, i verified the code, should be all correct as the patch shows. PCM helper is instantiated, called, and seems to work (put traces in dacinvi-pcm.c). The ALSA card 0 is visible and all settings and devices in the system (/dev/snd) are exactly the same of a working board, as well as the amixer settings.

    I identified a first issue. I see now through scope that my mbcsp CLKR0 amd CLKX0 are at 543Khz, while in a working board, they are at 2,7Mhz. I cannot measure MCLK that is not accessible.

    Looking the code to find this clock configuration.

  • Look into the following file for clock.

    arch/arm/mach-davinci/da850.c

        CLK("davinci-mcasp.0",    NULL,        &mcasp_clk),

  • An update,

    I am actually registering audio with da850_init_mcbsp from my board.c, using mcbsp, so davinci-mcbsp.0 so davinci-i2s.c is calling correctly davinci_soc_platform_register

    Clock setup for davinci-mcbsp.0 seems also fine.

    ret = davinci_soc_platform_register(&pdev->dev);
        if (ret) {
            dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
            goto err_unregister_component;
        }

    	CLK("spi_davinci.0",	NULL,		&spi0_clk),
    	CLK("spi_davinci.1",	NULL,		&spi1_clk),
    	CLK("vpif",		NULL,		&vpif_clk),
    	CLK("ahci_da850",		NULL,		&sata_clk),
    	CLK("davinci-rproc.0",	NULL,		&dsp_clk),
    	CLK("ehrpwm",		"fck",		&ehrpwm_clk),
    	CLK("ehrpwm",		"tbclk",	&ehrpwm_tbclk),
    	CLK("ecap",		"fck",		&ecap_clk),
    >>>	CLK("davinci-mcbsp.0",	NULL,		&mcbsp0_clk),

  • Still an update,

    clock measured on CLKR0 andCLKX0 is correct. Was a bad measurement due to the fact that it changes after playing sample files.

    So, CLKR0 andCLKX0 are at the same frequency of the working board (kernel 3.5.1).

    But, another strange thing is that, using "aplay" tool, playing a file, the new kernel board stays into playing about 5 times more to complete the play, and of course, audio is mute.

  • Ok, solved

    linux developers put always innovations with unavoidable breakage of existent boards, that when are custom, need to be adjusted.


    Issue was the davinci-pcm.c, a part of default settings has been removed to let cards configure them separately.

    I still have  a small last issue:

    Some mixer channels are not available, mixer get I/O error while accessing them, so i disabled them for now.

        //SOC_DOUBLE_R_TLV("Capture Volume", WM8758_LEFT_ADC_DIGITAL_VOL,
        //    WM8758_RIGHT_ADC_DIGITAL_VOL, 0, 255, 0, adc_tlv),

        //SOC_SINGLE("DAC Playback Limiter Switch", WM8758_DAC_LIMITER_1, 8, 1, 0),
        //SOC_SINGLE("DAC Playback Limiter Decay", WM8758_DAC_LIMITER_1, 4, 10, 0),
        //SOC_SINGLE("DAC Playback Limiter Attack", WM8758_DAC_LIMITER_1, 0, 11, 0)

    //SOC_ENUM("EQ4 Bandwith", eq4_bw),
    //SOC_ENUM("EQ4 Cutoff", eq4_cutoff),
    //SOC_SINGLE_TLV("EQ4 Volume", WM8758_EQ4_PEAK_3, 0, 24, 1, eq_tlv),

    Hopefully that is not am issue.

    Regards,