[ALSA] Add EM-X270 ASoC driver
[linux-2.6/linux-loongson.git] / sound / soc / pxa / em-x270.c
blob02dcac39cdf6cc9bd71c4440a367092e7d2153f4
1 /*
2 * em-x270.c -- SoC audio for EM-X270
4 * Copyright 2007 CompuLab, Ltd.
6 * Author: Mike Rapoport <mike@compulab.co.il>
8 * Copied from tosa.c:
9 * Copyright 2005 Wolfson Microelectronics PLC.
10 * Copyright 2005 Openedhand Ltd.
12 * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
13 * Richard Purdie <richard@openedhand.com>
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.
22 #include <linux/module.h>
23 #include <linux/moduleparam.h>
24 #include <linux/device.h>
26 #include <sound/driver.h>
27 #include <sound/core.h>
28 #include <sound/pcm.h>
29 #include <sound/soc.h>
30 #include <sound/soc-dapm.h>
32 #include <asm/mach-types.h>
33 #include <asm/arch/pxa-regs.h>
34 #include <asm/arch/hardware.h>
35 #include <asm/arch/audio.h>
37 #include "../codecs/wm9712.h"
38 #include "pxa2xx-pcm.h"
39 #include "pxa2xx-ac97.h"
41 static struct snd_soc_dai_link em_x270_dai[] = {
43 .name = "AC97",
44 .stream_name = "AC97 HiFi",
45 .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
46 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
49 .name = "AC97 Aux",
50 .stream_name = "AC97 Aux",
51 .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX],
52 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
56 static struct snd_soc_machine em_x270 = {
57 .name = "EM-X270",
58 .dai_link = em_x270_dai,
59 .num_links = ARRAY_SIZE(em_x270_dai),
62 static struct snd_soc_device em_x270_snd_devdata = {
63 .machine = &em_x270,
64 .platform = &pxa2xx_soc_platform,
65 .codec_dev = &soc_codec_dev_wm9712,
68 static struct platform_device *em_x270_snd_device;
70 static int __init em_x270_init(void)
72 int ret;
74 if (!machine_is_em_x270())
75 return -ENODEV;
77 em_x270_snd_device = platform_device_alloc("soc-audio", -1);
78 if (!em_x270_snd_device)
79 return -ENOMEM;
81 platform_set_drvdata(em_x270_snd_device, &em_x270_snd_devdata);
82 em_x270_snd_devdata.dev = &em_x270_snd_device->dev;
83 ret = platform_device_add(em_x270_snd_device);
85 if (ret)
86 platform_device_put(em_x270_snd_device);
88 return ret;
91 static void __exit em_x270_exit(void)
93 platform_device_unregister(em_x270_snd_device);
96 module_init(em_x270_init);
97 module_exit(em_x270_exit);
99 /* Module information */
100 MODULE_AUTHOR("Mike Rapoport");
101 MODULE_DESCRIPTION("ALSA SoC EM-X270");
102 MODULE_LICENSE("GPL");