On Sat, 2012-02-04 at 19:25 +0100, Lars-Peter Clausen wrote:
On 02/04/2012 07:06 PM, Vinod Koul wrote:
On Sat, 2012-02-04 at 18:00 +0100, Lars-Peter Clausen wrote:
This is sort of what I have implemented right now. Although I also prepare and submit the dma descriptor in trigger START instead of prepare. Mainly beacuse I mapped trigger STOP to dmaengine_terminate_all. Or is issue_pending supposed to just restart the transfer if it is circular, even though terminate_all has been called?
trigger START should not be used for preparing descriptors. You want to start to actually start the descriptor (which is issue_pending and NOT submit!!). You should do this is prepare callback.
I'm doing both, prepare+submit and issue_pending, because of what I wrote above. Or can we assume that each call to the ALSA/ASoC prepare callback will only be followed by at maximum one call to trigger START?
terminate_all is designed to abort all transfers, so that would mean the dmac will move the descriptors to free_list. So that way your implementation is the right one.
And while at it, I believe for this use, terminate_all is too strong an API to be used, perhaps we should introduce a STOP call, which just aborts the current descriptor but doesn't free it, or possibly move to submitted state/queue. And yes terminate_all should used in scenarios like free callback. That way it should map properly to ALSA PCM operations.