On 01/28/2014 12:34 PM, Mark Brown wrote:
On Tue, Jan 28, 2014 at 08:35:49AM +0100, Lars-Peter Clausen wrote:
I still think the emulation of the transfers is better done in the DMA driver rather than in the audio driver. The DMA driver has much more state information available than the audio driver, which should make the implementation on one hand simpler and on the other hand more reliable.
On the other hand it's a problem that several devices have so we should be able to factor out the interface matching so it should have at least some of the code in one of the frameworks, dmaengine would seem natural too me too but apparently audio is about the only user of cyclic DMA so IIRC the DMA guys were pushing back on doing it there.
The virt_dma helper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users of virt_dma already implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
- Lars