struct platform_device rk29_device_iis_2ch = {
.name = "rk29_i2s",
- .id = 0,
+ .id = 1,
.num_resources = ARRAY_SIZE(rk29_iis_2ch_resource),
.resource = rk29_iis_2ch_resource,
};
struct platform_device rk29_device_iis_8ch = {
.name = "rk29_i2s",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(rk29_iis_8ch_resource),
.resource = rk29_iis_8ch_resource,
};
#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;
config SND_RK29_SOC_I2S_8CH
bool "Soc RK29 I2S 8 Channel support"
- default y
+ default n
depends on SND_RK29_SOC_I2S
help
This supports the use of the 8 Channel I2S interface on rk29 processors.
#include <mach/board.h>
#include <mach/rk29_iomap.h>
#include <mach/rk29-dma-pl330.h>
-
+#include <mach/iomux.h>
#include "rk29_pcm.h"
#include "rk29_i2s.h"
iismod = readl(&(pheadi2s->I2S_TXCR));
//iismod &= (~((1<<5)-1));
switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S8:
- iismod |= SAMPLE_DATA_8bit;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- iismod |= I2S_DATA_WIDTH(15);
- break;
- }
+ case SNDRV_PCM_FORMAT_S8:
+ iismod |= SAMPLE_DATA_8bit;
+ break;
+ case SNDRV_PCM_FORMAT_S16_LE:
+ iismod |= I2S_DATA_WIDTH(15);
+ break;
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ iismod |= I2S_DATA_WIDTH(19);
+ break;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ iismod |= I2S_DATA_WIDTH(23);
+ break;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ iismod |= I2S_DATA_WIDTH(31);
+ break;
+ }
iismod |= I2S_SLAVE_MODE;
static int rockchip_i2s_dai_probe(struct platform_device *pdev, struct snd_soc_dai *dai)
{
I2S_DBG("Enter %s, %d >>>>>>>>>>>\n", __func__, __LINE__);
-
+
+ switch(dai->id) {
+ case 0:
+ rk29_mux_api_set(GPIO2D0_I2S0CLK_MIIRXCLKIN_NAME, GPIO2H_I2S0_CLK);
+ rk29_mux_api_set(GPIO2D1_I2S0SCLK_MIICRS_NAME, GPIO2H_I2S0_SCLK);
+ rk29_mux_api_set(GPIO2D2_I2S0LRCKRX_MIITXERR_NAME, GPIO2H_I2S0_LRCK_RX);
+ rk29_mux_api_set(GPIO2D3_I2S0SDI_MIICOL_NAME, GPIO2H_I2S0_SDI);
+ rk29_mux_api_set(GPIO2D4_I2S0SDO0_MIIRXD2_NAME, GPIO2H_I2S0_SDO0);
+ rk29_mux_api_set(GPIO2D5_I2S0SDO1_MIIRXD3_NAME, GPIO2H_I2S0_SDO1);
+ rk29_mux_api_set(GPIO2D6_I2S0SDO2_MIITXD2_NAME, GPIO2H_I2S0_SDO2);
+ rk29_mux_api_set(GPIO2D7_I2S0SDO3_MIITXD3_NAME, GPIO2H_I2S0_SDO3);
+
+ rk29_mux_api_set(GPIO4D6_I2S0LRCKTX0_NAME, GPIO4H_I2S0_LRCK_TX0);
+ rk29_mux_api_set(GPIO4D7_I2S0LRCKTX1_NAME, GPIO4H_I2S0_LRCK_TX1);
+ break;
+ case 1:
+ rk29_mux_api_set(GPIO3A0_I2S1CLK_NAME, GPIO3L_I2S1_CLK);
+ rk29_mux_api_set(GPIO3A1_I2S1SCLK_NAME, GPIO3L_I2S1_SCLK);
+ rk29_mux_api_set(GPIO3A2_I2S1LRCKRX_NAME, GPIO3L_I2S1_LRCK_RX);
+ rk29_mux_api_set(GPIO3A3_I2S1SDI_NAME, GPIO3L_I2S1_SDI);
+ rk29_mux_api_set(GPIO3A4_I2S1SDO_NAME, GPIO3L_I2S1_SDO);
+ rk29_mux_api_set(GPIO3A5_I2S1LRCKTX_NAME, GPIO3L_I2S1_LRCK_TX);
+ break;
+ default:
+ I2S_DBG("Enter:%s, %d, Error For DevId!!!", __FUNCTION__, __LINE__);
+ return -EINVAL;
+ }
return 0;
}
i2s->dma_playback->dma_size = 4;
i2s->iis_clk = clk_get(&pdev->dev, "i2s");
+ I2S_DBG("Enter:%s, %d, iis_clk=%d\n", __FUNCTION__, __LINE__, i2s->iis_clk);
if (IS_ERR(i2s->iis_clk)) {
dev_err(&pdev->dev, "failed to get i2s clk\n");
ret = PTR_ERR(i2s->iis_clk);
}
clk_enable(i2s->iis_clk);
-
+ clk_set_rate(i2s->iis_clk, 12000000);
ret = rk29_i2s_probe(pdev, dai, i2s, 0);
if (ret)
goto err_clk;
static int rk29_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
- int ret;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- /*by Vincent Hsiung for EQ Vol Change*/
- #define HW_PARAMS_FLAG_EQVOL_ON 0x21
- #define HW_PARAMS_FLAG_EQVOL_OFF 0x22
- if ((params->flags == HW_PARAMS_FLAG_EQVOL_ON)||(params->flags == HW_PARAMS_FLAG_EQVOL_OFF))
- {
- ret = codec_dai->ops->hw_params(substream, params, codec_dai); //by Vincent
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- }
- else
- {
- /* set codec DAI configuration */
- #if defined (CONFIG_SND_CODEC_SOC_SLAVE)
- ret = codec_dai->ops->set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
- #endif
- #if defined (CONFIG_SND_CODEC_SOC_MASTER)
- ret = codec_dai->ops->set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM );
- #endif
- if (ret < 0)
- return ret;
- /* set cpu DAI configuration */
- #if defined (CONFIG_SND_CODEC_SOC_SLAVE)
- ret = cpu_dai->ops->set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
- #endif
- #if defined (CONFIG_SND_CODEC_SOC_MASTER)
- ret = cpu_dai->ops->set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
- #endif
- if (ret < 0)
- return ret;
- }
-
- return 0;
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+ struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ int ret;
+
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /*by Vincent Hsiung for EQ Vol Change*/
+ #define HW_PARAMS_FLAG_EQVOL_ON 0x21
+ #define HW_PARAMS_FLAG_EQVOL_OFF 0x22
+ if ((params->flags == HW_PARAMS_FLAG_EQVOL_ON)||(params->flags == HW_PARAMS_FLAG_EQVOL_OFF))
+ {
+ ret = codec_dai->ops->hw_params(substream, params, codec_dai); //by Vincent
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ }
+ else
+ {
+
+ /* set codec DAI configuration */
+ #if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
+ 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 );
+ #endif
+ if (ret < 0)
+ return ret;
+ #if 0
+ /* set cpu DAI configuration */
+ #if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
+ 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);
+ #endif
+ if (ret < 0)
+ return ret;
+ #endif
+ }
+
+ snd_soc_dai_set_clkdiv(codec_dai, WM8900_BCLK_DIV, WM8900_BCLK_DIV_4);
+ snd_soc_dai_set_clkdiv(codec_dai, WM8900_LRCLK_MODE, 0x400);
+ snd_soc_dai_set_clkdiv(codec_dai, WM8900_DAC_LRCLK,0x40);
+
+ return 0;
}
static const struct snd_soc_dapm_widget wm8900_dapm_widgets[] = {
static const struct snd_soc_dapm_route audio_map[]= {
- {"Audio Out", NULL, "LOUT1"},
- {"Audio Out", NULL, "ROUT1"},
+ {"Audio Out", NULL, "HP_L"},
+ {"Audio Out", NULL, "HP_R"},
{"Line in", NULL, "RINPUT1"},
{"Line in", NULL, "LINPUT1"},
{"Micn", NULL, "RINPUT2"},
struct snd_soc_dai *codec_dai = &codec->dai[0];
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- ret = snd_soc_dai_set_sysclk(codec_dai, 0,
- 12000000, SND_SOC_CLOCK_IN);
- if (ret < 0) {
- printk(KERN_ERR "Failed to set WM8900 SYSCLK: %d\n", ret);
- return ret;
- }
-
- /* Add specific widgets */
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+
+ /* Add specific widgets */
snd_soc_dapm_new_controls(codec, wm8900_dapm_widgets,
ARRAY_SIZE(wm8900_dapm_widgets));
- snd_soc_dapm_nc_pin(codec, "LOUT1");
- snd_soc_dapm_nc_pin(codec, "ROUT1");
-
- /* Set up specific audio path audio_mapnects */
- snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
-
- snd_soc_dapm_sync(codec);
-
- return 0;
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* Set up specific audio path audio_mapnects */
+ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ snd_soc_dapm_nc_pin(codec, "HP_L");
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ snd_soc_dapm_nc_pin(codec, "HP_R");
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ snd_soc_dapm_sync(codec);
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ return 0;
}
static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "WM8900",
.stream_name = "WM8900 PCM",
- .cpu_dai = &rk29_i2s_dai,
+ .cpu_dai = &rk29_i2s_dai[1],
.codec_dai = &wm8900_dai,
.init = rk29_wm8900_init,
.ops = &rk29_ops,
static int __init audio_card_init(void)
{
int ret =0;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
rk29_snd_device = platform_device_alloc("soc-audio", -1);
if (!rk29_snd_device) {
DBG("platform device allocation failed\n");
rk29_snd_devdata.dev = &rk29_snd_device->dev;
ret = platform_device_add(rk29_snd_device);
if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
+ DBG("platform device add failed\n");
+ platform_device_put(rk29_snd_device);
}
return ret;
}