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/am3352: mcasp aplay problem

Part Number: AM3352
Other Parts Discussed in Thread: TLV320AIC3106,

Tool/software: Linux

I am now using the new kernel of sdk verson am335x_sdk_v03_02_00_05.
The aplay play sound fine in the old 3.2.0  kernel.
but I meet  problem that it can not play sound at all using the new kernel.
My mode is SND_SOC_DAIFMT_I2S| SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF
So the codec adau1961 will output bclk and lrclk to am335x.
I  use MCASP0_AHCLKX to output the MCLK 24Mhz to codec.
I measure on the scope that  there is data pulse on the pin MCASP0_AXR0,there is  24Mhz frequency on the pin MCASP0_AHCLKX.
I also measure there is correct BCLK and LRCLK  frequency on the pin MCASP0_ACLKX and MCASP0_FSX.
The setting of codec is the same to the value which play sound fine in the past 3.2.0 kernel.
when I run cat /proc/asound/card0/pcm0p/sub0/status
It is changing .
 
root@am335x-evm:/sys/devices/platform/sound/ADAU1X61X# cat /proc/asound/card0/pcm0p/sub0/status
state: RUNNING
owner_pid   : 2850
trigger_time: 5419.227225978
tstamp      : 0.000000000
delay       : 18342
avail       : 5658
avail_max   : 18000
-----
hw_ptr      : 227674
appl_ptr    : 246016
root@am335x-evm:/sys/devices/platform/sound/ADAU1X61X# cat /proc/asound/card0/pcm0p/sub0/status
state: RUNNING
owner_pid   : 2850
trigger_time: 5419.227225978
tstamp      : 0.000000000
delay       : 21595
avail       : 2405
avail_max   : 5994
-----
hw_ptr      : 578421
appl_ptr    : 600016
 
my dts is as following 
I do not use the simple-audio-card ,I use the davinci-evm.c  an ops 

mcasp0_pins: mcasp0_pins {
pinctrl-single,pins = <
0x190 (PIN_INPUT_PULLUP| MUX_MODE0) /* mcasp0_aclkx */
0x194 (PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx */
0x198 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_axr0 */
0x1ac (PIN_OUTPUT_PULLUP| MUX_MODE0) /* mcasp0_ahclkx */
>;
};

&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;

status = "okay";
clock-frequency = <400000>;

audio_codec: adau1961@3a {
status = "okay";
compatible = "dr,adau1961";
reg = <0x3a>;
};
};

&mcasp0 {
pinctrl-names = "default";
pinctrl-0 = <&mcasp0_pins>;
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
>;
tx-num-evt = <1>;
rx-num-evt = <0>;
};

can any one give me some idea ?

