How to create a sound-card with ESAI

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

How to create a sound-card with ESAI

2,247 Views
Riyan
Contributor II

I need to get a sound from radio-device, which use I2S protocol. The radio-device connected to the imx8 processor through ESAI. I have to registrate the radio-device and ESAI in the linux-kernel.

sound-x28 {
        compatible = "simple-audio-card";
        simple-audio-card,name = "x28-audio";
        simple-audio-card,format="i2s";
        simple-audio-card,mclk-fs = <64>;
        simple-audio-card,frame-master = <&sound2_esai>;
        simple-audio-card,bitclock-master = <&sound2_esai>;
        simple-audio-card,widgets =
                "Microphone", "Mic Jack",
                "Line", "Line In",
                "Line", "Line Out",
                "Headphone", "Headphone Jack";
        simple-audio-card,routing =
                "DMIC AIF", "DMic";
        mux-int-port = <1>;
        mux-ext-port = <4>;
        sound2_esai: simple-audio-card,cpu {
            sound-dai = <&esai1 0>;
            system-clock-frequency = <3072000>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
        };
        sound2codec: simple-audio-card,codec {
            sound-dai = <&sound>;
        };
    };
codec_x28: codec_x28 {
            #sound-dai-cells = <0>;
            compatible = "dmic,dmic-codec";
};
&esai1{
    #sound-dai-cells=<1>;
    status="okay";
};

 I don't fully understand how phandle #sound-dai-cells works. The sound-device "sound-x28" has passed a registration in the sysfs. But alsa don't see this device through aplay -l. I can't understand where I made a error in dts file. Or should I use  another driver? Please, could you show me your dts with ESAI?

6 Replies

396 Views
dmitry_sidorenkov
Contributor III

imx8qm has esai interface with multiple (4RX and 6 TX) pins, but NXP doesn't provide even single example how to use it existing drivers look useless for example how to use esai bus with 2-3 independent codecs, which can be used in simple-audio-card driver, but this driver can't work with esai because can't setup clocking.
Also, https://source.codeaurora.org is not available.

0 Kudos

2,179 Views
Riyan
Contributor II

The problem hasn't been solved yet. I use a driver imx-cs42888.c as you had said. But I get faults:

[ 7.824936] fsl-asoc-card custom-sound: CPU phandle missing or invalid
[ 7.824943] fsl-asoc-card: probe of custom-sound failed with error -22
[ 7.825762] imx-cs42888 custom-sound: failed to find codec platform device

custom-sound {
compatible = "fsl,imx-audio-cs42888";
model = "custom-sound";
esai-controller = <&esai1>;
audio-codec = <&codec>;
asrc-controller = <&asrc0>;
};

codec: codec {
#sound-dai-cells = <0>;
compatible = "dmic,dmic-codec";
};

&esai1{
#sound-dai-cells=<0>;
status="okay";
};

What could I do wrong?

0 Kudos

2,239 Views
igorpadykov
NXP Employee
NXP Employee

Hi Riyan

 

one can look at sound-cs42888 with esai example on

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-mek.d...

and description of audio in i.MX Linux Reference Manual​

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

nxp does not support "simple-audio-card" for esai.

 

Best regards
igor

 

0 Kudos

2,230 Views
Riyan
Contributor II

Hi Igor,

thank you for the answer. But My custom board have not a chip cs42888. Or are the chip and a codec not the same?

sound-cs42888 {
compatible = "fsl,imx8qm-sabreauto-cs42888",
"fsl,imx-audio-cs42888";
model = "imx-cs42888";
esai-controller = <&esai1>;
 audio-codec = <&cs42888>;
asrc-controller = <&asrc0>;
status = "okay";
};

0 Kudos

2,226 Views
igorpadykov
NXP Employee
NXP Employee

Hi Riyan

 

one can use cs42888 as example and create support for other chip, follow

Figure 27. ALSA SoC Software Architecture, sect.7.1.4.1 ASoC Driver Source Architecture

  i.MX Linux Reference Manual​

 

Best regards
igor

0 Kudos

2,175 Views
Riyan
Contributor II

Please, help me solve the problem