[RFC 03/34] dmaengine: virt-dma: add support for cyclic DMA periodic callbacks
From: zhangfei gao <hidden>
Date: 2012-05-31 03:45:54
On Wed, May 30, 2012 at 4:02 PM, Russell King - ARM Linux [off-list ref] wrote:
On Wed, May 30, 2012 at 03:52:53PM +0800, Linus Walleij wrote:quoted
On Tue, May 29, 2012 at 5:36 PM, Russell King [off-list ref] wrote:quoted
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.