From 89c1ad3ff328be8a37b31a4262f1a0eb349f1f23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=82=B1=E5=BB=BA=E6=96=8C?= Date: Wed, 7 Nov 2012 17:09:36 +0800 Subject: [PATCH] rk610_codec : In the state of the low volume noise problem --- sound/soc/codecs/rk610_codec.c | 55 ++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rk610_codec.c b/sound/soc/codecs/rk610_codec.c index 5c01474d36d5..9878a126829d 100755 --- a/sound/soc/codecs/rk610_codec.c +++ b/sound/soc/codecs/rk610_codec.c @@ -527,7 +527,7 @@ static int rk610_codec_pcm_hw_params(struct snd_pcm_substream *substream, #endif rk610_codec_write(codec, ACCELCODEC_R09, iface); if (coeff >= 0){ - rk610_codec_write(codec, ACCELCODEC_R00, srate|coeff_div[coeff].bclk); + // rk610_codec_write(codec, ACCELCODEC_R00, srate|coeff_div[coeff].bclk); rk610_codec_write(codec, ACCELCODEC_R0A, (coeff_div[coeff].sr << 1) | coeff_div[coeff].usb|ASC_CLKNODIV|ASC_CLK_ENABLE); } rk610_codec_write(codec,ACCELCODEC_R0B, gR0BReg); @@ -695,7 +695,7 @@ void rk610_codec_reg_set(void) gR0AReg = ASC_NORMAL_MODE|(0x10 << 1)|ASC_CLKNODIV|ASC_CLK_DISABLE; //2Config audio interface rk610_codec_write(codec,ACCELCODEC_R09, ASC_I2S_MODE|ASC_16BIT_MODE|ASC_NORMAL_LRCLK|ASC_LRSWAP_DISABLE|ASC_MASTER_MODE|ASC_NORMAL_BCLK); - rk610_codec_write(codec,ACCELCODEC_R00, ASC_HPF_ENABLE|ASC_DSM_MODE_DISABLE|ASC_SCRAMBLE_DISABLE|ASC_DITHER_ENABLE|ASC_BCLKDIV_4); + rk610_codec_write(codec,ACCELCODEC_R00, ASC_HPF_ENABLE|ASC_DSM_MODE_ENABLE|ASC_SCRAMBLE_ENABLE|ASC_DITHER_ENABLE|ASC_BCLKDIV_4); //2volume,input,output digital_gain = Volume_Output; rk610_codec_write(codec,ACCELCODEC_R05, (digital_gain >> 8) & 0xFF); @@ -870,6 +870,9 @@ static ssize_t RK610_PROC_write(struct file *file, const char __user *buffer, unsigned long len, void *data) { char *cookie_pot; + char *p; + int reg; + int value; cookie_pot = (char *)vmalloc( len ); if (!cookie_pot) @@ -889,7 +892,53 @@ static ssize_t RK610_PROC_write(struct file *file, const char __user *buffer, break; case 'o': spk_ctrl_fun(GPIO_LOW); - break; + break; + case 'r': + case 'R': + printk("Read reg debug\n"); + if(cookie_pot[1] ==':') + { + strsep(&cookie_pot,":"); + while((p=strsep(&cookie_pot,","))) + { + reg = simple_strtol(p,NULL,16); + value = rk610_codec_read(rk610_codec_codec,reg); + printk("wm8994_read:0x%04x = 0x%04x\n",reg,value); + } + printk("\n"); + } + else + { + printk("Error Read reg debug.\n"); + printk("For example: echo 'r:22,23,24,25'>wm8994_ts\n"); + } + break; + case 'w': + case 'W': + printk("Write reg debug\n"); + if(cookie_pot[1] ==':') + { + strsep(&cookie_pot,":"); + while((p=strsep(&cookie_pot,"="))) + { + reg = simple_strtol(p,NULL,16); + p=strsep(&cookie_pot,","); + value = simple_strtol(p,NULL,16); + rk610_codec_write(rk610_codec_codec,reg,value); + printk("wm8994_write:0x%04x = 0x%04x\n",reg,value); + } + printk("\n"); + } + else + { + printk("Error Write reg debug.\n"); + printk("For example: w:22=0,23=0,24=0,25=0\n"); + } + break; + case 'D' : + printk("Dump reg\n"); + rk610_codec_reg_read(); + break; } return len; -- 2.34.1