[alsa-devel] ASoC: how to calculate dma size in tdm mode

Scott Jiang scott.jiang.linux at gmail.com
Fri Aug 10 04:46:53 CEST 2012

2012/8/9 Mark Brown <broonie at opensource.wolfsonmicro.com>:
> On Thu, Aug 09, 2012 at 05:56:57PM +0800, Scott Jiang wrote:
>> If user app use 2 channels but codec need 8 channels in tdm mode, I
>> need to copy this data from user space to dma buffer. I wonder how to
>> calculate dma size, snd_pcm_hardware.buffer_bytes_max or
>> buffer_bytes_max * tdm_channels / channels_min?
> I'm not sure which data you mean here?  It sounds like your hardware
> doesn't support stereo DMA, if that's the case your capabilites should
> reflect it.  With most hardware you'd just do a normal stereo playback
> here, the unused TDM timeslots would not be visible outside of the DAI.

I'm not sure what stereo DMA mean. Our hardware supports mask that
choose which slot is active,but I can't solve the problem that app
channel order is different from that required by codec.
For example, app is 1L1R2L2R, ad1836 requires 1L2Lxx1R2Rxx.
So I choose to copy one by one.

More information about the Alsa-devel mailing list