imx8mq evk sdma firmware not ready? aplay to wm8524audio

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

imx8mq evk sdma firmware not ready? aplay to wm8524audio

8,953 Views
johnadamson
Contributor III

I'm trying to get the 1/8" audio working on the imx8mq evk using the Yocto (sumo) build, based on core-image-minimal.

I've added the alsa library and utilities, and aplay -l shows the wm8524, spdif, and hdmi devices.  But when I try to play a file, it throws a write error: Cannot allocate memory, and to the console "imx-sdma 30bd0000.sdma: sdma firmware not ready!"

I built firmware-imx (if it wasn't already) and note that lib/firmware/imx/sdma contains sdma-imx6q.bin and sdma-imx7d.bin, but nothing obvious for the imx8.  Seems like the recipe knows I'm building for an imx8qm because it populates the firmware/hdmi directory.  

I should also note that the systemd journal says "imx-sdma 30bd0000.sdma: external firmware not found, using ROM firmware" (also 302c0000.sdma)

What am I missing?

John

6 Replies

5,003 Views
johnadamson
Contributor III

I may be using the terminology imprecisely, but from what I've been able to gather, the recipe for firmware-imx doesn't package the sdma or epdc firmware as "firmware-imx".  It packages it as separate pieces, firmware-imx-epdc and firmware-imx-sdma (and others).  

So to include that firmware in the image build, it's not enough to do IMAGE_INSTALL_append = " firmware-imx" (although this does not cause a build error).   

IMAGE_INSTALL_append = " firmware-imx-sdma firmware-imx-epdc firmware-imx-brcm" DOES appear to work.  

Before making this change, ALSA won't play to the CODEC on core-image-minimal.  After, it does.  

Hope this helps someone else,

John

0 Kudos

5,003 Views
igorpadykov
NXP Employee
NXP Employee

Hi John

sdma is used for sai1 in linux/arch/arm64/boot/dts/freescale/fsl-imx8mq-evk-ak4497.dts

fsl-imx8mq-evk-ak4497.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

for sai2&wm8524 it is not used, seems it is considered that 4 x Cortex-A53 processing

power is sufficient for handling it.

fsl-imx8mq-evk.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

driver sources: linux/drivers/dma/imx-sdma.c

imx-sdma.c\dma\drivers - linux-imx - i.MX Linux kernel 

There are two sdma modules according to sect. 2.1.4 DMA memory maps i.MX8MDQ Reference Manual
https://www.nxp.com/docs/en/reference-manual/IMX8MDQLQRM.pdf

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

0 Kudos

5,003 Views
johnadamson
Contributor III

Igor,

Thanks for the reply, but it seems less than helpful.  Something about the software chain from ALSA 'aplay' on down must be expecting sdma firmware, or it wouldn't be saying "imx-sdma 30bd0000.sdma: sdma firmware not ready!"  in response, right?  

I've confirmed that the -ak4487.dts file and -evk.dts file match the ones you linked to.  I've confirmed (to the best of my ability) that the 'aplay' command line is trying to use the wm8524audio device.  I'll post the exact commands and response below.  

Put more plainly: should the Yocto build recipes for the IMX8 EVK be building firmware for the imx8 sdma, and if so, where and what files?  Repeating the original, I can see where firmware-imx is building firmware for the imx6q and the imx7d, but there doesn't seem to be anything in the recipe for the imx8 and sdma.  

The command line and response I'm using is:

root@aoc8mqevk:~# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=wm8524audio
wm8524-audio,
Default Audio Device
sysdefault:CARD=wm8524audio
wm8524-audio,
Default Audio Device
default:CARD=imxspdif
imx-spdif,
Default Audio Device
sysdefault:CARD=imxspdif
imx-spdif,
Default Audio Device
default:CARD=imxaudiohdmi
imx-audio-hdmi,
Default Audio Device
sysdefault:CARD=imxaudiohdmi
imx-audio-hdmi,
Default Audio Device
root@aoc8mqevk:~# aplay --device default:CARD=wm8524audio SINE440.wav
Playing WAVE 'SINE440.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
aplay: pcm_write:2051: write error: Cannot allocate memory
root@aoc8mqevk:~# aplay --device default:CARD=wm8524audio SINE440_FS48K.wav
Playing WAVE 'SINE440_FS48K.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: pcm_write:2051: write error: Cannot allocate memory

The response on the console port after running those two commands is:

[ 486.639678] imx-sdma 30bd0000.sdma: sdma firmware not ready!
[ 506.256332] imx-sdma 30bd0000.sdma: sdma firmware not ready!

To core-image-minimal, I'm adding these (among a few others) to get ALSA added:

IMAGE_INSTALL_append = " gcc libstdc++ kernel-modules libasound alsa-lib-dev alsa-utils alsa-plugins libsndfile1 linux-firmware util-linux imx-alsa-plugins firmware-imx"

John

0 Kudos

5,003 Views
johnadamson
Contributor III

So the correct answer to "should the Yocto build recipes for the IMX8 EVK be building firmware for the imx8 sdma, and if so, where and what files?"  is: 

"Yes, it's called /lib/firmware/imx/sdma/sdma-imx7d.bin and a bug in the build scripts keeps these from being shipped in the sdcard image.  If you manually copy /lib/firmware/imx/* from all-poky-linux/firmware-imx/1_8.0-r0/image/ onto your sdcard, they'll get loaded on boot up, eliminating the kernel message "external firmware not found", and aplay will now work properly."

If I come up with a recipe patch to fix the shipping bug, I'll try to post here.  If someone has a better suggestion about how to let the NXP Yocto maintainers know, I'm listening.

John

5,003 Views
igorpadykov
NXP Employee
NXP Employee

Hi John

sdma is described in sect.3.7.4 Source Code Structure attached Linux Manual,

since wm8524 does not use sdma, seems sdma firmware is not needed for it.

For audio test one can follow sect.7.3.1.1 Audio-only playback

attached Linux Guide. One can use i.MX8M EVK official Demo Image

Linux Binary Demo Files - i.MX 8MQuad EVK

If you have special need for using sdma with wm8524 may be suggested to use

NXP Professional Services | NXP 

>should the Yocto build recipes for the IMX8 EVK be building firmware
>for the imx8 sdma, and if so, where and what files?

linux/root/drivers/dma/imx-sdma.c

imx-sdma.c\dma\drivers - linux-imx - i.MX Linux kernel 

static struct sdma_driver_data sdma_imx8m = {
    .chnenbl0 = SDMA_CHNENBL0_IMX35,
    .num_events = 48,
    .script_addrs = &sdma_script_imx7d,
};

Best regards
igor

0 Kudos

5,003 Views
johnadamson
Contributor III

Hi, Igor, (and all)

Quoting section 3.7.4 of Document Number: IMXLXRM Rev. L4.14.78-1.0.0_ga, 01/2019, "i.MX Linux Reference Manual", "Source Code Structure":

"The following table shows the image files available in the directory firmware/imx/sdma
for 4.1 and 4.9 kernels. For 4.14 kernel, the sdma firmware is provided with the
firmware-imx package and not in the kernel source tree."

So I don't understand your statement "there is no references to 'firmware-imx'". 

The table points to two files, called "sdma-imx6q.bin" and "sdma-imx7d.bin" that I spoke of in my original message.  The one helpful bit is that it got me to see the text in the right column, "SDMA RAM scripts for i.MX7 and i.MX 8M".   More on this in the next message, for clarity.

John

0 Kudos