I2S: add i2s use DMA event mode choose,default use static mode
author邱建斌 <qjb@rock-chips.com>
Sat, 22 Oct 2011 06:31:01 +0000 (14:31 +0800)
committer邱建斌 <qjb@rock-chips.com>
Sat, 22 Oct 2011 06:36:16 +0000 (14:36 +0800)
sound/soc/rk29/Kconfig [changed mode: 0644->0755]
sound/soc/rk29/rk29_i2s.c
sound/soc/rk29/rk29_pcm.c

old mode 100644 (file)
new mode 100755 (executable)
index e3a0b5c..2f1829b
@@ -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"
index 62f54413b748f4a5b61f1e49b5b12ea72126c778..eb5e7c722c4b2771b3310824a9e4844ad4abbf63 100755 (executable)
@@ -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)) {
index c29e0a00f149aae7fb6e40e266a735206e251177..4ce82b42f5bc484f2d64fd0176cc2a631f311120 100755 (executable)
@@ -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;