rk30: add rt5631 supply
author邱建斌 <qjb@rock-chips.com>
Sat, 24 Mar 2012 03:07:30 +0000 (11:07 +0800)
committer邱建斌 <qjb@rock-chips.com>
Sat, 24 Mar 2012 03:07:30 +0000 (11:07 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/clock_data.c
arch/arm/mach-rk30/devices.c
sound/soc/codecs/rt5631.c
sound/soc/rk29/rk29_i2s.h
sound/soc/rk29/rk30_i2s.c

index 36731d2bb068f0b49ce4a5fe7d23bb65d90bf693..959ae14ea79bd6bfefc307825642db422714ba62 100755 (executable)
@@ -836,6 +836,14 @@ static struct i2c_board_info __initdata i2c0_info[] = {
                .flags         = 0,
        },
 #endif
+#if defined (CONFIG_SND_SOC_RT5631)
+        {
+                .type                   = "rt5631",
+                .addr                   = 0x1a,
+                .flags                  = 0,
+        },
+#endif
+
 };
 #endif
 
index a6b465de1b6fd5a046c016bad67601e18ec99151..bc623f8971722dc5f0e85f5f3b38d8f7ffefeb44 100644 (file)
@@ -2316,20 +2316,20 @@ static struct clk_lookup clks[] = {
 
        
        CLK1(i2s_pll),
-       CLK("rk30_i2s.0", "i2s_div", &clk_i2s0_div),
-       CLK("rk30_i2s.0", "i2s_frac_div", &clk_i2s0_frac_div),
-       CLK("rk30_i2s.0", "i2s", &clk_i2s0),
-       CLK("rk30_i2s.0", "hclk_i2s", &clk_hclk_i2s0_2ch),
-
-       CLK("rk30_i2s.1", "i2s_div", &clk_i2s1_div),
-       CLK("rk30_i2s.1", "i2s_frac_div", &clk_i2s1_frac_div),
-       CLK("rk30_i2s.1", "i2s", &clk_i2s1),
-       CLK("rk30_i2s.1", "hclk_i2s", &clk_hclk_i2s1_2ch),
-
-       CLK("rk30_i2s.2", "i2s_div", &clk_i2s2_div),
-       CLK("rk30_i2s.2", "i2s_frac_div", &clk_i2s2_frac_div),
-       CLK("rk30_i2s.2", "i2s", &clk_i2s2),
-       CLK("rk30_i2s.2", "hclk_i2s", &clk_hclk_i2s_8ch),
+       CLK("rk29_i2s.0", "i2s_div", &clk_i2s0_div),
+       CLK("rk29_i2s.0", "i2s_frac_div", &clk_i2s0_frac_div),
+       CLK("rk29_i2s.0", "i2s", &clk_i2s0),
+       CLK("rk29_i2s.0", "hclk_i2s", &clk_hclk_i2s0_2ch),
+
+       CLK("rk29_i2s.1", "i2s_div", &clk_i2s1_div),
+       CLK("rk29_i2s.1", "i2s_frac_div", &clk_i2s1_frac_div),
+       CLK("rk29_i2s.1", "i2s", &clk_i2s1),
+       CLK("rk29_i2s.1", "hclk_i2s", &clk_hclk_i2s1_2ch),
+
+       CLK("rk29_i2s.2", "i2s_div", &clk_i2s2_div),
+       CLK("rk29_i2s.2", "i2s_frac_div", &clk_i2s2_frac_div),
+       CLK("rk29_i2s.2", "i2s", &clk_i2s2),
+       CLK("rk29_i2s.2", "hclk_i2s", &clk_hclk_i2s_8ch),
        
        CLK1(spdif_div),
        CLK1(spdif_frac_div),
index 43374f02851427d42783b7b7f1cf9293e1b9c674..035342158caf5ff61dda40aedcd2b581cbaf18d9 100755 (executable)
@@ -814,6 +814,7 @@ static struct platform_device device_ipp = {
 #endif
 
 #ifdef CONFIG_SND_RK29_SOC_I2S
+#ifdef CONFIG_SND_RK29_SOC_I2S_8CH
 static struct resource resource_iis0_8ch[] = {
        [0] = {
                .start  = RK30_I2S0_8CH_PHYS,
@@ -843,7 +844,8 @@ static struct platform_device device_iis0_8ch = {
        .num_resources  = ARRAY_SIZE(resource_iis0_8ch),
        .resource       = resource_iis0_8ch,
 };
-
+#endif
+#ifdef CONFIG_SND_RK29_SOC_I2S_2CH
 static struct resource resource_iis1_2ch[] = {
        [0] = {
                .start  = RK30_I2S1_2CH_PHYS,
@@ -873,7 +875,8 @@ static struct platform_device device_iis1_2ch = {
        .num_resources  = ARRAY_SIZE(resource_iis1_2ch),
        .resource       = resource_iis1_2ch,
 };
-
+#endif
+#ifdef CONFIG_SND_RK_SOC_I2S2_2CH
 static struct resource resource_iis2_2ch[] = {
        [0] = {
                .start  = RK30_I2S2_2CH_PHYS,
@@ -904,6 +907,7 @@ static struct platform_device device_iis2_2ch = {
        .resource       = resource_iis2_2ch,
 };
 #endif
+#endif
 
 static struct platform_device device_pcm = {
        .name = "rockchip-audio",
index 09e132db93a67b9eba569309227f9ead27efb993..b61c35ea5d5ad05820a4f8baf3cc13cde55bb47e 100755 (executable)
@@ -1938,6 +1938,8 @@ static int rt5631_probe(struct snd_soc_codec *codec)
        struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
        unsigned int val;
        int ret;
+
+       DBG("%s..............\n", __func__);
        ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
        if (ret != 0) {
                dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
@@ -1991,7 +1993,7 @@ static int rt5631_probe(struct snd_soc_codec *codec)
                return ret;
        }
 
-       pr_info("RT5631 initial ok!\n");
+       DBG("RT5631 initial ok!\n");
 
        return 0;
 }
@@ -2112,7 +2114,7 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
        struct rt5631_priv *rt5631;
        int ret;
 
-       pr_info("RT5631 Audio Codec %s\n", RT5631_VERSION);
+       DBG("RT5631 Audio Codec %s\n", RT5631_VERSION);
 
        rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL);
        if (NULL == rt5631)
index 67b343a0f99ad3e3951f3d2f6ac0e878944917d3..7787d32f39f286b34b66b7946b33192bcd86c1ec 100755 (executable)
        #define I2S_MCLK_DIV(x)         ((0xFF&x)<<16)
        #define I2S_MCLK_DIV_MASK       ((0xFF)<<16)
        
+       #define I2S_RX_SCLK_DIV(x)      ((x&0xFF)<<8)
+       #define I2S_RX_SCLK_DIV_MASK    ((0xFF)<<8)
+       
        #define I2S_TX_SCLK_DIV(x)      (x&0xFF)
-       #define I2S_TX_SCLK_DIV_MASK    (0xFF)
+       #define I2S_TX_SCLK_DIV_MASK    (0xFF)
 #endif
 
 /* I2S_DMACR */
index 4497b178d259d493ac8afa873a4349424e049dbd..0daeeae572301e7cc24498a6bb387f0d7f2727bd 100755 (executable)
@@ -139,7 +139,6 @@ static void rockchip_snd_txctrl(struct rk29_i2s_info *i2s, int on, bool stopI2S)
        else
        {
                //stop tx
-
                flag_i2s_tx = 0;
                if ((flag_i2s_rx == 0) && (flag_i2s_tx == 0))
                {
@@ -404,7 +403,7 @@ static int rockchip_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
         
        I2S_DBG("Enter:%s, %d, i2s=0x%p, freq=%d\n", __FUNCTION__, __LINE__, i2s, freq);
        /*add scu clk source and enable clk*/
-//     clk_set_rate(i2s->iis_clk, freq);
+       clk_set_rate(i2s->iis_clk, freq);
        return 0;
 }
 
@@ -420,7 +419,6 @@ static int rockchip_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
        i2s = to_info(cpu_dai);
         
        //stereo mode MCLK/SCK=4  
-       
        reg = readl(&(pheadi2s->I2S_CKR));
 
        I2S_DBG("Enter:%s, %d, div_id=0x%08X, div=0x%08X\n", __FUNCTION__, __LINE__, div_id, div);
@@ -430,6 +428,8 @@ static int rockchip_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
         case ROCKCHIP_DIV_BCLK:
             reg &= ~I2S_TX_SCLK_DIV_MASK;
             reg |= I2S_TX_SCLK_DIV(div);
+            reg &= ~I2S_RX_SCLK_DIV_MASK;
+            reg |= I2S_RX_SCLK_DIV(div);                       
             break;
         case ROCKCHIP_DIV_MCLK:
             reg &= ~I2S_MCLK_DIV_MASK;
@@ -556,16 +556,16 @@ static int rk29_i2s_probe(struct platform_device *pdev,
                dev_err(dev, "cannot ioremap registers\n");
                return -ENXIO;
        }
-#if 0
-       i2s->iis_pclk = clk_get(dev, "i2s");
+
+       i2s->iis_pclk = clk_get(dev, "hclk_i2s");
        if (IS_ERR(i2s->iis_pclk)) {
                dev_err(dev, "failed to get iis_clock\n");
                iounmap(i2s->regs);
                return -ENOENT;
        }
-
        clk_enable(i2s->iis_pclk);
-#endif
+
+
        /* Mark ourselves as in TXRX mode so we can run through our cleanup
         * process without warnings. */
        rockchip_snd_txctrl(i2s, 0, true);
@@ -657,7 +657,7 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev)
         WARN_ON(rk29_dma_request(i2s->dma_playback->channel, i2s->dma_playback->client, NULL));
         WARN_ON(rk29_dma_request(i2s->dma_capture->channel, i2s->dma_capture->client, NULL));
 #endif
-#if 0
+
        i2s->iis_clk = clk_get(&pdev->dev, "i2s");
        I2S_DBG("Enter:%s, %d, iis_clk=%p\n", __FUNCTION__, __LINE__, i2s->iis_clk);
        if (IS_ERR(i2s->iis_clk)) {
@@ -668,7 +668,7 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev)
 
        clk_enable(i2s->iis_clk);
        clk_set_rate(i2s->iis_clk, 11289600);
-#endif 
+
        ret = rk29_i2s_probe(pdev, dai, i2s, 0);
        if (ret)
                goto err_clk;
@@ -744,10 +744,12 @@ static int proc_i2s_show(struct seq_file *s, void *v)
 {
 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
        struct rk29_i2s_info *i2s=&rk29_i2s[0];
-#elif CONFIG_SND_RK29_SOC_I2S_2CH
+#else 
+#ifdef CONFIG_SND_RK29_SOC_I2S_2CH
        struct rk29_i2s_info *i2s=&rk29_i2s[1];
 #else
        struct rk29_i2s_info *i2s=&rk29_i2s[2];
+#endif
 #endif
        printk("========Show I2S reg========\n");