[alsa-devel] DMA buffer alignment
Raymond Yau
superquad.vortex2 at gmail.com
Fri Dec 5 03:23:33 CET 2014
> Hi,
> I'm working with a SoC sound hw that requires that all the data
> written into the DMA memory is aligned a 64 byte boundary. Actually
> the alignment is required since the format of the data into the DMA
> memory is (for a 2 channel 16bit audio): 16 samples for the left
> channel followed by 16 samples for the right channel.
Do you mean the sound card only support non interleaved mode ?
>If I try to
> write anything that is not aligned to the 64 bytes I got audio
> corruption (high pitched noise).
> Several user-space programs (like aplay) work well with my hw, since
> the buffer sent from the user-space is always (padded) of period-size
> bytes, that is aligned to my 64 bytes boundary. Others (like
> speaker-test) are not working because sometimes they snd_pcm_writei()
> a buffer that is not multiple of 64 bytes. In general every time I
> write into the DMA area a buffer that is not aligned, my hw pointer is
> not aligned anymore with the 64 bytes and the noise starts.
You need to add constraint to restrict period bytes to 64
enum dma_residue_granularity {
DMA_RESIDUE_GRANULARITY_DESCRIPTOR = 0,
DMA_RESIDUE_GRANULARITY_SEGMENT = 1,
DMA_RESIDUE_GRANULARITY_BURST = 2,
};
Can it report DMA_RESIDUE_GRANULARITY_SEGMENT or
DMA_RESIDUE_GRANULARITY_BURST ?
>
> IIUC it is not possible to force the user-space programs to send
> buffers with a fixed size so the problem should be solved in
> kernel-space (am I wrong on this point?).
> Any suggestion on how to tackle this problem?
>
pulseaudio seem not support non interleaved mode ?
More information about the Alsa-devel
mailing list