codec:mod for compatible
authoryj <yangjie@rock-chips.com>
Wed, 26 Mar 2014 06:01:39 +0000 (14:01 +0800)
committeryj <yangjie@rock-chips.com>
Wed, 26 Mar 2014 06:01:39 +0000 (14:01 +0800)
sound/soc/codecs/rt3261.c
sound/soc/codecs/rt5631.c

index 1f993df97771a6ca0ca84d4549b662b7b2da1b3d..ea5f1ceac7ddc3e49067821c0508171855a6bfb7 100755 (executable)
@@ -49,7 +49,7 @@ enum {
 
 static struct snd_soc_codec *rt3261_codec;
 
-#if 1
+#if 0
 #define DBG(x...)      printk(KERN_DEBUG x)
 #else
 #define DBG(x...)
@@ -3363,7 +3363,11 @@ static int rt3261_probe(struct snd_soc_codec *codec)
        }
        #endif
        
-       rt3261_reset(codec);
+       ret=rt3261_reset(codec);
+       if (ret < 0)
+       {
+               return -ENODEV;
+       }
        snd_soc_update_bits(codec, RT3261_PWR_ANLG1,
                RT3261_PWR_VREF1 | RT3261_PWR_MB |
                RT3261_PWR_BG | RT3261_PWR_VREF2,
@@ -3576,7 +3580,7 @@ static int rt3261_parse_dt_property(struct device *dev,
        int ret;
        enum of_gpio_flags flags;
 
-       printk("%s()\n", __FUNCTION__);
+       DBG("%s()\n", __FUNCTION__);
 
        if (!node)
                return -ENODEV;
index 3527e97626de6b65f6d992fa30b81562d46d74cb..35e829400efe15a072f33d9a4c8cf914b8565b6b 100755 (executable)
@@ -120,8 +120,14 @@ static unsigned int rt5631_read_index(struct snd_soc_codec *codec,
                                unsigned int reg)
 {
        unsigned int value;
+       int ret = 0;
+
+       ret = rt5631_write(codec, RT5631_INDEX_ADD, reg);
+       if (ret < 0)
+       {
+               return ret;
+       }
 
-       rt5631_write(codec, RT5631_INDEX_ADD, reg);
        value = rt5631_read(codec, RT5631_INDEX_DATA);
 
        return value;
@@ -1985,7 +1991,7 @@ static int rt5631_set_bias_level(struct snd_soc_codec *codec,
 static int rt5631_probe(struct snd_soc_codec *codec)
 {
        struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
-       unsigned int val;
+       int val;
        int ret;
        ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
        if (ret != 0) {
@@ -1995,6 +2001,10 @@ static int rt5631_probe(struct snd_soc_codec *codec)
        codec->cache_bypass = 1;
 
        val = rt5631_read_index(codec, RT5631_ADDA_MIXER_INTL_REG3);
+       if(val < 0)
+       {
+               return -ENODEV;
+       }
        if (val & 0x0002)
                rt5631->codec_version = 1;
        else
@@ -2056,7 +2066,6 @@ static int rt5631_remove(struct snd_soc_codec *codec)
 
 
 #if (RT5631_SPK_TIMER == 1)    
-       /* Timer¡¡module¡¡uninstalling */
        int ret;
        ret = del_timer(&spk_timer);
        if(ret) printk("The timer is still in use...\n");