SDMA Issue on UDOObuntu 2.2.0

Discussion in 'UDOO QUAD' started by Drevose, May 8, 2019.

  1. Drevose

    Drevose New Member

    Mar 12, 2019
    Likes Received:
    I am working with a custom sound card that connects to a UDOO Quad. I wrote an ALSA driver for this piece of hardware making use of the SSI and SDMA drivers. The sound card seems to work fine when the amount of audio processing isn't too heavy. However, when the audio processing load is very high or the number of frames per period needs to be small, it stops working. Using a test application, I may hear audio for a second or two and then everything goes silent.

    I found that when this happens, the functions snd_pcm_readi and snd_pcm_writei in alsa-lib are returning EIO. I traced this error to snd_pcm_period_elapsed no longer being periodically called. The function imx_pcm_dma_complete defined in imx-pcm-dma.c is responsible for doing this. Ultimately, the imx-sdma driver is responsible for calling imx_pcm_dma_complete by scheduling a tasklet in the SDMA interrupt handler. I put some code in the SDMA interrupt handler to toggle a GPIO whenever the handler executes. I found that when the audio goes silent, the handler either stops executing for all DMA channels or stops executing for most DMA channels.

    I cannot figure out why the SDMA interrupt handler would stop executing. I do not see the SDMA driver shutting down any of the DMA channels due to errors. The only thing I can think of at the moment is that the SDMA core is failing to notify the AP that transfers are complete. I would think that if this were the case, the system would have to be rebooted for things to start working again. However, I only have to restart the test application to observe the same behavior.
  2. ektor5

    ektor5 Administrator Staff Member

    Jul 1, 2013
    Likes Received:
    Hi Drevose,
    Which audio card are you developing for?
    Can you provide the driver you're writing?

    @jas-mx Do you have any suggestions?


Share This Page