#ifdef CONFIG_RK_HDMI_CTL_CODEC
#ifdef CONFIG_MACH_RK_FAC
- #ifdef CONFIG_SND_RK29_SOC_ES8323
+ #ifdef CONFIG_SND_RK_SOC_ES8323
extern void es8323_codec_set_spk(bool on);
#endif
- #ifdef CONFIG_SND_RK29_SOC_RT5616
+ #ifdef CONFIG_SND_RK_SOC_RT5616
extern void rt5616_codec_set_spk(bool on);
#endif
#ifdef CONFIG_SND_RK_SOC_RK616
extern void rk616_codec_set_spk(bool on);
#endif
+ #ifdef CONFIG_SND_RK_SOC_RT5631
+ extern void rk610_codec_set_spk(bool on);
+ #endif
+ #ifdef CONFIG_SND_RK_SOC_RK610
+ extern void rk610_codec_set_spk(bool on);
+ #endif
#else
extern void codec_set_spk(bool on);
#endif
#endif
#ifdef CONFIG_RK_HDMI_CTL_CODEC
#ifdef CONFIG_MACH_RK_FAC
- #ifdef CONFIG_SND_RK29_SOC_ES8323
+ #ifdef CONFIG_SND_RK_SOC_ES8323
es8323_codec_set_spk(1);
#endif
- #ifdef CONFIG_SND_RK29_SOC_RT5616
+ #ifdef CONFIG_SND_RK_SOC_RT5616
rt5616_codec_set_spk(1);
#endif
#ifdef CONFIG_SND_RK_SOC_RK616
rk616_codec_set_spk(1);
- #endif
+ #endif
+ #ifdef CONFIG_SND_RK_SOC_RK610
+ rk610_codec_set_spk(1);
+ #endif
+ #ifdef CONFIG_SND_RK_SOC_RT5631
+ rt5631_codec_set_spk(1);
+ #endif
#else
codec_set_spk(1);
#endif
#endif
#if defined (CONFIG_SND_RK_SOC_RK616)
rk616_codec_set_spk(0);
- #endif
+ #endif
+ #ifdef CONFIG_SND_RK_SOC_RK610
+ rk610_codec_set_spk(1);
+ #endif
+ #ifdef CONFIG_SND_RK_SOC_RT5631
+ rt5631_codec_set_spk(1);
+ #endif
#else
codec_set_spk(0);
#endif
snd-soc-rt5616-objs := rt5616.o
snd-soc-rt5631-phone-objs := rt5631_phone.o
snd-soc-rt5625-objs := rt5625.o
-snd-soc-rt5639-objs := rt5639.o rt5639_ioctl.o rt56xx_ioctl.o
-snd-soc-rt5640-objs := rt5640.o rt5640-dsp.o rt5640_ioctl.o rt56xx_ioctl.o
-snd-soc-rt3261-objs := rt3261.o rt3261-dsp.o rt3261_ioctl.o rt_codec_ioctl.o
+obj-y := rt56xx_ioctl.o
+snd-soc-rt5639-objs := rt5639.o rt5639_ioctl.o
+snd-soc-rt5640-objs := rt5640.o rt5640-dsp.o rt5640_ioctl.o
snd-soc-rt3224-objs := rt3261.o rt3261_ioctl.o rt_codec_ioctl.o
+snd-soc-rt3261-objs := rt3261-dsp.o
snd-soc-cs42l52-objs := cs42l52.o
snd-soc-rk1000-objs := rk1000_codec.o
snd-soc-rk610-objs := rk610_codec.o
}
}
-void codec_set_spk(bool on)
+void rk610_codec_set_spk(bool on)
{
struct rk610_codec_priv *rk610_codec;
if(!rk610_codec_codec)
else
gpio_set_value(rk610_codec->spk_ctrl_io, GPIO_LOW);
}
-EXPORT_SYMBOL(codec_set_spk);
+EXPORT_SYMBOL(rk610_codec_set_spk);
/*
* read rk610 register cache
}
codec->write = rt3261_write;
- #if defined (CONFIG_SND_SOC_RT5623)
+ #if 0//defined (CONFIG_SND_SOC_RT5623)
struct clk *iis_clk;
//for rt5623 MCLK use
iis_clk = clk_get_sys("rk_i2s.2", "i2s");
#include "rt3261-dsp.h"
#endif
-hweq_t hweq_param[] = {
+static hweq_t hweq_param[] = {
{/* NORMAL */
{0},
{0},
return 0;
}
-void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
+static void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
{
snd_soc_update_bits(codec, RT3261_DRC_AGC_1, RT3261_DRC_AGC_P_MASK |
RT3261_DRC_AGC_MASK | RT3261_DRC_AGC_UPD,
1 << RT3261_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
+static void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
int sample_rate, int recovery_rate, int limit_level)
{
snd_soc_update_bits(codec, RT3261_DRC_AGC_3, RT3261_DRC_AGC_TAR_MASK,
0x1 << RT3261_DRC_AGC_UPD_BIT);
}
-void set_digital_boost_gain(struct snd_soc_codec *codec,
+static void set_digital_boost_gain(struct snd_soc_codec *codec,
int post_gain, int pre_gain)
{
snd_soc_update_bits(codec, RT3261_DRC_AGC_2,
RT3261_DRC_AGC_UPD, 1 << RT3261_DRC_AGC_UPD_BIT);
}
-void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
+static void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
int noise_gate_hold_en, int compression_gain, int noise_gate_th)
{
snd_soc_update_bits(codec, RT3261_DRC_AGC_3,
RT3261_DRC_AGC_UPD, 1 << RT3261_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_compression(struct snd_soc_codec *codec,
+static void set_drc_agc_compression(struct snd_soc_codec *codec,
int compression_en, int compression_ratio)
{
snd_soc_update_bits(codec, RT3261_DRC_AGC_2,
RT3261_DRC_AGC_UPD, 1 << RT3261_DRC_AGC_UPD_BIT);
}
-void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
+static void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
{
unsigned int reg = snd_soc_read(codec, RT3261_DRC_AGC_1);
RT3261_DRC_AGC_RC_SFT;
}
-void get_digital_boost_gain(struct snd_soc_codec *codec,
+static void get_digital_boost_gain(struct snd_soc_codec *codec,
int *post_gain, int *pre_gain)
{
unsigned int reg = snd_soc_read(codec, RT3261_DRC_AGC_2);
*pre_gain = (reg & RT3261_DRC_AGC_PRB_MASK) >> RT3261_DRC_AGC_PRB_SFT;
}
-void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
+static void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
int *noise_gate_hold_en, int *compression_gain, int *noise_gate_th)
{
unsigned int reg = snd_soc_read(codec, RT3261_DRC_AGC_3);
RT3261_DRC_AGC_NGT_SFT;
}
-void get_drc_agc_compression(struct snd_soc_codec *codec,
+static void get_drc_agc_compression(struct snd_soc_codec *codec,
int *compression_en, int *compression_ratio)
{
unsigned int reg = snd_soc_read(codec, RT3261_DRC_AGC_2);
#include "rt5623.h"
-#define RT5623_PROC
-#ifdef RT5623_PROC
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/vmalloc.h>
-#endif
-
#define MODEM_ON 1
#define MODEM_OFF 0
};
MODULE_DEVICE_TABLE(i2c, rt5623_i2c_id);
-static int rt5623_proc_init(void);
static int rt5623_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
pr_info("%s(%d)\n", __func__, __LINE__);
- #ifdef RT5623_PROC
- rt5623_proc_init();
- #endif
-
i2c_client = i2c;
rt5623_reset(i2c);
status = MODEM_ON;
return 0;
}
-static int __devexit rt5623_i2c_remove(struct i2c_client *i2c)
+static int rt5623_i2c_remove(struct i2c_client *i2c)
{
return 0;
}
.owner = THIS_MODULE,
},
.probe = rt5623_i2c_probe,
- .remove = __devexit_p(rt5623_i2c_remove),
+ .remove = rt5623_i2c_remove,
.id_table = rt5623_i2c_id,
};
MODULE_LICENSE("GPL");
-#ifdef RT5623_PROC
-
-static ssize_t rt5623_proc_write(struct file *file, const char __user *buffer,
- unsigned long len, void *data)
-{
- char *cookie_pot;
- char *p;
- int reg;
- int value;
-
- cookie_pot = (char *)vmalloc( len );
- if (!cookie_pot)
- {
- return -ENOMEM;
- }
- else
- {
- if (copy_from_user( cookie_pot, buffer, len ))
- return -EFAULT;
- }
-
- switch(cookie_pot[0])
- {
- case 'r':
- case 'R':
- printk("Read reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,",")))
- {
- reg = simple_strtol(p,NULL,16);
- value = codec_read(i2c_client,reg);
- printk("codec_read:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- else
- {
- printk("Error Read reg debug.\n");
- printk("For example: echo r:22,23,24,25>rt5623_ts\n");
- }
- break;
- case 'w':
- case 'W':
- printk("Write reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,"=")))
- {
- reg = simple_strtol(p,NULL,16);
- p=strsep(&cookie_pot,",");
- value = simple_strtol(p,NULL,16);
- codec_write(i2c_client,reg,value);
- printk("codec_write:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- else
- {
- printk("Error Write reg debug.\n");
- printk("For example: w:22=0,23=0,24=0,25=0>rt5623_ts\n");
- }
- break;
- case 'a':
- printk("Dump reg \n");
-
- for(reg = 0; reg < 0x6e; reg+=2)
- {
- value = codec_read(i2c_client,reg);
- printk("codec_read:0x%04x = 0x%04x\n",reg,value);
- }
-
- break;
- default:
- printk("Help for rt5623_ts .\n-->The Cmd list: \n");
- printk("-->'d&&D' Open or Off the debug\n");
- printk("-->'r&&R' Read reg debug,Example: echo 'r:22,23,24,25'>rt5623_ts\n");
- printk("-->'w&&W' Write reg debug,Example: echo 'w:22=0,23=0,24=0,25=0'>rt5623_ts\n");
- break;
- }
-
- return len;
-}
-
-static const struct file_operations rt5623_proc_fops = {
- .owner = THIS_MODULE,
-};
-
-static int rt5623_proc_init(void)
-{
- struct proc_dir_entry *rt5623_proc_entry;
- rt5623_proc_entry = create_proc_entry("driver/rt5623_ts", 0777, NULL);
- if(rt5623_proc_entry != NULL)
- {
- rt5623_proc_entry->write_proc = rt5623_proc_write;
- return 0;
- }
- else
- {
- printk("create proc error !\n");
- return -1;
- }
-}
-#endif
-
[RT5631_PSEUDO_SPATL_CTRL] = 0x0553,
};
-void rt5631_codec_set_spk(bool on)
+void rt5631_phone_set_spk(bool on)
{
struct snd_soc_codec *codec = rt5631_codec;
{3072000, 12288000, 0x0a90},
};
-struct coeff_clk_div coeff_div[] = {
+static struct coeff_clk_div coeff_div[] = {
/* sysclk is 256fs */
{2048000, 8000 * 32, 8000, 0x1000},
{2048000, 8000 * 64, 8000, 0x0000},
SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S8)
-struct snd_soc_dai_ops rt5631_ops = {
+static struct snd_soc_dai_ops rt5631_ops = {
.hw_params = rt5631_hifi_pcm_params,
.set_fmt = rt5631_hifi_codec_set_dai_fmt,
.set_sysclk = rt5631_hifi_codec_set_dai_sysclk,
.set_pll = rt5631_codec_set_dai_pll,
};
-struct snd_soc_dai_driver rt5631_dai[] = {
+static struct snd_soc_dai_driver rt5631_dai[] = {
{
.name = "RT5631 HiFi",
.id = RT5631_AIF1,
const struct i2c_device_id *id)
{
struct rt5631_priv *rt5631;
+ struct device_node *rt5631_np = i2c->dev.of_node;
int ret;
+ int val = 0;
rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL);
if (NULL == rt5631)
return -ENOMEM;
-
+ if(!of_property_read_u32(rt5631_np, "rt5631-phone", &val)){
+ if(val)
+ {
+ printk("rt5631 use for phone\n");
+ }
+ else
+ return -1;
+ }
+ else
+ return -1;
i2c_set_clientdata(i2c, rt5631);
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5631,
// return 0;
}
-struct i2c_driver rt5631_i2c_driver = {
+static struct i2c_driver rt5631_i2c_driver = {
.driver = {
.name = "RT5631",
.owner = THIS_MODULE,
}
}
-void DC_Calibrate(struct snd_soc_codec *codec)
+static void DC_Calibrate(struct snd_soc_codec *codec)
{
unsigned int sclk_src;
#include "rt5639-dsp.h"
#endif
-hweq_t hweq_param[] = {
+static hweq_t hweq_param[] = {
{/* NORMAL */
{0},
{0},
return 0;
}
-void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
+static void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
{
snd_soc_update_bits(codec, RT5639_DRC_AGC_1, RT5639_DRC_AGC_P_MASK |
RT5639_DRC_AGC_MASK | RT5639_DRC_AGC_UPD,
1 << RT5639_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
+static void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
int sample_rate, int recovery_rate, int limit_level)
{
snd_soc_update_bits(codec, RT5639_DRC_AGC_3, RT5639_DRC_AGC_TAR_MASK,
0x1 << RT5639_DRC_AGC_UPD_BIT);
}
-void set_digital_boost_gain(struct snd_soc_codec *codec,
+static void set_digital_boost_gain(struct snd_soc_codec *codec,
int post_gain, int pre_gain)
{
snd_soc_update_bits(codec, RT5639_DRC_AGC_2,
RT5639_DRC_AGC_UPD, 1 << RT5639_DRC_AGC_UPD_BIT);
}
-void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
+static void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
int noise_gate_hold_en, int compression_gain, int noise_gate_th)
{
snd_soc_update_bits(codec, RT5639_DRC_AGC_3,
RT5639_DRC_AGC_UPD, 1 << RT5639_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_compression(struct snd_soc_codec *codec,
+static void set_drc_agc_compression(struct snd_soc_codec *codec,
int compression_en, int compression_ratio)
{
snd_soc_update_bits(codec, RT5639_DRC_AGC_2,
RT5639_DRC_AGC_UPD, 1 << RT5639_DRC_AGC_UPD_BIT);
}
-void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
+static void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
{
unsigned int reg = snd_soc_read(codec, RT5639_DRC_AGC_1);
*path = (reg & RT5639_DRC_AGC_P_MASK) >> RT5639_DRC_AGC_P_SFT;
}
-void get_drc_agc_parameters(struct snd_soc_codec *codec, int *attack_rate,
+static void get_drc_agc_parameters(struct snd_soc_codec *codec, int *attack_rate,
int *sample_rate, int *recovery_rate, int *limit_level)
{
unsigned int reg = snd_soc_read(codec, RT5639_DRC_AGC_3);
RT5639_DRC_AGC_RC_SFT;
}
-void get_digital_boost_gain(struct snd_soc_codec *codec,
+static void get_digital_boost_gain(struct snd_soc_codec *codec,
int *post_gain, int *pre_gain)
{
unsigned int reg = snd_soc_read(codec, RT5639_DRC_AGC_2);
*pre_gain = (reg & RT5639_DRC_AGC_PRB_MASK) >> RT5639_DRC_AGC_PRB_SFT;
}
-void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
+static void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
int *noise_gate_hold_en, int *compression_gain, int *noise_gate_th)
{
unsigned int reg = snd_soc_read(codec, RT5639_DRC_AGC_3);
RT5639_DRC_AGC_NGT_SFT;
}
-void get_drc_agc_compression(struct snd_soc_codec *codec,
+static void get_drc_agc_compression(struct snd_soc_codec *codec,
int *compression_en, int *compression_ratio)
{
unsigned int reg = snd_soc_read(codec, RT5639_DRC_AGC_2);
}
}
-void DC_Calibrate(struct snd_soc_codec *codec)
+static void DC_Calibrate(struct snd_soc_codec *codec)
{
unsigned int sclk_src;
#include "rt5640-dsp.h"
#endif
-hweq_t hweq_param[] = {
+static hweq_t hweq_param[] = {
{/* NORMAL */
{0},
{0},
return 0;
}
-void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
+static void set_drc_agc_enable(struct snd_soc_codec *codec, int enable, int path)
{
snd_soc_update_bits(codec, RT5640_DRC_AGC_1, RT5640_DRC_AGC_P_MASK |
RT5640_DRC_AGC_MASK | RT5640_DRC_AGC_UPD,
1 << RT5640_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
+static void set_drc_agc_parameters(struct snd_soc_codec *codec, int attack_rate,
int sample_rate, int recovery_rate, int limit_level)
{
snd_soc_update_bits(codec, RT5640_DRC_AGC_3, RT5640_DRC_AGC_TAR_MASK,
0x1 << RT5640_DRC_AGC_UPD_BIT);
}
-void set_digital_boost_gain(struct snd_soc_codec *codec,
+static void set_digital_boost_gain(struct snd_soc_codec *codec,
int post_gain, int pre_gain)
{
snd_soc_update_bits(codec, RT5640_DRC_AGC_2,
RT5640_DRC_AGC_UPD, 1 << RT5640_DRC_AGC_UPD_BIT);
}
-void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
+static void set_noise_gate(struct snd_soc_codec *codec, int noise_gate_en,
int noise_gate_hold_en, int compression_gain, int noise_gate_th)
{
snd_soc_update_bits(codec, RT5640_DRC_AGC_3,
RT5640_DRC_AGC_UPD, 1 << RT5640_DRC_AGC_UPD_BIT);
}
-void set_drc_agc_compression(struct snd_soc_codec *codec,
+static void set_drc_agc_compression(struct snd_soc_codec *codec,
int compression_en, int compression_ratio)
{
snd_soc_update_bits(codec, RT5640_DRC_AGC_2,
RT5640_DRC_AGC_UPD, 1 << RT5640_DRC_AGC_UPD_BIT);
}
-void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
+static void get_drc_agc_enable(struct snd_soc_codec *codec, int *enable, int *path)
{
unsigned int reg = snd_soc_read(codec, RT5640_DRC_AGC_1);
*path = (reg & RT5640_DRC_AGC_P_MASK) >> RT5640_DRC_AGC_P_SFT;
}
-void get_drc_agc_parameters(struct snd_soc_codec *codec, int *attack_rate,
+static void get_drc_agc_parameters(struct snd_soc_codec *codec, int *attack_rate,
int *sample_rate, int *recovery_rate, int *limit_level)
{
unsigned int reg = snd_soc_read(codec, RT5640_DRC_AGC_3);
RT5640_DRC_AGC_RC_SFT;
}
-void get_digital_boost_gain(struct snd_soc_codec *codec,
+static void get_digital_boost_gain(struct snd_soc_codec *codec,
int *post_gain, int *pre_gain)
{
unsigned int reg = snd_soc_read(codec, RT5640_DRC_AGC_2);
*pre_gain = (reg & RT5640_DRC_AGC_PRB_MASK) >> RT5640_DRC_AGC_PRB_SFT;
}
-void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
+static void get_noise_gate(struct snd_soc_codec *codec, int *noise_gate_en,
int *noise_gate_hold_en, int *compression_gain, int *noise_gate_th)
{
unsigned int reg = snd_soc_read(codec, RT5640_DRC_AGC_3);
RT5640_DRC_AGC_NGT_SFT;
}
-void get_drc_agc_compression(struct snd_soc_codec *codec,
+static void get_drc_agc_compression(struct snd_soc_codec *codec,
int *compression_en, int *compression_ratio)
{
unsigned int reg = snd_soc_read(codec, RT5640_DRC_AGC_2);
if((24576000%params_rate(params))==0) //for 8k,16k,32k,48k
{
- snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 24576000);
+ snd_soc_dai_set_pll(codec_dai,0,RT5621_PLL_FR_MCLK,pll_out, 24576000);
snd_soc_dai_set_sysclk(codec_dai,0, 24576000, SND_SOC_CLOCK_IN);
}
else if((22579200%params_rate(params))==0) //for 11k,22k,44k
{
- snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 22579200);
+ snd_soc_dai_set_pll(codec_dai,0,RT5621_PLL_FR_MCLK,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0, 22579200, SND_SOC_CLOCK_IN);
}
}