Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[pandora-kernel.git] / sound / soc / pxa / em-x270.c
1 /*
2  * em-x270.c  --  SoC audio for EM-X270
3  *
4  * Copyright 2007 CompuLab, Ltd.
5  *
6  * Author: Mike Rapoport <mike@compulab.co.il>
7  *
8  * Copied from tosa.c:
9  * Copyright 2005 Wolfson Microelectronics PLC.
10  * Copyright 2005 Openedhand Ltd.
11  *
12  * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
13  *          Richard Purdie <richard@openedhand.com>
14  *
15  *  This program is free software; you can redistribute  it and/or modify it
16  *  under  the terms of  the GNU General  Public License as published by the
17  *  Free Software Foundation;  either version 2 of the  License, or (at your
18  *  option) any later version.
19  *
20  */
21
22 #include <linux/module.h>
23 #include <linux/moduleparam.h>
24 #include <linux/device.h>
25
26 #include <sound/core.h>
27 #include <sound/pcm.h>
28 #include <sound/soc.h>
29 #include <sound/soc-dapm.h>
30
31 #include <asm/mach-types.h>
32 #include <mach/pxa-regs.h>
33 #include <mach/hardware.h>
34 #include <mach/audio.h>
35
36 #include "../codecs/wm9712.h"
37 #include "pxa2xx-pcm.h"
38 #include "pxa2xx-ac97.h"
39
40 static struct snd_soc_dai_link em_x270_dai[] = {
41         {
42                 .name = "AC97",
43                 .stream_name = "AC97 HiFi",
44                 .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
45                 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
46         },
47         {
48                 .name = "AC97 Aux",
49                 .stream_name = "AC97 Aux",
50                 .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX],
51                 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
52         },
53 };
54
55 static struct snd_soc_card em_x270 = {
56         .name = "EM-X270",
57         .platform = &pxa2xx_soc_platform,
58         .dai_link = em_x270_dai,
59         .num_links = ARRAY_SIZE(em_x270_dai),
60 };
61
62 static struct snd_soc_device em_x270_snd_devdata = {
63         .card = &em_x270,
64         .codec_dev = &soc_codec_dev_wm9712,
65 };
66
67 static struct platform_device *em_x270_snd_device;
68
69 static int __init em_x270_init(void)
70 {
71         int ret;
72
73         if (!machine_is_em_x270())
74                 return -ENODEV;
75
76         em_x270_snd_device = platform_device_alloc("soc-audio", -1);
77         if (!em_x270_snd_device)
78                 return -ENOMEM;
79
80         platform_set_drvdata(em_x270_snd_device, &em_x270_snd_devdata);
81         em_x270_snd_devdata.dev = &em_x270_snd_device->dev;
82         ret = platform_device_add(em_x270_snd_device);
83
84         if (ret)
85                 platform_device_put(em_x270_snd_device);
86
87         return ret;
88 }
89
90 static void __exit em_x270_exit(void)
91 {
92         platform_device_unregister(em_x270_snd_device);
93 }
94
95 module_init(em_x270_init);
96 module_exit(em_x270_exit);
97
98 /* Module information */
99 MODULE_AUTHOR("Mike Rapoport");
100 MODULE_DESCRIPTION("ALSA SoC EM-X270");
101 MODULE_LICENSE("GPL");