From: 宋秀杰 Date: Tue, 15 May 2012 11:11:11 +0000 (+0800) Subject: rk30 phone: modify some warnnings、error and unused code in aic3262 X-Git-Tag: firefly_0821_release~9180 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=700ce854e6595066640ede3d43a68021a228f90b;p=firefly-linux-kernel-4.4.55.git rk30 phone: modify some warnnings、error and unused code in aic3262 --- diff --git a/include/linux/mfd/tlv320aic3262-registers.h b/include/linux/mfd/tlv320aic3262-registers.h index 3c268349f685..169dba69787b 100644 --- a/include/linux/mfd/tlv320aic3262-registers.h +++ b/include/linux/mfd/tlv320aic3262-registers.h @@ -164,7 +164,7 @@ #define AIC3262_AVDD_TO_DVDD_MASK (0b00001000) #define AIC3262_AVDD_TO_DVDD 0x8 -#define AIC3262_EXT_ANALOG_SUPPLY_MASK (0b00001000) +#define AIC3262_EXT_ANALOG_SUPPLY_MASK (0b00000100) #define AIC3262_EXT_ANALOG_SUPPLY_OFF 0x4 #define AIC3262_LDAC_PTM MAKE_REG(0,1, 3) diff --git a/sound/soc/codecs/tlv320aic326x.c b/sound/soc/codecs/tlv320aic326x.c index ace8d2c9bdea..0de788331a04 100644 --- a/sound/soc/codecs/tlv320aic326x.c +++ b/sound/soc/codecs/tlv320aic326x.c @@ -65,11 +65,6 @@ #include "aic3262_codec_ops.h" #include "tlv320aic3262_default_fw.h" -#if 0 -#define DBG(x...) printk(KERN_INFO x) -#else -#define DBG(x...) -#endif #ifdef AIC3262_TiLoad extern int aic3262_driver_init(struct snd_soc_codec *codec); @@ -96,7 +91,7 @@ static u32 aic3262_reg_ctl; * This function reprograms the clock dividers etc. this flag can be used to * disable this when the clock dividers are programmed by pps config file */ -static int soc_static_freq_config = 1; +//static int soc_static_freq_config = 1; /****************************************************************************** Macros @@ -169,9 +164,9 @@ static int __new_control_info(struct snd_kcontrol *kcontrol,struct snd_ctl_elem_ return 0; } -static long debug_level = 0; -module_param(debug_level, int, 0); -MODULE_PARM_DESC(debug_level, "Debug level for printing"); +//static long debug_level = 0; +//module_param(debug_level, int, 0); +//MODULE_PARM_DESC(debug_level, "Debug level for printing"); /* *---------------------------------------------------------------------------- @@ -212,7 +207,7 @@ static int __new_control_put(struct snd_kcontrol *kcontrol, return 0; } -static ssize_t debug_level_show(struct device *dev, +/*static ssize_t debug_level_show(struct device *dev, struct device_attribute *attr, char *buf, size_t count) { @@ -228,9 +223,9 @@ static ssize_t debug_level_set(struct device *dev, if(ret) return ret; return count; -} +}*/ //sxj -static DEVICE_ATTR(debug_level,0644, debug_level_show, debug_level_set); +//static DEVICE_ATTR(debug_level,0644, debug_level_show, debug_level_set); static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0); static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1200, 50, 0); @@ -1097,8 +1092,8 @@ static int aic3262_test_put(struct snd_kcontrol *kcontrol, static int aic3262_set_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct aic3262_priv *priv_ds = snd_soc_codec_get_drvdata(codec); + //struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + //struct aic3262_priv *priv_ds = snd_soc_codec_get_drvdata(codec); return 0; } @@ -1843,7 +1838,7 @@ static void aic3262_accessory_work(struct work_struct *work) } /* audio interrupt handler */ -static irqreturn_t aic3262_audio_handler(int irq, void *data) +/*static irqreturn_t aic3262_audio_handler(int irq, void *data) { struct snd_soc_codec *codec = data; struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec); @@ -1852,7 +1847,7 @@ static irqreturn_t aic3262_audio_handler(int irq, void *data) msecs_to_jiffies(200)); return IRQ_HANDLED; -} +}*/ //sxj /* *---------------------------------------------------------------------------- @@ -2069,6 +2064,9 @@ static int aic3262_set_dai_sysclk(struct snd_soc_dai *codec_dai, codec = codec_dai->codec; aic3262 = snd_soc_codec_get_drvdata(codec); switch (freq) { + case AIC3262_FREQ_11289600: + aic3262->sysclk = freq; + return 0; case AIC3262_FREQ_12000000: aic3262->sysclk = freq; return 0; @@ -2338,12 +2336,10 @@ static int aic3262_codec_probe(struct snd_soc_codec *codec) int ret = 0; struct aic3262 *control; struct aic3262_priv *aic3262; - struct aic3262_jack_data *jack; + //struct aic3262_jack_data *jack; if(codec == NULL) dev_err(codec->dev,"codec pointer is NULL. \n"); - DBG("aic3262_codec_probe is ok\n"); //sxj - #ifdef AIC3262_PROC aic3262_proc_init(); #endif @@ -2371,9 +2367,9 @@ static int aic3262_codec_probe(struct snd_soc_codec *codec) ret = -ENOMEM; goto work_err; } - ret = device_create_file(codec->dev, &dev_attr_debug_level); + /*ret = device_create_file(codec->dev, &dev_attr_debug_level); if (ret) - dev_info(codec->dev, "Failed to add debug_level sysfs \n"); + dev_info(codec->dev, "Failed to add debug_level sysfs \n");*/ //sxj INIT_DELAYED_WORK(&aic3262->delayed_work, aic3262_accessory_work); mutex_init(&aic3262->mutex); @@ -2422,11 +2418,11 @@ static int aic3262_codec_probe(struct snd_soc_codec *codec) request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,"tlv320aic3262_fw_v1.bin", codec->dev, GFP_KERNEL,codec, aic3262_firmware_load); aic3262_codec = codec; - DBG("%s end of aic3262_codec_probe\n",__FILE__); //sxj + return 0; -irq_err: - switch_dev_unregister(&jack->sdev); -reg_err: +//irq_err: +// switch_dev_unregister(&jack->sdev); +//reg_err: //sxj work_err: kfree(aic3262); return 0; @@ -2444,7 +2440,7 @@ static int aic3262_codec_remove(struct snd_soc_codec *codec) /* power down chip */ struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec); struct aic3262 *control = codec->control_data; - struct aic3262_jack_data *jack = &aic3262->hs_jack; + //struct aic3262_jack_data *jack = &aic3262->hs_jack; //sxj aic3262_set_bias_level(codec, SND_SOC_BIAS_OFF); @@ -2461,7 +2457,7 @@ static int aic3262_codec_remove(struct snd_soc_codec *codec) release_firmware(aic3262->cur_fw); } /* destroy workqueue for jac dev */ - switch_dev_unregister(&jack->sdev); + //switch_dev_unregister(&jack->sdev); //sxj destroy_workqueue(aic3262->workqueue); kfree(aic3262); @@ -2600,7 +2596,7 @@ MODULE_LICENSE("GPL"); aic3262_write(aic3262_codec, 0x3f, 0xc0); aic3262_write(aic3262_codec, 0x40, 0x00); -}*/ +} static void AP_to_speaker(void) @@ -2643,7 +2639,7 @@ static void AP_to_speaker(void) aic3262_codec_write(aic3262_codec, AIC3262_PASI_DAC_DP_SETUP, 0xc0); aic3262_codec_write(aic3262_codec, AIC3262_DAC_MVOL_CONF, 0x00); -} +}*/ static void AP_to_headphone(void) @@ -2685,7 +2681,7 @@ static void AP_to_headphone(void) } -static void record_in1lr(void) +/*static void record_in1lr(void) { printk("record in1lr\n"); @@ -2734,11 +2730,11 @@ static void record_in2lr(void) aic3262_codec_write(aic3262_codec, MAKE_REG(0,0,127), 0x00); aic3262_codec_write(aic3262_codec, AIC3262_RESET_REG, 0x01); -} +}*/ static void test_playback(void) { - int ret; + printk("test palyback start\n"); AP_to_headphone( ); diff --git a/sound/soc/codecs/tlv320aic326x.h b/sound/soc/codecs/tlv320aic326x.h index c07950d97fd7..00b34121afc8 100644 --- a/sound/soc/codecs/tlv320aic326x.h +++ b/sound/soc/codecs/tlv320aic326x.h @@ -79,6 +79,7 @@ #define AIC3262_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \ | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) +#define AIC3262_FREQ_11289600 11289600 #define AIC3262_FREQ_12000000 12000000 #define AIC3262_FREQ_19200000 19200000 #define AIC3262_FREQ_24000000 24000000 diff --git a/sound/soc/rk29/rk29_aic3262.c b/sound/soc/rk29/rk29_aic3262.c index bf28f37c3536..0c230541098e 100644 --- a/sound/soc/rk29/rk29_aic3262.c +++ b/sound/soc/rk29/rk29_aic3262.c @@ -43,18 +43,18 @@ #include "../codecs/tlv320aic326x.h" #if 0 -#define DBG(x...) printk(KERN_INFO x) +#define DBG_AIC3262(x...) printk(KERN_INFO x) #else -#define DBG(x...) +#define DBG_AIC3262(x...) #endif -struct regulator *vddhf_reg=NULL; +//struct regulator *vddhf_reg=NULL; /* Headset jack */ -static struct snd_soc_jack hs_jack; +//static struct snd_soc_jack hs_jack; /*Headset jack detection DAPM pins */ -static struct snd_soc_jack_pin hs_jack_pins[] = { +/*static struct snd_soc_jack_pin hs_jack_pins[] = { { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, @@ -94,7 +94,7 @@ static int spk_event(struct snd_soc_dapm_widget *w, } } return 0; -} +}*/ @@ -159,7 +159,7 @@ static int rk29_aic3262_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; - DBG("rk29_aic3262_init\n"); + DBG_AIC3262("rk29_aic3262_init\n"); ret = snd_soc_add_controls(codec, rk29_aic326x_controls, ARRAY_SIZE(rk29_aic326x_controls)); @@ -184,14 +184,14 @@ static int rk29_aic3262_init(struct snd_soc_pcm_runtime *rtd) return ret; /* Headset jack detection */ - ret = snd_soc_jack_new(codec, "Headset Jack", + /*ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); - aic3262_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); + aic3262_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);*/ /* don't wait before switching of HS power */ rtd->pmdown_time = 0; @@ -207,35 +207,33 @@ static int rk29_aif1_hw_params(struct snd_pcm_substream *substream, unsigned int pll_out = 0; int div_bclk,div_mclk; int ret; - struct clk *general_pll; - printk("Enter::%s----%d\n",__FUNCTION__,__LINE__); /* set codec DAI configuration */ #if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE) - DBG("Set codec_dai slave\n"); + DBG_AIC3262("Set codec_dai slave\n"); ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); #endif #if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER) ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - DBG("Set codec_dai master\n"); + DBG_AIC3262("Set codec_dai master\n"); #endif if (ret < 0) return ret; /* set cpu DAI configuration */ #if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE) - DBG("Set cpu_dai master\n"); + DBG_AIC3262("Set cpu_dai master\n"); ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); #endif #if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER) ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - DBG("Set cpu_dai slave\n"); + DBG_AIC3262("Set cpu_dai slave\n"); #endif if (ret < 0) return ret; @@ -254,32 +252,29 @@ static int rk29_aif1_hw_params(struct snd_pcm_substream *substream, pll_out = 11289600; break; default: - DBG("Enter:%s, %d, Error rate=%d\n",__FUNCTION__,__LINE__,params_rate(params)); + DBG_AIC3262("Enter:%s, %d, Error rate=%d\n",__FUNCTION__,__LINE__,params_rate(params)); return -EINVAL; } - general_pll=clk_get(NULL, "general_pll"); - if(clk_get_rate(general_pll)>260000000) - {//288m - div_bclk=(pll_out/4)/params_rate(params)-1; - div_mclk=3; - } - - DBG("func is%s,gpll=%ld,pll_out=%d,div_mclk=%d\n",__FUNCTION__,clk_get_rate(general_pll),pll_out,div_mclk); - ret = snd_soc_dai_set_sysclk(cpu_dai, 0, 12000000, 0); + + div_bclk=(pll_out/4)/params_rate(params)-1; + div_mclk=3; + + DBG_AIC3262(" %s, pll_out=%d, div_bclk=%d, div_mclk=%d\n",__FUNCTION__,pll_out,div_bclk,div_mclk); + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0); if(ret < 0) { - DBG("rk29_hw_params_aic3262:failed to set the cpu sysclk for codec side\n"); + DBG_AIC3262("rk29_hw_params_aic3262:failed to set the cpu sysclk for codec side\n"); return ret; } - snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk); + snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, div_bclk); snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk); - DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params)); + DBG_AIC3262("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params)); //MCLK == 11289600 or 12288000 - ret = snd_soc_dai_set_sysclk(codec_dai, 0, 12000000, 0); + ret = snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, 0); if (ret < 0) { - DBG("rk29_hw_params_aic3262:failed to set the sysclk for codec side\n"); + DBG_AIC3262("rk29_hw_params_aic3262:failed to set the sysclk for codec side\n"); return ret; } @@ -377,7 +372,7 @@ static int __init audio_card_init(void) { int ret =0; - DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); + DBG_AIC3262("Enter::%s----%d\n",__FUNCTION__,__LINE__); rk29_snd_device = platform_device_alloc("soc-audio", -1); if (!rk29_snd_device) {