Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 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 | |
Wan ZongShun | 019afb5 | 2010-06-10 10:40:40 +0800 | [diff] [blame] | 23 | #include "nuc900-audio.h" |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 24 | |
| 25 | static struct snd_soc_dai_link nuc900evb_ac97_dai = { |
| 26 | .name = "AC97", |
| 27 | .stream_name = "AC97 HiFi", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 28 | .cpu_dai_name = "nuc900-ac97", |
| 29 | .codec_dai_name = "ac97-hifi", |
| 30 | .codec_name = "ac97-codec", |
| 31 | .platform_name = "nuc900-pcm-audio", |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | static struct snd_soc_card nuc900evb_audio_machine = { |
| 35 | .name = "NUC900EVB_AC97", |
| 36 | .dai_link = &nuc900evb_ac97_dai, |
| 37 | .num_links = 1, |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | static struct platform_device *nuc900evb_asoc_dev; |
| 41 | |
| 42 | static int __init nuc900evb_audio_init(void) |
| 43 | { |
| 44 | int ret; |
| 45 | |
| 46 | ret = -ENOMEM; |
| 47 | nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1); |
| 48 | if (!nuc900evb_asoc_dev) |
| 49 | goto out; |
| 50 | |
| 51 | /* nuc900 board audio device */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 52 | platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_audio_machine); |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 53 | |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 54 | ret = platform_device_add(nuc900evb_asoc_dev); |
| 55 | |
| 56 | if (ret) { |
| 57 | platform_device_put(nuc900evb_asoc_dev); |
| 58 | nuc900evb_asoc_dev = NULL; |
| 59 | } |
| 60 | |
| 61 | out: |
| 62 | return ret; |
| 63 | } |
| 64 | |
| 65 | static void __exit nuc900evb_audio_exit(void) |
| 66 | { |
| 67 | platform_device_unregister(nuc900evb_asoc_dev); |
| 68 | } |
| 69 | |
| 70 | module_init(nuc900evb_audio_init); |
| 71 | module_exit(nuc900evb_audio_exit); |
| 72 | |
| 73 | MODULE_LICENSE("GPL"); |
| 74 | MODULE_DESCRIPTION("NUC900 Series ASoC audio support"); |
| 75 | MODULE_AUTHOR("Wan ZongShun"); |