Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 1 | /* |
Mike Rapoport | eaaa532 | 2009-05-11 15:05:29 +0300 | [diff] [blame] | 2 | * SoC audio driver for EM-X270, eXeda and CM-X300 |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 3 | * |
Mike Rapoport | eaaa532 | 2009-05-11 15:05:29 +0300 | [diff] [blame] | 4 | * Copyright 2007, 2009 CompuLab, Ltd. |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 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 | * |
Liam Girdwood | d331124 | 2008-10-12 13:17:36 +0100 | [diff] [blame] | 12 | * Authors: Liam Girdwood <lrg@slimlogic.co.uk> |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 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 | |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 26 | #include <sound/core.h> |
| 27 | #include <sound/pcm.h> |
| 28 | #include <sound/soc.h> |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 29 | |
| 30 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | #include <mach/audio.h> |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 32 | |
| 33 | #include "../codecs/wm9712.h" |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 34 | #include "pxa2xx-ac97.h" |
| 35 | |
| 36 | static struct snd_soc_dai_link em_x270_dai[] = { |
| 37 | { |
| 38 | .name = "AC97", |
| 39 | .stream_name = "AC97 HiFi", |
Dmitry Eremin-Solenikov | 4bfc4e2 | 2011-02-23 02:29:11 +0300 | [diff] [blame] | 40 | .cpu_dai_name = "pxa2xx-ac97", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 41 | .codec_dai_name = "wm9712-hifi", |
| 42 | .platform_name = "pxa-pcm-audio", |
| 43 | .codec_name = "wm9712-codec", |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 44 | }, |
| 45 | { |
| 46 | .name = "AC97 Aux", |
| 47 | .stream_name = "AC97 Aux", |
Dmitry Eremin-Solenikov | 4bfc4e2 | 2011-02-23 02:29:11 +0300 | [diff] [blame] | 48 | .cpu_dai_name = "pxa2xx-ac97-aux", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 49 | .codec_dai_name ="wm9712-aux", |
| 50 | .platform_name = "pxa-pcm-audio", |
| 51 | .codec_name = "wm9712-codec", |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 52 | }, |
| 53 | }; |
| 54 | |
Mark Brown | 8750654 | 2008-11-18 20:50:34 +0000 | [diff] [blame] | 55 | static struct snd_soc_card em_x270 = { |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 56 | .name = "EM-X270", |
Axel Lin | 561c6a1 | 2011-12-22 09:44:43 +0800 | [diff] [blame] | 57 | .owner = THIS_MODULE, |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 58 | .dai_link = em_x270_dai, |
| 59 | .num_links = ARRAY_SIZE(em_x270_dai), |
| 60 | }; |
| 61 | |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 62 | static struct platform_device *em_x270_snd_device; |
| 63 | |
| 64 | static int __init em_x270_init(void) |
| 65 | { |
| 66 | int ret; |
| 67 | |
Mike Rapoport | eaaa532 | 2009-05-11 15:05:29 +0300 | [diff] [blame] | 68 | if (!(machine_is_em_x270() || machine_is_exeda() |
| 69 | || machine_is_cm_x300())) |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 70 | return -ENODEV; |
| 71 | |
| 72 | em_x270_snd_device = platform_device_alloc("soc-audio", -1); |
| 73 | if (!em_x270_snd_device) |
| 74 | return -ENOMEM; |
| 75 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 76 | platform_set_drvdata(em_x270_snd_device, &em_x270); |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 77 | ret = platform_device_add(em_x270_snd_device); |
| 78 | |
| 79 | if (ret) |
| 80 | platform_device_put(em_x270_snd_device); |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | |
| 85 | static void __exit em_x270_exit(void) |
| 86 | { |
| 87 | platform_device_unregister(em_x270_snd_device); |
| 88 | } |
| 89 | |
| 90 | module_init(em_x270_init); |
| 91 | module_exit(em_x270_exit); |
| 92 | |
| 93 | /* Module information */ |
| 94 | MODULE_AUTHOR("Mike Rapoport"); |
Mike Rapoport | eaaa532 | 2009-05-11 15:05:29 +0300 | [diff] [blame] | 95 | MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300"); |
Mike Rapoport | 142054a | 2008-05-26 12:59:16 +0300 | [diff] [blame] | 96 | MODULE_LICENSE("GPL"); |