From 8bdc2169716de0fc82f95355d8b53be280a12324 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=82=B1=E5=BB=BA=E6=96=8C?= Date: Sat, 22 Oct 2011 14:31:01 +0800 Subject: [PATCH] I2S: add i2s use DMA event mode choose,default use static mode --- sound/soc/rk29/Kconfig | 12 ++++++++++++ sound/soc/rk29/rk29_i2s.c | 6 ++++-- sound/soc/rk29/rk29_pcm.c | 11 +++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) mode change 100644 => 100755 sound/soc/rk29/Kconfig diff --git a/sound/soc/rk29/Kconfig b/sound/soc/rk29/Kconfig old mode 100644 new mode 100755 index e3a0b5c69654..2f1829bfbf69 --- a/sound/soc/rk29/Kconfig +++ b/sound/soc/rk29/Kconfig @@ -22,6 +22,18 @@ config SND_RK29_SOC_I2S_8CH depends on SND_RK29_SOC_I2S help This supports the use of the 8 Channel I2S interface on rk29 processors. + +if SND_RK29_SOC_I2S_2CH || SND_RK29_SOC_I2S_8CH +choice + bool "Set i2s on DMA event mode" + default SND_I2S_DMA_EVENT_STATIC + config SND_I2S_DMA_EVENT_DYNAMIC + tristate "dynamic mode" + + config SND_I2S_DMA_EVENT_STATIC + tristate "static mode" +endchoice +endif config SND_RK29_SOC_WM8988 tristate "SoC I2S Audio support for rockchip - WM8988" diff --git a/sound/soc/rk29/rk29_i2s.c b/sound/soc/rk29/rk29_i2s.c index 62f54413b748..eb5e7c722c4b 100755 --- a/sound/soc/rk29/rk29_i2s.c +++ b/sound/soc/rk29/rk29_i2s.c @@ -662,8 +662,10 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev) i2s->dma_playback->client = &rk29_dma_client_out; i2s->dma_playback->dma_size = 4; i2s->dma_playback->flag = 0; //add by sxj, used for burst change - - +#ifdef CONFIG_SND_I2S_DMA_EVENT_STATIC + WARN_ON(rk29_dma_request(i2s->dma_playback->channel, i2s->dma_playback->client, NULL)); + WARN_ON(rk29_dma_request(i2s->dma_capture->channel, i2s->dma_capture->client, NULL)); +#endif i2s->iis_clk = clk_get(&pdev->dev, "i2s"); I2S_DBG("Enter:%s, %d, iis_clk=%d\n", __FUNCTION__, __LINE__, i2s->iis_clk); if (IS_ERR(i2s->iis_clk)) { diff --git a/sound/soc/rk29/rk29_pcm.c b/sound/soc/rk29/rk29_pcm.c index c29e0a00f149..4ce82b42f5bc 100755 --- a/sound/soc/rk29/rk29_pcm.c +++ b/sound/soc/rk29/rk29_pcm.c @@ -292,6 +292,11 @@ void rk29_audio_buffdone(void *dev_id, int size, unsigned long flags; DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); + + if (!substream) + return; + if (!substream->runtime) + return; prtd = substream->runtime->private_data; DBG("Enter::%s----%d, substream=0x%08X, prtd=0x%08X\n",__FUNCTION__,__LINE__, substream, prtd); @@ -337,7 +342,7 @@ static int rockchip_pcm_hw_params(struct snd_pcm_substream *substream, if (prtd->params == NULL) { /* prepare DMA */ prtd->params = dma; - +#ifdef CONFIG_SND_I2S_DMA_EVENT_DYNAMIC DBG("params %p, client %p, channel %d\n", prtd->params, prtd->params->client, prtd->params->channel); @@ -356,7 +361,7 @@ static int rockchip_pcm_hw_params(struct snd_pcm_substream *substream, DBG(KERN_ERR "failed to get dma channel\n"); return ret; } - +#endif } rk29_dma_set_buffdone_fn(prtd->params->channel, rk29_audio_buffdone); @@ -389,9 +394,11 @@ static int rockchip_pcm_hw_free(struct snd_pcm_substream *substream) snd_pcm_set_runtime_buffer(substream, NULL); if (prtd->params) { +#ifdef CONFIG_SND_I2S_DMA_EVENT_DYNAMIC //free_dma(prtd->params->channel); rk29_dma_free(prtd->params->channel, prtd->params->client); prtd->params = NULL; +#endif } return 0; -- 2.34.1