diff options
author | Mark Brown <broonie@linaro.org> | 2013-06-10 05:26:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-10 05:26:16 -0400 |
commit | 915b2c750e4a0036afa0449f5d376b5b4e8717d8 (patch) | |
tree | 5b5ae6df1c763ce09e25bfed76310b68258d62e3 | |
parent | 2bdc1bb2b4e1f517d8aa5bbbad9cb6ccac8a94fb (diff) | |
parent | dbdf6b54340e1671439a4a5efbd15b7a0b14eacb (diff) |
Merge branch 'topic/fsl' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-sgtl5000
-rw-r--r-- | sound/soc/fsl/Kconfig | 5 | ||||
-rw-r--r-- | sound/soc/fsl/Makefile | 11 | ||||
-rw-r--r-- | sound/soc/fsl/eukrea-tlv320.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 13 | ||||
-rw-r--r-- | sound/soc/fsl/imx-audmux.c | 8 | ||||
-rw-r--r-- | sound/soc/fsl/imx-mc13783.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-fiq.c | 92 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm.c | 145 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm.h | 10 | ||||
-rw-r--r-- | sound/soc/fsl/imx-sgtl5000.c | 7 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.c | 44 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.h | 3 | ||||
-rw-r--r-- | sound/soc/fsl/mx27vis-aic32x4.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/phycore-ac97.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/wm1133-ev1.c | 2 |
16 files changed, 127 insertions, 223 deletions
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 3843a18d4e56..7860cc27e5b2 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -108,18 +108,13 @@ if SND_IMX_SOC | |||
108 | config SND_SOC_IMX_SSI | 108 | config SND_SOC_IMX_SSI |
109 | tristate | 109 | tristate |
110 | 110 | ||
111 | config SND_SOC_IMX_PCM | ||
112 | tristate | ||
113 | |||
114 | config SND_SOC_IMX_PCM_FIQ | 111 | config SND_SOC_IMX_PCM_FIQ |
115 | bool | 112 | bool |
116 | select FIQ | 113 | select FIQ |
117 | select SND_SOC_IMX_PCM | ||
118 | 114 | ||
119 | config SND_SOC_IMX_PCM_DMA | 115 | config SND_SOC_IMX_PCM_DMA |
120 | bool | 116 | bool |
121 | select SND_SOC_GENERIC_DMAENGINE_PCM | 117 | select SND_SOC_GENERIC_DMAENGINE_PCM |
122 | select SND_SOC_IMX_PCM | ||
123 | 118 | ||
124 | config SND_SOC_IMX_AUDMUX | 119 | config SND_SOC_IMX_AUDMUX |
125 | tristate | 120 | tristate |
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index afd34794db53..91883f8a2321 100644 --- a/sound/soc/fsl/Makefile +++ b/sound/soc/fsl/Makefile | |||
@@ -30,18 +30,11 @@ obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o | |||
30 | # i.MX Platform Support | 30 | # i.MX Platform Support |
31 | snd-soc-imx-ssi-objs := imx-ssi.o | 31 | snd-soc-imx-ssi-objs := imx-ssi.o |
32 | snd-soc-imx-audmux-objs := imx-audmux.o | 32 | snd-soc-imx-audmux-objs := imx-audmux.o |
33 | snd-soc-imx-pcm-objs := imx-pcm.o | ||
34 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_FIQ),) | ||
35 | snd-soc-imx-pcm-objs += imx-pcm-fiq.o | ||
36 | endif | ||
37 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_DMA),) | ||
38 | snd-soc-imx-pcm-objs += imx-pcm-dma.o | ||
39 | endif | ||
40 | |||
41 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o | 33 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o |
42 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o | 34 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o |
43 | 35 | ||
44 | obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o | 36 | obj-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += imx-pcm-fiq.o |
37 | obj-$(CONFIG_SND_SOC_IMX_PCM_DMA) += imx-pcm-dma.o | ||
45 | 38 | ||
46 | # i.MX Machine Support | 39 | # i.MX Machine Support |
47 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o | 40 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o |
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index 75ffdf0e2aad..9a4a0ca2c1de 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c | |||
@@ -80,7 +80,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { | |||
80 | .name = "tlv320aic23", | 80 | .name = "tlv320aic23", |
81 | .stream_name = "TLV320AIC23", | 81 | .stream_name = "TLV320AIC23", |
82 | .codec_dai_name = "tlv320aic23-hifi", | 82 | .codec_dai_name = "tlv320aic23-hifi", |
83 | .platform_name = "imx-fiq-pcm-audio.0", | 83 | .platform_name = "imx-ssi.0", |
84 | .codec_name = "tlv320aic23-codec.0-001a", | 84 | .codec_name = "tlv320aic23-codec.0-001a", |
85 | .cpu_dai_name = "imx-ssi.0", | 85 | .cpu_dai_name = "imx-ssi.0", |
86 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0f0bed6def9e..2f2d837df07f 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -122,7 +122,6 @@ struct fsl_ssi_private { | |||
122 | bool new_binding; | 122 | bool new_binding; |
123 | bool ssi_on_imx; | 123 | bool ssi_on_imx; |
124 | struct clk *clk; | 124 | struct clk *clk; |
125 | struct platform_device *imx_pcm_pdev; | ||
126 | struct snd_dmaengine_dai_dma_data dma_params_tx; | 125 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
127 | struct snd_dmaengine_dai_dma_data dma_params_rx; | 126 | struct snd_dmaengine_dai_dma_data dma_params_rx; |
128 | struct imx_dma_data filter_data_tx; | 127 | struct imx_dma_data filter_data_tx; |
@@ -809,13 +808,9 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
809 | } | 808 | } |
810 | 809 | ||
811 | if (ssi_private->ssi_on_imx) { | 810 | if (ssi_private->ssi_on_imx) { |
812 | ssi_private->imx_pcm_pdev = | 811 | ret = imx_pcm_dma_init(pdev); |
813 | platform_device_register_simple("imx-pcm-audio", | 812 | if (ret) |
814 | -1, NULL, 0); | ||
815 | if (IS_ERR(ssi_private->imx_pcm_pdev)) { | ||
816 | ret = PTR_ERR(ssi_private->imx_pcm_pdev); | ||
817 | goto error_dev; | 813 | goto error_dev; |
818 | } | ||
819 | } | 814 | } |
820 | 815 | ||
821 | /* | 816 | /* |
@@ -854,7 +849,7 @@ done: | |||
854 | 849 | ||
855 | error_dai: | 850 | error_dai: |
856 | if (ssi_private->ssi_on_imx) | 851 | if (ssi_private->ssi_on_imx) |
857 | platform_device_unregister(ssi_private->imx_pcm_pdev); | 852 | imx_pcm_dma_exit(pdev); |
858 | snd_soc_unregister_component(&pdev->dev); | 853 | snd_soc_unregister_component(&pdev->dev); |
859 | 854 | ||
860 | error_dev: | 855 | error_dev: |
@@ -889,7 +884,7 @@ static int fsl_ssi_remove(struct platform_device *pdev) | |||
889 | if (!ssi_private->new_binding) | 884 | if (!ssi_private->new_binding) |
890 | platform_device_unregister(ssi_private->pdev); | 885 | platform_device_unregister(ssi_private->pdev); |
891 | if (ssi_private->ssi_on_imx) { | 886 | if (ssi_private->ssi_on_imx) { |
892 | platform_device_unregister(ssi_private->imx_pcm_pdev); | 887 | imx_pcm_dma_exit(pdev); |
893 | clk_disable_unprepare(ssi_private->clk); | 888 | clk_disable_unprepare(ssi_private->clk); |
894 | clk_put(ssi_private->clk); | 889 | clk_put(ssi_private->clk); |
895 | } | 890 | } |
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index 47f046a8fdab..e260f1f899db 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/of_device.h> | 26 | #include <linux/of_device.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/pinctrl/consumer.h> | ||
30 | 29 | ||
31 | #include "imx-audmux.h" | 30 | #include "imx-audmux.h" |
32 | 31 | ||
@@ -247,7 +246,6 @@ EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port); | |||
247 | static int imx_audmux_probe(struct platform_device *pdev) | 246 | static int imx_audmux_probe(struct platform_device *pdev) |
248 | { | 247 | { |
249 | struct resource *res; | 248 | struct resource *res; |
250 | struct pinctrl *pinctrl; | ||
251 | const struct of_device_id *of_id = | 249 | const struct of_device_id *of_id = |
252 | of_match_device(imx_audmux_dt_ids, &pdev->dev); | 250 | of_match_device(imx_audmux_dt_ids, &pdev->dev); |
253 | 251 | ||
@@ -256,12 +254,6 @@ static int imx_audmux_probe(struct platform_device *pdev) | |||
256 | if (IS_ERR(audmux_base)) | 254 | if (IS_ERR(audmux_base)) |
257 | return PTR_ERR(audmux_base); | 255 | return PTR_ERR(audmux_base); |
258 | 256 | ||
259 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
260 | if (IS_ERR(pinctrl)) { | ||
261 | dev_err(&pdev->dev, "setup pinctrl failed!"); | ||
262 | return PTR_ERR(pinctrl); | ||
263 | } | ||
264 | |||
265 | audmux_clk = devm_clk_get(&pdev->dev, "audmux"); | 257 | audmux_clk = devm_clk_get(&pdev->dev, "audmux"); |
266 | if (IS_ERR(audmux_clk)) { | 258 | if (IS_ERR(audmux_clk)) { |
267 | dev_dbg(&pdev->dev, "cannot get clock: %ld\n", | 259 | dev_dbg(&pdev->dev, "cannot get clock: %ld\n", |
diff --git a/sound/soc/fsl/imx-mc13783.c b/sound/soc/fsl/imx-mc13783.c index 4ae30f21fdb5..9df173c091a6 100644 --- a/sound/soc/fsl/imx-mc13783.c +++ b/sound/soc/fsl/imx-mc13783.c | |||
@@ -64,7 +64,7 @@ static struct snd_soc_dai_link imx_mc13783_dai_mc13783[] = { | |||
64 | .codec_dai_name = "mc13783-hifi", | 64 | .codec_dai_name = "mc13783-hifi", |
65 | .codec_name = "mc13783-codec", | 65 | .codec_name = "mc13783-codec", |
66 | .cpu_dai_name = "imx-ssi.0", | 66 | .cpu_dai_name = "imx-ssi.0", |
67 | .platform_name = "imx-pcm-audio.0", | 67 | .platform_name = "imx-ssi.0", |
68 | .ops = &imx_mc13783_hifi_ops, | 68 | .ops = &imx_mc13783_hifi_ops, |
69 | .symmetric_rates = 1, | 69 | .symmetric_rates = 1, |
70 | .dai_fmt = FMT_SSI, | 70 | .dai_fmt = FMT_SSI, |
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index c246fb514930..fde4d2ea68c8 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c | |||
@@ -67,8 +67,10 @@ int imx_pcm_dma_init(struct platform_device *pdev) | |||
67 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 67 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
68 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 68 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
69 | } | 69 | } |
70 | EXPORT_SYMBOL_GPL(imx_pcm_dma_init); | ||
70 | 71 | ||
71 | void imx_pcm_dma_exit(struct platform_device *pdev) | 72 | void imx_pcm_dma_exit(struct platform_device *pdev) |
72 | { | 73 | { |
73 | snd_dmaengine_pcm_unregister(&pdev->dev); | 74 | snd_dmaengine_pcm_unregister(&pdev->dev); |
74 | } | 75 | } |
76 | EXPORT_SYMBOL_GPL(imx_pcm_dma_exit); | ||
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c index 670b96b0ce2f..310d90290320 100644 --- a/sound/soc/fsl/imx-pcm-fiq.c +++ b/sound/soc/fsl/imx-pcm-fiq.c | |||
@@ -225,6 +225,22 @@ static int snd_imx_close(struct snd_pcm_substream *substream) | |||
225 | return 0; | 225 | return 0; |
226 | } | 226 | } |
227 | 227 | ||
228 | static int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
229 | struct vm_area_struct *vma) | ||
230 | { | ||
231 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
232 | int ret; | ||
233 | |||
234 | ret = dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
235 | runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); | ||
236 | |||
237 | pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret, | ||
238 | runtime->dma_area, | ||
239 | runtime->dma_addr, | ||
240 | runtime->dma_bytes); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
228 | static struct snd_pcm_ops imx_pcm_ops = { | 244 | static struct snd_pcm_ops imx_pcm_ops = { |
229 | .open = snd_imx_open, | 245 | .open = snd_imx_open, |
230 | .close = snd_imx_close, | 246 | .close = snd_imx_close, |
@@ -236,6 +252,54 @@ static struct snd_pcm_ops imx_pcm_ops = { | |||
236 | .mmap = snd_imx_pcm_mmap, | 252 | .mmap = snd_imx_pcm_mmap, |
237 | }; | 253 | }; |
238 | 254 | ||
255 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | ||
256 | { | ||
257 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | ||
258 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
259 | size_t size = IMX_SSI_DMABUF_SIZE; | ||
260 | |||
261 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
262 | buf->dev.dev = pcm->card->dev; | ||
263 | buf->private_data = NULL; | ||
264 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
265 | &buf->addr, GFP_KERNEL); | ||
266 | if (!buf->area) | ||
267 | return -ENOMEM; | ||
268 | buf->bytes = size; | ||
269 | |||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static u64 imx_pcm_dmamask = DMA_BIT_MASK(32); | ||
274 | |||
275 | static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) | ||
276 | { | ||
277 | struct snd_card *card = rtd->card->snd_card; | ||
278 | struct snd_pcm *pcm = rtd->pcm; | ||
279 | int ret = 0; | ||
280 | |||
281 | if (!card->dev->dma_mask) | ||
282 | card->dev->dma_mask = &imx_pcm_dmamask; | ||
283 | if (!card->dev->coherent_dma_mask) | ||
284 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
285 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { | ||
286 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
287 | SNDRV_PCM_STREAM_PLAYBACK); | ||
288 | if (ret) | ||
289 | goto out; | ||
290 | } | ||
291 | |||
292 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | ||
293 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
294 | SNDRV_PCM_STREAM_CAPTURE); | ||
295 | if (ret) | ||
296 | goto out; | ||
297 | } | ||
298 | |||
299 | out: | ||
300 | return ret; | ||
301 | } | ||
302 | |||
239 | static int ssi_irq = 0; | 303 | static int ssi_irq = 0; |
240 | 304 | ||
241 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | 305 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) |
@@ -268,6 +332,27 @@ static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | |||
268 | return 0; | 332 | return 0; |
269 | } | 333 | } |
270 | 334 | ||
335 | static void imx_pcm_free(struct snd_pcm *pcm) | ||
336 | { | ||
337 | struct snd_pcm_substream *substream; | ||
338 | struct snd_dma_buffer *buf; | ||
339 | int stream; | ||
340 | |||
341 | for (stream = 0; stream < 2; stream++) { | ||
342 | substream = pcm->streams[stream].substream; | ||
343 | if (!substream) | ||
344 | continue; | ||
345 | |||
346 | buf = &substream->dma_buffer; | ||
347 | if (!buf->area) | ||
348 | continue; | ||
349 | |||
350 | dma_free_writecombine(pcm->card->dev, buf->bytes, | ||
351 | buf->area, buf->addr); | ||
352 | buf->area = NULL; | ||
353 | } | ||
354 | } | ||
355 | |||
271 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) | 356 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) |
272 | { | 357 | { |
273 | mxc_set_irq_fiq(ssi_irq, 0); | 358 | mxc_set_irq_fiq(ssi_irq, 0); |
@@ -314,3 +399,10 @@ failed_register: | |||
314 | 399 | ||
315 | return ret; | 400 | return ret; |
316 | } | 401 | } |
402 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_init); | ||
403 | |||
404 | void imx_pcm_fiq_exit(struct platform_device *pdev) | ||
405 | { | ||
406 | snd_soc_unregister_platform(&pdev->dev); | ||
407 | } | ||
408 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_exit); | ||
diff --git a/sound/soc/fsl/imx-pcm.c b/sound/soc/fsl/imx-pcm.c deleted file mode 100644 index c49896442d8e..000000000000 --- a/sound/soc/fsl/imx-pcm.c +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> | ||
3 | * | ||
4 | * This code is based on code copyrighted by Freescale, | ||
5 | * Liam Girdwood, Javier Martin and probably others. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/dma-mapping.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <sound/pcm.h> | ||
16 | #include <sound/soc.h> | ||
17 | #include "imx-pcm.h" | ||
18 | |||
19 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
20 | struct vm_area_struct *vma) | ||
21 | { | ||
22 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
23 | int ret; | ||
24 | |||
25 | ret = dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
26 | runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); | ||
27 | |||
28 | pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret, | ||
29 | runtime->dma_area, | ||
30 | runtime->dma_addr, | ||
31 | runtime->dma_bytes); | ||
32 | return ret; | ||
33 | } | ||
34 | EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap); | ||
35 | |||
36 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | ||
37 | { | ||
38 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | ||
39 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
40 | size_t size = IMX_SSI_DMABUF_SIZE; | ||
41 | |||
42 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
43 | buf->dev.dev = pcm->card->dev; | ||
44 | buf->private_data = NULL; | ||
45 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
46 | &buf->addr, GFP_KERNEL); | ||
47 | if (!buf->area) | ||
48 | return -ENOMEM; | ||
49 | buf->bytes = size; | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static u64 imx_pcm_dmamask = DMA_BIT_MASK(32); | ||
55 | |||
56 | int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) | ||
57 | { | ||
58 | struct snd_card *card = rtd->card->snd_card; | ||
59 | struct snd_pcm *pcm = rtd->pcm; | ||
60 | int ret = 0; | ||
61 | |||
62 | if (!card->dev->dma_mask) | ||
63 | card->dev->dma_mask = &imx_pcm_dmamask; | ||
64 | if (!card->dev->coherent_dma_mask) | ||
65 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
66 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { | ||
67 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
68 | SNDRV_PCM_STREAM_PLAYBACK); | ||
69 | if (ret) | ||
70 | goto out; | ||
71 | } | ||
72 | |||
73 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | ||
74 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
75 | SNDRV_PCM_STREAM_CAPTURE); | ||
76 | if (ret) | ||
77 | goto out; | ||
78 | } | ||
79 | |||
80 | out: | ||
81 | return ret; | ||
82 | } | ||
83 | EXPORT_SYMBOL_GPL(imx_pcm_new); | ||
84 | |||
85 | void imx_pcm_free(struct snd_pcm *pcm) | ||
86 | { | ||
87 | struct snd_pcm_substream *substream; | ||
88 | struct snd_dma_buffer *buf; | ||
89 | int stream; | ||
90 | |||
91 | for (stream = 0; stream < 2; stream++) { | ||
92 | substream = pcm->streams[stream].substream; | ||
93 | if (!substream) | ||
94 | continue; | ||
95 | |||
96 | buf = &substream->dma_buffer; | ||
97 | if (!buf->area) | ||
98 | continue; | ||
99 | |||
100 | dma_free_writecombine(pcm->card->dev, buf->bytes, | ||
101 | buf->area, buf->addr); | ||
102 | buf->area = NULL; | ||
103 | } | ||
104 | } | ||
105 | EXPORT_SYMBOL_GPL(imx_pcm_free); | ||
106 | |||
107 | static int imx_pcm_probe(struct platform_device *pdev) | ||
108 | { | ||
109 | if (strcmp(pdev->id_entry->name, "imx-fiq-pcm-audio") == 0) | ||
110 | return imx_pcm_fiq_init(pdev); | ||
111 | |||
112 | return imx_pcm_dma_init(pdev); | ||
113 | } | ||
114 | |||
115 | static int imx_pcm_remove(struct platform_device *pdev) | ||
116 | { | ||
117 | if (strcmp(pdev->id_entry->name, "imx-fiq-pcm-audio") == 0) | ||
118 | snd_soc_unregister_platform(&pdev->dev); | ||
119 | else | ||
120 | imx_pcm_dma_exit(pdev); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static struct platform_device_id imx_pcm_devtype[] = { | ||
126 | { .name = "imx-pcm-audio", }, | ||
127 | { .name = "imx-fiq-pcm-audio", }, | ||
128 | { /* sentinel */ } | ||
129 | }; | ||
130 | MODULE_DEVICE_TABLE(platform, imx_pcm_devtype); | ||
131 | |||
132 | static struct platform_driver imx_pcm_driver = { | ||
133 | .driver = { | ||
134 | .name = "imx-pcm", | ||
135 | .owner = THIS_MODULE, | ||
136 | }, | ||
137 | .id_table = imx_pcm_devtype, | ||
138 | .probe = imx_pcm_probe, | ||
139 | .remove = imx_pcm_remove, | ||
140 | }; | ||
141 | module_platform_driver(imx_pcm_driver); | ||
142 | |||
143 | MODULE_DESCRIPTION("Freescale i.MX PCM driver"); | ||
144 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); | ||
145 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h index b7fa0d75c687..67f656c7c320 100644 --- a/sound/soc/fsl/imx-pcm.h +++ b/sound/soc/fsl/imx-pcm.h | |||
@@ -32,11 +32,6 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data, | |||
32 | dma_data->peripheral_type = IMX_DMATYPE_SSI; | 32 | dma_data->peripheral_type = IMX_DMATYPE_SSI; |
33 | } | 33 | } |
34 | 34 | ||
35 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
36 | struct vm_area_struct *vma); | ||
37 | int imx_pcm_new(struct snd_soc_pcm_runtime *rtd); | ||
38 | void imx_pcm_free(struct snd_pcm *pcm); | ||
39 | |||
40 | #ifdef CONFIG_SND_SOC_IMX_PCM_DMA | 35 | #ifdef CONFIG_SND_SOC_IMX_PCM_DMA |
41 | int imx_pcm_dma_init(struct platform_device *pdev); | 36 | int imx_pcm_dma_init(struct platform_device *pdev); |
42 | void imx_pcm_dma_exit(struct platform_device *pdev); | 37 | void imx_pcm_dma_exit(struct platform_device *pdev); |
@@ -53,11 +48,16 @@ static inline void imx_pcm_dma_exit(struct platform_device *pdev) | |||
53 | 48 | ||
54 | #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ | 49 | #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ |
55 | int imx_pcm_fiq_init(struct platform_device *pdev); | 50 | int imx_pcm_fiq_init(struct platform_device *pdev); |
51 | void imx_pcm_fiq_exit(struct platform_device *pdev); | ||
56 | #else | 52 | #else |
57 | static inline int imx_pcm_fiq_init(struct platform_device *pdev) | 53 | static inline int imx_pcm_fiq_init(struct platform_device *pdev) |
58 | { | 54 | { |
59 | return -ENODEV; | 55 | return -ENODEV; |
60 | } | 56 | } |
57 | |||
58 | static inline void imx_pcm_fiq_exit(struct platform_device *pdev) | ||
59 | { | ||
60 | } | ||
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #endif /* _IMX_PCM_H */ | 63 | #endif /* _IMX_PCM_H */ |
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 9584e78858df..a60aaa053d28 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c | |||
@@ -149,7 +149,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) | |||
149 | data->dai.codec_dai_name = "sgtl5000"; | 149 | data->dai.codec_dai_name = "sgtl5000"; |
150 | data->dai.codec_of_node = codec_np; | 150 | data->dai.codec_of_node = codec_np; |
151 | data->dai.cpu_of_node = ssi_np; | 151 | data->dai.cpu_of_node = ssi_np; |
152 | data->dai.platform_name = "imx-pcm-audio"; | 152 | data->dai.platform_of_node = ssi_np; |
153 | data->dai.init = &imx_sgtl5000_dai_init; | 153 | data->dai.init = &imx_sgtl5000_dai_init; |
154 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 154 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
155 | SND_SOC_DAIFMT_CBM_CFM; | 155 | SND_SOC_DAIFMT_CBM_CFM; |
@@ -174,6 +174,11 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | platform_set_drvdata(pdev, data); | 176 | platform_set_drvdata(pdev, data); |
177 | of_node_put(ssi_np); | ||
178 | of_node_put(codec_np); | ||
179 | |||
180 | return 0; | ||
181 | |||
177 | clk_fail: | 182 | clk_fail: |
178 | clk_put(data->codec_clk); | 183 | clk_put(data->codec_clk); |
179 | fail: | 184 | fail: |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index 902fab02b851..1b2e750151ae 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -595,41 +595,19 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
595 | goto failed_register; | 595 | goto failed_register; |
596 | } | 596 | } |
597 | 597 | ||
598 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 598 | ret = imx_pcm_fiq_init(pdev); |
599 | if (!ssi->soc_platform_pdev_fiq) { | 599 | if (ret) |
600 | ret = -ENOMEM; | 600 | goto failed_pcm_fiq; |
601 | goto failed_pdev_fiq_alloc; | ||
602 | } | ||
603 | |||
604 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | ||
605 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | ||
606 | if (ret) { | ||
607 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
608 | goto failed_pdev_fiq_add; | ||
609 | } | ||
610 | 601 | ||
611 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | 602 | ret = imx_pcm_dma_init(pdev); |
612 | if (!ssi->soc_platform_pdev) { | 603 | if (ret) |
613 | ret = -ENOMEM; | 604 | goto failed_pcm_dma; |
614 | goto failed_pdev_alloc; | ||
615 | } | ||
616 | |||
617 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | ||
618 | ret = platform_device_add(ssi->soc_platform_pdev); | ||
619 | if (ret) { | ||
620 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
621 | goto failed_pdev_add; | ||
622 | } | ||
623 | 605 | ||
624 | return 0; | 606 | return 0; |
625 | 607 | ||
626 | failed_pdev_add: | 608 | failed_pcm_dma: |
627 | platform_device_put(ssi->soc_platform_pdev); | 609 | imx_pcm_fiq_exit(pdev); |
628 | failed_pdev_alloc: | 610 | failed_pcm_fiq: |
629 | platform_device_del(ssi->soc_platform_pdev_fiq); | ||
630 | failed_pdev_fiq_add: | ||
631 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
632 | failed_pdev_fiq_alloc: | ||
633 | snd_soc_unregister_component(&pdev->dev); | 611 | snd_soc_unregister_component(&pdev->dev); |
634 | failed_register: | 612 | failed_register: |
635 | release_mem_region(res->start, resource_size(res)); | 613 | release_mem_region(res->start, resource_size(res)); |
@@ -645,8 +623,8 @@ static int imx_ssi_remove(struct platform_device *pdev) | |||
645 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 623 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
646 | struct imx_ssi *ssi = platform_get_drvdata(pdev); | 624 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
647 | 625 | ||
648 | platform_device_unregister(ssi->soc_platform_pdev); | 626 | imx_pcm_dma_exit(pdev); |
649 | platform_device_unregister(ssi->soc_platform_pdev_fiq); | 627 | imx_pcm_fiq_exit(pdev); |
650 | 628 | ||
651 | snd_soc_unregister_component(&pdev->dev); | 629 | snd_soc_unregister_component(&pdev->dev); |
652 | 630 | ||
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h index bb6b3dbb13fd..d5003cefca8d 100644 --- a/sound/soc/fsl/imx-ssi.h +++ b/sound/soc/fsl/imx-ssi.h | |||
@@ -211,9 +211,6 @@ struct imx_ssi { | |||
211 | struct imx_dma_data filter_data_rx; | 211 | struct imx_dma_data filter_data_rx; |
212 | 212 | ||
213 | int enabled; | 213 | int enabled; |
214 | |||
215 | struct platform_device *soc_platform_pdev; | ||
216 | struct platform_device *soc_platform_pdev_fiq; | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | #endif /* _IMX_SSI_H */ | 216 | #endif /* _IMX_SSI_H */ |
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c index 3d1074179057..f4c3bda5e69e 100644 --- a/sound/soc/fsl/mx27vis-aic32x4.c +++ b/sound/soc/fsl/mx27vis-aic32x4.c | |||
@@ -161,7 +161,7 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = { | |||
161 | .name = "tlv320aic32x4", | 161 | .name = "tlv320aic32x4", |
162 | .stream_name = "TLV320AIC32X4", | 162 | .stream_name = "TLV320AIC32X4", |
163 | .codec_dai_name = "tlv320aic32x4-hifi", | 163 | .codec_dai_name = "tlv320aic32x4-hifi", |
164 | .platform_name = "imx-pcm-audio.0", | 164 | .platform_name = "imx-ssi.0", |
165 | .codec_name = "tlv320aic32x4.0-0018", | 165 | .codec_name = "tlv320aic32x4.0-0018", |
166 | .cpu_dai_name = "imx-ssi.0", | 166 | .cpu_dai_name = "imx-ssi.0", |
167 | .ops = &mx27vis_aic32x4_snd_ops, | 167 | .ops = &mx27vis_aic32x4_snd_ops, |
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c index f8da6dd115ed..ae403c29688f 100644 --- a/sound/soc/fsl/phycore-ac97.c +++ b/sound/soc/fsl/phycore-ac97.c | |||
@@ -33,7 +33,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
33 | .codec_dai_name = "wm9712-hifi", | 33 | .codec_dai_name = "wm9712-hifi", |
34 | .codec_name = "wm9712-codec", | 34 | .codec_name = "wm9712-codec", |
35 | .cpu_dai_name = "imx-ssi.0", | 35 | .cpu_dai_name = "imx-ssi.0", |
36 | .platform_name = "imx-fiq-pcm-audio.0", | 36 | .platform_name = "imx-ssi.0", |
37 | .ops = &imx_phycore_hifi_ops, | 37 | .ops = &imx_phycore_hifi_ops, |
38 | }, | 38 | }, |
39 | }; | 39 | }; |
diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c index fe54a69073e5..fce63252bdbb 100644 --- a/sound/soc/fsl/wm1133-ev1.c +++ b/sound/soc/fsl/wm1133-ev1.c | |||
@@ -245,7 +245,7 @@ static struct snd_soc_dai_link wm1133_ev1_dai = { | |||
245 | .stream_name = "Audio", | 245 | .stream_name = "Audio", |
246 | .cpu_dai_name = "imx-ssi.0", | 246 | .cpu_dai_name = "imx-ssi.0", |
247 | .codec_dai_name = "wm8350-hifi", | 247 | .codec_dai_name = "wm8350-hifi", |
248 | .platform_name = "imx-fiq-pcm-audio.0", | 248 | .platform_name = "imx-ssi.0", |
249 | .codec_name = "wm8350-codec.0-0x1a", | 249 | .codec_name = "wm8350-codec.0-0x1a", |
250 | .init = wm1133_ev1_init, | 250 | .init = wm1133_ev1_init, |
251 | .ops = &wm1133_ev1_ops, | 251 | .ops = &wm1133_ev1_ops, |