i.mx6q I2S sdma hangs

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

i.mx6q I2S sdma hangs

Jump to solution
2,526 Views
alexandersmirno
Contributor I

Dear all,

 

I have a custom board based on i.MX6q SoC. There is a codec installed on the board which is connected to AUDPORT4 over I2S.

I created a simple drivers for ALSA based on existing ones. In my case i.MX6q is master, so I changed relative options, below are most important configuration prints from my codec:

 

static int cs4344_params(struct snd_pcm_substream *substream,

        struct snd_pcm_hw_params *params)

{

          dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |

                              SND_SOC_DAIFMT_CBS_CFS;

 

          ssi_mode->flags |= IMX_SSI_SYN;

 

          snd_soc_dai_set_tdm_slot(cpu_dai, 0xfffffffc, 0xfffffffc, 2, 32);

 

          ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);

          if (ret < 0)

               return ret;

 

          snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0, SND_SOC_CLOCK_OUT);

          snd_soc_dai_set_clkdiv(cpu_dai, IMX_SSI_TX_DIV_PM, 4);

          snd_soc_dai_set_clkdiv(cpu_dai, IMX_SSI_TX_DIV_2, 1);

          snd_soc_dai_set_clkdiv(cpu_dai, IMX_SSI_TX_DIV_PSR, 0);

}

 

static int imx_audmux_config(int slave, int master)

{

        unsigned int ptcr = 0, pdcr = 0;

        slave = slave - 1;

        master = master - 1;

 

        mxc_audmux_v2_configure_port(slave, ptcr, pdcr);

        mxc_audmux_v2_configure_port(master, ptcr, pdcr);

 

        /* SSI0 mastered by port 5 */

        ptcr = MXC_AUDMUX_V2_PTCR_SYN |

                MXC_AUDMUX_V2_PTCR_TFSDIR |

                MXC_AUDMUX_V2_PTCR_TFSEL(master) |

                MXC_AUDMUX_V2_PTCR_TCLKDIR |

                MXC_AUDMUX_V2_PTCR_TCSEL(master);

        pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(master);

        mxc_audmux_v2_configure_port(slave, ptcr, pdcr);

 

        ptcr = MXC_AUDMUX_V2_PTCR_SYN;

        pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(slave);

        mxc_audmux_v2_configure_port(master, ptcr, pdcr);

 

        return 0;

}

 

static int __devinit imx_cs4344_probe(struct platform_device *pdev)

{

 

 

....

          imx_audmux_config(plat->ext_port, plat->src_port);

...

}

 

As a result, I try to run aplay, but it hangs. But meantime I see on oscilloscope, that TXC and TXFS clocks are working. I've enabled debug info in sdma and attached the log.

 

What can be the problem, why SDMA isn't working? Also I pushed sdma firmware to /lib/firmware/sdma folder and now my board hangs for about 60 sec during boot.

 

Thank a lot in advance!

 

Alex

Original Attachment has been moved to: aplay.log.zip

Labels (2)
0 Kudos
1 Solution
1,149 Views
AlanZhang
Contributor V

Hi, Alex,

From your description, it seems that you want to make a shortcut to perform a quick test just based on CODEC driver (i.e. CS4344). But as we know that ALSA SoC/CODEC driver must follow a specific architecture. In the part of ALSA SoC/CODEC implementation in FSL release, we defines 3 parts:

1. Machine driver that glues the platform driver and codec driver according to ALSA SoC/Codec arch;

2. Platform driver that implement the i.MX6Q SSI driver where you can find out the SDMA logic, which plays as being DAI role in the ALSA SoC/CODEC arch;

3. CODEC driver that should be provided by 3rd part (i.e. cs4344 linux driver) implements the codec DAIs' driver which plays as being DAI role in the ALSA SoC/CODEC arch.

So to integrate a CODEC in current release, pls follow the stpe below:

1. Modify the instance data of mxc_audio_platform_data in board-mx6q_sabresd.c in terms of your audmux port mapping config (i.e. src_port, dst_port) that will be referenced in machine driver during init;

2. Edit imx-cs4344.c file (machine driver), if no exit, you could populate it from imx-sgtl3000.c or imx-wm8994.c, to modify the interface to codec driver parts;

3. Insert debug probe printk(KERN_ERR "xxxx) to track the execution;

4. Check the dmesg to check the alsa driver init to see whether everything is ok.

Since that i.MX6Q work in master mode, you could observe the I2S signal driven from i.MX6Q. If everything is done in the proper way, then we will see whether SDMA behaves in abnormal.

Regards,

Alan Zhang

View solution in original post

0 Kudos
7 Replies
1,149 Views
chikigai
Contributor II

Hello Alexander,

I am also experiencing some trouble with the CS4344.

Can you possibly share your Codec and Link drivers?

Best regards,

Daniel

0 Kudos
1,149 Views
luozhh1018
Contributor I

Dear Alex:

     I had use the CS4344 in i.MX6DL,how did you fixed the probelem?can you share you cs4344 source code ?

hibernate

0 Kudos
1,150 Views
AlanZhang
Contributor V

Hi, Alex,

From your description, it seems that you want to make a shortcut to perform a quick test just based on CODEC driver (i.e. CS4344). But as we know that ALSA SoC/CODEC driver must follow a specific architecture. In the part of ALSA SoC/CODEC implementation in FSL release, we defines 3 parts:

1. Machine driver that glues the platform driver and codec driver according to ALSA SoC/Codec arch;

2. Platform driver that implement the i.MX6Q SSI driver where you can find out the SDMA logic, which plays as being DAI role in the ALSA SoC/CODEC arch;

3. CODEC driver that should be provided by 3rd part (i.e. cs4344 linux driver) implements the codec DAIs' driver which plays as being DAI role in the ALSA SoC/CODEC arch.

So to integrate a CODEC in current release, pls follow the stpe below:

1. Modify the instance data of mxc_audio_platform_data in board-mx6q_sabresd.c in terms of your audmux port mapping config (i.e. src_port, dst_port) that will be referenced in machine driver during init;

2. Edit imx-cs4344.c file (machine driver), if no exit, you could populate it from imx-sgtl3000.c or imx-wm8994.c, to modify the interface to codec driver parts;

3. Insert debug probe printk(KERN_ERR "xxxx) to track the execution;

4. Check the dmesg to check the alsa driver init to see whether everything is ok.

Since that i.MX6Q work in master mode, you could observe the I2S signal driven from i.MX6Q. If everything is done in the proper way, then we will see whether SDMA behaves in abnormal.

Regards,

Alan Zhang

0 Kudos
1,149 Views
simonvanveerdeg
Contributor I

I have also tried to add cs4344.c and imx-cs4344.c, its get recognized in the kernel, but i don't get audio out of it

Can someone help us?

0 Kudos
1,149 Views
alexandersmirno
Contributor I

Dear Alan,

sorry for the delay in reply. The problem was fixed by itself, but thank you a lot for your hints.

Alex

0 Kudos
1,149 Views
alexandersmirno
Contributor I

static struct mxc_audio_platform_data mx6_my_audio_data = {

        .ssi_num = 1,

        .src_port = 2,

        .ext_port = 4,

}


0 Kudos
1,149 Views
johnturnur
Contributor III

Hi,

Alexander

Are you able to fixed?

What changes it requires?

Br,

John

0 Kudos