codec: compatible rt3261 && rt5616 && rt5631 codec
authoryj <yangjie@rock-chips.com>
Tue, 8 Apr 2014 00:43:38 +0000 (08:43 +0800)
committeryj <yangjie@rock-chips.com>
Tue, 8 Apr 2014 00:43:38 +0000 (08:43 +0800)
sound/soc/codecs/rt3261.c
sound/soc/codecs/rt5616.c
sound/soc/codecs/rt5631.c
sound/soc/rockchip/Makefile

index a159ca1adae5a26576bb250158b014c9978c5675..e900add9b2bdaee170103686db7e0321a94bd673 100755 (executable)
@@ -3651,11 +3651,18 @@ static int rt3261_i2c_probe(struct i2c_client *i2c,
 {
        struct rt3261_priv *rt3261;
        int ret;
+       char reg;
 
-       rt3261 = kzalloc(sizeof(struct rt3261_priv), GFP_KERNEL);
+       reg = RT3261_VENDOR_ID;
+       ret = i2c_master_recv(i2c, &reg, 1);
+       if (ret < 0){
+               printk("rt3261 && rt3224 probe error\n");
+               return ret;
+       }
+
+       rt3261 = devm_kzalloc(&i2c->dev,sizeof(struct rt3261_priv), GFP_KERNEL);
        if (NULL == rt3261)
                return -ENOMEM;
-
        rt3261->i2c = i2c;
 
        ret = rt3261_parse_dt_property(&i2c->dev, rt3261);
@@ -3672,8 +3679,6 @@ static int rt3261_i2c_probe(struct i2c_client *i2c,
        DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
        ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt3261,
                        rt3261_dai, ARRAY_SIZE(rt3261_dai));
-       if (ret < 0)
-               kfree(rt3261);
 
        return ret;
 }
index da5ca65f95430c87feb6741d7615c0da981d2a59..54005a73cdf82bf0f6986111e18b1fc4ffd0c33c 100755 (executable)
@@ -1707,8 +1707,6 @@ static int rt5616_codec_parse_dt_property(struct device *dev,
        enum of_gpio_flags flags;
        int ret;
 
-       printk("%s()\n", __FUNCTION__);
-
        if (!node) {
                printk("%s() dev->of_node is NULL\n", __FUNCTION__);
                return -ENODEV;
@@ -1753,9 +1751,16 @@ static int rt5616_i2c_probe(struct i2c_client *i2c,
 {
        struct rt5616_priv *rt5616;
        int ret;
-       printk("enter %s\n",__func__);
+       char reg;
 
-       rt5616 = kzalloc(sizeof(struct rt5616_priv), GFP_KERNEL);
+       reg = RT5616_HP_VOL;
+       ret = i2c_master_recv(i2c, &reg, 1);
+       if (ret < 0){
+               printk("RT5616 probe error\n");
+               return ret;
+       }
+
+       rt5616 = devm_kzalloc(&i2c->dev,sizeof(struct rt5616_priv), GFP_KERNEL);
        if (NULL == rt5616)
                return -ENOMEM;
 
@@ -1772,8 +1777,6 @@ static int rt5616_i2c_probe(struct i2c_client *i2c,
                        rt5616_dai, ARRAY_SIZE(rt5616_dai));
 
 err_r:
-       if (ret < 0)
-               kfree(rt5616);
        return ret;
 }
 
@@ -1811,7 +1814,6 @@ struct i2c_driver rt5616_i2c_driver = {
 
 static int __init rt5616_modinit(void)
 {
-       printk("enter %s\n",__func__);
        return i2c_add_driver(&rt5616_i2c_driver);
 }
 module_init(rt5616_modinit);
index b86647bdf223c9e7608da94266a145f03116d2cf..478f5cca8e466bf4c4515095e04fa7809c4691ef 100755 (executable)
@@ -2159,10 +2159,18 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
        struct rt5631_priv *rt5631;
        struct device_node *node = i2c->dev.of_node;
        int ret;
+       char reg;
 
        printk("RT5631 Audio Codec %s\n", RT5631_VERSION);
 
-       rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL);
+       reg = RT5631_SPK_OUT_VOL;
+       ret = i2c_master_recv(i2c, &reg, 1);
+       if (ret < 0){
+               printk("RT5631 probe error\n");
+               return ret;
+       }
+
+       rt5631 = devm_kzalloc(&i2c->dev,sizeof(struct rt5631_priv), GFP_KERNEL);
        if (NULL == rt5631)
                return -ENOMEM; 
 
@@ -2177,8 +2185,6 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
 
        ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5631,
                        rt5631_dai, ARRAY_SIZE(rt5631_dai));
-       if (ret < 0)
-               kfree(rt5631);
 
        return ret;
 }
index e10bbbe2865121b05183049701f199e49172645d..2c731cc1318e7a6e793f09599c1dc5f2e37686a4 100755 (executable)
@@ -59,11 +59,11 @@ obj-$(CONFIG_SND_RK_SOC_AIC3111) += snd-soc-aic3111.o
 obj-$(CONFIG_SND_RK_SOC_AIC3262) += snd-soc-aic3262.o
 obj-$(CONFIG_SND_RK_SOC_RK610) += snd-soc-rk610.o
 obj-$(CONFIG_SND_RK_SOC_RK616) += snd-soc-rk616.o
-obj-$(CONFIG_SND_RK_SOC_HDMI_I2S) += snd-soc-hdmi-i2s.o
-obj-$(CONFIG_SND_RK_SOC_HDMI_SPDIF) += snd-soc-hdmi-spdif.o
 obj-$(CONFIG_SND_RK_SOC_RK2928) += snd-soc-rk2928.o
 obj-$(CONFIG_SND_RK_SOC_ES8323) += snd-soc-es8323.o
 obj-$(CONFIG_SND_RK_SOC_RK3026) += snd-soc-rk3026.o
 obj-$(CONFIG_SND_RK_SOC_RK3190) += snd-soc-rk3190.o
 obj-$(CONFIG_SND_RK_SOC_RT5512) += snd-soc-rt5512.o
 obj-$(CONFIG_SND_RK_SOC_CX2070X) += snd-soc-cx2070x.o
+obj-$(CONFIG_SND_RK_SOC_HDMI_I2S) += snd-soc-hdmi-i2s.o
+obj-$(CONFIG_SND_RK_SOC_HDMI_SPDIF) += snd-soc-hdmi-spdif.o