diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-10-25 04:00:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-10-25 04:00:30 -0400 |
commit | aa5c14d5c0d3e4c587db4a1b220b9c86415c538f (patch) | |
tree | 0114637e8be2b38176e7e91e6cea3501b22cb66a /sound/soc/imx | |
parent | 79fc84c7e0d2fe89c4e82f3a26fd8b0d13c31703 (diff) | |
parent | b11bdb5254ff17cb63e4ae5088b73fdcd2cc2602 (diff) |
Merge branch 'topic/asoc' into for-linus
Conflicts:
arch/powerpc/platforms/85xx/p1022_ds.c
Diffstat (limited to 'sound/soc/imx')
-rw-r--r-- | sound/soc/imx/Kconfig | 16 | ||||
-rw-r--r-- | sound/soc/imx/Makefile | 10 | ||||
-rw-r--r-- | sound/soc/imx/eukrea-tlv320.c | 16 | ||||
-rw-r--r-- | sound/soc/imx/imx-pcm-dma-mx2.c | 43 | ||||
-rw-r--r-- | sound/soc/imx/imx-pcm-fiq.c | 68 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 148 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.h | 7 | ||||
-rw-r--r-- | sound/soc/imx/phycore-ac97.c | 19 | ||||
-rw-r--r-- | sound/soc/imx/wm1133-ev1.c | 27 |
9 files changed, 203 insertions, 151 deletions
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index 687c76fc0839..642270a635ea 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig | |||
@@ -8,12 +8,24 @@ menuconfig SND_IMX_SOC | |||
8 | Say Y or M if you want to add support for codecs attached to | 8 | Say Y or M if you want to add support for codecs attached to |
9 | the i.MX SSI interface. | 9 | the i.MX SSI interface. |
10 | 10 | ||
11 | |||
11 | if SND_IMX_SOC | 12 | if SND_IMX_SOC |
12 | 13 | ||
14 | config SND_MXC_SOC_SSI | ||
15 | tristate | ||
16 | |||
17 | config SND_MXC_SOC_FIQ | ||
18 | tristate | ||
19 | |||
20 | config SND_MXC_SOC_MX2 | ||
21 | tristate | ||
22 | |||
13 | config SND_MXC_SOC_WM1133_EV1 | 23 | config SND_MXC_SOC_WM1133_EV1 |
14 | tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted" | 24 | tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted" |
15 | depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL | 25 | depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL |
16 | select SND_SOC_WM8350 | 26 | select SND_SOC_WM8350 |
27 | select SND_MXC_SOC_SSI | ||
28 | select SND_MXC_SOC_FIQ | ||
17 | help | 29 | help |
18 | Enable support for audio on the i.MX31ADS with the WM1133-EV1 | 30 | Enable support for audio on the i.MX31ADS with the WM1133-EV1 |
19 | PMIC board with WM8835x fitted. | 31 | PMIC board with WM8835x fitted. |
@@ -22,6 +34,8 @@ config SND_SOC_PHYCORE_AC97 | |||
22 | tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards" | 34 | tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards" |
23 | depends on MACH_PCM043 || MACH_PCA100 | 35 | depends on MACH_PCM043 || MACH_PCA100 |
24 | select SND_SOC_WM9712 | 36 | select SND_SOC_WM9712 |
37 | select SND_MXC_SOC_SSI | ||
38 | select SND_MXC_SOC_FIQ | ||
25 | help | 39 | help |
26 | Say Y if you want to add support for SoC audio on Phytec phyCORE | 40 | Say Y if you want to add support for SoC audio on Phytec phyCORE |
27 | and phyCARD boards in AC97 mode | 41 | and phyCARD boards in AC97 mode |
@@ -32,6 +46,8 @@ config SND_SOC_EUKREA_TLV320 | |||
32 | || MACH_EUKREA_MBIMXSD25_BASEBOARD \ | 46 | || MACH_EUKREA_MBIMXSD25_BASEBOARD \ |
33 | || MACH_EUKREA_MBIMXSD35_BASEBOARD | 47 | || MACH_EUKREA_MBIMXSD35_BASEBOARD |
34 | select SND_SOC_TLV320AIC23 | 48 | select SND_SOC_TLV320AIC23 |
49 | select SND_MXC_SOC_SSI | ||
50 | select SND_MXC_SOC_FIQ | ||
35 | help | 51 | help |
36 | Enable I2S based access to the TLV320AIC23B codec attached | 52 | Enable I2S based access to the TLV320AIC23B codec attached |
37 | to the SSI interface | 53 | to the SSI interface |
diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile index 7bc57baf2b0e..b67fc02a4ecc 100644 --- a/sound/soc/imx/Makefile +++ b/sound/soc/imx/Makefile | |||
@@ -1,11 +1,11 @@ | |||
1 | # i.MX Platform Support | 1 | # i.MX Platform Support |
2 | snd-soc-imx-objs := imx-ssi.o imx-pcm-fiq.o | 2 | snd-soc-imx-objs := imx-ssi.o |
3 | 3 | snd-soc-imx-fiq-objs := imx-pcm-fiq.o | |
4 | ifdef CONFIG_MACH_MX27 | 4 | snd-soc-imx-mx2-objs := imx-pcm-dma-mx2.o |
5 | snd-soc-imx-objs += imx-pcm-dma-mx2.o | ||
6 | endif | ||
7 | 5 | ||
8 | obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o | 6 | obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o |
7 | obj-$(CONFIG_SND_MXC_SOC_FIQ) += snd-soc-imx-fiq.o | ||
8 | obj-$(CONFIG_SND_MXC_SOC_MX2) += snd-soc-imx-mx2.o | ||
9 | 9 | ||
10 | # i.MX Machine Support | 10 | # i.MX Machine Support |
11 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o | 11 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o |
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index f15dfbdc47ee..b59675257ce5 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -79,22 +79,19 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = { | |||
79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { | 79 | 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 = &tlv320aic23_dai, | 82 | .codec_dai = "tlv320aic23-hifi", |
83 | .platform_name = "imx-pcm-audio.0", | ||
84 | .codec_name = "tlv320aic23-codec.0-001a", | ||
85 | .cpu_dai = "imx-ssi.0", | ||
83 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
84 | }; | 87 | }; |
85 | 88 | ||
86 | static struct snd_soc_card eukrea_tlv320 = { | 89 | static struct snd_soc_card eukrea_tlv320 = { |
87 | .name = "cpuimx-audio", | 90 | .name = "cpuimx-audio", |
88 | .platform = &imx_soc_platform, | ||
89 | .dai_link = &eukrea_tlv320_dai, | 91 | .dai_link = &eukrea_tlv320_dai, |
90 | .num_links = 1, | 92 | .num_links = 1, |
91 | }; | 93 | }; |
92 | 94 | ||
93 | static struct snd_soc_device eukrea_tlv320_snd_devdata = { | ||
94 | .card = &eukrea_tlv320, | ||
95 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
96 | }; | ||
97 | |||
98 | static struct platform_device *eukrea_tlv320_snd_device; | 95 | static struct platform_device *eukrea_tlv320_snd_device; |
99 | 96 | ||
100 | static int __init eukrea_tlv320_init(void) | 97 | static int __init eukrea_tlv320_init(void) |
@@ -110,10 +107,7 @@ static int __init eukrea_tlv320_init(void) | |||
110 | if (!eukrea_tlv320_snd_device) | 107 | if (!eukrea_tlv320_snd_device) |
111 | return -ENOMEM; | 108 | return -ENOMEM; |
112 | 109 | ||
113 | eukrea_tlv320_dai.cpu_dai = &imx_ssi_pcm_dai[0]; | 110 | platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320); |
114 | |||
115 | platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320_snd_devdata); | ||
116 | eukrea_tlv320_snd_devdata.dev = &eukrea_tlv320_snd_device->dev; | ||
117 | ret = platform_device_add(eukrea_tlv320_snd_device); | 111 | ret = platform_device_add(eukrea_tlv320_snd_device); |
118 | 112 | ||
119 | if (ret) { | 113 | if (ret) { |
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index 0a595da4811d..fd493ee1428e 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c | |||
@@ -103,7 +103,7 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) | |||
103 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 103 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
104 | int ret; | 104 | int ret; |
105 | 105 | ||
106 | dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 106 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
107 | 107 | ||
108 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); | 108 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); |
109 | if (iprtd->dma < 0) { | 109 | if (iprtd->dma < 0) { |
@@ -213,7 +213,7 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | |||
213 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 213 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
214 | int err; | 214 | int err; |
215 | 215 | ||
216 | dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 216 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
217 | 217 | ||
218 | iprtd->substream = substream; | 218 | iprtd->substream = substream; |
219 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; | 219 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; |
@@ -318,19 +318,42 @@ static struct snd_pcm_ops imx_pcm_ops = { | |||
318 | .mmap = snd_imx_pcm_mmap, | 318 | .mmap = snd_imx_pcm_mmap, |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static struct snd_soc_platform imx_soc_platform_dma = { | 321 | static struct snd_soc_platform_driver imx_soc_platform_mx2 = { |
322 | .name = "imx-audio", | 322 | .ops = &imx_pcm_ops, |
323 | .pcm_ops = &imx_pcm_ops, | ||
324 | .pcm_new = imx_pcm_new, | 323 | .pcm_new = imx_pcm_new, |
325 | .pcm_free = imx_pcm_free, | 324 | .pcm_free = imx_pcm_free, |
326 | }; | 325 | }; |
327 | 326 | ||
328 | struct snd_soc_platform *imx_ssi_dma_mx2_init(struct platform_device *pdev, | 327 | static int __devinit imx_soc_platform_probe(struct platform_device *pdev) |
329 | struct imx_ssi *ssi) | ||
330 | { | 328 | { |
331 | ssi->dma_params_tx.burstsize = DMA_TXFIFO_BURST; | 329 | return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2); |
332 | ssi->dma_params_rx.burstsize = DMA_RXFIFO_BURST; | 330 | } |
331 | |||
332 | static int __devexit imx_soc_platform_remove(struct platform_device *pdev) | ||
333 | { | ||
334 | snd_soc_unregister_platform(&pdev->dev); | ||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static struct platform_driver imx_pcm_driver = { | ||
339 | .driver = { | ||
340 | .name = "imx-pcm-audio", | ||
341 | .owner = THIS_MODULE, | ||
342 | }, | ||
333 | 343 | ||
334 | return &imx_soc_platform_dma; | 344 | .probe = imx_soc_platform_probe, |
345 | .remove = __devexit_p(imx_soc_platform_remove), | ||
346 | }; | ||
347 | |||
348 | static int __init snd_imx_pcm_init(void) | ||
349 | { | ||
350 | return platform_driver_register(&imx_pcm_driver); | ||
351 | } | ||
352 | module_init(snd_imx_pcm_init); | ||
353 | |||
354 | static void __exit snd_imx_pcm_exit(void) | ||
355 | { | ||
356 | platform_driver_unregister(&imx_pcm_driver); | ||
335 | } | 357 | } |
358 | module_exit(snd_imx_pcm_exit); | ||
336 | 359 | ||
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index b2bf27282cd2..413b78da248f 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c | |||
@@ -236,6 +236,8 @@ static struct snd_pcm_ops imx_pcm_ops = { | |||
236 | .mmap = snd_imx_pcm_mmap, | 236 | .mmap = snd_imx_pcm_mmap, |
237 | }; | 237 | }; |
238 | 238 | ||
239 | static int ssi_irq = 0; | ||
240 | |||
239 | static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | 241 | static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, |
240 | struct snd_pcm *pcm) | 242 | struct snd_pcm *pcm) |
241 | { | 243 | { |
@@ -245,7 +247,7 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
245 | if (ret) | 247 | if (ret) |
246 | return ret; | 248 | return ret; |
247 | 249 | ||
248 | if (dai->playback.channels_min) { | 250 | if (dai->driver->playback.channels_min) { |
249 | struct snd_pcm_substream *substream = | 251 | struct snd_pcm_substream *substream = |
250 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 252 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
251 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 253 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
@@ -253,7 +255,7 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
253 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; | 255 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; |
254 | } | 256 | } |
255 | 257 | ||
256 | if (dai->capture.channels_min) { | 258 | if (dai->driver->capture.channels_min) { |
257 | struct snd_pcm_substream *substream = | 259 | struct snd_pcm_substream *substream = |
258 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 260 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
259 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 261 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
@@ -267,24 +269,32 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
267 | return 0; | 269 | return 0; |
268 | } | 270 | } |
269 | 271 | ||
270 | static struct snd_soc_platform imx_soc_platform_fiq = { | 272 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) |
271 | .pcm_ops = &imx_pcm_ops, | 273 | { |
274 | mxc_set_irq_fiq(ssi_irq, 0); | ||
275 | release_fiq(&fh); | ||
276 | imx_pcm_free(pcm); | ||
277 | } | ||
278 | |||
279 | static struct snd_soc_platform_driver imx_soc_platform_fiq = { | ||
280 | .ops = &imx_pcm_ops, | ||
272 | .pcm_new = imx_pcm_fiq_new, | 281 | .pcm_new = imx_pcm_fiq_new, |
273 | .pcm_free = imx_pcm_free, | 282 | .pcm_free = imx_pcm_fiq_free, |
274 | }; | 283 | }; |
275 | 284 | ||
276 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 285 | static int __devinit imx_soc_platform_probe(struct platform_device *pdev) |
277 | struct imx_ssi *ssi) | ||
278 | { | 286 | { |
279 | int ret = 0; | 287 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
288 | int ret; | ||
280 | 289 | ||
281 | ret = claim_fiq(&fh); | 290 | ret = claim_fiq(&fh); |
282 | if (ret) { | 291 | if (ret) { |
283 | dev_err(&pdev->dev, "failed to claim fiq: %d", ret); | 292 | dev_err(&pdev->dev, "failed to claim fiq: %d", ret); |
284 | return ERR_PTR(ret); | 293 | return ret; |
285 | } | 294 | } |
286 | 295 | ||
287 | mxc_set_irq_fiq(ssi->irq, 1); | 296 | mxc_set_irq_fiq(ssi->irq, 1); |
297 | ssi_irq = ssi->irq; | ||
288 | 298 | ||
289 | imx_pcm_fiq = ssi->irq; | 299 | imx_pcm_fiq = ssi->irq; |
290 | 300 | ||
@@ -293,13 +303,43 @@ struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | |||
293 | ssi->dma_params_tx.burstsize = 4; | 303 | ssi->dma_params_tx.burstsize = 4; |
294 | ssi->dma_params_rx.burstsize = 6; | 304 | ssi->dma_params_rx.burstsize = 6; |
295 | 305 | ||
296 | return &imx_soc_platform_fiq; | 306 | ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); |
307 | if (ret) | ||
308 | goto failed_register; | ||
309 | |||
310 | return 0; | ||
311 | |||
312 | failed_register: | ||
313 | mxc_set_irq_fiq(ssi_irq, 0); | ||
314 | release_fiq(&fh); | ||
315 | |||
316 | return ret; | ||
297 | } | 317 | } |
298 | 318 | ||
299 | void imx_ssi_fiq_exit(struct platform_device *pdev, | 319 | static int __devexit imx_soc_platform_remove(struct platform_device *pdev) |
300 | struct imx_ssi *ssi) | ||
301 | { | 320 | { |
302 | mxc_set_irq_fiq(ssi->irq, 0); | 321 | snd_soc_unregister_platform(&pdev->dev); |
303 | release_fiq(&fh); | 322 | return 0; |
304 | } | 323 | } |
305 | 324 | ||
325 | static struct platform_driver imx_pcm_driver = { | ||
326 | .driver = { | ||
327 | .name = "imx-fiq-pcm-audio", | ||
328 | .owner = THIS_MODULE, | ||
329 | }, | ||
330 | |||
331 | .probe = imx_soc_platform_probe, | ||
332 | .remove = __devexit_p(imx_soc_platform_remove), | ||
333 | }; | ||
334 | |||
335 | static int __init snd_imx_pcm_init(void) | ||
336 | { | ||
337 | return platform_driver_register(&imx_pcm_driver); | ||
338 | } | ||
339 | module_init(snd_imx_pcm_init); | ||
340 | |||
341 | static void __exit snd_imx_pcm_exit(void) | ||
342 | { | ||
343 | platform_driver_unregister(&imx_pcm_driver); | ||
344 | } | ||
345 | module_exit(snd_imx_pcm_exit); | ||
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index c81da05a4f11..d4bd345b0a8d 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -61,7 +61,7 @@ | |||
61 | static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | 61 | static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, |
62 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) | 62 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) |
63 | { | 63 | { |
64 | struct imx_ssi *ssi = cpu_dai->private_data; | 64 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
65 | u32 sccr; | 65 | u32 sccr; |
66 | 66 | ||
67 | sccr = readl(ssi->base + SSI_STCCR); | 67 | sccr = readl(ssi->base + SSI_STCCR); |
@@ -86,7 +86,7 @@ static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | |||
86 | */ | 86 | */ |
87 | static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) | 87 | static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) |
88 | { | 88 | { |
89 | struct imx_ssi *ssi = cpu_dai->private_data; | 89 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
90 | u32 strcr = 0, scr; | 90 | u32 strcr = 0, scr; |
91 | 91 | ||
92 | scr = readl(ssi->base + SSI_SCR) & ~(SSI_SCR_SYN | SSI_SCR_NET); | 92 | scr = readl(ssi->base + SSI_SCR) & ~(SSI_SCR_SYN | SSI_SCR_NET); |
@@ -164,7 +164,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) | |||
164 | static int imx_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | 164 | static int imx_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai, |
165 | int clk_id, unsigned int freq, int dir) | 165 | int clk_id, unsigned int freq, int dir) |
166 | { | 166 | { |
167 | struct imx_ssi *ssi = cpu_dai->private_data; | 167 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
168 | u32 scr; | 168 | u32 scr; |
169 | 169 | ||
170 | scr = readl(ssi->base + SSI_SCR); | 170 | scr = readl(ssi->base + SSI_SCR); |
@@ -192,7 +192,7 @@ static int imx_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
192 | static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | 192 | static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, |
193 | int div_id, int div) | 193 | int div_id, int div) |
194 | { | 194 | { |
195 | struct imx_ssi *ssi = cpu_dai->private_data; | 195 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
196 | u32 stccr, srccr; | 196 | u32 stccr, srccr; |
197 | 197 | ||
198 | stccr = readl(ssi->base + SSI_STCCR); | 198 | stccr = readl(ssi->base + SSI_STCCR); |
@@ -241,7 +241,7 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream, | |||
241 | struct snd_pcm_hw_params *params, | 241 | struct snd_pcm_hw_params *params, |
242 | struct snd_soc_dai *cpu_dai) | 242 | struct snd_soc_dai *cpu_dai) |
243 | { | 243 | { |
244 | struct imx_ssi *ssi = cpu_dai->private_data; | 244 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
245 | struct imx_pcm_dma_params *dma_data; | 245 | struct imx_pcm_dma_params *dma_data; |
246 | u32 reg, sccr; | 246 | u32 reg, sccr; |
247 | 247 | ||
@@ -282,9 +282,7 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream, | |||
282 | static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd, | 282 | static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd, |
283 | struct snd_soc_dai *dai) | 283 | struct snd_soc_dai *dai) |
284 | { | 284 | { |
285 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 285 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(dai); |
286 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
287 | struct imx_ssi *ssi = cpu_dai->private_data; | ||
288 | unsigned int sier_bits, sier; | 286 | unsigned int sier_bits, sier; |
289 | unsigned int scr; | 287 | unsigned int scr; |
290 | 288 | ||
@@ -353,22 +351,6 @@ static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { | |||
353 | .trigger = imx_ssi_trigger, | 351 | .trigger = imx_ssi_trigger, |
354 | }; | 352 | }; |
355 | 353 | ||
356 | static struct snd_soc_dai imx_ssi_dai = { | ||
357 | .playback = { | ||
358 | .channels_min = 2, | ||
359 | .channels_max = 2, | ||
360 | .rates = SNDRV_PCM_RATE_8000_96000, | ||
361 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
362 | }, | ||
363 | .capture = { | ||
364 | .channels_min = 2, | ||
365 | .channels_max = 2, | ||
366 | .rates = SNDRV_PCM_RATE_8000_96000, | ||
367 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
368 | }, | ||
369 | .ops = &imx_ssi_pcm_dai_ops, | ||
370 | }; | ||
371 | |||
372 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | 354 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, |
373 | struct vm_area_struct *vma) | 355 | struct vm_area_struct *vma) |
374 | { | 356 | { |
@@ -384,6 +366,7 @@ int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | |||
384 | runtime->dma_bytes); | 366 | runtime->dma_bytes); |
385 | return ret; | 367 | return ret; |
386 | } | 368 | } |
369 | EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap); | ||
387 | 370 | ||
388 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | 371 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) |
389 | { | 372 | { |
@@ -415,14 +398,14 @@ int imx_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
415 | card->dev->dma_mask = &imx_pcm_dmamask; | 398 | card->dev->dma_mask = &imx_pcm_dmamask; |
416 | if (!card->dev->coherent_dma_mask) | 399 | if (!card->dev->coherent_dma_mask) |
417 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 400 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
418 | if (dai->playback.channels_min) { | 401 | if (dai->driver->playback.channels_min) { |
419 | ret = imx_pcm_preallocate_dma_buffer(pcm, | 402 | ret = imx_pcm_preallocate_dma_buffer(pcm, |
420 | SNDRV_PCM_STREAM_PLAYBACK); | 403 | SNDRV_PCM_STREAM_PLAYBACK); |
421 | if (ret) | 404 | if (ret) |
422 | goto out; | 405 | goto out; |
423 | } | 406 | } |
424 | 407 | ||
425 | if (dai->capture.channels_min) { | 408 | if (dai->driver->capture.channels_min) { |
426 | ret = imx_pcm_preallocate_dma_buffer(pcm, | 409 | ret = imx_pcm_preallocate_dma_buffer(pcm, |
427 | SNDRV_PCM_STREAM_CAPTURE); | 410 | SNDRV_PCM_STREAM_CAPTURE); |
428 | if (ret) | 411 | if (ret) |
@@ -432,6 +415,7 @@ int imx_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
432 | out: | 415 | out: |
433 | return ret; | 416 | return ret; |
434 | } | 417 | } |
418 | EXPORT_SYMBOL_GPL(imx_pcm_new); | ||
435 | 419 | ||
436 | void imx_pcm_free(struct snd_pcm *pcm) | 420 | void imx_pcm_free(struct snd_pcm *pcm) |
437 | { | 421 | { |
@@ -453,14 +437,40 @@ void imx_pcm_free(struct snd_pcm *pcm) | |||
453 | buf->area = NULL; | 437 | buf->area = NULL; |
454 | } | 438 | } |
455 | } | 439 | } |
440 | EXPORT_SYMBOL_GPL(imx_pcm_free); | ||
456 | 441 | ||
457 | struct snd_soc_platform imx_soc_platform = { | 442 | static struct snd_soc_dai_driver imx_ssi_dai = { |
458 | .name = "imx-audio", | 443 | .playback = { |
444 | .channels_min = 2, | ||
445 | .channels_max = 2, | ||
446 | .rates = SNDRV_PCM_RATE_8000_96000, | ||
447 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
448 | }, | ||
449 | .capture = { | ||
450 | .channels_min = 2, | ||
451 | .channels_max = 2, | ||
452 | .rates = SNDRV_PCM_RATE_8000_96000, | ||
453 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
454 | }, | ||
455 | .ops = &imx_ssi_pcm_dai_ops, | ||
459 | }; | 456 | }; |
460 | EXPORT_SYMBOL_GPL(imx_soc_platform); | ||
461 | 457 | ||
462 | static struct snd_soc_dai imx_ac97_dai = { | 458 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) |
463 | .name = "AC97", | 459 | { |
460 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
461 | uint32_t val; | ||
462 | |||
463 | snd_soc_dai_set_drvdata(dai, ssi); | ||
464 | |||
465 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
466 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
467 | writel(val, ssi->base + SSI_SFCSR); | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static struct snd_soc_dai_driver imx_ac97_dai = { | ||
473 | .probe = imx_ssi_dai_probe, | ||
464 | .ac97_control = 1, | 474 | .ac97_control = 1, |
465 | .playback = { | 475 | .playback = { |
466 | .stream_name = "AC97 Playback", | 476 | .stream_name = "AC97 Playback", |
@@ -580,25 +590,18 @@ struct snd_ac97_bus_ops soc_ac97_ops = { | |||
580 | }; | 590 | }; |
581 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | 591 | EXPORT_SYMBOL_GPL(soc_ac97_ops); |
582 | 592 | ||
583 | struct snd_soc_dai imx_ssi_pcm_dai[2]; | ||
584 | EXPORT_SYMBOL_GPL(imx_ssi_pcm_dai); | ||
585 | |||
586 | static int imx_ssi_probe(struct platform_device *pdev) | 593 | static int imx_ssi_probe(struct platform_device *pdev) |
587 | { | 594 | { |
588 | struct resource *res; | 595 | struct resource *res; |
589 | struct imx_ssi *ssi; | 596 | struct imx_ssi *ssi; |
590 | struct imx_ssi_platform_data *pdata = pdev->dev.platform_data; | 597 | struct imx_ssi_platform_data *pdata = pdev->dev.platform_data; |
591 | struct snd_soc_platform *platform; | ||
592 | int ret = 0; | 598 | int ret = 0; |
593 | unsigned int val; | 599 | struct snd_soc_dai_driver *dai; |
594 | struct snd_soc_dai *dai = &imx_ssi_pcm_dai[pdev->id]; | ||
595 | |||
596 | if (dai->id >= ARRAY_SIZE(imx_ssi_pcm_dai)) | ||
597 | return -EINVAL; | ||
598 | 600 | ||
599 | ssi = kzalloc(sizeof(*ssi), GFP_KERNEL); | 601 | ssi = kzalloc(sizeof(*ssi), GFP_KERNEL); |
600 | if (!ssi) | 602 | if (!ssi) |
601 | return -ENOMEM; | 603 | return -ENOMEM; |
604 | dev_set_drvdata(&pdev->dev, ssi); | ||
602 | 605 | ||
603 | if (pdata) { | 606 | if (pdata) { |
604 | ssi->ac97_reset = pdata->ac97_reset; | 607 | ssi->ac97_reset = pdata->ac97_reset; |
@@ -643,9 +646,9 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
643 | } | 646 | } |
644 | ac97_ssi = ssi; | 647 | ac97_ssi = ssi; |
645 | setup_channel_to_ac97(ssi); | 648 | setup_channel_to_ac97(ssi); |
646 | memcpy(dai, &imx_ac97_dai, sizeof(imx_ac97_dai)); | 649 | dai = &imx_ac97_dai; |
647 | } else | 650 | } else |
648 | memcpy(dai, &imx_ssi_dai, sizeof(imx_ssi_dai)); | 651 | dai = &imx_ssi_dai; |
649 | 652 | ||
650 | writel(0x0, ssi->base + SSI_SIER); | 653 | writel(0x0, ssi->base + SSI_SIER); |
651 | 654 | ||
@@ -660,37 +663,36 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
660 | if (res) | 663 | if (res) |
661 | ssi->dma_params_rx.dma = res->start; | 664 | ssi->dma_params_rx.dma = res->start; |
662 | 665 | ||
663 | dai->id = pdev->id; | ||
664 | dai->dev = &pdev->dev; | ||
665 | dai->name = kasprintf(GFP_KERNEL, "imx-ssi.%d", pdev->id); | ||
666 | dai->private_data = ssi; | ||
667 | |||
668 | if ((cpu_is_mx27() || cpu_is_mx21()) && | 666 | if ((cpu_is_mx27() || cpu_is_mx21()) && |
669 | !(ssi->flags & IMX_SSI_USE_AC97) && | 667 | !(ssi->flags & IMX_SSI_USE_AC97) && |
670 | (ssi->flags & IMX_SSI_DMA)) { | 668 | (ssi->flags & IMX_SSI_DMA)) { |
671 | ssi->flags |= IMX_SSI_DMA; | 669 | ssi->flags |= IMX_SSI_DMA; |
672 | platform = imx_ssi_dma_mx2_init(pdev, ssi); | 670 | } |
673 | } else | ||
674 | platform = imx_ssi_fiq_init(pdev, ssi); | ||
675 | |||
676 | imx_soc_platform.pcm_ops = platform->pcm_ops; | ||
677 | imx_soc_platform.pcm_new = platform->pcm_new; | ||
678 | imx_soc_platform.pcm_free = platform->pcm_free; | ||
679 | 671 | ||
680 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | 672 | platform_set_drvdata(pdev, ssi); |
681 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
682 | writel(val, ssi->base + SSI_SFCSR); | ||
683 | 673 | ||
684 | ret = snd_soc_register_dai(dai); | 674 | ret = snd_soc_register_dai(&pdev->dev, dai); |
685 | if (ret) { | 675 | if (ret) { |
686 | dev_err(&pdev->dev, "register DAI failed\n"); | 676 | dev_err(&pdev->dev, "register DAI failed\n"); |
687 | goto failed_register; | 677 | goto failed_register; |
688 | } | 678 | } |
689 | 679 | ||
690 | platform_set_drvdata(pdev, ssi); | 680 | ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); |
681 | if (!ssi->soc_platform_pdev) | ||
682 | goto failed_pdev_alloc; | ||
683 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | ||
684 | ret = platform_device_add(ssi->soc_platform_pdev); | ||
685 | if (ret) { | ||
686 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
687 | goto failed_pdev_add; | ||
688 | } | ||
691 | 689 | ||
692 | return 0; | 690 | return 0; |
693 | 691 | ||
692 | failed_pdev_add: | ||
693 | platform_device_put(ssi->soc_platform_pdev); | ||
694 | failed_pdev_alloc: | ||
695 | snd_soc_unregister_dai(&pdev->dev); | ||
694 | failed_register: | 696 | failed_register: |
695 | failed_ac97: | 697 | failed_ac97: |
696 | iounmap(ssi->base); | 698 | iounmap(ssi->base); |
@@ -709,16 +711,15 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev) | |||
709 | { | 711 | { |
710 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 712 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
711 | struct imx_ssi *ssi = platform_get_drvdata(pdev); | 713 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
712 | struct snd_soc_dai *dai = &imx_ssi_pcm_dai[pdev->id]; | ||
713 | 714 | ||
714 | snd_soc_unregister_dai(dai); | 715 | platform_device_del(ssi->soc_platform_pdev); |
716 | platform_device_put(ssi->soc_platform_pdev); | ||
717 | |||
718 | snd_soc_unregister_dai(&pdev->dev); | ||
715 | 719 | ||
716 | if (ssi->flags & IMX_SSI_USE_AC97) | 720 | if (ssi->flags & IMX_SSI_USE_AC97) |
717 | ac97_ssi = NULL; | 721 | ac97_ssi = NULL; |
718 | 722 | ||
719 | if (!(ssi->flags & IMX_SSI_DMA)) | ||
720 | imx_ssi_fiq_exit(pdev, ssi); | ||
721 | |||
722 | iounmap(ssi->base); | 723 | iounmap(ssi->base); |
723 | release_mem_region(res->start, resource_size(res)); | 724 | release_mem_region(res->start, resource_size(res)); |
724 | clk_disable(ssi->clk); | 725 | clk_disable(ssi->clk); |
@@ -733,34 +734,19 @@ static struct platform_driver imx_ssi_driver = { | |||
733 | .remove = __devexit_p(imx_ssi_remove), | 734 | .remove = __devexit_p(imx_ssi_remove), |
734 | 735 | ||
735 | .driver = { | 736 | .driver = { |
736 | .name = DRV_NAME, | 737 | .name = "imx-ssi", |
737 | .owner = THIS_MODULE, | 738 | .owner = THIS_MODULE, |
738 | }, | 739 | }, |
739 | }; | 740 | }; |
740 | 741 | ||
741 | static int __init imx_ssi_init(void) | 742 | static int __init imx_ssi_init(void) |
742 | { | 743 | { |
743 | int ret; | 744 | return platform_driver_register(&imx_ssi_driver); |
744 | |||
745 | ret = snd_soc_register_platform(&imx_soc_platform); | ||
746 | if (ret) { | ||
747 | pr_err("failed to register soc platform: %d\n", ret); | ||
748 | return ret; | ||
749 | } | ||
750 | |||
751 | ret = platform_driver_register(&imx_ssi_driver); | ||
752 | if (ret) { | ||
753 | snd_soc_unregister_platform(&imx_soc_platform); | ||
754 | return ret; | ||
755 | } | ||
756 | |||
757 | return 0; | ||
758 | } | 745 | } |
759 | 746 | ||
760 | static void __exit imx_ssi_exit(void) | 747 | static void __exit imx_ssi_exit(void) |
761 | { | 748 | { |
762 | platform_driver_unregister(&imx_ssi_driver); | 749 | platform_driver_unregister(&imx_ssi_driver); |
763 | snd_soc_unregister_platform(&imx_soc_platform); | ||
764 | } | 750 | } |
765 | 751 | ||
766 | module_init(imx_ssi_init); | 752 | module_init(imx_ssi_init); |
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h index 55f26ebcd8c2..53b780d9b2b0 100644 --- a/sound/soc/imx/imx-ssi.h +++ b/sound/soc/imx/imx-ssi.h | |||
@@ -183,9 +183,6 @@ | |||
183 | #define IMX_SSI_RX_DIV_PSR 4 | 183 | #define IMX_SSI_RX_DIV_PSR 4 |
184 | #define IMX_SSI_RX_DIV_PM 5 | 184 | #define IMX_SSI_RX_DIV_PM 5 |
185 | 185 | ||
186 | extern struct snd_soc_dai imx_ssi_pcm_dai[2]; | ||
187 | extern struct snd_soc_platform imx_soc_platform; | ||
188 | |||
189 | #define DRV_NAME "imx-ssi" | 186 | #define DRV_NAME "imx-ssi" |
190 | 187 | ||
191 | struct imx_pcm_dma_params { | 188 | struct imx_pcm_dma_params { |
@@ -197,7 +194,7 @@ struct imx_pcm_dma_params { | |||
197 | struct imx_ssi { | 194 | struct imx_ssi { |
198 | struct platform_device *ac97_dev; | 195 | struct platform_device *ac97_dev; |
199 | 196 | ||
200 | struct snd_soc_device imx_ac97; | 197 | struct snd_soc_dai *imx_ac97; |
201 | struct clk *clk; | 198 | struct clk *clk; |
202 | void __iomem *base; | 199 | void __iomem *base; |
203 | int irq; | 200 | int irq; |
@@ -213,6 +210,8 @@ struct imx_ssi { | |||
213 | struct imx_pcm_dma_params dma_params_tx; | 210 | struct imx_pcm_dma_params dma_params_tx; |
214 | 211 | ||
215 | int enabled; | 212 | int enabled; |
213 | |||
214 | struct platform_device *soc_platform_pdev; | ||
216 | }; | 215 | }; |
217 | 216 | ||
218 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 217 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, |
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c index a8307d55c70e..6a65dd705519 100644 --- a/sound/soc/imx/phycore-ac97.c +++ b/sound/soc/imx/phycore-ac97.c | |||
@@ -32,23 +32,20 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
32 | { | 32 | { |
33 | .name = "HiFi", | 33 | .name = "HiFi", |
34 | .stream_name = "HiFi", | 34 | .stream_name = "HiFi", |
35 | .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI], | 35 | .codec_dai_name = "wm9712-hifi", |
36 | .codec_name = "wm9712-codec", | ||
37 | .cpu_dai_name = "imx-ssi.0", | ||
38 | .platform_name = "imx-fiq-pcm-audio.0", | ||
36 | .ops = &imx_phycore_hifi_ops, | 39 | .ops = &imx_phycore_hifi_ops, |
37 | }, | 40 | }, |
38 | }; | 41 | }; |
39 | 42 | ||
40 | static struct snd_soc_card imx_phycore = { | 43 | static struct snd_soc_card imx_phycore = { |
41 | .name = "PhyCORE-audio", | 44 | .name = "PhyCORE-audio", |
42 | .platform = &imx_soc_platform, | ||
43 | .dai_link = imx_phycore_dai_ac97, | 45 | .dai_link = imx_phycore_dai_ac97, |
44 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), | 46 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), |
45 | }; | 47 | }; |
46 | 48 | ||
47 | static struct snd_soc_device imx_phycore_snd_devdata = { | ||
48 | .card = &imx_phycore, | ||
49 | .codec_dev = &soc_codec_dev_wm9712, | ||
50 | }; | ||
51 | |||
52 | static struct platform_device *imx_phycore_snd_device; | 49 | static struct platform_device *imx_phycore_snd_device; |
53 | 50 | ||
54 | static int __init imx_phycore_init(void) | 51 | static int __init imx_phycore_init(void) |
@@ -63,10 +60,12 @@ static int __init imx_phycore_init(void) | |||
63 | if (!imx_phycore_snd_device) | 60 | if (!imx_phycore_snd_device) |
64 | return -ENOMEM; | 61 | return -ENOMEM; |
65 | 62 | ||
66 | imx_phycore_dai_ac97[0].cpu_dai = &imx_ssi_pcm_dai[0]; | 63 | platform_set_drvdata(imx_phycore_snd_device, &imx_phycore); |
64 | ret = platform_device_add(imx_phycore_snd_device); | ||
67 | 65 | ||
68 | platform_set_drvdata(imx_phycore_snd_device, &imx_phycore_snd_devdata); | 66 | imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1); |
69 | imx_phycore_snd_devdata.dev = &imx_phycore_snd_device->dev; | 67 | if (!imx_phycore_snd_device) |
68 | return -ENOMEM; | ||
70 | ret = platform_device_add(imx_phycore_snd_device); | 69 | ret = platform_device_add(imx_phycore_snd_device); |
71 | 70 | ||
72 | if (ret) { | 71 | if (ret) { |
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c index a6e7d9497639..30fdb15065be 100644 --- a/sound/soc/imx/wm1133-ev1.c +++ b/sound/soc/imx/wm1133-ev1.c | |||
@@ -82,8 +82,8 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream, | |||
82 | struct snd_pcm_hw_params *params) | 82 | struct snd_pcm_hw_params *params) |
83 | { | 83 | { |
84 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 84 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
85 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 85 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
86 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 86 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
87 | int i, found = 0; | 87 | int i, found = 0; |
88 | snd_pcm_format_t format = params_format(params); | 88 | snd_pcm_format_t format = params_format(params); |
89 | unsigned int rate = params_rate(params); | 89 | unsigned int rate = params_rate(params); |
@@ -210,9 +210,9 @@ static struct snd_soc_jack_pin mic_jack_pins[] = { | |||
210 | { .pin = "Mic2 Jack", .mask = SND_JACK_MICROPHONE }, | 210 | { .pin = "Mic2 Jack", .mask = SND_JACK_MICROPHONE }, |
211 | }; | 211 | }; |
212 | 212 | ||
213 | static int wm1133_ev1_init(struct snd_soc_codec *codec) | 213 | static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) |
214 | { | 214 | { |
215 | struct snd_soc_card *card = codec->socdev->card; | 215 | struct snd_soc_codec *codec = rtd->codec; |
216 | 216 | ||
217 | snd_soc_dapm_new_controls(codec, wm1133_ev1_widgets, | 217 | snd_soc_dapm_new_controls(codec, wm1133_ev1_widgets, |
218 | ARRAY_SIZE(wm1133_ev1_widgets)); | 218 | ARRAY_SIZE(wm1133_ev1_widgets)); |
@@ -221,13 +221,13 @@ static int wm1133_ev1_init(struct snd_soc_codec *codec) | |||
221 | ARRAY_SIZE(wm1133_ev1_map)); | 221 | ARRAY_SIZE(wm1133_ev1_map)); |
222 | 222 | ||
223 | /* Headphone jack detection */ | 223 | /* Headphone jack detection */ |
224 | snd_soc_jack_new(card, "Headphone", SND_JACK_HEADPHONE, &hp_jack); | 224 | snd_soc_jack_new(codec, "Headphone", SND_JACK_HEADPHONE, &hp_jack); |
225 | snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), | 225 | snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), |
226 | hp_jack_pins); | 226 | hp_jack_pins); |
227 | wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); | 227 | wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); |
228 | 228 | ||
229 | /* Microphone jack detection */ | 229 | /* Microphone jack detection */ |
230 | snd_soc_jack_new(card, "Microphone", | 230 | snd_soc_jack_new(codec, "Microphone", |
231 | SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack); | 231 | SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack); |
232 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), | 232 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), |
233 | mic_jack_pins); | 233 | mic_jack_pins); |
@@ -243,8 +243,10 @@ static int wm1133_ev1_init(struct snd_soc_codec *codec) | |||
243 | static struct snd_soc_dai_link wm1133_ev1_dai = { | 243 | static struct snd_soc_dai_link wm1133_ev1_dai = { |
244 | .name = "WM1133-EV1", | 244 | .name = "WM1133-EV1", |
245 | .stream_name = "Audio", | 245 | .stream_name = "Audio", |
246 | .cpu_dai = &imx_ssi_pcm_dai[0], | 246 | .cpu_dai_name = "imx-ssi.0", |
247 | .codec_dai = &wm8350_dai, | 247 | .codec_dai_name = "wm8350-hifi", |
248 | .platform_name = "imx-fiq-pcm-audio.0", | ||
249 | .codec_name = "wm8350-codec.0-0x1a", | ||
248 | .init = wm1133_ev1_init, | 250 | .init = wm1133_ev1_init, |
249 | .ops = &wm1133_ev1_ops, | 251 | .ops = &wm1133_ev1_ops, |
250 | .symmetric_rates = 1, | 252 | .symmetric_rates = 1, |
@@ -252,16 +254,10 @@ static struct snd_soc_dai_link wm1133_ev1_dai = { | |||
252 | 254 | ||
253 | static struct snd_soc_card wm1133_ev1 = { | 255 | static struct snd_soc_card wm1133_ev1 = { |
254 | .name = "WM1133-EV1", | 256 | .name = "WM1133-EV1", |
255 | .platform = &imx_soc_platform, | ||
256 | .dai_link = &wm1133_ev1_dai, | 257 | .dai_link = &wm1133_ev1_dai, |
257 | .num_links = 1, | 258 | .num_links = 1, |
258 | }; | 259 | }; |
259 | 260 | ||
260 | static struct snd_soc_device wm1133_ev1_snd_devdata = { | ||
261 | .card = &wm1133_ev1, | ||
262 | .codec_dev = &soc_codec_dev_wm8350, | ||
263 | }; | ||
264 | |||
265 | static struct platform_device *wm1133_ev1_snd_device; | 261 | static struct platform_device *wm1133_ev1_snd_device; |
266 | 262 | ||
267 | static int __init wm1133_ev1_audio_init(void) | 263 | static int __init wm1133_ev1_audio_init(void) |
@@ -286,8 +282,7 @@ static int __init wm1133_ev1_audio_init(void) | |||
286 | if (!wm1133_ev1_snd_device) | 282 | if (!wm1133_ev1_snd_device) |
287 | return -ENOMEM; | 283 | return -ENOMEM; |
288 | 284 | ||
289 | platform_set_drvdata(wm1133_ev1_snd_device, &wm1133_ev1_snd_devdata); | 285 | platform_set_drvdata(wm1133_ev1_snd_device, &wm1133_ev1); |
290 | wm1133_ev1_snd_devdata.dev = &wm1133_ev1_snd_device->dev; | ||
291 | ret = platform_device_add(wm1133_ev1_snd_device); | 286 | ret = platform_device_add(wm1133_ev1_snd_device); |
292 | 287 | ||
293 | if (ret) | 288 | if (ret) |