diff options
author | Graeme Gregory <gg@opensource.wolfsonmicro.com> | 2007-04-17 12:35:18 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-11 16:56:03 +0200 |
commit | 7f1bc26e7df85957bcc48442f135e7a6f85e5edc (patch) | |
tree | 0a422afba5ff1b99e6960d95bcf98845c71d4a40 /sound/soc | |
parent | c45e20eb214648014d2df54ddb9f8665b231629f (diff) |
[ALSA] ASoC Samsung S3c24xx updates - audio DMA cleanup
This patch cleans up the audio DMA for the Samsung S3C24xx platform.
Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.c | 42 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.h | 7 |
2 files changed, 27 insertions, 22 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index f1c0b9fa179c..21dc6974d6a3 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c @@ -89,7 +89,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) DBG("Entered %s\n", __FUNCTION__); - while ( prtd->dma_loaded < prtd->dma_limit) { + while (prtd->dma_loaded < prtd->dma_limit) { unsigned long len = prtd->dma_period; DBG("dma_loaded: %d\n",prtd->dma_loaded); @@ -100,7 +100,8 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) __FUNCTION__, len); } - ret = s3c2410_dma_enqueue(prtd->params->channel, substream, pos, len); + ret = s3c2410_dma_enqueue(prtd->params->channel, + substream, pos, len); if (ret == 0) { prtd->dma_loaded++; @@ -115,17 +116,19 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) } static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, - void *dev_id, int size, - enum s3c2410_dma_buffresult result) + void *dev_id, int size, + enum s3c2410_dma_buffresult result) { struct snd_pcm_substream *substream = dev_id; - struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; + struct s3c24xx_runtime_data *prtd; DBG("Entered %s\n", __FUNCTION__); if (result == S3C2410_RES_ABORT || result == S3C2410_RES_ERR) return; + prtd = substream->runtime->private_data; + if (substream) snd_pcm_period_elapsed(substream); @@ -173,18 +176,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, * sync to pclk, half-word transfers to the IIS-FIFO. */ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { s3c2410_dma_devconfig(prtd->params->channel, - S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC | - S3C2410_DISRCC_APB, prtd->params->dma_addr); + S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC | + S3C2410_DISRCC_APB, prtd->params->dma_addr); s3c2410_dma_config(prtd->params->channel, - 2, S3C2410_DCON_SYNC_PCLK | S3C2410_DCON_HANDSHAKE); + prtd->params->dma_size, + S3C2410_DCON_SYNC_PCLK | + S3C2410_DCON_HANDSHAKE); } else { s3c2410_dma_config(prtd->params->channel, - 2, S3C2410_DCON_HANDSHAKE | S3C2410_DCON_SYNC_PCLK); + prtd->params->dma_size, + S3C2410_DCON_HANDSHAKE | + S3C2410_DCON_SYNC_PCLK); s3c2410_dma_devconfig(prtd->params->channel, - S3C2410_DMASRC_HW, 0x3, - prtd->params->dma_addr); + S3C2410_DMASRC_HW, 0x3, + prtd->params->dma_addr); } s3c2410_dma_set_buffdone_fn(prtd->params->channel, @@ -215,7 +222,7 @@ static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream) /* TODO - do we need to ensure DMA flushed */ snd_pcm_set_runtime_buffer(substream, NULL); - if(prtd->params) { + if (prtd->params) { s3c2410_dma_free(prtd->params->channel, prtd->params->client); prtd->params = NULL; } @@ -281,7 +288,8 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) return ret; } -static snd_pcm_uframes_t s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t + s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct s3c24xx_runtime_data *prtd = runtime->private_data; @@ -321,8 +329,6 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct s3c24xx_runtime_data *prtd; - int ret; - DBG("Entered %s\n", __FUNCTION__); snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware); @@ -342,7 +348,7 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream) DBG("Entered %s\n", __FUNCTION__); - if(prtd) + if (prtd) kfree(prtd); else DBG("s3c24xx_pcm_close called with prtd == NULL\n"); @@ -419,8 +425,8 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; -static int s3c24xx_pcm_new(struct snd_card *card, struct snd_soc_codec_dai *dai, - struct snd_pcm *pcm) +static int s3c24xx_pcm_new(struct snd_card *card, + struct snd_soc_codec_dai *dai, struct snd_pcm *pcm) { int ret = 0; diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.h b/sound/soc/s3c24xx/s3c24xx-pcm.h index 5dced4ab1932..0088c79822ea 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.h +++ b/sound/soc/s3c24xx/s3c24xx-pcm.h @@ -16,15 +16,14 @@ #define ST_OPENED (1<<1) struct s3c24xx_pcm_dma_params { - struct s3c2410_dma_client *client; /* stream identifier */ - int channel; /* Channel ID */ + struct s3c2410_dma_client *client; /* stream identifier */ + int channel; /* Channel ID */ dma_addr_t dma_addr; + int dma_size; /* Size of the DMA transfer */ }; #define S3C24XX_DAI_I2S 0 -extern struct snd_soc_cpu_dai s3c24xx_i2s_dai; - /* platform data */ extern struct snd_soc_platform s3c24xx_soc_platform; extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; |