upload tizen1.0 source
[kernel/linux-2.6.36.git] / sound / soc / nuc900 / nuc900-audio.c
1 /*
2  * Copyright (c) 2010 Nuvoton technology corporation.
3  *
4  * Wan ZongShun <mcuos.com@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation;version 2 of the License.
9  *
10  */
11
12 #include <linux/module.h>
13 #include <linux/moduleparam.h>
14 #include <linux/timer.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
17
18 #include <sound/core.h>
19 #include <sound/pcm.h>
20 #include <sound/soc.h>
21 #include <sound/soc-dapm.h>
22
23 #include "../codecs/ac97.h"
24 #include "nuc900-audio.h"
25
26 static struct snd_soc_dai_link nuc900evb_ac97_dai = {
27         .name           = "AC97",
28         .stream_name    = "AC97 HiFi",
29         .cpu_dai        = &nuc900_ac97_dai,
30         .codec_dai      = &ac97_dai,
31 };
32
33 static struct snd_soc_card nuc900evb_audio_machine = {
34         .name           = "NUC900EVB_AC97",
35         .dai_link       = &nuc900evb_ac97_dai,
36         .num_links      = 1,
37         .platform       = &nuc900_soc_platform,
38 };
39
40 static struct snd_soc_device nuc900evb_ac97_devdata = {
41         .card           = &nuc900evb_audio_machine,
42         .codec_dev      = &soc_codec_dev_ac97,
43 };
44
45 static struct platform_device *nuc900evb_asoc_dev;
46
47 static int __init nuc900evb_audio_init(void)
48 {
49         int ret;
50
51         ret = -ENOMEM;
52         nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1);
53         if (!nuc900evb_asoc_dev)
54                 goto out;
55
56         /* nuc900 board audio device */
57         platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_ac97_devdata);
58
59         nuc900evb_ac97_devdata.dev = &nuc900evb_asoc_dev->dev;
60         ret = platform_device_add(nuc900evb_asoc_dev);
61
62         if (ret) {
63                 platform_device_put(nuc900evb_asoc_dev);
64                 nuc900evb_asoc_dev = NULL;
65         }
66
67 out:
68         return ret;
69 }
70
71 static void __exit nuc900evb_audio_exit(void)
72 {
73         platform_device_unregister(nuc900evb_asoc_dev);
74 }
75
76 module_init(nuc900evb_audio_init);
77 module_exit(nuc900evb_audio_exit);
78
79 MODULE_LICENSE("GPL");
80 MODULE_DESCRIPTION("NUC900 Series ASoC audio support");
81 MODULE_AUTHOR("Wan ZongShun");