imx6 alsa play I/O error problem with wm8960 on kernel 4.1.15

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

imx6 alsa play I/O error problem with wm8960 on kernel 4.1.15

3,613 Views
tianmingeda
Contributor I

Hi,all!

         I  have a board based on i.MX6dl, with wm8960 chip connected to i2c1 and audmux3. With the uboot-2016.03, kernel-4.1.15 and rootfs, i can play wav files and record the voice from mic, it works well. And the above images are provided by the board vendor. 

         I built a rootfs with busybox, alsa-lib and alsa-utils, and i use it as the rootfs for the board, and i also rebuild the uboot and kernel with the same cross compile gcc toolchain. when i used aplay to play a wav file, it return an error message as follows:

         / # aplay abba_out.wav
         Playing WAVE 'abba_out.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
         aplay: pcm_write:1940: write error: Input/output error

         But there was a time i can play the wav file with my own roofs, however i just forget the configuration and it never reappear again.

         Is there any advice for that?

         Thanks a lot.

Labels (2)
Tags (1)
0 Kudos
8 Replies

1,605 Views
Hamza_Jamil
Contributor I

Hi,

 

I am using imx8mp-evk. i am facing the same problem. when image built with yocto it works fine and i can play wav files, but when build my own rootfs it stoped working and it throwswrite error.

 

Any solution to this problem?

Regards

0 Kudos

955 Views
kevinkimkr
Contributor I

Hi, I have same problem with debian and ubuntu rootfs on imx8mp. Did you solve this issue? If so, what's problem?

0 Kudos

901 Views
kevinkimkr
Contributor I

(Solved) In my case(imx-5.10.9-1.0.0 BSP + Ubuntu 20.04 + LXQt)

1. sudo apt remove alsa-base 

2. copied /var/lib/alsa/asound.state from yocto rootfs to ubuntu rootfs

0 Kudos

2,312 Views
tianmingeda
Contributor I

The latest progress is as follows

   in pcm_lib.c wait_for_avail

      tout = schedule_timeout(wait_time);

      

      if (!tout) {
         pcm_dbg(substream->pcm, "%s write error (DMA or IRQ trouble?)\n",
         is_playback ? "playback" : "capture");
         err = -EIO;
          break;
       }

And once i enabled the pcm_dbg output, the aplay will print "playback write error (DMA or IRQ trouble?)"

It seem like it was caused by DMA or IRQ ?

0 Kudos

2,312 Views
chengsi
Contributor I

Hi ma:

 Have you solved this problem? It seems that  i have meet the same problem as you, if you have  solved it please tell me the solution.

0 Kudos

2,312 Views
igorpadykov
NXP Employee
NXP Employee

Hi chao

please look on

WM8960 audio codec 

for building images use nxp linux sources and documentation from

i.MX Software|NXP 

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

0 Kudos

2,312 Views
tianmingeda
Contributor I

I use the strace tool to analysis the process of aplay.

And i find that after several times of snd_pcm_lib_write1 called successfully, in snd_pcm_lib_write1 function, 

   avail = snd_pcm_playback_avail(runtime);

   avail = 0;

  and it will use  "err = wait_for_avail(substream, &avail);" to wait for avail, but it will return -5.

the return err leads to "aplay: pcm_write:2051: write error: Input/output error"

Thanks.

0 Kudos

2,312 Views
tianmingeda
Contributor I

Hi igorpadykov

Thanks for your advice.

I've found the web pages before i posed the problem, which you listed. but i dont have any idea about the error.

It is so strange that i only changed the rootfs, and the kernel and the wm8960 driver should be ok, what i did is rebuild them with my gcc toolchain.

1、I use uboot and linux kernel images, which i rebuild, and the rootfs, provided by board vendor, i can excute aplay and  arecord operation, it works well.

2、When i use my rebuilt rootfs to replace rootfs in step 1, the system startup successfully. But i can't play a wav file, it return Input/Output error.

When i play a wav file, it is stucked, and after a while, it returns "aplay: pcm_write:2051: write error: Input/output error"

And i checked the alsa-uitls/aplay/aplay.c, it seems that "snd_pcm_writei" return a minus.

The more detailed log is as follows:

/ # aplay -vv abba_out.wav
Playing WAVE 'abba_out.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Plug PCM: Hardware PCM card 0 'wm8960-audio' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 22050
exact rate : 22050 (22050/1)
msbits : 16
buffer_size : 13780
period_size : 2756
period_time : 124988
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 2756
period_event : 0
start_threshold : 13780
stop_threshold : 13780
silence_threshold: 0
silence_size : 0
boundary : 1806172160
appl_ptr : 0
hw_ptr : 0
############# + | 30%

aplay: pcm_write:2051: write error: Input/output error

0 Kudos