boundarydevices / linux

Kernel tree for Boundary Devices platforms
194 stars 290 forks source link

Issue while playing audio on kernel 5.4 #65

Open grassead opened 3 years ago

grassead commented 3 years ago

Hello,

With BuildRoot mainline (nitrogen8mm_defconfig + alsa + tinyalsa, kernel 5.4 boundary devices, boundary_defconfig), I tried to play audio on my nitrogen8m-mini board with aplay (alsa) and tinyplay (tinyalsa) and I am facing an error.

The audio device seems to be listed by the kernel (ALSA device list: #0: wm8960-audio), but with aplay and tinyplay are exiting on error after about 10s (and no audio played).

# aplay /ring_sound.wav Playing WAVE '/ring_sound.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo aplay: pcm_write:2058: write error: Input/output error

# tinyplay /ring_sound.wav playing '/ring_sound.wav': 2 ch, 48000 hz, 16 bit error playing sample

With the same board (but different kernel version) I am able to play sound with Android (with UI, not tested with aplay nor tinyplay).

I think I am missing something on BR, Could you please help me? (I need to play audio to verify that my driver integration is OK on mainline)

Thanks,

gibsson commented 3 years ago

Hi,

Please try building Buildroot exactly as explained here: https://boundarydevices.com/buildroot-2020-08-for-imx-platforms/

Audio was working with this config. Maybe the kernel was more up to date in our external layer though.

Regards, Gary

grassead commented 3 years ago

Hi Gary,

Same error with this version.

# aplay /ring_sound.wav Playing WAVE '/ring_sound.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo aplay: pcm_write:2061: write error: Input/output error

Trying to play a video (in the tuto): no sound Trying to play an audio file using: "gst-launch-1.0 -v uridecodebin file:///ring_sound.wav ! audioconvert ! audioresample ! autoaudiosink: no sound and gst-launch never finish (on my PC, this pipeline ends at the end of the audiofile)

Note: I am using an headset + micro (I don't have HP to connect directly to the board).

Thanks

gibsson commented 3 years ago

Hi, Please try this branch then: https://github.com/boundarydevices/linux-imx6/tree/boundary-imx_5.4.x_2.2.0 If it doesn't work there must be something wrong with the setup. I usually test with headset as well. Regards

grassead commented 3 years ago

Hi,

Same with this version:

Linux version 5.4.72 (adgra@adgra-XPS-15-9570)

aplay /ring_sound.wav Playing WAVE '/ring_sound.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo aplay: pcm_write:2061: write error: Input/output error

gibsson commented 3 years ago

Hi, I just tried the latest Linux version and it works as expected:

root@nfs:~# uname -r
5.4.72-g3b0d9a0a12eb
root@nfs:~# aplay song.wav 
Playing WAVE 'song.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

Have you tried the prebuilt Buildroot images from the blog post? IIRC I tried playing BigBuckBunny and checked the audio back then.

grassead commented 3 years ago

Could you please send me the wav file you are using (maybe my file is corrupted / special)?

I will try the prebuilt image.

Thanks,

gibsson commented 3 years ago

http://linode.boundarydevices.com/audio/song.wav

grassead commented 3 years ago

Same with the jenkins version and your file :(

(Linux version 5.4.60 (jenkins@ae899e375adb))

#aplay /song.wav Playing WAVE '/song.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo aplay: pcm_write:2061: write error: Input/output error

grassead commented 3 years ago

I have a nitrogen8m_mini board "rev30 06-28-2019"

gibsson commented 3 years ago

I have an older version of the board (rev20). Please copy/paste your bootlog into pastebin. Also, please make sure to have latest UBoot (just in case).

grassead commented 3 years ago

Complete dmesg: dmesg.txt

I think I will take some time to investigate this (after mainlining my patches on kernel).

Thanks,

gibsson commented 3 years ago

I've seen people havin issues with SDMA with newer kernel and old U-Boot/ATF. Please make sure you have the latest.

grassead commented 3 years ago

Same issue with latest u-boot (U-Boot SPL 2018.07-01626-g338e38fa4e (Nov 25 2020 - 17:17:56 +0100).

Thanks,

dcrawford1 commented 2 years ago

Sorry to post to an old issue, but I am seeing the same problem with the Boundary imx8m plus EVK. When I run with a recent "Boundary XWayland 3.2 (gatesgarth)" yocto release the song.wav plays fine over my headphones. But with the recent Boundary 2021.05 release I get no audio and this error:

# aplay /opt/song.wav
Playing WAVE '/opt/song.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:2058: write error: Input/output error

The 5.4.110 kernels between my yocto and buildroot were almost identical. But, just to eliminate the kernel I copied the Image and imx8mp-a0-nitrogen8mp.dtb out of yocto and into the buildroot /boot dir (The kernel modules were still from buildroot) But, I still get the same error from aplay. I am guessing there is some important user space difference here between yocto and buildroot. Maybe alsa libraries (I have no idea)?

Here are the versions I am testing with:

=> ver
U-Boot 2020.10-52977-g903a2c2264 (Aug 19 2021 - 16:41:22 -0700), Build: jenkins-uboot_v2020.10-134

aarch64-linux-gnu-gcc (Linaro GCC 6.4-2018.05) 6.4.1 20180425 [linaro-6.4-2018.05 revision 7b15d0869c096fe39603ad63dc19ab7cf035eb70]
GNU ld (Linaro_Binutils-2018.05) 2.27.0.20161229
# uname -a
Linux buildroot 5.4.110+ge5cde7b05e54 #1 SMP PREEMPT Wed Apr 14 00:16:51 UTC 2021 aarch64 GNU/Linux
# cat /etc/os-release
NAME=Buildroot
VERSION=2021.05.1
ID=buildroot
VERSION_ID=2021.05.1
PRETTY_NAME="Buildroot 2021.05.1"