On 02/22/2012 11:01 AM, Russell King - ARM Linux wrote:
On Wed, Feb 22, 2012 at 10:49:08AM +0100, Lars-Peter Clausen wrote:
This patch adds a set of functions which are intended to be used when implementing a dmaengine based sound PCM driver.
This isn't going to be usable on sa11x0 platforms, because we need to know the struct device underlying the DMA device before we allocate the buffers.
Which means the dma channel has to be requested before allocating the buffers. Which can be done. Not with the current code but it can be implemented on top of it.
I had a look at your 'generic' dmaengine PCM driver patch. And it looks like you went to opposite way as I did in this patch. You implemented one driver which is supposed to work for all cases, while my patch provides a set of helper functions which can be used to implement a PCM driver. Your patch only supports non-cyclic transfers, mine only supports cyclic transfers.
Your driver emulates cyclic transfers using non-cyclic transfers, in my opinion it is better to add such a emulation layer to the dmaengine core itself. This will allow other users to benefit from this as well and it doesn't have to be reimplemented in other subsystems/driver. Also users don't have to be updated if a dmaengine driver gets native support for cyclic transfers. But, well, the code exists and it is a step in the right direction so we should probably use it.
I suppose we could rearrange the code so that we can share most of it between the cyclic and non-cyclic case. The non-cyclic case needs special handling everywhere, which can be made conditional.
- Lars