AnsweredAssumed Answered

i.MX535 SDMA not starting

Question asked by Rick Ball on Jan 25, 2013
Latest reply on Feb 5, 2013 by Rick Ball

I have a custom board containing an i.MX535 device, and it needs to use Linux to talk to a codec with data connected (through the AUDMUX) to SSI2 (in I2S mode).

 

I'm working with the BSP from 01/11 (11.01.00), but I've also seen the same behavior with 11.09.01. Both are using Linux 2.6.35.3, plus lots of Freescale patches (via LTIB).

 

For now, I'm just trying to get the DMA running - I can tell it isn't, because when I test with 'speaker-test' (from alsa-utils), the buffers fill up and eventually report an overrun (return code -5, I/O error).

 

I've added trace printk's so I can see that all the right routines are being called (and it looks like they are), but nothing happens when mxc_dma_enable() is called - seems like I should start getting interrupts and the 'hw_ptr' should move forward. When I check the interrupt status by cat'ing /proc/interrupts I can see that I'm getting some interrupts on INT 6 (SDMA), but I believe these are occurring when I setup the channel (before the callback is 'set') - see the printk from 'sdma_int_handler' in the log below.

 

Is there anything special that needs to be done to get the SDMA engine going? I think I must be missing some init somewhere in my code/machine driver, since all this DMA code is supposed to already work, right? But as you can see from the log below, it looks like it chose a valid DMA channel (31, it seems to like to start with the highest number), and it has configured the correct 'event' (25, which according to the TRM Table 3.2 is SSI2 Transmit 1 (first FIFO) Request.

 

Any hints/help would be much appreciated.

 

-------------------------------------------------------------------

root@freescale ~$ speaker-test -Dhw:0

 

speaker-test 1.0.11rc2

 

Playback device is hw:0

Stream parameters are 48000Hz, S16_LE, 1 channels

Using 16 octaves of pink noise

Rate set to 48000Hz (requested 48000Hz)

Buffer size range from 2048 to 12288

Period size range from 1024 to 3072

Buffer time size 2525

To choose buffer_size = 12288

To choose period_size = 3072

was set period_size = 3072

was set buffer_size = 12288

 

RDB: mxc_dma_request_ext ENTRY, name=ALSA TX SDMA

RDB: imx_get_sdma_transfer ENTRY format=2, dai_port=2

RDB: imx_get_sdma_transfer EXIT transfer=31

RDB: mxc_dma_request_ext channel_num = 31

RDB: mxc_dma_request_ext EXIT

 

RDB: imx_pcm_prepare ENTRY

RDB: mxc_dma_setup_channel : name=ALSA TX SDMA, event=25

RDB: sdma_int_handler irq 6, dev @ (null)

RDB: Setting callback to audio_dma_irq @ 8033bba0

RDB: mxc_dma_callback_set chan=31, callback=8033bba0

RDB: imx_pcm_prepare EXIT

 

0 - Front Left

RDB: snd_pcm_lib_write

RDB: state = 2, avail = 12288

RDB: state = 2, buffered = 3072, threshold = 6144

RDB: snd_pcm_lib_write

RDB: state = 2, avail = 9216

RDB: state = 2, buffered = 6144, threshold = 6144

 

RDB: snd_pcm_start

RDB: imx_pcm_trigger ENTRY cmd=1

RDB: dma_new_period ENTRY

RDB: mxc_dma_config ENTRY chan=31, buf=df52be14, nbuf=1, mode=1

RDB: mxc_dma_enable ENTRY chan=31

RDB: mxc_dma_start ENTRY (chan=31, running=0)

RDB: dma_new_period ENTRY

RDB: mxc_dma_config ENTRY chan=31, buf=df52be24, nbuf=1, mode=1

RDB: mxc_dma_enable ENTRY chan=31

RDB: mxc_dma_start ENTRY (chan=31, running=1)

 

RDB: snd_pcm_lib_write

RDB: snd_pcm_update_hw_ptr0 ENTRY

RDB: snd_pcm_update_hw_ptr0 EXIT (no change to hw_ptr = 0)

RDB: state = 3, avail = 6144

RDB: state = 3, buffered = 9216, threshold = 6144

RDB: snd_pcm_lib_write

RDB: snd_pcm_update_hw_ptr0 ENTRY

RDB: snd_pcm_update_hw_ptr0 EXIT (no change to hw_ptr = 0)

RDB: state = 3, avail = 3072

RDB: state = 3, buffered = 12288, threshold = 6144

RDB: snd_pcm_lib_write

RDB: snd_pcm_update_hw_ptr0 ENTRY

RDB: snd_pcm_update_hw_ptr0 EXIT (no change to hw_ptr = 0)

RDB: state = 3, avail = 0

 

... (I press ctrl-c to exit)

 

RDB: wait_for_avail_min returned -512, avail now 0

RDB: imx_pcm_trigger ENTRY cmd=0

Outcomes