ASoC: samsung: Add devm_clk_get to pcm.c
[deliverable/linux.git] / sound / soc / samsung / i2s.c
index a5cbdb4f1655d8213a778159c34a0fb0321b2b77..07ff3e7cb890c59112cf67bc0be1443ac3e05efa 100644 (file)
@@ -22,8 +22,6 @@
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/dma.h>
-
 #include <linux/platform_data/asoc-s3c.h>
 
 #include "dma.h"
@@ -453,6 +451,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
        u32 mod = readl(i2s->addr + I2SMOD);
 
        switch (clk_id) {
+       case SAMSUNG_I2S_OPCLK:
+               mod &= ~MOD_OPCLK_MASK;
+               mod |= dir;
+               break;
        case SAMSUNG_I2S_CDCLK:
                /* Shouldn't matter in GATING(CLOCK_IN) mode */
                if (dir == SND_SOC_CLOCK_IN)
@@ -702,6 +704,8 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
        }
        writel(mod, i2s->addr + I2SMOD);
 
+       samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
+
        i2s->frmclk = params_rate(params);
 
        return 0;
@@ -724,9 +728,6 @@ static int i2s_startup(struct snd_pcm_substream *substream,
        else
                i2s->mode |= DAI_MANAGER;
 
-       /* Enforce set_sysclk in Master mode */
-       i2s->rclk_srcrate = 0;
-
        if (!any_active(i2s) && (i2s->quirks & QUIRK_NEED_RSTCLR))
                writel(CON_RSTCLR, i2s->addr + I2SCON);
 
@@ -946,8 +947,11 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
        struct i2s_dai *i2s = to_info(dai);
        struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai;
 
-       if (other && other->clk) /* If this is probe on secondary */
+       if (other && other->clk) { /* If this is probe on secondary */
+               samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback,
+                                          NULL);
                goto probe_exit;
+       }
 
        i2s->addr = ioremap(i2s->base, 0x100);
        if (i2s->addr == NULL) {
@@ -963,7 +967,7 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
        }
        clk_prepare_enable(i2s->clk);
 
-       snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
+       samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
 
        if (other) {
                other->addr = i2s->addr;
@@ -981,6 +985,7 @@ probe_exit:
        /* Reset any constraint on RFS and BFS */
        i2s->rfs = 0;
        i2s->bfs = 0;
+       i2s->rclk_srcrate = 0;
        i2s_txctrl(i2s, 0);
        i2s_rxctrl(i2s, 0);
        i2s_fifo(i2s, FIC_TXFLUSH);
@@ -1208,10 +1213,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
        pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
        pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
        pri_dai->dma_playback.client =
-               (struct s3c2410_dma_client *)&pri_dai->dma_playback;
+               (struct s3c_dma_client *)&pri_dai->dma_playback;
        pri_dai->dma_playback.ch_name = "tx";
        pri_dai->dma_capture.client =
-               (struct s3c2410_dma_client *)&pri_dai->dma_capture;
+               (struct s3c_dma_client *)&pri_dai->dma_capture;
        pri_dai->dma_capture.ch_name = "rx";
        pri_dai->dma_playback.dma_size = 4;
        pri_dai->dma_capture.dma_size = 4;
@@ -1230,7 +1235,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
                }
                sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
                sec_dai->dma_playback.client =
-                       (struct s3c2410_dma_client *)&sec_dai->dma_playback;
+                       (struct s3c_dma_client *)&sec_dai->dma_playback;
                sec_dai->dma_playback.ch_name = "tx-sec";
 
                if (!np) {
@@ -1263,7 +1268,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 
        return 0;
 err:
-       release_mem_region(regs_base, resource_size(res));
+       if (res)
+               release_mem_region(regs_base, resource_size(res));
 
        return ret;
 }
@@ -1289,8 +1295,6 @@ static int samsung_i2s_remove(struct platform_device *pdev)
        i2s->pri_dai = NULL;
        i2s->sec_dai = NULL;
 
-       samsung_asoc_dma_platform_unregister(&pdev->dev);
-
        return 0;
 }
 
This page took 0.026201 seconds and 5 git commands to generate.