#include "rt3261-dsp.h"
static const u16 rt3261_dsp_init[][2] = {
- {0x3fd2, 0x0038}, {0x229C, 0x0fa0}, {0x22d2, 0x8400}, {0x22ee, 0x0001},
+ {0x3fd2, 0x0038}, {0x229C, 0x0fa0}, {0x22d2, 0x8400}, {0x22ee, 0x0000},
{0x22f2, 0x0040}, {0x22f5, 0x8000}, {0x22f6, 0x0000}, {0x22f9, 0x007f},
{0x2310, 0x0880},
};
//static const u16 rt3261_dsp_441[][2] = {
unsigned short rt3261_dsp_441[][2] = {
{0x22c6, 0x0031}, {0x22c7, 0x0050}, {0x22c8, 0x0009}, {0x22fe, 0x0e5b},
- {0x22ff, 0x3c83}, {0x22fa, 0x2484}, {0x2301, 0x0001},
+ {0x22ff, 0x3883}, {0x22fa, 0x2484}, {0x2301, 0x0001},
};
#define RT3261_DSP_441_NUM (sizeof(rt3261_dsp_441) / sizeof(rt3261_dsp_441[0]))
return 0;
}
+
/**
* rt3261_dsp_write - Write DSP register.
* @codec: SoC audio codec device.
*
* Returns 0 for success or negative error code.
*/
-static int rt3261_dsp_write(struct snd_soc_codec *codec,
+int rt3261_dsp_write(struct snd_soc_codec *codec,
struct rt3261_dsp_param *param)
{
unsigned int dsp_val = snd_soc_read(codec, RT3261_DSP_CTRL3);
return ret;
}
+EXPORT_SYMBOL_GPL(rt3261_dsp_write);
+
/**
* rt3261_dsp_read - Read DSP register.
* @codec: SoC audio codec device.
*
* Returns DSP register value or negative error code.
*/
-static unsigned int rt3261_dsp_read(
+unsigned int rt3261_dsp_read(
struct snd_soc_codec *codec, unsigned int reg)
{
unsigned int val_h, val_l, value;
err:
return ret;
}
+EXPORT_SYMBOL_GPL(rt3261_dsp_read);
static int rt3261_dsp_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
rt3261_dsp_conf(codec);
ret = rt3261_dsp_read(codec, 0x3800);
pr_info("DSP version code = 0x%04x\n",ret);
- if(ret != 0x501a) {
+ /*if(ret != 0x501a) {
rt3261 = snd_soc_codec_get_drvdata(codec);
INIT_DELAYED_WORK(&rt3261->patch_work, rt3261_do_dsp_patch);
schedule_delayed_work(&rt3261->patch_work,
msecs_to_jiffies(100));
- }
+ }*/
snd_soc_update_bits(codec, RT3261_PWR_DIG2,
RT3261_PWR_I2S_DSP, 0);
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/vmalloc.h>
-char debug_write_read = 0;
#endif
static struct snd_soc_codec *rt3261_codec;
int ret;
struct clk *iis_clk;
- pr_info("Codec driver version %s\n", VERSION);
+ #if defined (CONFIG_SND_SOC_RT3224)
+ pr_info("Codec driver version %s, in fact you choose rt3224, no dsp!\n", VERSION);
+ #else
+ pr_info("Codec driver version %s, in fact you choose rt3261 with a dsp!\n", VERSION);
+ #endif
ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
if (ret != 0) {
int reg;
int i;
int value;
+ struct rt3261_dsp_param param;
cookie_pot = (char *)vmalloc( len );
if (!cookie_pot)
switch(cookie_pot[0])
{
- case 'd':
- case 'D':
- debug_write_read ++;
- debug_write_read %= 2;
- if(debug_write_read != 0)
- printk("Debug read and write reg on\n");
- else
- printk("Debug read and write reg off\n");
- break;
case 'r':
case 'R':
printk("Read reg debug\n");
if(cookie_pot[1] ==':')
{
- debug_write_read = 1;
strsep(&cookie_pot,":");
while((p=strsep(&cookie_pot,",")))
{
value = rt3261_read(rt3261_codec,reg);
printk("rt3261_read:0x%04x = 0x%04x\n",reg,value);
}
- debug_write_read = 0;
printk("\n");
}
else
printk("Write reg debug\n");
if(cookie_pot[1] ==':')
{
- debug_write_read = 1;
strsep(&cookie_pot,":");
while((p=strsep(&cookie_pot,"=")))
{
rt3261_write(rt3261_codec,reg,value);
printk("rt3261_write:0x%04x = 0x%04x\n",reg,value);
}
- debug_write_read = 0;
printk("\n");
}
else
}
break;
case 'a':
- printk("Dump rt3261 dsp reg \n");
+ printk("Dump rt3261 index reg \n");
for (i = 0; i < 0xb4; i++)
{
value = rt3261_index_read(rt3261_codec, i);
printk("rt3261_index_read:0x%04x = 0x%04x\n",i,value);
}
-
- break;
+ break;
+ #if defined (CONFIG_SND_SOC_RT3261)
+ case 'b':
+ param.cmd_fmt = 0x00e0;
+ param.cmd = RT3261_DSP_CMD_MW;
+ printk("Write dsp reg debug\n");
+ if(cookie_pot[1] ==':')
+ {
+ strsep(&cookie_pot,":");
+ while((p=strsep(&cookie_pot,"=")))
+ {
+ param.addr = simple_strtol(p,NULL,16);
+ p=strsep(&cookie_pot,",");
+ param.data = simple_strtol(p,NULL,16);
+ rt3261_dsp_write(rt3261_codec,¶m);
+ printk("rt3261_dsp_write:0x%04x = 0x%04x\n",param.addr,param.data);
+ }
+ printk("\n");
+ }
+ break;
+ case 'c':
+ printk("Read dsp reg debug\n");
+ if(cookie_pot[1] ==':')
+ {
+ strsep(&cookie_pot,":");
+ while((p=strsep(&cookie_pot,",")))
+ {
+ reg = simple_strtol(p,NULL,16);
+ value = rt3261_dsp_read(rt3261_codec,reg);
+ printk("rt3261_dsp_read:0x%04x = 0x%04x\n",reg,value);
+ }
+ printk("\n");
+ }
+ break;
+ #endif
default:
printk("Help for rt3261_ts .\n-->The Cmd list: \n");
printk("-->'d&&D' Open or Off the debug\n");