From adba4d2fdbce481b5e02adaf42795f9fb4390a65 Mon Sep 17 00:00:00 2001 From: yj Date: Tue, 8 Apr 2014 08:43:38 +0800 Subject: [PATCH] codec: compatible rt3261 && rt5616 && rt5631 codec --- sound/soc/codecs/rt3261.c | 13 +++++++++---- sound/soc/codecs/rt5616.c | 16 +++++++++------- sound/soc/codecs/rt5631.c | 12 +++++++++--- sound/soc/rockchip/Makefile | 4 ++-- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/rt3261.c b/sound/soc/codecs/rt3261.c index a159ca1adae5..e900add9b2bd 100755 --- a/sound/soc/codecs/rt3261.c +++ b/sound/soc/codecs/rt3261.c @@ -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, ®, 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; } diff --git a/sound/soc/codecs/rt5616.c b/sound/soc/codecs/rt5616.c index da5ca65f9543..54005a73cdf8 100755 --- a/sound/soc/codecs/rt5616.c +++ b/sound/soc/codecs/rt5616.c @@ -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, ®, 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); diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index b86647bdf223..478f5cca8e46 100755 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -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, ®, 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; } diff --git a/sound/soc/rockchip/Makefile b/sound/soc/rockchip/Makefile index e10bbbe28651..2c731cc1318e 100755 --- a/sound/soc/rockchip/Makefile +++ b/sound/soc/rockchip/Makefile @@ -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 -- 2.34.1