From: 邱建斌 Date: Fri, 31 May 2013 03:29:43 +0000 (+0800) Subject: rk30_i2s pcm: modify android record samplerate to 44100/48000 X-Git-Tag: firefly_0821_release~7025 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2f1ecf8aaa7c88c8c7acebe0cc783d0df2572840;p=firefly-linux-kernel-4.4.55.git rk30_i2s pcm: modify android record samplerate to 44100/48000 --- diff --git a/sound/soc/rk29/rk29_pcm.c b/sound/soc/rk29/rk29_pcm.c index 20e43275ac9f..2b1f57bd5358 100755 --- a/sound/soc/rk29/rk29_pcm.c +++ b/sound/soc/rk29/rk29_pcm.c @@ -149,7 +149,6 @@ static void rockchip_pcm_enqueue(struct snd_pcm_substream *substream) DBG("size = 1, channel = %d, flag = %d\n",prtd->params->channel,prtd->params->flag); } - ret = rk29_dma_enqueue(prtd->params->channel,substream, pos, len); // if(prtd->params->channel == 2) DBG("Enter::%s, %d, ret=%d, Channel=%d, Addr=0x%X, Len=%lu\n", @@ -277,12 +276,14 @@ static int rockchip_pcm_hw_params(struct snd_pcm_substream *substream, prtd->dma_period = params_period_bytes(params); prtd->dma_start = runtime->dma_addr; prtd->dma_pos = prtd->dma_start; - prtd->dma_end = prtd->dma_start + totbytes; + prtd->dma_end = prtd->dma_start + prtd->dma_limit*prtd->dma_period; prtd->transfer_first = 1; prtd->curr = NULL; prtd->next = NULL; prtd->end = NULL; spin_unlock_irq(&prtd->lock); + printk(KERN_DEBUG "i2s dma info:periodsize(%ld),limit(%d),buffersize(%d),over(%d)\n", + prtd->dma_period,prtd->dma_limit,totbytes,totbytes-(prtd->dma_period*prtd->dma_limit)); return ret; } diff --git a/sound/soc/rk29/rk30_i2s.c b/sound/soc/rk29/rk30_i2s.c index d22d3173d516..ca8b55ce7971 100755 --- a/sound/soc/rk29/rk30_i2s.c +++ b/sound/soc/rk29/rk30_i2s.c @@ -37,7 +37,7 @@ #include "rk29_pcm.h" #include "rk29_i2s.h" - +#define ANDROID_REC #if 0 #define I2S_DBG(x...) printk(KERN_INFO x) #else @@ -238,14 +238,9 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, return -EINVAL; } I2S_DBG("Enter::%s----%d, I2S_TXCR=0x%X\n",__FUNCTION__,__LINE__,tx_ctl); -#if 0//defined(CONFIG_SND_RK29_SOC_alc5631) || defined(CONFIG_SND_RK29_SOC_alc5621) - rx_ctl = tx_ctl; - rx_ctl &= ~I2S_MODE_MASK; - rx_ctl |= I2S_SLAVE_MODE; // set tx slave, rx master - writel(rx_ctl, &(pheadi2s->I2S_TXCR)); -#else + writel(tx_ctl, &(pheadi2s->I2S_TXCR)); -#endif + rx_ctl = tx_ctl & 0x00007FFF; writel(rx_ctl, &(pheadi2s->I2S_RXCR)); return 0; @@ -307,14 +302,9 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, writel(dmarc, &(pheadi2s->I2S_DMACR)); I2S_DBG("Enter %s, %d I2S_TXCR=0x%08X\n", __func__, __LINE__, iismod); -#if 0//defined(CONFIG_SND_RK29_SOC_alc5631) || defined(CONFIG_SND_RK29_SOC_alc5621) - dmarc = iismod; - dmarc &= ~I2S_MODE_MASK; - dmarc |= I2S_SLAVE_MODE; // set tx slave, rx master - writel(dmarc, &(pheadi2s->I2S_TXCR)); -#else + writel(iismod, &(pheadi2s->I2S_TXCR)); -#endif + iismod = iismod & 0x00007FFF; writel(iismod, &(pheadi2s->I2S_RXCR)); @@ -427,8 +417,8 @@ int rockchip_i2s_resume(struct snd_soc_dai *cpu_dai) #define rockchip_i2s_resume NULL #endif -#if defined(CONFIG_SND_RK29_SOC_alc5631) || defined(CONFIG_SND_RK29_SOC_alc5621) -#define ROCKCHIP_I2S_RATES (SNDRV_PCM_RATE_44100) //zyy 20110704, playback and record use same sample rate +#ifdef ANDROID_REC +#define ROCKCHIP_I2S_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) #else #define ROCKCHIP_I2S_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ @@ -603,7 +593,7 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev) dai->playback.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE; dai->capture.channels_min = 2; dai->capture.channels_max = 2; - dai->capture.rates = ROCKCHIP_I2S_RATES;//;SNDRV_PCM_RATE_44100 + dai->capture.rates = ROCKCHIP_I2S_RATES; dai->capture.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE; dai->probe = rockchip_i2s_dai_probe; dai->ops = &rockchip_i2s_dai_ops;