[RFC 03/34] dmaengine: virt-dma: add support for cyclic DMA periodic callbacks

zhangfei gao zhangfei.gao at gmail.com
Wed May 30 23:45:54 EDT 2012


On Wed, May 30, 2012 at 4:02 PM, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Wed, May 30, 2012 at 03:52:53PM +0800, Linus Walleij wrote:
>> On Tue, May 29, 2012 at 5:36 PM, Russell King
>> <rmk+kernel at arm.linux.org.uk> wrote:
>>
>> > Add support for cyclic DMA's periodic callbacks.  Drivers are expected
>> > to call vchan_cyclic_callback() when a period has completed, which will
>> > schedule the tasklet to make the callback into the driver.
>> >
>> > As callbacks are made from tasklet context, it is important to realise
>> > that we don't guarantee a callback for each completed period, but for
>> > N completed periods where N may be greater than one.
>>
>> This last thing was something we have to fix right?
>> Like for each driver to keep a counter of completed periods
>> and call the handler repeatedly if N > 1.
>
> No, I don't think we should do that - ALSA doesn't require it, and ALSA
> is about the only user of this.  As I've said, DMA engine drivers should
> implement a correct tx_status function, which returns the remaining bytes
> to be transferred to the end of the buffer so it's possible to find out
> how many periods have completed when the callback is called.

Could we directly use pos, but unmatch with dma_tx_state.residue.
For cyclic buffer, when pos reach to buffer size, pos will change to 0,
remaining bytes also 0, we may have to distinguish them.



More information about the linux-arm-kernel mailing list