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 also have a helper function which maps a hw_params to a dma_slave_config. Individual drivers still have to implement their own hw_params callback since not all fields of a dma_slave_config can be deduced from a hw_params (e.g. the burst size).
yes, since dma_slave_config is dependent upon what you want to DMA and match that with peripheral, it can be done by PCM drivers only. Core cannot take care of this. That would also help, as channel is set rightly before core calls dmaengine APIs in prepare :-)