i2s dma optimization, default use burst 16
authorsxj <sxj@rock-chips.com>
Thu, 1 Sep 2011 08:06:36 +0000 (01:06 -0700)
committersxj <sxj@rock-chips.com>
Thu, 1 Sep 2011 08:06:36 +0000 (01:06 -0700)
sound/soc/rk29/rk29_i2s.c
sound/soc/rk29/rk29_pcm.c
sound/soc/rk29/rk29_pcm.h

index f91dd898178e504565900af7fabf1892954abc52..809efcf6d25dc95b9e4c071972dcaee16f7ad127 100755 (executable)
@@ -658,8 +658,11 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev)
 
        i2s->dma_capture->client = &rk29_dma_client_in;
        i2s->dma_capture->dma_size = 4;
+       i2s->dma_capture->flag = 0;                     //add by sxj, used for burst change
        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
+
 
        i2s->iis_clk = clk_get(&pdev->dev, "i2s");
        I2S_DBG("Enter:%s, %d, iis_clk=%d\n", __FUNCTION__, __LINE__, i2s->iis_clk);
index 066eaa1ad50f70147c1530f4193ebae341accab3..c29e0a00f149aae7fb6e40e266a735206e251177 100755 (executable)
@@ -54,7 +54,7 @@ static const struct snd_pcm_hardware rockchip_pcm_hardware = {
        .channels_max           = 8,
        .buffer_bytes_max       = 128*1024,
        .period_bytes_min       = 64,  ///PAGE_SIZE,
-       .period_bytes_max       = 2047*4,///PAGE_SIZE*2,
+       .period_bytes_max       = 2048*4,///PAGE_SIZE*2,
        .periods_min            = 3,///2,
        .periods_max            = 128,
        .fifo_size              = 16,
@@ -219,6 +219,23 @@ static void rockchip_pcm_enqueue(struct snd_pcm_substream *substream)
                if ((pos + len) > prtd->dma_end) {
                        len  = prtd->dma_end - pos;
                }
+
+               if((len%(prtd->params->dma_size*16) == 0) && (prtd->params->flag == 1))                 
+               {                                               
+                       ret = rk29_dma_config(prtd->params->channel,                                    
+                               prtd->params->dma_size, 16);                                            
+                       prtd->params->flag = 0;                                         
+                       DBG("size = 16, channel = %d, flag = %d\n",prtd->params->channel,prtd->params->flag);        
+               }                               
+               else if((len%(prtd->params->dma_size*16) != 0) && (prtd->params->flag == 0))            
+               {                                               
+                       ret = rk29_dma_config(prtd->params->channel,                    
+                               prtd->params->dma_size, 1);                                             
+                       prtd->params->flag = 1;                                         
+                       DBG("size = 1, channel = %d, flag = %d\n",prtd->params->channel,prtd->params->flag);         
+               }
+
+
                //ret = rockchip_dma_buffer_set_enqueue(prtd, pos, len);                
                ret = rk29_dma_enqueue(prtd->params->channel, 
                        substream, pos, len);
@@ -403,7 +420,7 @@ static int rockchip_pcm_prepare(struct snd_pcm_substream *substream)
         }
         DBG("Enter::%s, %d, ret=%d, Channel=%d, Addr=0x%X\n", __FUNCTION__, __LINE__, ret, prtd->params->channel, prtd->params->dma_addr);
         ret = rk29_dma_config(prtd->params->channel, 
-                prtd->params->dma_size, 1);
+                prtd->params->dma_size, 16);
 
         DBG("Enter:%s, %d, ret = %d, Channel=%d, Size=%d\n", 
                 __FUNCTION__, __LINE__, ret, prtd->params->channel, 
index 58710e1ca6a442cd7d28eefe99c794a7474a5f82..96d774c5a62664a00e9095eec8cac35a83cb6af2 100755 (executable)
@@ -26,7 +26,8 @@ struct rockchip_pcm_dma_params {
        struct rockchip_dma_client *client;     /* stream identifier */
        int channel;                            /* Channel ID */
        dma_addr_t dma_addr;
-       int dma_size;                   /* Size of the DMA transfer */
+       int dma_size;                           /* Size of the DMA transfer */
+       int flag;                               /*burst change flag*/
 };
 
 extern struct snd_soc_platform rk29_soc_platform;