From 3a5b7f31e11eec70fc118d94545608ec91d69840 Mon Sep 17 00:00:00 2001 From: sxj Date: Thu, 1 Sep 2011 01:06:36 -0700 Subject: [PATCH] i2s dma optimization, default use burst 16 --- sound/soc/rk29/rk29_i2s.c | 3 +++ sound/soc/rk29/rk29_pcm.c | 21 +++++++++++++++++++-- sound/soc/rk29/rk29_pcm.h | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sound/soc/rk29/rk29_i2s.c b/sound/soc/rk29/rk29_i2s.c index f91dd898178e..809efcf6d25d 100755 --- a/sound/soc/rk29/rk29_i2s.c +++ b/sound/soc/rk29/rk29_i2s.c @@ -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); diff --git a/sound/soc/rk29/rk29_pcm.c b/sound/soc/rk29/rk29_pcm.c index 066eaa1ad50f..c29e0a00f149 100755 --- a/sound/soc/rk29/rk29_pcm.c +++ b/sound/soc/rk29/rk29_pcm.c @@ -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, diff --git a/sound/soc/rk29/rk29_pcm.h b/sound/soc/rk29/rk29_pcm.h index 58710e1ca6a4..96d774c5a626 100755 --- a/sound/soc/rk29/rk29_pcm.h +++ b/sound/soc/rk29/rk29_pcm.h @@ -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; -- 2.34.1