iMX6 ESAI TDM with underrun and overrun support

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

iMX6 ESAI TDM with underrun and overrun support

7,729 Views
aurelienbouin
Contributor IV

I am trying to use the ESAI of the iMX6...

I need to use 2x 32 slots of 8 bits at 8Khz, and I am in slave mode since i am listenning Frame Synchro and Tx Clock

I am testing the interface simply sending a word of 0xAA on slot 0 and slot 15, the others are 0x00

I am probably facing the underrun and overrun chip errata (ERR008000) on ESAI since my channels are switching randomly ...

I already tested the kernel from :

-> git://git.freescale.com/imx/linux-2.6-imx.git --- branch : imx_3.10.31_1.1.0_alpha

-> git://git.freescale.com/imx/linux-2.6-imx.git --- branch : imx_3.10.31_1.1.0_beta2

And now I am trying to use the main kernel stable git :

-> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --- branch master

But I have some trouble actually with the mailine kernel :

[  745.648380] fsl-esai-dai 2024000.esai: Missing dma channel for stream: 0

[  745.655198] fsl-esai-dai 2024000.esai: ASoC: pcm constructor failed: -22

I figured out that the imx6qdl.dtsi was not giving enough information to use the ESAI so I add to my own dts :

pinctrl_esai_gip2: esaigrp-gip2 {

                fsl,pins = <

                        MX6QDL_PAD_GPIO_2__ESAI_TX_FS           0x1b030

                        MX6QDL_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x1b030

                        MX6QDL_PAD_GPIO_1__ESAI_RX_CLK       0x1b030

                        MX6QDL_PAD_GPIO_6__ESAI_TX_CLK         0x1b030

                        MX6QDL_PAD_GPIO_17__ESAI_TX0            0x1b030

                        MX6QDL_PAD_GPIO_8__ESAI_TX5_RX0       0x1b030

                        MX6QDL_PAD_GPIO_9__ESAI_RX_FS           0x1b030

                        MX6QDL_PAD_GPIO_18__ESAI_TX1 0x1b030

                        MX6QDL_PAD_GPIO_7__ESAI_TX4_RX1 0x1b030

                >;

&esai {

    dma-names = "rx", "tx";

    clocks = <&clks 228>, <&clks 229>, <&clks 118>, <&clks 228>, <&clks 156>;

    clock-names = "core", "mem", "extal", "fsys", "dma";

    compatible = "fsl,imx35-esai";

    fsl,esai-dma-events = <24 23>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_esai_gip2>;

    fsl,esai-synchronous;

    fsl,fifo-depth = <64>; /* Transmit FIFO watermark => the Transmit FIFO Empty flag will set => 32 slots * 2 bus of TX the same for RX */

    status = "okay";

};

sound {

  compatible = "fsl,imx6q-gipc-generic-esai",

      "fsl,imx-audio-generic-esai";

  model = "generic-esai-audio";

  esai-controller = <&esai>;

  };

I do have in my .config :

#

# SoC Audio for Freescale CPUs

#

#

# Common SoC Audio options for Freescale CPUs:

#

# CONFIG_SND_SOC_FSL_ASRC is not set

CONFIG_SND_SOC_FSL_SAI=y

CONFIG_SND_SOC_FSL_SSI=y

CONFIG_SND_SOC_FSL_SPDIF=y

CONFIG_SND_SOC_FSL_ESAI=y

CONFIG_SND_SOC_FSL_UTILS=y

CONFIG_SND_SOC_IMX_PCM_DMA=y

CONFIG_SND_SOC_IMX_AUDMUX=y

CONFIG_SND_IMX_SOC=y

CONFIG_SND_SOC_IMX_PCM_FIQ=y

I simply make a module that connect to a dummy codec the dai interface ESAI to use it in a generic way : http://pastebin.com/CupYva7Z

thank you for your return

Aurelien BOUIN

27 Replies

1,220 Views
fabio_estevam
NXP Employee
NXP Employee

Ok, got it. I think people in alsa-devel list would be able to give you some good guidance on this.

0 Kudos

1,220 Views
fabio_estevam
NXP Employee
NXP Employee

You missed to add the dma nodes for esai.

Take a look at Documentation/devicetree/bindings/sound/fsl,esai.txt for an example on how to pass the dma nodes.

Also, you don't need to create a "fsl,imx6q-gipc-generic-esai". You can use "simple-card" instead or "fsl-asoc-card".

1,220 Views
aurelienbouin
Contributor IV

Thank you for the dma nodes !!

I didn't know about simple-card, seems like a powerful tool !!

But it seems hard to get the right parameters !!

For the moment I am at :

sound {
compatible = "simple-audio-card";
simple-audio-card,name = "Generic-ESAI-Sound-Card";
simple-audio-card,bitclock-master = <&link0_cpu>;
simple-audio-card,frame-master = <&link0_cpu>;
simple-audio-card,format = "left_j";
link0_cpu: simple-audio-card,cpu {
sound-dai = <&esai>;
dai-tdm-slot-num = <32>;
dai-tdm-slot-width = <8>;
/*system-clock-frequency = <2000000>; */
};
simple-audio-card,codec {
sound-dai = <&codec>;
frame-master;
bitclock-master;
};
};

But I don't see where I can use a fake codec ...

I have an extra question : Do you think that it could be possible to get a different pcm for each slot of the TDM (2x32 in my case)

Thank you very much for your help !!!

Regards,

Aurelien BOUIN

1,220 Views
leige-b42127
Senior Contributor II

hi, i have a way to use different pcms for each slot. It is from the alsa_lib side, you can use deshare plug-in to do this. Now i can use ESAI to play 4 2-channels music at the same time, the musics are not mixed. But this solution is not shared to customers.

0 Kudos

1,220 Views
aurelienbouin
Contributor IV

Hi Lei,

Thank you for your experience

Can you share your asound.conf in your use case ?

Thank you

0 Kudos

1,220 Views
leige-b42127
Senior Contributor II

hi, i have a way to use different pcms for each slot. It is from the alsa_lib side, you can use deshare plug-in to do this.

0 Kudos

1,220 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Aurelien,

Not sure what you mean by "fake" codec.

I personally haven't used the esai driver in mainline yet. I would recommend you to post this in the alsa-devel mailing list with Nicolin Chen <nicoleotsuka@gmail.com>, who is the driver maintainer on Cc.

Regards,

Fabio Estevam

0 Kudos