From: 邱建斌 Date: Sat, 24 Mar 2012 12:51:57 +0000 (+0800) Subject: rk30: fix i2s and pcm bug X-Git-Tag: firefly_0821_release~9595^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=072c21e360c2eec829965e76c5a6b435252f69db;p=firefly-linux-kernel-4.4.55.git rk30: fix i2s and pcm bug --- diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index b61c35ea5d5a..9948c2bb72ba 100755 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -176,7 +176,7 @@ static struct rt5631_init_reg init_list[] = { //{RT5631_STEREO_DAC_VOL_1 , 0x004C}, {RT5631_ADC_REC_MIXER , 0xb0f0},//Record Mixer source from Mic1 by default {RT5631_ADC_CTRL_1 , 0x0006},//STEREO ADC CONTROL 1 - {RT5631_MIC_CTRL_2 , 0x6600},//0x8800},//0x5500}, //Mic1/Mic2 boost 40DB by default + {RT5631_MIC_CTRL_2 , 0x4400},//0x8800},//0x6600}, //Mic1/Mic2 boost 40DB by default {RT5631_PWR_MANAG_ADD1 , 0x93e0}, #if RT5631_ALC_ADC_FUNC_ENA @@ -1910,8 +1910,13 @@ static int rt5631_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: - rt5631_write_mask(codec, RT5631_PWR_MANAG_ADD2, 0, - PWR_MICBIAS1_VOL | PWR_MICBIAS2_VOL); + // rt5631_write_mask(codec, RT5631_PWR_MANAG_ADD2, 0, + // PWR_MICBIAS1_VOL | PWR_MICBIAS2_VOL); + printk("standby rt5631\n"); + rt5631_write(codec, RT5631_PWR_MANAG_ADD1, 0x0000); + rt5631_write(codec, RT5631_PWR_MANAG_ADD2, 0x0000); + rt5631_write(codec, RT5631_PWR_MANAG_ADD3, 0x0000); + rt5631_write(codec, RT5631_PWR_MANAG_ADD4, 0x0000); break; case SND_SOC_BIAS_OFF: @@ -1938,8 +1943,6 @@ static int rt5631_probe(struct snd_soc_codec *codec) struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); unsigned int val; int ret; - - DBG("%s..............\n", __func__); ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); diff --git a/sound/soc/rk29/rk29_pcm.c b/sound/soc/rk29/rk29_pcm.c index c015652d6a2d..8630a4ab5a0b 100755 --- a/sound/soc/rk29/rk29_pcm.c +++ b/sound/soc/rk29/rk29_pcm.c @@ -144,8 +144,22 @@ void rk29_audio_buffdone(void *dev_id, int size, return; if (!substream->runtime) return; + switch(result) + { + case RK29_RES_OK: + DBG("::%s----%d RK29_RES_OK\n",__FUNCTION__,__LINE__); + break; + case RK29_RES_ERR: + DBG("::%s----%d RK29_RES_ERR\n",__FUNCTION__,__LINE__); + break; + case RK29_RES_ABORT: + DBG("Enter::%s----%d RK29_RES_ABORT \n",__FUNCTION__,__LINE__); + return; + } prtd = substream->runtime->private_data; + if(!(prtd->state & ST_RUNNING)) + return; DBG("Enter::%s----%d, substream=%p, prtd=%p\n",__FUNCTION__,__LINE__, substream, prtd); if (substream){ snd_pcm_period_elapsed(substream); diff --git a/sound/soc/rk29/rk29_rt5631.c b/sound/soc/rk29/rk29_rt5631.c index c38fefe198c2..05e5c9af4412 100644 --- a/sound/soc/rk29/rk29_rt5631.c +++ b/sound/soc/rk29/rk29_rt5631.c @@ -195,7 +195,13 @@ static struct snd_soc_dai_link rk29_dai = { .stream_name = "RT5631 PCM", .codec_name = "RT5631.0-001a", .platform_name = "rockchip-audio", +#if defined(CONFIG_SND_RK29_SOC_I2S_8CH) .cpu_dai_name = "rk29_i2s.0", +#elif defined(CONFIG_SND_RK29_SOC_I2S_2CH) + .cpu_dai_name = "rk29_i2s.1", +#else + .cpu_dai_name = "rk29_i2s.2", +#endif .codec_dai_name = "RT5631 HiFi", .init = rk29_rt5631_init, .ops = &rk29_ops, diff --git a/sound/soc/rk29/rk30_i2s.c b/sound/soc/rk29/rk30_i2s.c index 0daeeae57230..348c3ce54d65 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 2 +#define MAX_I2S 3 struct rk29_i2s_info { struct device *dev;