#include "wm8900.h"
+
+#if 0
+#define WM8900_DBG(x...) printk(KERN_INFO x)
+#else
+#define WM8900_DBG(x...)
+#endif
+
/* WM8900 register space */
#define WM8900_REG_RESET 0x0
#define WM8900_REG_ID 0x0
static void wm8900_reset(struct snd_soc_codec *codec)
{
+ WM8900_DBG("Enter:%s, %d, codec=0x%8X \n", __FUNCTION__, __LINE__,codec);
snd_soc_write(codec, WM8900_REG_RESET, 0);
memcpy(codec->reg_cache, wm8900_reg_defaults,
{
struct snd_soc_codec *codec = w->codec;
u16 hpctl1 = snd_soc_read(codec, WM8900_REG_HPCTL1);
+
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
hpctl1 = WM8900_REG_HPCTL1_HP_CLAMP_IP |
WM8900_REG_HPCTL1_HP_CLAMP_OP;
snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1);
+ WM8900_DBG("Enter:%s, %d, HPCTL=0x%04X \n", __FUNCTION__, __LINE__, hpctl1);
break;
case SND_SOC_DAPM_POST_PMU:
snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1);
hpctl1 &= ~WM8900_REG_HPCTL1_HP_SHORT;
snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1);
+ WM8900_DBG("Enter:%s, %d, HPCTL=0x%04X \n", __FUNCTION__, __LINE__, hpctl1);
break;
case SND_SOC_DAPM_PRE_PMD:
WM8900_REG_HPCTL1_HP_CLAMP_OP;
hpctl1 &= ~WM8900_REG_HPCTL1_HP_IPSTAGE_ENA;
snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1);
+ WM8900_DBG("Enter:%s, %d, HPCTL=0x%04X \n", __FUNCTION__, __LINE__, hpctl1);
break;
case SND_SOC_DAPM_POST_PMD:
/* Disable everything */
snd_soc_write(codec, WM8900_REG_HPCTL1, 0);
+ WM8900_DBG("Enter:%s, %d, HPCTL=0x%04X \n", __FUNCTION__, __LINE__, hpctl1);
break;
default:
static int wm8900_add_widgets(struct snd_soc_codec *codec)
{
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
snd_soc_dapm_new_controls(codec, wm8900_dapm_widgets,
ARRAY_SIZE(wm8900_dapm_widgets));
-
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
-
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
snd_soc_dapm_new_widgets(codec);
return 0;
struct snd_soc_codec *codec = socdev->card->codec;
u16 reg;
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
reg = snd_soc_read(codec, WM8900_REG_AUDIO1) & ~0x60;
switch (params_format(params)) {
reg &= ~WM8900_REG_DACCTRL_DAC_SB_FILT;
snd_soc_write(codec, WM8900_REG_DACCTRL, reg);
+
+ snd_soc_write(codec, WM8900_REG_POWER3, 0xEF);
+
+ snd_soc_write(codec, WM8900_REG_LOUTMIXCTL1, 0x150);
+ snd_soc_write(codec, WM8900_REG_ROUTMIXCTL1, 0x150);
+ snd_soc_write(codec, WM8900_REG_LOUT2CTL, 0x126);
+ snd_soc_write(codec, WM8900_REG_ROUT2CTL, 0x126);
+ snd_soc_write(codec, WM8900_REG_HPCTL1, 0xC0);
}
return 0;
unsigned int div;
BUG_ON(!Fout);
-
+
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
/* The FLL must run at 90-100MHz which is then scaled down to
* the output value by FLLCLK_DIV. */
target = Fout;
struct _fll_div fll_div;
unsigned int reg;
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
if (wm8900->fll_in == freq_in && wm8900->fll_out == freq_out)
return 0;
static int wm8900_set_dai_pll(struct snd_soc_dai *codec_dai,
int pll_id, unsigned int freq_in, unsigned int freq_out)
{
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
return wm8900_set_fll(codec_dai->codec, pll_id, freq_in, freq_out);
}
{
struct snd_soc_codec *codec = codec_dai->codec;
unsigned int reg;
+ WM8900_DBG("Enter:%s, %d, div_id=%d, div=%d \n", __FUNCTION__, __LINE__, div_id, div);
switch (div_id) {
case WM8900_BCLK_DIV:
struct snd_soc_codec *codec = codec_dai->codec;
unsigned int clocking1, aif1, aif3, aif4;
+ WM8900_DBG("Enter:%s, %d, fmt=0x%08X \n", __FUNCTION__, __LINE__, fmt);
+
clocking1 = snd_soc_read(codec, WM8900_REG_CLOCKING1);
aif1 = snd_soc_read(codec, WM8900_REG_AUDIO1);
aif3 = snd_soc_read(codec, WM8900_REG_AUDIO3);
{
struct snd_soc_codec *codec = codec_dai->codec;
u16 reg;
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
reg = snd_soc_read(codec, WM8900_REG_DACCTRL);
{
u16 reg;
+ WM8900_DBG("Enter:%s, %d, level=0x%08X \n", __FUNCTION__, __LINE__, level);
+
switch (level) {
case SND_SOC_BIAS_ON:
/* Enable thermal shutdown */
WM8900_REG_POWER2_SYSCLK_ENA);
break;
}
+
+
codec->bias_level = level;
return 0;
}
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;
struct wm8900_priv *wm8900 = codec->private_data;
+
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
int fll_out = wm8900->fll_out;
int fll_in = wm8900->fll_in;
int ret;
unsigned int reg;
int ret;
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
wm8900 = kzalloc(sizeof(struct wm8900_priv), GFP_KERNEL);
if (wm8900 == NULL)
return -ENOMEM;
snd_soc_write(codec, WM8900_REG_RADC_DV,
snd_soc_read(codec, WM8900_REG_RADC_DV) | 0x100);
+ /* For Fzf Test */
+ #if 1
+ snd_soc_write(codec, WM8900_REG_LDAC_DV,
+ (snd_soc_read(codec, WM8900_REG_LDAC_DV)&0xFF00) | 0xB0);
+ snd_soc_write(codec, WM8900_REG_RDAC_DV,
+ (snd_soc_read(codec, WM8900_REG_RDAC_DV)&0xFF00) | 0xB0);
+ #endif
/* Set the DAC and mixer output bias */
snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81);
static __devexit int wm8900_i2c_remove(struct i2c_client *client)
{
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
snd_soc_unregister_dai(&wm8900_dai);
snd_soc_unregister_codec(wm8900_codec);
#ifdef CONFIG_PM
static int wm8900_i2c_suspend(struct i2c_client *client, pm_message_t msg)
{
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
return snd_soc_suspend_device(&client->dev);
}
struct snd_soc_codec *codec;
int ret = 0;
+ WM8900_DBG("Enter:%s, %d \n", __FUNCTION__, __LINE__);
+
if (!wm8900_codec) {
dev_err(&pdev->dev, "I2C client not yet instantiated\n");
return -ENODEV;