Part 4: S3C ASoC 24XX-I2S drivers. Add the callback functions for the DMA drivers. These callback functions are determined in the compile time (no need to be registered in the probe phase).
--- a/sound/soc/s3c24xx/s3c24xx-i2s.c 2009-08-24 13:28:58.000000000 +0800 +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c 2009-08-24 15:20:53.000000000 +0800 @@ -41,12 +41,21 @@ #include "s3c24xx-pcm.h" #include "s3c24xx-i2s.h"
+static int s3c24xx_snd_txctrl(int); +static int s3c24xx_snd_rxctrl(int); + static struct s3c2410_dma_client s3c24xx_dma_client_out = { - .name = "I2S PCM Stereo out" + .name = "I2S PCM Stereo out", + .channel = DMACH_I2S_OUT, + .gen_request = (void *)s3c24xx_snd_txctrl, + .end_request = (void *)s3c24xx_snd_txctrl, };
static struct s3c2410_dma_client s3c24xx_dma_client_in = { - .name = "I2S PCM Stereo in" + .name = "I2S PCM Stereo in", + .channel = DMACH_I2S_IN, + .gen_request = (void *)s3c24xx_snd_rxctrl, + .end_request = (void *)s3c24xx_snd_rxctrl, };
static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_out = { @@ -73,7 +82,7 @@ }; static struct s3c24xx_i2s_info s3c24xx_i2s;
-static void s3c24xx_snd_txctrl(int on) +static int s3c24xx_snd_txctrl(int on) { u32 iisfcon; u32 iiscon; @@ -116,9 +125,10 @@ }
pr_debug("w: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon); + return 0; }
-static void s3c24xx_snd_rxctrl(int on) +static int s3c24xx_snd_rxctrl(int on) { u32 iisfcon; u32 iiscon; @@ -161,6 +171,7 @@ }
pr_debug("w: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon); + return 0; }
/* @@ -279,6 +290,9 @@ struct snd_soc_dai *dai) { int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct s3c24xx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; + struct s3c2410_dma_client *client = dma_params->client;
pr_debug("Entered %s\n", __func__);
@@ -292,24 +306,23 @@ goto exit_err; }
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) - s3c24xx_snd_rxctrl(1); - else - s3c24xx_snd_txctrl(1); + client->event= S3C2410_DMA_TRIGGER_START; + client->private_data = (void *)1; break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) - s3c24xx_snd_rxctrl(0); - else - s3c24xx_snd_txctrl(0); + client->event= S3C2410_DMA_TRIGGER_STOP; + client->private_data = (void *)0; break; + default: ret = -EINVAL; - break; + goto exit_err; }
+ ret = s3c2410_dma_trigger(client); + exit_err: return ret; }