From: 邱建斌 Date: Tue, 9 Jul 2013 03:38:02 +0000 (+0800) Subject: rt5631: support sample rate up to 192khz X-Git-Tag: firefly_0821_release~6921 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bc07a28a70563187f938814887b8c0aa6701a309;p=firefly-linux-kernel-4.4.55.git rt5631: support sample rate up to 192khz RT5631_VERSION "0.01 alsa 1.0.25" --- diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 99c5ab9a33ac..4cd004fa9450 100755 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -35,7 +35,11 @@ #else #define DBG(x...) #endif -#define RT5631_VERSION "0.01 alsa 1.0.24" +/* +1.0.25 + add support sample rate up to 192k +*/ +#define RT5631_VERSION "0.01 alsa 1.0.25" #define RT5631_ALC_DAC_FUNC_ENA 0 //ALC functio for DAC #define RT5631_ALC_ADC_FUNC_ENA 0 //ALC function for ADC @@ -1574,6 +1578,10 @@ struct coeff_clk_div coeff_div[] = { {22579200, 88200 * 64, 88200, 0x0000}, {24576000, 96000 * 32, 96000, 0x1000}, {24576000, 96000 * 64, 96000, 0x0000}, + {22579200, 176400 * 32, 176400, 0x1000}, + {22579200, 176400 * 64, 176400, 0x0000}, + {24576000, 192000 * 32, 192000, 0x1000}, + {24576000, 162000 * 64, 192000, 0x0000}, /* sysclk is 512fs */ {4096000, 8000 * 32, 8000, 0x3000}, {4096000, 8000 * 64, 8000, 0x2000}, @@ -1889,7 +1897,7 @@ static ssize_t rt5631_index_reg_show(struct device *dev, } static DEVICE_ATTR(index_reg, 0444, rt5631_index_reg_show, NULL); -#define RT5631_STEREO_RATES SNDRV_PCM_RATE_8000_96000 +#define RT5631_STEREO_RATES SNDRV_PCM_RATE_8000_192000 #define RT5631_FORMAT (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ @@ -2158,7 +2166,7 @@ static int rt5631_i2c_probe(struct i2c_client *i2c, struct rt5631_priv *rt5631; int ret; - DBG("RT5631 Audio Codec %s\n", RT5631_VERSION); + printk("RT5631 Audio Codec %s\n", RT5631_VERSION); rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL); if (NULL == rt5631) diff --git a/sound/soc/rk29/rk29_rt5631.c b/sound/soc/rk29/rk29_rt5631.c index 89462daef287..6ce4585f2d14 100755 --- a/sound/soc/rk29/rk29_rt5631.c +++ b/sound/soc/rk29/rk29_rt5631.c @@ -83,37 +83,40 @@ static int rk29_hw_params(struct snd_pcm_substream *substream, case 24000: case 32000: case 48000: - case 96000: - case 192000: pll_out = 12288000; break; case 11025: case 22050: case 44100: - case 88100: - case 176400: pll_out = 11289600; break; + case 96000: + case 192000: + pll_out = 12288000*2; + break; + case 88200: + case 176400: + pll_out = 11289600*2; + break; default: DBG("Enter:%s, %d, Error rate=%d\n",__FUNCTION__,__LINE__,params_rate(params)); return -EINVAL; break; } - DBG("Enter:%s, %d, LRCK=%d rate=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params),params_rate(params)); #if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE) snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0); - snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1); + snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, 64-1);//bclk = 2*32*lrck; 2*32fs switch(params_rate(params)) { - case 96000: - case 88100: - snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 1); - break; case 176400: case 192000: - snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 0); + snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 1); + DBG("Enter:%s, %d, MCLK=%d BCLK=%d LRCK=%d\n", + __FUNCTION__,__LINE__,pll_out,pll_out/2,params_rate(params)); break; default: snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3); + DBG("default:%s, %d, MCLK=%d BCLK=%d LRCK=%d\n", + __FUNCTION__,__LINE__,pll_out,pll_out/4,params_rate(params)); break; }