aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/kirkwood
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/kirkwood')
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.c69
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.h17
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c55
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.h17
-rw-r--r--sound/soc/kirkwood/kirkwood-openrd.c24
5 files changed, 85 insertions, 97 deletions
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index a30205be3e2b..0fd6a630db01 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -2,6 +2,7 @@
2 * kirkwood-dma.c 2 * kirkwood-dma.c
3 * 3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com> 4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -18,7 +19,6 @@
18#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
19#include <linux/mbus.h> 20#include <linux/mbus.h>
20#include <sound/soc.h> 21#include <sound/soc.h>
21#include "kirkwood-dma.h"
22#include "kirkwood.h" 22#include "kirkwood.h"
23 23
24#define KIRKWOOD_RATES \ 24#define KIRKWOOD_RATES \
@@ -123,9 +123,10 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
123 int err; 123 int err;
124 struct snd_pcm_runtime *runtime = substream->runtime; 124 struct snd_pcm_runtime *runtime = substream->runtime;
125 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; 125 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
126 struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; 126 struct snd_soc_platform *platform = soc_runtime->platform;
127 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
127 struct kirkwood_dma_data *priv; 128 struct kirkwood_dma_data *priv;
128 struct kirkwood_dma_priv *prdata = cpu_dai->private_data; 129 struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform);
129 unsigned long addr; 130 unsigned long addr;
130 131
131 priv = snd_soc_dai_get_dma_data(cpu_dai, substream); 132 priv = snd_soc_dai_get_dma_data(cpu_dai, substream);
@@ -151,7 +152,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
151 if (err < 0) 152 if (err < 0)
152 return err; 153 return err;
153 154
154 if (soc_runtime->dai->cpu_dai->private_data == NULL) { 155 if (prdata == NULL) {
155 prdata = kzalloc(sizeof(struct kirkwood_dma_priv), GFP_KERNEL); 156 prdata = kzalloc(sizeof(struct kirkwood_dma_priv), GFP_KERNEL);
156 if (prdata == NULL) 157 if (prdata == NULL)
157 return -ENOMEM; 158 return -ENOMEM;
@@ -165,7 +166,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
165 return -EBUSY; 166 return -EBUSY;
166 } 167 }
167 168
168 soc_runtime->dai->cpu_dai->private_data = prdata; 169 snd_soc_platform_set_drvdata(platform, prdata);
169 170
170 /* 171 /*
171 * Enable Error interrupts. We're only ack'ing them but 172 * Enable Error interrupts. We're only ack'ing them but
@@ -191,8 +192,9 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
191static int kirkwood_dma_close(struct snd_pcm_substream *substream) 192static int kirkwood_dma_close(struct snd_pcm_substream *substream)
192{ 193{
193 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; 194 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
194 struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; 195 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
195 struct kirkwood_dma_priv *prdata = cpu_dai->private_data; 196 struct snd_soc_platform *platform = soc_runtime->platform;
197 struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform);
196 struct kirkwood_dma_data *priv; 198 struct kirkwood_dma_data *priv;
197 199
198 priv = snd_soc_dai_get_dma_data(cpu_dai, substream); 200 priv = snd_soc_dai_get_dma_data(cpu_dai, substream);
@@ -209,7 +211,7 @@ static int kirkwood_dma_close(struct snd_pcm_substream *substream)
209 writel(0, priv->io + KIRKWOOD_ERR_MASK); 211 writel(0, priv->io + KIRKWOOD_ERR_MASK);
210 free_irq(priv->irq, prdata); 212 free_irq(priv->irq, prdata);
211 kfree(prdata); 213 kfree(prdata);
212 soc_runtime->dai->cpu_dai->private_data = NULL; 214 snd_soc_platform_set_drvdata(platform, NULL);
213 } 215 }
214 216
215 return 0; 217 return 0;
@@ -236,7 +238,7 @@ static int kirkwood_dma_prepare(struct snd_pcm_substream *substream)
236{ 238{
237 struct snd_pcm_runtime *runtime = substream->runtime; 239 struct snd_pcm_runtime *runtime = substream->runtime;
238 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; 240 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
239 struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; 241 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
240 struct kirkwood_dma_data *priv; 242 struct kirkwood_dma_data *priv;
241 unsigned long size, count; 243 unsigned long size, count;
242 244
@@ -265,7 +267,7 @@ static snd_pcm_uframes_t kirkwood_dma_pointer(struct snd_pcm_substream
265 *substream) 267 *substream)
266{ 268{
267 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; 269 struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
268 struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; 270 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
269 struct kirkwood_dma_data *priv; 271 struct kirkwood_dma_data *priv;
270 snd_pcm_uframes_t count; 272 snd_pcm_uframes_t count;
271 273
@@ -320,14 +322,14 @@ static int kirkwood_dma_new(struct snd_card *card,
320 if (!card->dev->coherent_dma_mask) 322 if (!card->dev->coherent_dma_mask)
321 card->dev->coherent_dma_mask = 0xffffffff; 323 card->dev->coherent_dma_mask = 0xffffffff;
322 324
323 if (dai->playback.channels_min) { 325 if (dai->driver->playback.channels_min) {
324 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 326 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
325 SNDRV_PCM_STREAM_PLAYBACK); 327 SNDRV_PCM_STREAM_PLAYBACK);
326 if (ret) 328 if (ret)
327 return ret; 329 return ret;
328 } 330 }
329 331
330 if (dai->capture.channels_min) { 332 if (dai->driver->capture.channels_min) {
331 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 333 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
332 SNDRV_PCM_STREAM_CAPTURE); 334 SNDRV_PCM_STREAM_CAPTURE);
333 if (ret) 335 if (ret)
@@ -357,27 +359,46 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm)
357 } 359 }
358} 360}
359 361
360struct snd_soc_platform kirkwood_soc_platform = { 362static struct snd_soc_platform_driver kirkwood_soc_platform = {
361 .name = "kirkwood-dma", 363 .ops = &kirkwood_dma_ops,
362 .pcm_ops = &kirkwood_dma_ops,
363 .pcm_new = kirkwood_dma_new, 364 .pcm_new = kirkwood_dma_new,
364 .pcm_free = kirkwood_dma_free_dma_buffers, 365 .pcm_free = kirkwood_dma_free_dma_buffers,
365}; 366};
366EXPORT_SYMBOL_GPL(kirkwood_soc_platform);
367 367
368static int __init kirkwood_soc_platform_init(void) 368static int __devinit kirkwood_soc_platform_probe(struct platform_device *pdev)
369{ 369{
370 return snd_soc_register_platform(&kirkwood_soc_platform); 370 return snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform);
371} 371}
372module_init(kirkwood_soc_platform_init);
373 372
374static void __exit kirkwood_soc_platform_exit(void) 373static int __devexit kirkwood_soc_platform_remove(struct platform_device *pdev)
375{ 374{
376 snd_soc_unregister_platform(&kirkwood_soc_platform); 375 snd_soc_unregister_platform(&pdev->dev);
376 return 0;
377} 377}
378module_exit(kirkwood_soc_platform_exit);
379 378
380MODULE_AUTHOR("Arnaud Patard <apatard@mandriva.com>"); 379static struct platform_driver kirkwood_pcm_driver = {
380 .driver = {
381 .name = "kirkwood-pcm-audio",
382 .owner = THIS_MODULE,
383 },
384
385 .probe = kirkwood_soc_platform_probe,
386 .remove = __devexit_p(kirkwood_soc_platform_remove),
387};
388
389static int __init kirkwood_pcm_init(void)
390{
391 return platform_driver_register(&kirkwood_pcm_driver);
392}
393module_init(kirkwood_pcm_init);
394
395static void __exit kirkwood_pcm_exit(void)
396{
397 platform_driver_unregister(&kirkwood_pcm_driver);
398}
399module_exit(kirkwood_pcm_exit);
400
401MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
381MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); 402MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module");
382MODULE_LICENSE("GPL"); 403MODULE_LICENSE("GPL");
383 404MODULE_ALIAS("platform:kirkwood-pcm-audio");
diff --git a/sound/soc/kirkwood/kirkwood-dma.h b/sound/soc/kirkwood/kirkwood-dma.h
deleted file mode 100644
index ba4454cd34f1..000000000000
--- a/sound/soc/kirkwood/kirkwood-dma.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * kirkwood-dma.h
3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef _KIRKWOOD_DMA_H
13#define _KIRKWOOD_DMA_H
14
15extern struct snd_soc_platform kirkwood_soc_platform;
16
17#endif
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 981ffc2a13c8..a33fc51f363b 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -2,6 +2,7 @@
2 * kirkwood-i2s.c 2 * kirkwood-i2s.c
3 * 3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com> 4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -20,7 +21,6 @@
20#include <sound/pcm_params.h> 21#include <sound/pcm_params.h>
21#include <sound/soc.h> 22#include <sound/soc.h>
22#include <plat/audio.h> 23#include <plat/audio.h>
23#include "kirkwood-i2s.h"
24#include "kirkwood.h" 24#include "kirkwood.h"
25 25
26#define DRV_NAME "kirkwood-i2s" 26#define DRV_NAME "kirkwood-i2s"
@@ -33,13 +33,10 @@
33 SNDRV_PCM_FMTBIT_S24_LE | \ 33 SNDRV_PCM_FMTBIT_S24_LE | \
34 SNDRV_PCM_FMTBIT_S32_LE) 34 SNDRV_PCM_FMTBIT_S32_LE)
35 35
36
37struct snd_soc_dai kirkwood_i2s_dai;
38static struct kirkwood_dma_data *priv;
39
40static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, 36static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
41 unsigned int fmt) 37 unsigned int fmt)
42{ 38{
39 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(cpu_dai);
43 unsigned long mask; 40 unsigned long mask;
44 unsigned long value; 41 unsigned long value;
45 42
@@ -101,10 +98,20 @@ static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate)
101 } while (value == 0); 98 } while (value == 0);
102} 99}
103 100
101static int kirkwood_i2s_startup(struct snd_pcm_substream *substream,
102 struct snd_soc_dai *dai)
103{
104 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
105
106 snd_soc_dai_set_dma_data(dai, substream, priv);
107 return 0;
108}
109
104static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, 110static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
105 struct snd_pcm_hw_params *params, 111 struct snd_pcm_hw_params *params,
106 struct snd_soc_dai *dai) 112 struct snd_soc_dai *dai)
107{ 113{
114 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
108 unsigned int i2s_reg, reg; 115 unsigned int i2s_reg, reg;
109 unsigned long i2s_value, value; 116 unsigned long i2s_value, value;
110 117
@@ -171,6 +178,7 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
171static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, 178static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
172 int cmd, struct snd_soc_dai *dai) 179 int cmd, struct snd_soc_dai *dai)
173{ 180{
181 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
174 unsigned long value; 182 unsigned long value;
175 183
176 /* 184 /*
@@ -244,6 +252,7 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
244static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, 252static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
245 int cmd, struct snd_soc_dai *dai) 253 int cmd, struct snd_soc_dai *dai)
246{ 254{
255 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
247 unsigned long value; 256 unsigned long value;
248 257
249 value = readl(priv->io + KIRKWOOD_RECCTL); 258 value = readl(priv->io + KIRKWOOD_RECCTL);
@@ -323,9 +332,9 @@ static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
323 return 0; 332 return 0;
324} 333}
325 334
326static int kirkwood_i2s_probe(struct platform_device *pdev, 335static int kirkwood_i2s_probe(struct snd_soc_dai *dai)
327 struct snd_soc_dai *dai)
328{ 336{
337 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
329 unsigned long value; 338 unsigned long value;
330 unsigned int reg_data; 339 unsigned int reg_data;
331 340
@@ -359,21 +368,20 @@ static int kirkwood_i2s_probe(struct platform_device *pdev,
359 368
360} 369}
361 370
362static void kirkwood_i2s_remove(struct platform_device *pdev, 371static int kirkwood_i2s_remove(struct snd_soc_dai *dai)
363 struct snd_soc_dai *dai)
364{ 372{
373 return 0;
365} 374}
366 375
367static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { 376static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = {
377 .startup = kirkwood_i2s_startup,
368 .trigger = kirkwood_i2s_trigger, 378 .trigger = kirkwood_i2s_trigger,
369 .hw_params = kirkwood_i2s_hw_params, 379 .hw_params = kirkwood_i2s_hw_params,
370 .set_fmt = kirkwood_i2s_set_fmt, 380 .set_fmt = kirkwood_i2s_set_fmt,
371}; 381};
372 382
373 383
374struct snd_soc_dai kirkwood_i2s_dai = { 384static struct snd_soc_dai_driver kirkwood_i2s_dai = {
375 .name = DRV_NAME,
376 .id = 0,
377 .probe = kirkwood_i2s_probe, 385 .probe = kirkwood_i2s_probe,
378 .remove = kirkwood_i2s_remove, 386 .remove = kirkwood_i2s_remove,
379 .playback = { 387 .playback = {
@@ -388,13 +396,13 @@ struct snd_soc_dai kirkwood_i2s_dai = {
388 .formats = KIRKWOOD_I2S_FORMATS,}, 396 .formats = KIRKWOOD_I2S_FORMATS,},
389 .ops = &kirkwood_i2s_dai_ops, 397 .ops = &kirkwood_i2s_dai_ops,
390}; 398};
391EXPORT_SYMBOL_GPL(kirkwood_i2s_dai);
392 399
393static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) 400static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
394{ 401{
395 struct resource *mem; 402 struct resource *mem;
396 struct kirkwood_asoc_platform_data *data = 403 struct kirkwood_asoc_platform_data *data =
397 pdev->dev.platform_data; 404 pdev->dev.platform_data;
405 struct kirkwood_dma_data *priv;
398 int err; 406 int err;
399 407
400 priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL); 408 priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL);
@@ -403,6 +411,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
403 err = -ENOMEM; 411 err = -ENOMEM;
404 goto error; 412 goto error;
405 } 413 }
414 dev_set_drvdata(&pdev->dev, priv);
406 415
407 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 416 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
408 if (!mem) { 417 if (!mem) {
@@ -441,10 +450,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
441 priv->dram = data->dram; 450 priv->dram = data->dram;
442 priv->burst = data->burst; 451 priv->burst = data->burst;
443 452
444 kirkwood_i2s_dai.capture.dma_data = priv; 453 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai);
445 kirkwood_i2s_dai.playback.dma_data = priv;
446
447 return snd_soc_register_dai(&kirkwood_i2s_dai);
448 454
449err_ioremap: 455err_ioremap:
450 iounmap(priv->io); 456 iounmap(priv->io);
@@ -458,12 +464,13 @@ error:
458 464
459static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) 465static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev)
460{ 466{
461 if (priv) { 467 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
462 iounmap(priv->io); 468
463 release_mem_region(priv->mem->start, SZ_16K); 469 snd_soc_unregister_dai(&pdev->dev);
464 kfree(priv); 470 iounmap(priv->io);
465 } 471 release_mem_region(priv->mem->start, SZ_16K);
466 snd_soc_unregister_dai(&kirkwood_i2s_dai); 472 kfree(priv);
473
467 return 0; 474 return 0;
468} 475}
469 476
@@ -489,7 +496,7 @@ static void __exit kirkwood_i2s_exit(void)
489module_exit(kirkwood_i2s_exit); 496module_exit(kirkwood_i2s_exit);
490 497
491/* Module information */ 498/* Module information */
492MODULE_AUTHOR("Arnaud Patard, <apatard@mandriva.com>"); 499MODULE_AUTHOR("Arnaud Patard, <arnaud.patard@rtp-net.org>");
493MODULE_DESCRIPTION("Kirkwood I2S SoC Interface"); 500MODULE_DESCRIPTION("Kirkwood I2S SoC Interface");
494MODULE_LICENSE("GPL"); 501MODULE_LICENSE("GPL");
495MODULE_ALIAS("platform:kirkwood-i2s"); 502MODULE_ALIAS("platform:kirkwood-i2s");
diff --git a/sound/soc/kirkwood/kirkwood-i2s.h b/sound/soc/kirkwood/kirkwood-i2s.h
deleted file mode 100644
index c5595c616d7a..000000000000
--- a/sound/soc/kirkwood/kirkwood-i2s.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * kirkwood-i2s.h
3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef _KIRKWOOD_I2S_H
13#define _KIRKWOOD_I2S_H
14
15extern struct snd_soc_dai kirkwood_i2s_dai;
16
17#endif
diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c
index 0353d06bc41a..9d7c81e921f1 100644
--- a/sound/soc/kirkwood/kirkwood-openrd.c
+++ b/sound/soc/kirkwood/kirkwood-openrd.c
@@ -2,6 +2,7 @@
2 * kirkwood-openrd.c 2 * kirkwood-openrd.c
3 * 3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com> 4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -18,16 +19,14 @@
18#include <mach/kirkwood.h> 19#include <mach/kirkwood.h>
19#include <plat/audio.h> 20#include <plat/audio.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include "kirkwood-i2s.h"
22#include "kirkwood-dma.h"
23#include "../codecs/cs42l51.h" 22#include "../codecs/cs42l51.h"
24 23
25static int openrd_client_hw_params(struct snd_pcm_substream *substream, 24static int openrd_client_hw_params(struct snd_pcm_substream *substream,
26 struct snd_pcm_hw_params *params) 25 struct snd_pcm_hw_params *params)
27{ 26{
28 struct snd_soc_pcm_runtime *rtd = substream->private_data; 27 struct snd_soc_pcm_runtime *rtd = substream->private_data;
29 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 28 struct snd_soc_dai *codec_dai = rtd->codec_dai;
30 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 29 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
31 int ret; 30 int ret;
32 unsigned int freq, fmt; 31 unsigned int freq, fmt;
33 32
@@ -66,8 +65,10 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
66{ 65{
67 .name = "CS42L51", 66 .name = "CS42L51",
68 .stream_name = "CS42L51 HiFi", 67 .stream_name = "CS42L51 HiFi",
69 .cpu_dai = &kirkwood_i2s_dai, 68 .cpu_dai_name = "kirkwood-i2s",
70 .codec_dai = &cs42l51_dai, 69 .platform_name = "kirkwood-pcm-audio",
70 .codec_dai_name = "cs42l51-hifi",
71 .codec_name = "cs42l51-codec.0-004a",
71 .ops = &openrd_client_ops, 72 .ops = &openrd_client_ops,
72}, 73},
73}; 74};
@@ -75,16 +76,10 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
75 76
76static struct snd_soc_card openrd_client = { 77static struct snd_soc_card openrd_client = {
77 .name = "OpenRD Client", 78 .name = "OpenRD Client",
78 .platform = &kirkwood_soc_platform,
79 .dai_link = openrd_client_dai, 79 .dai_link = openrd_client_dai,
80 .num_links = ARRAY_SIZE(openrd_client_dai), 80 .num_links = ARRAY_SIZE(openrd_client_dai),
81}; 81};
82 82
83static struct snd_soc_device openrd_client_snd_devdata = {
84 .card = &openrd_client,
85 .codec_dev = &soc_codec_device_cs42l51,
86};
87
88static struct platform_device *openrd_client_snd_device; 83static struct platform_device *openrd_client_snd_device;
89 84
90static int __init openrd_client_init(void) 85static int __init openrd_client_init(void)
@@ -99,8 +94,7 @@ static int __init openrd_client_init(void)
99 return -ENOMEM; 94 return -ENOMEM;
100 95
101 platform_set_drvdata(openrd_client_snd_device, 96 platform_set_drvdata(openrd_client_snd_device,
102 &openrd_client_snd_devdata); 97 &openrd_client);
103 openrd_client_snd_devdata.dev = &openrd_client_snd_device->dev;
104 98
105 ret = platform_device_add(openrd_client_snd_device); 99 ret = platform_device_add(openrd_client_snd_device);
106 if (ret) { 100 if (ret) {
@@ -120,7 +114,7 @@ module_init(openrd_client_init);
120module_exit(openrd_client_exit); 114module_exit(openrd_client_exit);
121 115
122/* Module information */ 116/* Module information */
123MODULE_AUTHOR("Arnaud Patard <apatard@mandriva.com>"); 117MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
124MODULE_DESCRIPTION("ALSA SoC OpenRD Client"); 118MODULE_DESCRIPTION("ALSA SoC OpenRD Client");
125MODULE_LICENSE("GPL"); 119MODULE_LICENSE("GPL");
126MODULE_ALIAS("platform:soc-audio"); 120MODULE_ALIAS("platform:soc-audio");