aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/s3c2412-i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/samsung/s3c2412-i2s.c')
-rw-r--r--sound/soc/samsung/s3c2412-i2s.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 08c059be9104..d9d27cc0657c 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -33,25 +33,19 @@
33#include "regs-i2s-v2.h" 33#include "regs-i2s-v2.h"
34#include "s3c2412-i2s.h" 34#include "s3c2412-i2s.h"
35 35
36static struct s3c_dma_client s3c2412_dma_client_out = {
37 .name = "I2S PCM Stereo out"
38};
39
40static struct s3c_dma_client s3c2412_dma_client_in = {
41 .name = "I2S PCM Stereo in"
42};
43
44static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = { 36static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
45 .client = &s3c2412_dma_client_out, 37 .client =
38 (struct s3c_dma_client *)&s3c2412_i2s_pcm_stereo_out,
46 .channel = DMACH_I2S_OUT, 39 .channel = DMACH_I2S_OUT,
47 .dma_addr = S3C2410_PA_IIS + S3C2412_IISTXD, 40 .ch_name = "tx",
48 .dma_size = 4, 41 .dma_size = 4,
49}; 42};
50 43
51static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { 44static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {
52 .client = &s3c2412_dma_client_in, 45 .client =
46 (struct s3c_dma_client *)&s3c2412_i2s_pcm_stereo_in,
53 .channel = DMACH_I2S_IN, 47 .channel = DMACH_I2S_IN,
54 .dma_addr = S3C2410_PA_IIS + S3C2412_IISRXD, 48 .ch_name = "rx",
55 .dma_size = 4, 49 .dma_size = 4,
56}; 50};
57 51
@@ -63,6 +57,9 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
63 57
64 pr_debug("Entered %s\n", __func__); 58 pr_debug("Entered %s\n", __func__);
65 59
60 samsung_asoc_init_dma_data(dai, &s3c2412_i2s_pcm_stereo_out,
61 &s3c2412_i2s_pcm_stereo_in);
62
66 ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); 63 ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS);
67 if (ret) 64 if (ret)
68 return ret; 65 return ret;
@@ -70,10 +67,9 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
70 s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; 67 s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in;
71 s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; 68 s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out;
72 69
73 s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk"); 70 s3c2412_i2s.iis_cclk = devm_clk_get(dai->dev, "i2sclk");
74 if (IS_ERR(s3c2412_i2s.iis_cclk)) { 71 if (IS_ERR(s3c2412_i2s.iis_cclk)) {
75 pr_err("failed to get i2sclk clock\n"); 72 pr_err("failed to get i2sclk clock\n");
76 iounmap(s3c2412_i2s.regs);
77 return PTR_ERR(s3c2412_i2s.iis_cclk); 73 return PTR_ERR(s3c2412_i2s.iis_cclk);
78 } 74 }
79 75
@@ -94,8 +90,6 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
94static int s3c2412_i2s_remove(struct snd_soc_dai *dai) 90static int s3c2412_i2s_remove(struct snd_soc_dai *dai)
95{ 91{
96 clk_disable(s3c2412_i2s.iis_cclk); 92 clk_disable(s3c2412_i2s.iis_cclk);
97 clk_put(s3c2412_i2s.iis_cclk);
98 iounmap(s3c2412_i2s.regs);
99 93
100 return 0; 94 return 0;
101} 95}
@@ -105,18 +99,10 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
105 struct snd_soc_dai *cpu_dai) 99 struct snd_soc_dai *cpu_dai)
106{ 100{
107 struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); 101 struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai);
108 struct s3c_dma_params *dma_data;
109 u32 iismod; 102 u32 iismod;
110 103
111 pr_debug("Entered %s\n", __func__); 104 pr_debug("Entered %s\n", __func__);
112 105
113 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
114 dma_data = i2s->dma_playback;
115 else
116 dma_data = i2s->dma_capture;
117
118 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
119
120 iismod = readl(i2s->regs + S3C2412_IISMOD); 106 iismod = readl(i2s->regs + S3C2412_IISMOD);
121 pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); 107 pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);
122 108
@@ -169,6 +155,19 @@ static const struct snd_soc_component_driver s3c2412_i2s_component = {
169static int s3c2412_iis_dev_probe(struct platform_device *pdev) 155static int s3c2412_iis_dev_probe(struct platform_device *pdev)
170{ 156{
171 int ret = 0; 157 int ret = 0;
158 struct resource *res;
159
160 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
161 if (!res) {
162 dev_err(&pdev->dev, "Can't get IO resource.\n");
163 return -ENOENT;
164 }
165 s3c2412_i2s.regs = devm_ioremap_resource(&pdev->dev, res);
166 if (s3c2412_i2s.regs == NULL)
167 return -ENXIO;
168
169 s3c2412_i2s_pcm_stereo_out.dma_addr = res->start + S3C2412_IISTXD;
170 s3c2412_i2s_pcm_stereo_in.dma_addr = res->start + S3C2412_IISRXD;
172 171
173 ret = s3c_i2sv2_register_component(&pdev->dev, -1, 172 ret = s3c_i2sv2_register_component(&pdev->dev, -1,
174 &s3c2412_i2s_component, 173 &s3c2412_i2s_component,