wangl

  • I was so strange with the mcasp
    when I do the test with my old kernel
    I remove the following line which is add by myself.in static int davinci_mcasp_probe(struct platform_device *pdev)
    mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
    then it behave like the new kernel, there is MCLK bclk lrclk and data pulse ,but there is no sound.

    But when i add this line in the new kernel ,the kernel panic.
    Can any one tell me why?
  • Liang,

    From what I understand, when using old SDK6 (kernel 3.2) with your AM335x custom board, you are able to use aplay successful. But when switch to PSDK 3.02 (kernel 4.4.32), you have problems.

    As a start you can compare the boot logs between 3.2 and 4.4 kernels and check if there are some major differences regarding Audio/ALSA/McASP

    You can also make McASP registers dump in 3.2 and 4.4 and compare the results.

    Regards,
    Pavel
  • There are also appl notes for debugging audio problems in DRA7x device, but the main concept is also applicable for AM335x, you might have a look:

    www.ti.com/.../sprac09a.pdf

    www.ti.com/.../sprac10.pdf

    Regards,
    Pavel
  • Hello Pavel:

    I have dump the register of the new kernel ,it is almost the same .

    i print the value at the tail of static void mcasp_start_tx(struct davinci_mcasp *mcasp)

    [ 407.155260] regs_offset: ac,val:101
    [ 407.158775] regs_offset: 6c,val:11
    [ 407.162199] regs_offset: a8,val:18074
    [ 407.165886] regs_offset: 68,val:10070
    [ 407.169571] regs_offset: b0,val:80
    [ 407.172995] regs_offset: 70,val:180080
    [ 407.176767] regs_offset: b4,val:8000
    [ 407.180364] regs_offset: 74,val:8000
    [ 407.183962] regs_offset: 14,val:8000001
    [ 407.187821] regs_offset: 64,val:ffff
    [ 407.191417] regs_offset: a4,val:ffff
    [ 407.195014] regs_offset: 78,val:0
    [ 407.198351] regs_offset: b8,val:3

    The xstat register always 0x10c,it report Transmit clock failure.

    But it is also 0x10c in the old kernel.

    It is  strange that why I must add  mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);

    in the  davinci_mcasp_probe().

    If I do not add this line ,the register of PDIR also show val 8000001 in the old kernel,there is no sound .

  • Liang,

    LIANG WANG102707 said:
    I have dump the register of the new kernel ,it is almost the same .

    Almost the same! What is the difference?

    Do you listen the sound on speaker or headphone? You can compare the signal you have on McASP pins in old kernel and new kernel, if there is no difference on the pins, then you should focus on codec adau1961 kernel 4.4 porting, the McASP (AM335x device) should be fine.

    LIANG WANG102707 said:

    The xstat register always 0x10c,it report Transmit clock failure.

    But it is also 0x10c in the old kernel.

    When xstat is 0x10c, do you still have data output on the AXR0 pin? If XINTCTL (0xBC) [2] XCKFAIL is 0x1, you might get interrupt generated to Cortex-A8, which will stop audio transmit process.

    LIANG WANG102707 said:

    It is  strange that why I must add  mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);

    in the  davinci_mcasp_probe().

    If I do not add this line ,the register of PDIR also show val 8000001 in the old kernel,there is no sound .

    You are using SND_SOC_DAIFMT_CBM_CFM, which is clearing PDIR[27] AHCLKX also as ACLKX and FSX:

    static int davinci_mcasp_set_dai_fmt()

    {

    case SND_SOC_DAIFMT_CBM_CFM:
            /* codec is clock and frame master */
            mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
            mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);

            mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
            mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, AFSRE);

            mcasp_clr_bits(mcasp, DAVINCI_MCASP_PDIR_REG,
                       ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR);
            mcasp->bclk_master = 0;
            break;

    }

    Regards,
    Pavel

  • Dear Pavel:
    I have do the change in my old kernel and new kernel as following:
    case SND_SOC_DAIFMT_CBM_CFM:
    /* codec is clock and frame master */
    mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
    mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);

    mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
    mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
    /* comment wangl for AHCLK should be set*/
    mcasp_clr_bits(mcasp, DAVINCI_MCASP_PDIR_REG,
    ACLKX /*| AHCLKX */| AFSX | ACLKR | AHCLKR | AFSR);
    mcasp->bclk_master = 0;
    /*add wangl20151122 */
    mcasp_set_bits(mcasp,DAVINCI_MCASP_PDIR_REG, AHCLKX);//add wangl set as output
    mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);//add wangl

    but it is so strange,can you tell me which the xstat always compliant transmit clock error but play sound fine?

    Best regards
    wangl
  • Liang,

    Do you mean that now you have sound in new kernel (aplay play sound fine)?

    And the only issue now is XSTAT register value?

    Regards,
    Pavel
  • Hi Pavel

    I do not have sound in new kernel 4.4.32  till now.

    But I do have sound in old kernel 3.2.0.

    What I strange is that XSTAT always have transmit clock error both in old kernel and new kernel.

    And it seem that this line mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);

    make some influence to the sound play.

    There is two place I add this line in the old kernel.

    One is in the  davinci_mcasp_probe(),another one is davinci_mcasp_set_dai_fmt()

    If I remove the line in davinci_mcasp_probe(),the old kernel also do not have the sound.

    I also add this line in new kernel in davinci_mcasp_startup()  and  davinci_mcasp_set_dai_fmt().

    But it do not have sound.

    I do not add it in davinci_mcasp_probe() because it make the new kernel panic.

    so strange.

  • LIANG WANG102707 said:
    What I strange is that XSTAT always have transmit clock error both in old kernel and new kernel.

    What value you have in XINTCTL[2] XCKFAIL bit  in old and new kernel?

    LIANG WANG102707 said:
    And it seem that this line mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);

    LIANG WANG102707 said:

    I also add this line in new kernel in davinci_mcasp_startup()  and  davinci_mcasp_set_dai_fmt().

    But it do not have sound.

    I do not add it in davinci_mcasp_probe() because it make the new kernel panic.

    so strange.

    Do not add this line. MCASP_PDIR_REG[27] AHCLKX bit is set in the below line:

    static int davinci_mcasp_set_sysclk()

    {

    ...

    else {
            /* Select AUXCLK as HCLK */
            mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
            mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
            mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);

    ...

    }

     

    What you need to do is to modify the SND_SOC_DAIFMT_CBM_CFM case (as you already did), and set SND_SOC_CLOCK_OUT instead SND_SOC_CLOCK_IN.

    For how to set SND_SOC_CLOCK_OUT refer to the below pointers:

    linux-4.4.32/sound/soc/generic/simple-card.c

    linux-4.4.32/Documentation/devicetree/bindings/sound/simple-card.txt -> system-clock-direction

    Update you DTS file, like the one below:

    linux-4.4.32/arch/arm/boot/dts/am437x-gp-evm-hdmi.dts -> system-clock-direction = "out";

    SND_SOC_CLOCK_IN and SND_SOC_CLOCK_OUT are also explained in the PDF file that I already provided to you, here is the link again:

     

    Regards,
    Pavel

  • Hi pavel :

    I do not use the simple card interface .I use the davici-evm.c

    static int dr_hw_params(struct snd_pcm_substream *substream,
    struct snd_pcm_hw_params *params)
    {
    struct snd_soc_pcm_runtime *rtd = substream->private_data;
    struct snd_soc_dai *codec_dai = rtd->codec_dai;
    struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
    struct snd_soc_card *soc_card = rtd->card;
    int ret = 0;
    int pll_rate;
    unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *)
    snd_soc_card_get_drvdata(soc_card))->sysclk;

    #define AUDIO_FORMAT_DR (SND_SOC_DAIFMT_I2S| \
    SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF)

    snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT_DR);

    ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT_DR);

    if (ret < 0)
    return ret;

    switch (params_rate(params)) {
    case 48000:
    case 8000:
    case 12000:
    case 16000:
    case 24000:
    case 32000:
    pll_rate = 48000 * 1024;
    break;
    case 44100:
    case 7350:
    case 11025:
    case 14700:
    case 22050:
    case 29400:
    pll_rate = 44100 * 1024;
    break;
    default:
    return -EINVAL;
    }

    /* set the codec system clock */
    ret = snd_soc_dai_set_sysclk(codec_dai,1, sysclk, SND_SOC_CLOCK_OUT);
    if (ret < 0)
    return ret;

    /* set the CPU system clock */
    ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);

    then it will call the davinci_mcasp_set_sysclk().

    It will  in the case

    else {
    /* Select AUXCLK as HCLK */

    mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);

    So it will also set the AHCLKX twice.but there is no sound.

    I print the  XINTCTL is 1.XUNDRN is enabled.

  • LIANG WANG102707 said:
    I do not use the simple card interface

    May be this is the problem here. In your DTS file, do you have a sound node (like for example in am335x-evm.dts)

    sound {
            compatible = "simple-audio-card";
            simple-audio-card,name = "AM335x-EVM";
            simple-audio-card,widgets =
                "Headphone", "Headphone Jack",
                "Line", "Line In";
            simple-audio-card,routing =
                "Headphone Jack",    "HPLOUT",
                "Headphone Jack",    "HPROUT",
                "LINE1L",        "Line In",
                "LINE1R",        "Line In";
            simple-audio-card,format = "dsp_b";
            simple-audio-card,bitclock-master = <&sound_master>;
            simple-audio-card,frame-master = <&sound_master>;
            simple-audio-card,bitclock-inversion;

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

            sound_master: simple-audio-card,codec {
                sound-dai = <&tlv320aic3106>;
                system-clock-frequency = <12000000>;
            };
        };

     

    How you specify the connection between the SoC and the codec without using the "simple-card" driver?

    LIANG WANG102707 said:
    So it will also set the AHCLKX twice.but there is no sound.

    From what I understand now you have PDIR[27] AHCLKX set to 1, but still no sound. Please provide me full boot up log and aplay log.

    See also the below wiki page:

    http://processors.wiki.ti.com/index.php/Sitara_Linux_Audio_Porting_Guide

    Regards,
    Pavel

  • Hello Pavel:

    I do this in my dts 

    sound {
    compatible = "dr,adau1961-tod-audio";
    ti,model = "DR adau1961";
    ti,audio-codec = <&audio_codec>;
    ti,mcasp-controller = <&mcasp0>;
    ti,codec-clock-rate = <24000000>;
    };

    I add these in my davinci-evm.c

    static int dr_hw_params(struct snd_pcm_substream *substream,
    struct snd_pcm_hw_params *params)
    {

    struct snd_soc_pcm_runtime *rtd = substream->private_data;
    struct snd_soc_dai *codec_dai = rtd->codec_dai;
    struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
    struct snd_soc_card *soc_card = rtd->card;
    int ret = 0;
    int pll_rate;
    unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *)
    snd_soc_card_get_drvdata(soc_card))->sysclk;

    #define AUDIO_FORMAT_DR (SND_SOC_DAIFMT_I2S | \
    SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF)

    snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT_DR);
    ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT_DR);

    if (ret < 0)
    return ret;

    switch (params_rate(params)) {
    case 48000:
    case 8000:
    case 12000:
    case 16000:
    case 24000:
    case 32000:
    pll_rate = 48000 * 1024;
    break;
    case 44100:
    case 7350:
    case 11025:
    case 14700:
    case 22050:
    case 29400:
    pll_rate = 44100 * 1024;
    break;
    default:
    return -EINVAL;
    }

    /* set the codec system clock */
    ret = snd_soc_dai_set_sysclk(codec_dai,1, sysclk, SND_SOC_CLOCK_OUT);
    if (ret < 0)
    return ret;

    /* set the CPU system clock */
    ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);

    ret = snd_soc_dai_set_pll(codec_dai, 0, 0,sysclk,pll_rate);

    return 0;
    }

    static struct snd_soc_ops dr_ops = {
    .startup = evm_startup,
    .shutdown = evm_shutdown,
    .hw_params = dr_hw_params,
    };

    //add wangl 
    static struct snd_soc_dai_link dr_dai_adau1961 = {
    .name = "ADAU1X61X",
    .stream_name = "ADAU",
    .codec_dai_name = "adau-hifi",
    .ops = &dr_ops,
    .init = dr_adau_init,
    .dai_fmt = SND_SOC_DAIFMT_I2S | \
    SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
    };
    //add wangl end

    static const struct of_device_id davinci_evm_dt_ids[] = {
    {
    .compatible = "ti,da830-evm-audio",
    .data = (void *) &evm_dai_tlv320aic3x,
    },
    {
    .compatible = "dr,adau1961-tod-audio",
    .data = (void *) &dr_dai_adau1961,
    },
    { /* sentinel */ }
    };

    There is no problem with the connection .It is not important whether to use the simple card interface.It just do the bind.

    The problem is I see the clock and data pulse and there is no sound.

  • Liang,

    How do you verify if there is sound or not? Do you use speaker or microphone?

    Please provide me full boot up log, "aplay -l" and "aplay file" console output for old kernel and for new kernel.

    Regards,
    Pavel
  • Hi Pavel:

    this is for new kernel


    root@am335x-evm:~# dmesg
    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct
    [ 0.000000] Linux version 4.4.32-gadde2ca9f8 (wangl@ubuntu) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #66 PREEMPT Mon Jun 19 17:22:37 CST 2017
    [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [ 0.000000] Machine model: TI AM335x dr_am335x
    [ 0.000000] cma: Reserved 48 MiB at 0x9d000000
    [ 0.000000] Memory policy: Data cache writeback
    [ 0.000000] On node 0 totalpages: 131072
    [ 0.000000] free_area_init_node: node 0, pgdat c0a0a068, node_mem_map dcb61000
    [ 0.000000] Normal zone: 1152 pages used for memmap
    [ 0.000000] Normal zone: 0 pages reserved
    [ 0.000000] Normal zone: 131072 pages, LIFO batch:31
    [ 0.000000] CPU: All CPU(s) started in SVC mode.
    [ 0.000000] AM335X ES2.1 (neon )
    [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [ 0.000000] pcpu-alloc: [0] 0
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129920
    [ 0.000000] Kernel command line: console=ttyO0,115200 root=/dev/nfs ip=192.168.1.171:::::eth0:off nfsroot=192.168.1.77:/tftpboot/am335x_rootfs_v03050002,v3,tcp
    [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    [ 0.000000] Memory: 459232K/524288K available (7023K kernel code, 387K rwdata, 2620K rodata, 280K init, 267K bss, 15904K reserved, 49152K cma-reserved, 0K highmem)
    [ 0.000000] Virtual kernel memory layout:
    vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    vmalloc : 0xe0800000 - 0xff800000 ( 496 MB)
    lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
    modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
    .text : 0xc0008000 - 0xc0973014 (9645 kB)
    .init : 0xc0974000 - 0xc09ba000 ( 280 kB)
    .data : 0xc09ba000 - 0xc0a1ae18 ( 388 kB)
    .bss : 0xc0a1ae18 - 0xc0a5dc18 ( 268 kB)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] Preemptible hierarchical RCU implementation.
    [ 0.000000] Build-time adjustment of leaf fanout to 32.
    [ 0.000000] NR_IRQS:16 nr_irqs:16 16
    [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [ 0.000013] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [ 0.000032] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [ 0.000041] OMAP clocksource: timer1 at 24000000 Hz
    [ 0.000165] clocksource_probe: no matching clocksources found
    [ 0.000321] Console: colour dummy device 80x30
    [ 0.000342] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [ 0.000347] This ensures that you still see kernel messages. Please
    [ 0.000351] update your kernel commandline.
    [ 0.000367] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
    [ 0.089311] pid_max: default: 32768 minimum: 301
    [ 0.089422] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.089432] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.090033] Initializing cgroup subsys io
    [ 0.090059] Initializing cgroup subsys memory
    [ 0.090092] Initializing cgroup subsys devices
    [ 0.090105] Initializing cgroup subsys freezer
    [ 0.090117] Initializing cgroup subsys perf_event
    [ 0.090126] Initializing cgroup subsys pids
    [ 0.090152] CPU: Testing write buffer coherency: ok
    [ 0.090517] Setting up static identity map for 0x80008200 - 0x80008258
    [ 0.094538] devtmpfs: initialized
    [ 0.103452] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [ 0.115282] omap_hwmod: debugss: _wait_target_disable failed
    [ 0.170126] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [ 0.173646] pinctrl core: initialized pinctrl subsystem
    [ 0.174840] NET: Registered protocol family 16
    [ 0.176680] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [ 0.199302] cpuidle: using governor ladder
    [ 0.229291] cpuidle: using governor menu
    [ 0.232824] gpiochip_add: registered GPIOs 0 to 31 on device: gpio
    [ 0.233108] OMAP GPIO hardware version 0.1
    [ 0.233791] gpiochip_add: registered GPIOs 32 to 63 on device: gpio
    [ 0.234461] gpiochip_add: registered GPIOs 64 to 95 on device: gpio
    [ 0.235109] gpiochip_add: registered GPIOs 96 to 127 on device: gpio
    [ 0.239264] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/gpmc_pins, deferring probe
    [ 0.241340] hw-breakpoint: debug architecture 0x4 unsupported.
    [ 0.276269] edma 49000000.edma: TI EDMA DMA engine driver
    [ 0.276592] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator@0[0]'
    [ 0.279043] SCSI subsystem initialized
    [ 0.279456] usbcore: registered new interface driver usbfs
    [ 0.279525] usbcore: registered new interface driver hub
    [ 0.279612] usbcore: registered new device driver usb
    [ 0.279990] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
    [ 0.280100] media: Linux media interface: v0.10
    [ 0.280150] Linux video capture interface: v2.00
    [ 0.280191] pps_core: LinuxPPS API ver. 1 registered
    [ 0.280197] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [ 0.280221] PTP clock support registered
    [ 0.280267] EDAC MC: Ver: 3.0.0
    [ 0.281250] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [ 0.281540] Advanced Linux Sound Architecture Driver Initialized.
    [ 0.282548] clocksource: Switched to clocksource timer1
    [ 0.291784] NET: Registered protocol family 2
    [ 0.292488] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.292534] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.292628] TCP: Hash tables configured (established 4096 bind 4096)
    [ 0.292695] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.292711] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.292847] NET: Registered protocol family 1
    [ 0.293214] RPC: Registered named UNIX socket transport module.
    [ 0.293225] RPC: Registered udp transport module.
    [ 0.293231] RPC: Registered tcp transport module.
    [ 0.293236] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.293259] PCI: CLS 0 bytes, default 64
    [ 0.294073] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [ 0.295731] futex hash table entries: 256 (order: -1, 3072 bytes)
    [ 0.302493] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [ 0.303495] NFS: Registering the id_resolver key type
    [ 0.303565] Key type id_resolver registered
    [ 0.303573] Key type id_legacy registered
    [ 0.303642] ntfs: driver 2.1.32 [Flags: R/O].
    [ 0.306872] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [ 0.306900] io scheduler noop registered
    [ 0.306913] io scheduler deadline registered
    [ 0.307066] io scheduler cfq registered (default)
    [ 0.308211] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [ 0.361204] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [ 0.364881] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
    [ 0.994753] console [ttyS0] enabled
    [ 0.999392] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
    [ 1.008671] pinctrl-single 44e10800.pinmux: pin 44e10944.0 already requested by 44e10800.pinmux; cannot claim for 481aa000.serial
    [ 1.020439] pinctrl-single 44e10800.pinmux: pin-81 (481aa000.serial) status -22
    [ 1.027814] pinctrl-single 44e10800.pinmux: could not request pin 81 (44e10944.0) from group pinmux_uart5_pins on device pinctrl-single
    [ 1.040141] omap8250 481aa000.serial: Error applying setting, reverse things back
    [ 1.048314] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 160, base_baud = 3000000) is a 8250
    [ 1.058040] [drm] Initialized drm 1.1.0 20060810
    [ 1.069120] loop: module loaded
    [ 1.074550] libphy: Fixed MDIO Bus: probed
    [ 1.142619] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [ 1.148754] davinci_mdio 4a101000.mdio: detected phy mask fffffff9
    [ 1.156374] libphy: 4a101000.mdio: probed
    [ 1.160419] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver SMSC LAN8710/LAN8720
    [ 1.169683] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver SMSC LAN8710/LAN8720
    [ 1.179522] cpsw 4a100000.ethernet: Missing dual_emac_res_vlan in DT.
    [ 1.186155] cpsw 4a100000.ethernet: Using 1 as Reserved VLAN for 0 slave
    [ 1.192970] cpsw 4a100000.ethernet: Missing dual_emac_res_vlan in DT.
    [ 1.199440] cpsw 4a100000.ethernet: Using 2 as Reserved VLAN for 1 slave
    [ 1.206204] cpsw 4a100000.ethernet: Detected MACID = ec:24:b8:9a:ac:79
    [ 1.212886] cpsw 4a100000.ethernet: cpts: overflow check period 850
    [ 1.219921] cpsw 4a100000.ethernet: cpsw: Detected MACID = ec:24:b8:9a:ac:7b
    [ 1.227743] usbcore: registered new interface driver smsc95xx
    [ 1.234399] mousedev: PS/2 mouse device common for all mice
    [ 1.240487] i2c /dev entries driver
    [ 1.244946] cpuidle: enable-method property 'ti,am3352' found operations
    [ 1.252241] omap_hsmmc 48060000.mmc: GPIO lookup for consumer cd
    [ 1.252257] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [ 1.252271] of_get_named_gpiod_flags: can't parse 'cd-gpios' property of node '/ocp/mmc@48060000[0]'
    [ 1.252281] of_get_named_gpiod_flags: can't parse 'cd-gpio' property of node '/ocp/mmc@48060000[0]'
    [ 1.252290] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
    [ 1.252300] omap_hsmmc 48060000.mmc: lookup for GPIO cd failed
    [ 1.252311] omap_hsmmc 48060000.mmc: GPIO lookup for consumer wp
    [ 1.252319] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [ 1.252328] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@48060000[0]'
    [ 1.252337] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@48060000[0]'
    [ 1.252344] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
    [ 1.252352] omap_hsmmc 48060000.mmc: lookup for GPIO wp failed
    [ 1.293205] ledtrig-cpu: registered to indicate activity on CPUs
    [ 1.305388] sysclk evm 24000000
    [ 1.308666] davinci_evm sound: ASoC: CODEC DAI adau-hifi not registered
    [ 1.315442] davinci_evm sound: snd_soc_register_card failed (-517)
    [ 1.323894] NET: Registered protocol family 10
    [ 1.331656] sit: IPv6 over IPv4 tunneling driver
    [ 1.337090] NET: Registered protocol family 17
    [ 1.341844] Key type dns_resolver registered
    [ 1.346450] omap_voltage_late_init: Voltage driver support not added
    [ 1.353974] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 1000000 KHz
    [ 1.361451] cpu cpu0: dev_pm_opp_domain_set_rate: failed to find current OPP for freq 1000000000 (-34)
    [ 1.371003] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 800000 KHz
    [ 1.382696] omap-gpmc 50000000.gpmc: GPMC revision 6.0
    [ 1.387881] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
    [ 1.394107] gpiochip_find_base: found new base at 510
    [ 1.394294] gpiochip_add: registered GPIOs 510 to 511 on device: omap-gpmc
    [ 1.395633] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [ 1.403282] adau1761 register codec now
    [ 1.407212] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [ 1.413488] sysclk evm 24000000
    [ 1.433539] adau1961 format set
    [ 1.436840] mode is CBM_CFM
    [ 1.439644] set falling
    [ 1.443076] davinci_evm sound: adau-hifi <-> 48038000.mcasp mapping ok
    [ 1.451317] ** snd_soc_Register card ok
    [ 1.456004] hctosys: unable to open rtc device (rtc0)
    [ 1.478695] net eth0: initializing cpsw version 1.12 (0)
    [ 1.484143] net eth0: initialized cpsw ale version 1.4
    [ 1.489307] net eth0: ALE Table size 1024
    [ 1.496745] net eth0: phy found : id is : 0x7c0f1
    [ 1.507732] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [ 1.796553] mmc0: MAN_BKOPS_EN bit is not set
    [ 1.804682] mmc0: new high speed MMC card at address 0001
    [ 1.810940] mmcblk0: mmc0:0001 MMC08G 7.27 GiB
    [ 1.815908] mmcblk0boot0: mmc0:0001 MMC08G partition 1 16.0 MiB
    [ 1.822137] mmcblk0boot1: mmc0:0001 MMC08G partition 2 16.0 MiB
    [ 1.830406] mmcblk0: p1 p2
    [ 4.513363] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
    [ 4.521569] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [ 4.542625] IP-Config: Guessing netmask 255.255.255.0
    [ 4.548131] IP-Config: Complete:
    [ 4.551411] device=eth0, hwaddr=ec:24:b8:9a:ac:79, ipaddr=192.168.1.171, mask=255.255.255.0, gw=255.255.255.255
    [ 4.562375] host=192.168.1.171, domain=, nis-domain=(none)
    [ 4.568457] bootserver=255.255.255.255, rootserver=192.168.1.77, rootpath=
    [ 4.576336] ALSA device list:
    [ 4.579337] #0: DR adau1961
    [ 4.642201] VFS: Mounted root (nfs filesystem) readonly on device 0:14.
    [ 4.693751] devtmpfs: mounted
    [ 4.697708] Freeing unused kernel memory: 280K (c0974000 - c09ba000)
    [ 4.704172] This architecture does not have kernel memory protection.
    [ 5.569467] systemd[1]: System time before build time, advancing clock.
    [ 5.704081] random: systemd: uninitialized urandom read (16 bytes read, 101 bits of entropy available)
    [ 5.736654] random: systemd: uninitialized urandom read (16 bytes read, 102 bits of entropy available)
    [ 5.760208] systemd[1]: systemd 229 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
    [ 5.779499] systemd[1]: Detected architecture arm.
    [ 5.816655] systemd[1]: Set hostname to <am335x-evm>.
    [ 6.113261] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 125 bits of entropy available)
    [ 6.189435] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 127 bits of entropy available)
    [ 6.250179] random: nonblocking pool is initialized
    [ 6.951652] systemd[1]: [/lib/systemd/system/gadget-init.service:15] Unknown lvalue 'ExecStopPre' in section 'Service'
    [ 7.770439] systemd[1]: sysinit.target: Found ordering cycle on sysinit.target/start
    [ 7.778508] systemd[1]: sysinit.target: Found dependency on alignment.service/start
    [ 7.786303] systemd[1]: sysinit.target: Found dependency on basic.target/start
    [ 7.793607] systemd[1]: sysinit.target: Found dependency on sysinit.target/start
    [ 7.801058] systemd[1]: sysinit.target: Breaking ordering cycle by deleting job alignment.service/start
    [ 7.810650] systemd[1]: alignment.service: Job alignment.service/start deleted to break ordering cycle starting with sysinit.target/start
    [ 7.853206] systemd[1]: Created slice System Slice.
    [ 7.887039] systemd[1]: Listening on Journal Socket (/dev/log).
    [ 7.915639] systemd[1]: Listening on udev Control Socket.
    [ 7.945529] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [ 7.973048] systemd[1]: Reached target Swap.
    [ 7.993515] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [ 8.025357] systemd[1]: Listening on Network Service Netlink Socket.
    [ 8.054833] systemd[1]: Listening on Syslog Socket.
    [ 8.083546] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
    [ 8.113009] systemd[1]: Reached target Paths.
    [ 8.134583] systemd[1]: Created slice User and Session Slice.
    [ 8.163039] systemd[1]: Reached target Slices.
    [ 8.269559] systemd[1]: Created slice system-serial\x2dgetty.slice.
    [ 8.303750] systemd[1]: Reached target Remote File Systems.
    [ 8.336311] systemd[1]: Created slice system-getty.slice.
    [ 8.366360] systemd[1]: Listening on Journal Socket.
    [ 8.441046] systemd[1]: Starting Load Kernel Modules...
    [ 8.550304] systemd[1]: Mounting Temporary Directory...
    [ 8.618951] systemd[1]: Starting File System Check on Root Device...
    [ 8.709248] systemd[1]: Starting Setup Virtual Console...
    [ 8.825867] systemd[1]: Mounting POSIX Message Queue File System...
    [ 8.878734] systemd[1]: Mounting Debug File System...
    [ 8.938477] systemd[1]: Starting Create Static Device Nodes in /dev...
    [ 8.999427] systemd[1]: Starting Journal Service...
    [ 9.111989] systemd[1]: Listening on udev Kernel Socket.
    [ 9.161256] systemd[1]: Mounted Debug File System.
    [ 9.198299] systemd[1]: Mounted POSIX Message Queue File System.
    [ 9.254217] systemd[1]: Mounted Temporary Directory.
    [ 9.284326] systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
    [ 9.298016] systemd[1]: Failed to start Load Kernel Modules.
    [ 9.352969] systemd[1]: systemd-modules-load.service: Unit entered failed state.
    [ 9.363600] systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
    [ 9.404907] systemd[1]: Started File System Check on Root Device.
    [ 9.455686] systemd[1]: Started Setup Virtual Console.
    [ 9.584049] systemd[1]: Started Create Static Device Nodes in /dev.
    [ 9.625888] systemd[1]: Started Journal Service.
    [ 12.123783] systemd-journald[100]: Received request to flush runtime journal from PID 1
    [ 18.585800] EXT4-fs (mmcblk0p2): recovery complete
    [ 18.621118] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [ 18.653072] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

    root@am335x-evm:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: adau1961 [DR adau1961], device 0: ADAU adau-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    root@am335x-evm:~# aplay Alarm02.wav
    Playing WAVE 'Alarm02.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

    When use the old kernel :

    root@DR02:/home/dmi# aplay A0.wav
    Playing WAVE 'A0.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

    root@DR02:/home/dmi# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: DR02 [AM335X DR02], device 0: ADAU1X adau-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    The codec register is readable in /sys/kernel/debug/regmap/1-003a 

    it is same in old and new kernel. The codec setting is fine.

  • Liang,

    LIANG WANG102707 said:

    this is for new kernel


    root@am335x-evm:~# dmesg

    Can you provide also log for old kernel?

    LIANG WANG102707 said:
    root@am335x-evm:~# aplay Alarm02.wav
    Playing WAVE 'Alarm02.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

    LIANG WANG102707 said:

    When use the old kernel :

    root@DR02:/home/dmi# aplay A0.wav
    Playing WAVE 'A0.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

    I see you are using sample rate of 48000 Hz (stereo mode) in old kernel and 22050 Hz (mono mode) in new kernel. Can you try with sample rate of 48000 Hz and stereo mode for new kernel also, will be there any difference?


    Regards,
    Pavel

  • >>I see you are using sample rate of 48000 Hz (stereo mode) in old kernel and 22050 Hz (mono mode) in new kernel.

    >>Can you try with sample rate of 48000 Hz and stereo mode for new kernel also,will be there any difference?

    There is no difference,

  • How do you verify if there is sound or not? Do you use speaker or microphone?

    Please provide me full boot up log, "aplay -l" and "aplay file" console output for old kernel and for new kernel, use 48000Hz sample rate and Stereo mode for both.

    Regards,
    Pavel
  • Hi pavel:

    I use speaker ,what info do you want get  and why need old aplay -l  output?

    I also can see the output on the scope of my codec ,there is no wave.

    wangl

  • LIANG WANG102707 said:
    what info do you want get

    Please provide me full boot up log, "aplay -l" and "aplay file" console output for old kernel and for new kernel, use 48000Hz sample rate and Stereo mode for both.

    LIANG WANG102707 said:
    why need old aplay -l  output?

    to compare with new aplay

  • Hi Pavel:
    I think that is not the problem ,the aplay -l only can see the device info .
    This is kernel problem .
    What I am strange is the /proc/interrupt output after the system boot.
    root@am335x-evm:~# cat /proc/interrupts
    CPU0
    16: 19210 INTC 68 Level gp_timer
    20: 514 INTC 12 Level 49000000.edma_ccint
    22: 1 INTC 14 Level 49000000.edma_ccerrint
    26: 0 INTC 96 Level 44e07000.gpio
    59: 0 INTC 98 Level 4804c000.gpio
    92: 0 INTC 32 Level 481ac000.gpio
    125: 0 INTC 62 Level 481ae000.gpio
    158: 349 INTC 72 Level 44e09000.serial
    161: 344 INTC 70 Level 44e0b000.i2c
    162: 803 INTC 64 Level mmc0
    173: 101212 INTC 41 Level 4a100000.ethernet
    174: 52394 INTC 42 Level 4a100000.ethernet
    176: 0 INTC 100 Level gpmc
    179: 0 INTC 80 Level 48038000.mcasp_tx
    180: 0 INTC 81 Level 48038000.mcasp_rx

    when I run aplay to play sound
    root@am335x-evm:~# cat /proc/interrupts
    CPU0
    16: 21075 INTC 68 Level gp_timer
    20: 763 INTC 12 Level 49000000.edma_ccint
    22: 1 INTC 14 Level 49000000.edma_ccerrint
    26: 0 INTC 96 Level 44e07000.gpio
    59: 0 INTC 98 Level 4804c000.gpio
    92: 0 INTC 32 Level 481ac000.gpio
    125: 0 INTC 62 Level 481ae000.gpio
    158: 349 INTC 72 Level 44e09000.serial
    161: 432 INTC 70 Level 44e0b000.i2c
    162: 803 INTC 64 Level mmc0
    173: 108822 INTC 41 Level 4a100000.ethernet
    174: 56734 INTC 42 Level 4a100000.ethernet
    176: 0 INTC 100 Level gpmc
    179: 0 INTC 80 Level 48038000.mcasp_tx
    180: 0 INTC 81 Level 48038000.mcasp_rx

    The edma _ccint is increased.I am strange why there is edma_ccerrint.

    wangl
  • Wangl,

    LIANG WANG102707 said:
    I think that is not the problem ,the aplay -l only can see the device info .
    This is kernel problem .

    That is way I need to boot up log. "aplay -l" can also report some problems related to the kernel.

    LIANG WANG102707 said:
    I am strange why there is edma_ccerrint.

    I will check this and come back to you.

    Regards,
    Pavel

  • LIANG WANG102707 said:
    22: 1 INTC 14 Level 49000000.edma_ccerrint

    LIANG WANG102707 said:
    22: 1 INTC 14 Level 49000000.edma_ccerrint

    The edma_ccerrint seems not caused by aplay command execution, as it remains 1. You can check edma_ccerrint value in old 3.2 kernel also.

    Regards,
    Pavel

  • Hi Pavel:

    I think may be the problem come from the codec side .When I am use the kernel 4.4.32.I change the cache_type to NONE,then the register of regmap is abnormal.

    const struct regmap_config adau1761_regmap_config = {
    .val_bits = 8,
    .reg_bits = 16,
    .max_register = 0x40fa,
    .cache_type = REGCACHE_NONE,//REGCACHE_RBTREE
    };

    When the cache_type is NONE, the value set by amixer tool can not be read correctly by  /sys/kernel/debug/regmap/register

    When the cache_type is REGCACHE_RBTREE, the value set by amixer tool can be read by  /sys/kernel/debug/regmap/register correctly  

    And I change the code of i2cget and i2cset to get the register of adau1961,then only the first register of adau1961 can be set and get correctly.Other register are 0.

    But when I change to the kernel 3.2.0 ,then the i2cget and i2cset  can set and get all the  register correctly.

    That is strange.the following is the config of dts ,I also change the  PIN_INPUT_PULLDOWN to PIN_INPUT_PULLUP .There is no difference.

    i2c0_pins: pinmux_i2c0_pins {
    pinctrl-single,pins = <
    0x188 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* i2c0_sda.i2c0_sda */
    0x18c (PIN_INPUT_PULLDOWN | MUX_MODE0) /* i2c0_scl.i2c0_scl */
    >;
    };

    Best regards

    wangl

  • LIANG WANG102707 said:
    I think may be the problem come from the codec side

    I can advice only from the AM335x device side. Regarding adau1961 codec related questions, you should check with the codec supplier support team.

    To isolate the issue, you should attach a scope to the AM335x pins (McASP and I2C) and verify that all the signals there are available and as expected. See also the below wiki where dummy codec is used:

    processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example

    Regards,
    Pavel

  • Hi pavel:
    The problem is that why the codec register can be read out and set correctly in the old kernel?But fail in the new kernel.
    The problem come from am335x side.The codec is fine ,the same board .
    Best regards
    wangl
  • Wangl,

    I would suggest you to check again the DTS files regarding correct audio codec describing in the new kernel. Compare also I2C module registers settings between old kernel and new kernel to see if there are any differences.

    Regards,
    Pavel
  • Hi Pavel:

    I have found the root cause now.

    It is do relate to am335x ,the new kernel behavior.

    The mcascp0_ahclk provide 24Mhz clock  MCLK to my codec .

    The old kernel output  24Mhz clock by ahckl always after init the sound card mcasp,

    but when I use the new kernel  ahclk -the 24Mhz clock is output only when I run aplay xxx.wav..When I run aplay ,then run the mixer setting in other console .I can heard the song.

    And I can set and get the i2c register correctly at that time.I can not get and set the registers after the aplay finished.

    Problem is  how to enable the output clk always ,not  decided by the aplay.

    So ,I add the following line  at end of davinci_mcasp_probe() 

    mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);
    mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);

    Then the kernel  crash

    [ 1.305008] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa038014
    [ 1.312711] pgd = c0004000
    [ 1.315426] [fa038014] *pgd=48011452(bad)
    [ 1.319468] Internal error: : 1028 [#1] PREEMPT ARM

    [ 1.595939] Backtrace:
    [ 1.598412] [<c05b3a88>] (davinci_mcasp_probe) from [<c03f8b40>] (platform_drv_probe+0x54/0xb8)
    [ 1.607144] r10:00000000 r9:00000000 r8:c0a05194 r7:fffffdfb r6:c0a05194 r5:dc10e610
    [ 1.615030] r4:c0a54dc8

    Can you give me advice? and why ?

    Best regard

    wangl

     

  • Wangl,

    I think we have the same functionality for old kernels also (2.6.37, 3.2), McASP is configured when aplay is called.

    Make sure you are not using SND_SOC_DAIFMT_CBM_CFM case, as this will clear bit PDIR[27] AHCLKX:

    davinci_mcasp_set_dai_fmt()

    {

    .......

    case SND_SOC_DAIFMT_CBM_CFM:

    /* codec is clock and frame master */

    mcasp_clr_bits(mcasp, DAVINCI_MCASP_PDIR_REG,

          ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR);

    ....

    }

     

    Make sure you are not using MCASP_CLK_HCLK_AHCLK case, as this will clear also bit AHCLKXCTL[15] HCLKXM:

    davinci_mcasp_set_sysclk()

    {

    ....

    case MCASP_CLK_HCLK_AHCLK:

    mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,

          AHCLKXE);

    mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,

          AHCLKRE);

    mcasp_clr_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);

    break;

    .....

    }

     

    LIANG WANG102707 said:

    Problem is  how to enable the output clk always ,not  decided by the aplay.

    So ,I add the following line  at end of davinci_mcasp_probe() 

    mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);
    mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);

    Then the kernel  crash

    [ 1.305008] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa038014


    See if the below approach will be in help. You can use __raw_writel() to write value in register.

     

    Regards,
    Pavel

  • hi Pavel:

    I have fix it.

    I just add line  pm_runtime_get_sync(mcasp->dev);  before the mcasp_set_bit ,then  the kernel panic gone.

    What  is the purpose of  pm_runtime_get_sync()  function  ? Why it can fix the kernel panic?

    Best regards

    wangl

  • Wangl,

    It seems that this functions initialize the mcasp structure (struct davinci_mcasp *mcasp) and pull it out of suspend (if it is in suspend state).

    linux-kernel/Documentation/power/runtime_pm.txt

    int pm_runtime_get_sync(struct device *dev);
    - increment the device's usage counter, run pm_runtime_resume(dev) and return its result

    It does so by calling pm_runtime_get_sync() before driver_sysfs_remove() and the BUS_NOTIFY_UNBIND_DRIVER notifications. This resumes the device if it's in the suspended state and prevents it from being suspended again while those routines are being executed.