aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/spear/spdif_out.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/spear/spdif_out.c')
-rw-r--r--sound/soc/spear/spdif_out.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 1e3c3dda3598..2fdf68c98d22 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -62,8 +62,6 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
62 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) 62 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
63 return -EINVAL; 63 return -EINVAL;
64 64
65 snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
66
67 ret = clk_enable(host->clk); 65 ret = clk_enable(host->clk);
68 if (ret) 66 if (ret)
69 return ret; 67 return ret;
@@ -84,7 +82,6 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
84 82
85 clk_disable(host->clk); 83 clk_disable(host->clk);
86 host->running = false; 84 host->running = false;
87 snd_soc_dai_set_dma_data(dai, substream, NULL);
88} 85}
89 86
90static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq, 87static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq,
@@ -243,8 +240,12 @@ static const struct snd_kcontrol_new spdif_out_controls[] = {
243 spdif_mute_get, spdif_mute_put), 240 spdif_mute_get, spdif_mute_put),
244}; 241};
245 242
246int spdif_soc_dai_probe(struct snd_soc_dai *dai) 243static int spdif_soc_dai_probe(struct snd_soc_dai *dai)
247{ 244{
245 struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
246
247 dai->playback_dma_data = &host->dma_params;
248
248 return snd_soc_add_dai_controls(dai, spdif_out_controls, 249 return snd_soc_add_dai_controls(dai, spdif_out_controls,
249 ARRAY_SIZE(spdif_out_controls)); 250 ARRAY_SIZE(spdif_out_controls));
250} 251}
@@ -281,30 +282,18 @@ static int spdif_out_probe(struct platform_device *pdev)
281 struct resource *res; 282 struct resource *res;
282 int ret; 283 int ret;
283 284
284 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
285 if (!res)
286 return -EINVAL;
287
288 if (!devm_request_mem_region(&pdev->dev, res->start,
289 resource_size(res), pdev->name)) {
290 dev_warn(&pdev->dev, "Failed to get memory resourse\n");
291 return -ENOENT;
292 }
293
294 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); 285 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
295 if (!host) { 286 if (!host) {
296 dev_warn(&pdev->dev, "kzalloc fail\n"); 287 dev_warn(&pdev->dev, "kzalloc fail\n");
297 return -ENOMEM; 288 return -ENOMEM;
298 } 289 }
299 290
300 host->io_base = devm_ioremap(&pdev->dev, res->start, 291 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
301 resource_size(res)); 292 host->io_base = devm_ioremap_resource(&pdev->dev, res);
302 if (!host->io_base) { 293 if (IS_ERR(host->io_base))
303 dev_warn(&pdev->dev, "ioremap failed\n"); 294 return PTR_ERR(host->io_base);
304 return -ENOMEM;
305 }
306 295
307 host->clk = clk_get(&pdev->dev, NULL); 296 host->clk = devm_clk_get(&pdev->dev, NULL);
308 if (IS_ERR(host->clk)) 297 if (IS_ERR(host->clk))
309 return PTR_ERR(host->clk); 298 return PTR_ERR(host->clk);
310 299
@@ -320,22 +309,12 @@ static int spdif_out_probe(struct platform_device *pdev)
320 309
321 ret = snd_soc_register_component(&pdev->dev, &spdif_out_component, 310 ret = snd_soc_register_component(&pdev->dev, &spdif_out_component,
322 &spdif_out_dai, 1); 311 &spdif_out_dai, 1);
323 if (ret != 0) { 312 return ret;
324 clk_put(host->clk);
325 return ret;
326 }
327
328 return 0;
329} 313}
330 314
331static int spdif_out_remove(struct platform_device *pdev) 315static int spdif_out_remove(struct platform_device *pdev)
332{ 316{
333 struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
334
335 snd_soc_unregister_component(&pdev->dev); 317 snd_soc_unregister_component(&pdev->dev);
336 dev_set_drvdata(&pdev->dev, NULL);
337
338 clk_put(host->clk);
339 318
340 return 0; 319 return 0;
341} 320}