[alsa-devel] [PATCH] ASoC: s3c24xx platform: Fix s3c2410_dma_started called at wrong time

Shine Liu shinel at foxmail.com
Sun Aug 23 13:37:13 CEST 2009


> 
> This isn't quite what I was expecting - what I was expecting was more
> that the I2S driver would set up a function on startup which would be
> called by the ASoC DMA driver from its trigger function.  It does look
> like a reasonable approach, though.

Yes, I understand what you exactly want. I was intend to register the
callback function on I2S startup, but finally I found it is not possible
because there are two callback functions for the DMA driver:
s3c24xx_snd_txctrl() and s3c24xx_snd_rxctrl(), however, there's only one
slot for the callback function. So I choose not to setup the callback
functions dynamicly, when the task is playback, the callback funtion is
s3c24xx_snd_txctrl() and when the task is record, the funtion is
s3c24xx_snd_rxctrl().

However, there's another way to archive what you expect: combine the
s3c24xx_snd_txctrl() and s3c24xx_snd_rxctrl() into one function. That
would be like:

struct s3c24xx_snd_ctrl_data {
	int event;	//start or stop
	int direction;	//playback or record
};

static void s3c24xx_snd_ctrl(struct s3c24xx_snd_ctrl_data* data)
{
	if(data->direction == SNDRV_PCM_STREAM_PLAYBACK)
		s3c24xx_snd_txctrl(data->event);
	eles
		s3c24xx_snd_rxctrl(data->event);
}

Then we can register this callback funtion on I2S startup.

> 
> The way you've got things at the minute at least all the other S3C ASoC
> drivers will need to be updated to match the change in the DMA driver.
> 

I have posted the DMA driver patch to linux-arm-kernel yesterday:
http://lists.arm.linux.org.uk/lurker/message/20090822.153940.e15e3bd7.en.html

Hope there is no problem to merge the patch.

If the dma patch is accepted, I will post a formal patch here for ASoC
S3C24XX.





More information about the Alsa-devel mailing list