On Thu, 2009-08-20 at 11:15 +0100, Mark Brown wrote:
On Thu, Aug 20, 2009 at 05:42:11PM +0800, Shine Liu wrote:
In the current framework, s3c24xx_pcm_trigger() is always called before s3c24xx_pcm_trigger(). So the s3c2410_dma_started() should be called in s3c24xx_pcm_trigger() after s3c24xx_snd_txctrl(1) or s3c24xx_snd_rxctrl(1) is called in this function.
I suspect some of the function names in your description here are incorrect :) Another option is to provide a callback in the private data passed to the DMA driver which the DMA driver can call at the appropriate point during setup.
Sorry for the mistake. Should be s3c24xx_pcm_trigger() is always called before s3c24xx_i2s_trigger() in current framework : s3c24xx_pcm_trigger() is called via platform->pcm_ops->trigger and s3c24xx_i2s_trigger() is called via cpu_dai->ops->trigger.
The problem is that DMA driver doesn't know when the DMA transfer has been really started. The DMA setup is done in s3c24xx_pcm_trigger(), in which all DMA related registers are set. But it doesn't mean the DMA transfer is started at this point because the DMA REQ signal has not arrived which is generated by the IIS. DMA driver has no way to know when the DMA REQ signal arrived. So the s3c24xx DMA driver provids a s3c2410_dma_started() method to let the user call when he knows the DMA transfer has been started.
Someone will presumably also need to take care of the same things in the other S3C DAI drivers too, though it should be possible to arrange things so that can be done seperately.