Using ESAI1 Interface to connect I2S from another board as an ALSA card in iMX8QMMEK

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

Using ESAI1 Interface to connect I2S from another board as an ALSA card in iMX8QMMEK

2,311 Views
mustafa_ozcelik
Contributor I

I am trying to initialize ESAI1 interface on iMX8QMMEK so that it reads I2S from another board.

Our custom board has the following wiring:

                           SC_P_ESAI1_SCKR_AUD_ESAI1_SCKR <---------------------- WS
(iMX8QMMEK)   SC_P_ESAI1_TX5_RX0_AUD_ESAI1_TX5_RX0 <------------- DATA       (Board with I2S Out)

                           SC_P_ESAI1_FSR_AUD_ESAI1_FSR <--------------------------- BCK

Reading from examples, I came up with the following devicetree configuration (I use 4.14-sumo, release: fsl-imx8qm.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel ) :

    sound-custom {
        compatible = "simple-audio-card";
        simple-audio-card,name = "Custom_Sound_Card";
        simple-audio-card,format = "i2s";
        simple-audio-card,bitclock-master = <&dailink_master>;
        simple-audio-card,frame-master = <&dailink_master>;
        status = "okay";

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

        dailink_master: simple-audio-card,codec {
            sound-dai = <&codec_test>;
        };
    };

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

pinctrl_esai1: esai1grp {
                fsl,pins = <
                    SC_P_ESAI1_FSR_AUD_ESAI1_FSR        0xc6000040
                    SC_P_ESAI1_FST_AUD_ESAI1_FST        0xc6000040
                    SC_P_ESAI1_SCKR_AUD_ESAI1_SCKR        0xc6000040
                    SC_P_ESAI1_SCKT_AUD_ESAI1_SCKT        0xc6000040
                    SC_P_ESAI1_TX0_AUD_ESAI1_TX0        0xc6000040
                    SC_P_ESAI1_TX1_AUD_ESAI1_TX1        0xc6000040
                    SC_P_ESAI1_TX2_RX3_AUD_ESAI1_TX2_RX3    0xc6000040
                    SC_P_ESAI1_TX3_RX2_AUD_ESAI1_TX3_RX2    0xc6000040
                    /*SC_P_ESAI1_TX4_RX1_AUD_ESAI1_TX4_RX1    0xc6000040*/ /* This pin is used by another device, I commented it */
                    SC_P_ESAI1_TX5_RX0_AUD_ESAI1_TX5_RX0    0xc6000040
                >;
            };

esai1: esai@59810000 {
    compatible = "fsl,imx8qm-esai";
    reg = <0x0 0x59810000 0x0 0x10000>;
    interrupts = <GIC_SPI 411 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clk IMX8QM_AUD_ESAI_1_IPG>,
        <&clk IMX8QM_AUD_ESAI_1_EXTAL_IPG>,
        <&clk IMX8QM_AUD_ESAI_1_IPG>,
        <&clk IMX8QM_CLK_DUMMY>;
    clock-names = "core", "extal", "fsys", "spba";
    dmas = <&edma3 6 0 1>, <&edma3 7 0 0>;
    dma-names = "rx", "tx";
    status = "disabled";
    power-domains = <&pd_esai1>;
};

&esai1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_esai1>;
    assigned-clocks = <&clk IMX8QM_ACM_ESAI1_MCLK_SEL>,
            <&clk IMX8QM_AUD_PLL0_DIV>,
            <&clk IMX8QM_AUD_ACM_AUD_PLL_CLK0_DIV>,
            <&clk IMX8QM_AUD_ACM_AUD_REC_CLK0_DIV>,
            <&clk IMX8QM_AUD_ESAI_1_EXTAL_IPG>;
    assigned-clock-parents = <&clk IMX8QM_AUD_ACM_AUD_PLL_CLK0_CLK>;
    assigned-clock-rates = <0>, <786432000>, <49152000>, <24576000>, <49152000>;
    fsl,txm-rxs;
    status = "okay";
};

Unfortunately, there is no additional ALSA card showing up with the command "aplay -l". No warning or indication in "dmesg". Being able to configure esai and see a ALSA card are the first steps for me.

Another question is whether or not if using &esai1 phandle is possible with "simple-sound-card" driver.
I am quite new with this audio interfacing. I want to receive PCM data to ALSA (somehow). Is that possible? Any suggestions are greatly appreciated.

Tags (3)
0 Kudos
5 Replies

1,750 Views
igorpadykov
NXP Employee
NXP Employee

Hi Mustafa

one can try to use "sound-cs42888" :

fsl-imx8qm-ddr4-arm2.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

nxp does not support "simple-audio-card", may be useful look on

https://community.nxp.com/thread/337305 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,750 Views
mustafa_ozcelik
Contributor I

I have a question. Will I be able to use cs42888 codec for esai1, even though I dont have cs42888 card on my custom iMX board? I intend to use it by modifying a few things.

0 Kudos

1,750 Views
igorpadykov
NXP Employee
NXP Employee

I think you should analyze driver and remove codes for cs42888, check for

possible clocks provided by cs42888, replacing them for internally generated.

Best regards
igor

0 Kudos

1,750 Views
mustafa_ozcelik
Contributor I

Do you think it is possible to use imx-esai.c as suggested here https://community.nxp.com/message/516818  for this task? Is there any devicetree examples of using ESAI for I2S input? Thanks

0 Kudos

1,750 Views
igorpadykov
NXP Employee
NXP Employee

in general yes as ESAI block is the same as in i.MX6Q.

Best regards
igor

0 Kudos