From: cch Date: Thu, 19 Jul 2012 09:11:01 +0000 (+0800) Subject: fixed rt5631 capture not work well at the first time (after device booting) X-Git-Tag: firefly_0821_release~8993 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3e45cd34ec606bb491155b342592443982ed5054;p=firefly-linux-kernel-4.4.55.git fixed rt5631 capture not work well at the first time (after device booting) --- diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index db1b1397c90d..03d944d7ac97 100755 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -56,6 +56,8 @@ static bool last_is_spk = false; // need modify. #endif static struct snd_soc_codec *rt5631_codec; +struct delayed_work rt5631_delay_cap; //bard 7-16 +EXPORT_SYMBOL(rt5631_delay_cap); //bard 7-16 static const u16 rt5631_reg[0x80]; static int timesofbclk = 32; bool isPlaybackon = false, isCaptureon = false; @@ -274,7 +276,25 @@ static int rt5631_reg_init(struct snd_soc_codec *codec) return 0; } +//bard 7-16 s +void rt5631_adc_on(void) +{ + int val; + + val = snd_soc_read(rt5631_codec,RT5631_ADC_REC_MIXER); + snd_soc_write(rt5631_codec,RT5631_ADC_REC_MIXER,0xf0f0); + + snd_soc_update_bits(rt5631_codec, RT5631_PWR_MANAG_ADD1, + PWR_ADC_L_CLK | PWR_ADC_R_CLK, 0); + snd_soc_update_bits(rt5631_codec, RT5631_PWR_MANAG_ADD1, + PWR_ADC_L_CLK | PWR_ADC_R_CLK, + PWR_ADC_L_CLK | PWR_ADC_R_CLK); + snd_soc_write(rt5631_codec,RT5631_ADC_REC_MIXER,val); + snd_soc_update_bits(rt5631_codec, RT5631_ADC_CTRL_1, + RT_L_MUTE|RT_R_MUTE,0x0); +} +//bard 7-16 e static const char *rt5631_spol_source_sel[] = { "SPOLMIX", "MONOIN_RX", "VDAC", "DACL"}; static const char *rt5631_spor_source_sel[] = { @@ -1984,7 +2004,9 @@ static int rt5631_probe(struct snd_soc_codec *codec) INIT_WORK(&spk_work, spk_work_handler); #endif - +//bard 7-16 s + INIT_DELAYED_WORK(&rt5631_delay_cap,rt5631_adc_on); +//bard 7-16 e snd_soc_add_controls(codec, rt5631_snd_controls, ARRAY_SIZE(rt5631_snd_controls)); rt5631_add_widgets(codec); diff --git a/sound/soc/rk29/rk29_i2s.c b/sound/soc/rk29/rk29_i2s.c index 3c129885ba73..923aa15acd3b 100755 --- a/sound/soc/rk29/rk29_i2s.c +++ b/sound/soc/rk29/rk29_i2s.c @@ -254,6 +254,11 @@ static void rockchip_snd_rxctrl(struct rk29_i2s_info *i2s, int on, bool stopI2S) } flag_i2s_rx = 1; +#if (CONFIG_SND_SOC_RT5631) +//bard 7-16 s + schedule_delayed_work(&rt5631_delay_cap,HZ/4); +//bard 7-16 e +#endif } else { diff --git a/sound/soc/rk29/rk29_i2s.h b/sound/soc/rk29/rk29_i2s.h index 7787d32f39f2..374c773f65b0 100755 --- a/sound/soc/rk29/rk29_i2s.h +++ b/sound/soc/rk29/rk29_i2s.h @@ -244,5 +244,9 @@ extern struct snd_soc_dai_driver rk29_i2s_dai[]; extern struct snd_soc_dai rk29_i2s_dai[]; #endif +#if (CONFIG_SND_SOC_RT5631) +extern struct delayed_work rt5631_delay_cap; //bard 7-16 +#endif + #endif /* _ROCKCHIP_IIS_H */ diff --git a/sound/soc/rk29/rk30_i2s.c b/sound/soc/rk29/rk30_i2s.c index 19ce18820571..67ad0342a9b2 100755 --- a/sound/soc/rk29/rk30_i2s.c +++ b/sound/soc/rk29/rk30_i2s.c @@ -46,7 +46,7 @@ #define pheadi2s ((pI2S_REG)(i2s->regs)) -#define MAX_I2S 3 +#define MAX_I2S 3 struct rk29_i2s_info { struct device *dev; @@ -164,6 +164,7 @@ static void rockchip_snd_txctrl(struct rk29_i2s_info *i2s, int on, bool stopI2S) } } + static void rockchip_snd_rxctrl(struct rk29_i2s_info *i2s, int on, bool stopI2S) { u32 opr,xfer; @@ -196,6 +197,11 @@ static void rockchip_snd_rxctrl(struct rk29_i2s_info *i2s, int on, bool stopI2S) } flag_i2s_rx = 1; +#if (CONFIG_SND_SOC_RT5631) +//bard 7-16 s + schedule_delayed_work(&rt5631_delay_cap,HZ/4); +//bard 7-16 e +#endif } else {