rk29:wm8994 change to slave

This commit is contained in:
邱建斌
2011-04-28 17:51:46 +08:00
parent 3271229f8c
commit 42562fd6e6
4 changed files with 290 additions and 657 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -72,4 +72,6 @@ struct wm8994_platform_data {
unsigned int bt_call_vol;
};
#define WM_EN_PIN RK29_PIN5_PA1
#endif

2
sound/soc/rk29/rk29_i2s.c Normal file → Executable file
View File

@@ -602,7 +602,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 = SNDRV_PCM_RATE_44100;//ROCKCHIP_I2S_RATES;
dai->capture.rates = ROCKCHIP_I2S_RATES;//;SNDRV_PCM_RATE_44100
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;

View File

@@ -24,6 +24,7 @@
#include "../codecs/wm8994.h"
#include "rk29_pcm.h"
#include "rk29_i2s.h"
#include <linux/clk.h>
#if 0
#define DBG(x...) printk(KERN_INFO x)
@@ -38,7 +39,9 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
unsigned int pll_out = 0;
int ret;
int div_bclk,div_mclk;
int ret;
struct clk *general_pll;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/*by Vincent Hsiung for EQ Vol Change*/
@@ -78,7 +81,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
if (ret < 0)
return ret;
}
/*
switch(params_rate(params)) {
case 8000:
case 16000:
@@ -98,12 +101,36 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
break;
}
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SYSCLK = FLL1
snd_soc_dai_set_sysclk(codec_dai,WM8994_SYSCLK_FLL1,12000000,pll_out);
//2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FLL1 CLK
snd_soc_dai_set_pll(codec_dai,WM8994_FLL1,12000000,pll_out);
*/
snd_soc_dai_set_sysclk(cpu_dai, 0, 12000000, 0);
#if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
#endif
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
general_pll=clk_get(NULL, "general_pll");
if(clk_get_rate(general_pll)>260000000)
{
div_bclk=(pll_out/4)/params_rate(params)-1;
div_mclk=3;
}
else if(clk_get_rate(general_pll)>130000000)
{
div_bclk=(pll_out/2)/params_rate(params)-1;
div_mclk=1;
}
else
{
pll_out=pll_out/4;
div_bclk=(pll_out)/params_rate(params)-1;
div_mclk=0;
}
DBG("func is%s,gpll=%ld,pll_out=%ld,div_mclk=%ld\n",
__FUNCTION__,clk_get_rate(general_pll),pll_out,div_mclk);
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
#endif
return 0;
}
/*
@@ -143,13 +170,9 @@ static int rk29_wm8994_init(struct snd_soc_codec *codec)
/* Add specific widgets */
// snd_soc_dapm_new_controls(codec, rk2818_dapm_widgets,
// ARRAY_SIZE(rk2818_dapm_widgets));
// snd_soc_dapm_nc_pin(codec, "LOUT2");
// snd_soc_dapm_nc_pin(codec, "ROUT2");
// ARRAY_SIZE(rk2818_dapm_widgets));
/* Set up specific audio path audio_mapnects */
// snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
// snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
// snd_soc_dapm_sync(codec);
return 0;