]> git.karo-electronics.de Git - mv-sheeva.git/blob - sound/soc/imx/phycore-ac97.c
ASoC: multi-component - ASoC Multi-Component Support
[mv-sheeva.git] / sound / soc / imx / phycore-ac97.c
1 /*
2  * phycore-ac97.c  --  SoC audio for imx_phycore in AC97 mode
3  *
4  * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
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
13 #include <linux/module.h>
14 #include <linux/moduleparam.h>
15 #include <linux/device.h>
16 #include <linux/i2c.h>
17 #include <sound/core.h>
18 #include <sound/pcm.h>
19 #include <sound/soc.h>
20 #include <sound/soc-dapm.h>
21 #include <asm/mach-types.h>
22
23 #include "../codecs/wm9712.h"
24 #include "imx-ssi.h"
25
26 static struct snd_soc_card imx_phycore;
27
28 static struct snd_soc_ops imx_phycore_hifi_ops = {
29 };
30
31 static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
32         {
33                 .name           = "HiFi",
34                 .stream_name    = "HiFi",
35                 .codec_dai_name         = "wm9712-hifi",
36                 .codec_name     = "wm9712-codec",
37                 .cpu_dai_name   = "imx-ssi-dai.0",
38                 .platform_name  = "imx-fiq-pcm-audio.0",
39                 .ops            = &imx_phycore_hifi_ops,
40         },
41 };
42
43 static struct snd_soc_card imx_phycore = {
44         .name           = "PhyCORE-audio",
45         .dai_link       = imx_phycore_dai_ac97,
46         .num_links      = ARRAY_SIZE(imx_phycore_dai_ac97),
47 };
48
49 static struct platform_device *imx_phycore_snd_device;
50
51 static int __init imx_phycore_init(void)
52 {
53         int ret;
54
55         if (!machine_is_pcm043() && !machine_is_pca100())
56                 /* return happy. We might run on a totally different machine */
57                 return 0;
58
59         imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
60         if (!imx_phycore_snd_device)
61                 return -ENOMEM;
62
63         platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
64         ret = platform_device_add(imx_phycore_snd_device);
65
66         imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
67         if (!imx_phycore_snd_device)
68                 return -ENOMEM;
69         ret = platform_device_add(imx_phycore_snd_device);
70
71         if (ret) {
72                 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
73                 platform_device_put(imx_phycore_snd_device);
74         }
75
76         return ret;
77 }
78
79 static void __exit imx_phycore_exit(void)
80 {
81         platform_device_unregister(imx_phycore_snd_device);
82 }
83
84 late_initcall(imx_phycore_init);
85 module_exit(imx_phycore_exit);
86
87 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
88 MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
89 MODULE_LICENSE("GPL");