blob: e046770ce70ef07e53cade44b22d3c798f115872 [file] [log] [blame]
Mike Rapoport142054a2008-05-26 12:59:16 +03001/*
Mike Rapoporteaaa5322009-05-11 15:05:29 +03002 * SoC audio driver for EM-X270, eXeda and CM-X300
Mike Rapoport142054a2008-05-26 12:59:16 +03003 *
Mike Rapoporteaaa5322009-05-11 15:05:29 +03004 * Copyright 2007, 2009 CompuLab, Ltd.
Mike Rapoport142054a2008-05-26 12:59:16 +03005 *
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 *
Liam Girdwoodd3311242008-10-12 13:17:36 +010012 * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
Mike Rapoport142054a2008-05-26 12:59:16 +030013 * 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
Mike Rapoport142054a2008-05-26 12:59:16 +030026#include <sound/core.h>
27#include <sound/pcm.h>
28#include <sound/soc.h>
Mike Rapoport142054a2008-05-26 12:59:16 +030029
30#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010031#include <mach/audio.h>
Mike Rapoport142054a2008-05-26 12:59:16 +030032
Mike Rapoport142054a2008-05-26 12:59:16 +030033static struct snd_soc_dai_link em_x270_dai[] = {
34 {
35 .name = "AC97",
36 .stream_name = "AC97 HiFi",
Dmitry Eremin-Solenikov4bfc4e22011-02-23 02:29:11 +030037 .cpu_dai_name = "pxa2xx-ac97",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000038 .codec_dai_name = "wm9712-hifi",
39 .platform_name = "pxa-pcm-audio",
40 .codec_name = "wm9712-codec",
Mike Rapoport142054a2008-05-26 12:59:16 +030041 },
42 {
43 .name = "AC97 Aux",
44 .stream_name = "AC97 Aux",
Dmitry Eremin-Solenikov4bfc4e22011-02-23 02:29:11 +030045 .cpu_dai_name = "pxa2xx-ac97-aux",
Codrut Grosu7be5c5f2017-02-25 22:25:23 +020046 .codec_dai_name = "wm9712-aux",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000047 .platform_name = "pxa-pcm-audio",
48 .codec_name = "wm9712-codec",
Mike Rapoport142054a2008-05-26 12:59:16 +030049 },
50};
51
Mark Brown87506542008-11-18 20:50:34 +000052static struct snd_soc_card em_x270 = {
Mike Rapoport142054a2008-05-26 12:59:16 +030053 .name = "EM-X270",
Axel Lin561c6a12011-12-22 09:44:43 +080054 .owner = THIS_MODULE,
Mike Rapoport142054a2008-05-26 12:59:16 +030055 .dai_link = em_x270_dai,
56 .num_links = ARRAY_SIZE(em_x270_dai),
57};
58
Mike Rapoport142054a2008-05-26 12:59:16 +030059static struct platform_device *em_x270_snd_device;
60
61static int __init em_x270_init(void)
62{
63 int ret;
64
Mike Rapoporteaaa5322009-05-11 15:05:29 +030065 if (!(machine_is_em_x270() || machine_is_exeda()
66 || machine_is_cm_x300()))
Mike Rapoport142054a2008-05-26 12:59:16 +030067 return -ENODEV;
68
69 em_x270_snd_device = platform_device_alloc("soc-audio", -1);
70 if (!em_x270_snd_device)
71 return -ENOMEM;
72
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000073 platform_set_drvdata(em_x270_snd_device, &em_x270);
Mike Rapoport142054a2008-05-26 12:59:16 +030074 ret = platform_device_add(em_x270_snd_device);
75
76 if (ret)
77 platform_device_put(em_x270_snd_device);
78
79 return ret;
80}
81
82static void __exit em_x270_exit(void)
83{
84 platform_device_unregister(em_x270_snd_device);
85}
86
87module_init(em_x270_init);
88module_exit(em_x270_exit);
89
90/* Module information */
91MODULE_AUTHOR("Mike Rapoport");
Mike Rapoporteaaa5322009-05-11 15:05:29 +030092MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300");
Mike Rapoport142054a2008-05-26 12:59:16 +030093MODULE_LICENSE("GPL");