From 068a81907d41a964aa8af473054964c8a22a68ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=AE=8B=E7=A7=80=E6=9D=B0?= Date: Thu, 24 May 2012 16:38:50 +0800 Subject: [PATCH] rk30 phone: modify the fmt of codec side in bt and bb incall mode, slove a Uninitialized bug --- sound/soc/codecs/tlv320aic326x.c | 70 +++++++++++++++++++++++++++++--- sound/soc/rk29/rk29_aic3262.c | 8 ++-- 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/tlv320aic326x.c b/sound/soc/codecs/tlv320aic326x.c index 0de788331a04..bffb7e1f74c5 100644 --- a/sound/soc/codecs/tlv320aic326x.c +++ b/sound/soc/codecs/tlv320aic326x.c @@ -2106,7 +2106,7 @@ static int aic3262_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) int aif_bclk_wclk_reg; int aif_interface_reg; int aif_bclk_offset_reg; - int iface_reg; + int iface_reg = 0; //must be init, not will lead to error codec = codec_dai->codec; aic3262 = snd_soc_codec_get_drvdata(codec); iface_val = 0x00; @@ -2639,7 +2639,7 @@ static void AP_to_speaker(void) aic3262_codec_write(aic3262_codec, AIC3262_PASI_DAC_DP_SETUP, 0xc0); aic3262_codec_write(aic3262_codec, AIC3262_DAC_MVOL_CONF, 0x00); -}*/ +} static void AP_to_headphone(void) @@ -2679,7 +2679,7 @@ static void AP_to_headphone(void) aic3262_codec_write(aic3262_codec, AIC3262_PASI_DAC_DP_SETUP, 0xc0); aic3262_codec_write(aic3262_codec, AIC3262_DAC_MVOL_CONF, 0x00); -} +}*/ /*static void record_in1lr(void) { @@ -2730,14 +2730,74 @@ static void record_in2lr(void) aic3262_codec_write(aic3262_codec, MAKE_REG(0,0,127), 0x00); aic3262_codec_write(aic3262_codec, AIC3262_RESET_REG, 0x01); +} + +static void incall_mic(void) +{ + unsigned char ret; + //Choose Book 0 + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x00); + aic3262_codec_write(aic3262_codec, MAKE_REG(0,0,127), 0x00); + + // Clock Configuration + //ret = aic3262_codec_read(aic3262_codec, AIC3262_DAC_ADC_CLKIN_REG); + //ret = ret &0xf0; + //aic3262_codec_write(aic3262_codec, AIC3262_DAC_ADC_CLKIN_REG, ret); + //aic3262_codec_write(aic3262_codec, AIC3262_NADC_DIV_POW_REG, 0x81); + //aic3262_codec_write(aic3262_codec, AIC3262_MADC_DIV_POW_REG, 0x8b); + //aic3262_codec_write(aic3262_codec, AIC3262_AOSR_REG, 0x80); + + // Initialize the Codec + //aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x01); + //aic3262_codec_write(aic3262_codec, AIC3262_POWER_CONF, 0x00); + //aic3262_codec_write(aic3262_codec, AIC3262_REF_PWR_DLY, 0x01); + //aic3262_codec_write(aic3262_codec, AIC3262_MIC_PWR_DLY, 0x33); + + //ASI#3 configuration + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x04); + //aic3262_codec_write(aic3262_codec, AIC3262_ASI3_BUS_FMT, 0x00); + //aic3262_codec_write(aic3262_codec, AIC3262_ASI3_ADC_INPUT_CNTL, 0x01); + //aic3262_codec_write(aic3262_codec, AIC3262_ASI3_BWCLK_CNTL_REG, 0x00); + aic3262_codec_write(aic3262_codec, AIC3262_ASI3_DOUT_CNTL, 0x00); + + //Signal processing + //aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x00); + //aic3262_codec_write(aic3262_codec, AIC3262_ADC_PRB, 0x01); + + //ADC configuration + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x01); + aic3262_codec_write(aic3262_codec, AIC3262_MIC_BIAS_CNTL, 0x55); + aic3262_codec_write(aic3262_codec, AIC3262_LMIC_PGA_PIN, 0x80); + aic3262_codec_write(aic3262_codec, AIC3262_LMIC_PGA_MIN, 0x80); + aic3262_codec_write(aic3262_codec, AIC3262_RMIC_PGA_PIN, 0x80); + + aic3262_codec_write(aic3262_codec, AIC3262_RMIC_PGA_MIN, 0x20); + aic3262_codec_write(aic3262_codec, AIC3262_MICL_PGA, 0x3c); + aic3262_codec_write(aic3262_codec, AIC3262_MICR_PGA, 0x3c); + aic3262_codec_write(aic3262_codec, MAKE_REG(0,1, 61), 0x00); + + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x00); + + aic3262_codec_write(aic3262_codec, AIC3262_ADC_CHANNEL_POW, 0xc0); + aic3262_codec_write(aic3262_codec, AIC3262_ADC_FINE_GAIN, 0x00); }*/ +static void test(void) +{ + //Choose Book 0 + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x00); + aic3262_codec_write(aic3262_codec, MAKE_REG(0,0,127), 0x00); + + aic3262_codec_write(aic3262_codec, AIC3262_PAGE_SEL_REG, 0x04); + aic3262_codec_write(aic3262_codec, AIC3262_ASI3_BUS_FMT, 0x60); +} + static void test_playback(void) { - printk("test palyback start\n"); + printk("test\n"); - AP_to_headphone( ); + test( ); } diff --git a/sound/soc/rk29/rk29_aic3262.c b/sound/soc/rk29/rk29_aic3262.c index e43bed7d2f73..88f04ce9fcf0 100644 --- a/sound/soc/rk29/rk29_aic3262.c +++ b/sound/soc/rk29/rk29_aic3262.c @@ -294,8 +294,8 @@ static int rk29_aif2_hw_params(struct snd_pcm_substream *substream, DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params)); /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A | - SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBM_CFM); + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); if (ret < 0) { printk("%s: snd_soc_dai_set_fmt err =%d\n",__FUNCTION__,ret); @@ -366,8 +366,8 @@ static int rk29_aif3_hw_params(struct snd_pcm_substream *substream, DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params)); /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A | - SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS); + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J | + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); if (ret < 0) { printk("%s: snd_soc_dai_set_fmt err =%d\n",__FUNCTION__,ret); -- 2.34.1